Introducing the... BrickMyVolume, the tweak which removes all volume down and volume up functionality. With this tweak installed, the volume down and volume up events are automatically overrided with null code.
Everything has a use for at least one person. - sandStoop
It could be used to prevent volume modifications by setting a lock on the volume.
The code is 8 lines when only including functionality. Let's break it down:
- It hooks into the SBVolumeControl class. This is from the VolumeControl/VolumeControl.h header. Since the Springboard's headers (and therefore, classes) are automatically loaded in, no imports are made. This class holds all methods for controlling the volume (which includes
increaseVolumeanddecreaseVolume) - It modifies the code of the
increaseVolumemethod which is used to increase the volume of the device (when the volume up button is pressed, this method is ran). Instead of doing%origwhich increases the volume and in newer iOS versions, shows and updates a special volume UI, it simply returns NO. That's it, nothing happening except plain NO. - The same thing as step 2 happens for
decreaseVolume!
It works on both! The only requirement is that your device needs to use the SBVolumeControl class for volume control, which isn't used for iOS 2.0 - 13.0!
Your device is likely using VolumeControl's class instead. If so, make a GitHub issue since as of now, there is no traffic nor activity of this type to prove this suspicion. Keep in mind I don't have many iOS devices nor do I have iOS manual header practice to test every iOS device (or to check if they have the header and the class).
Check if your device is on Safe Mode or has tweak injection disabled, both of these factors will unbrick your volume!
The most important actions for this repository sorted from most to least important are:
- Use another library such as Cephei to add the tweak into Settings! (after skill improvements)
- Try to find more and make a reasonable explanation of VolumeControl, which will help the inclusion of older devices in the long term
- Add this tweak into an actual repository
- Improve the README and other visibility factors of this tweak's repository
Please credit me in the tweak's description or in another way when uploading this tweak in external repositories!