Created
January 21, 2020 17:53
-
-
Save pixelomer/b5e29d5ef90f8e0085b5b90e3fc474a6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
@interface SpringBoard : UIApplication | |
- (BOOL)isLocked; | |
- (id)_accessibilityFrontMostApplication; | |
@end | |
static void NVAHVolumeHook(id self, SEL _cmd, id arg1, IMP orig) { | |
SpringBoard *springboard = (id)UIApplication.sharedApplication; | |
id frontmostApp = [springboard _accessibilityFrontMostApplication]; | |
if (frontmostApp || [springboard isLocked]) { | |
((void(*)(id,SEL,id))orig)(self, _cmd, arg1); | |
} | |
} | |
%hook SBVolumeHardwareButton | |
- (void)volumeIncreasePress:(id)arg1 { | |
NVAHVolumeHook(self, _cmd, arg1, (IMP)&%orig); | |
} | |
- (void)volumeDecreasePress:(id)arg1 { | |
NVAHVolumeHook(self, _cmd, arg1, (IMP)&%orig); | |
} | |
%end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment