-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathTweak.xm
33 lines (24 loc) · 1007 Bytes
/
Tweak.xm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#define PLIST_PATH @"/var/mobile/Library/Preferences/com.gilshahar7.pearlretryprefs.plist"
@interface SBUIBiometricResource : NSObject
+ (id)sharedInstance;
- (void)noteScreenDidTurnOff;
- (void)noteScreenWillTurnOn;
@end
float delay = 0;
static void loadPrefs() {
NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:PLIST_PATH];
delay = [[prefs objectForKey:@"delay"] floatValue];
}
%hook SBDashBoardPearlUnlockBehavior
-(void)_handlePearlFailure{
%orig;
[[%c(SBUIBiometricResource) sharedInstance] noteScreenDidTurnOff];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delay * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[[%c(SBUIBiometricResource) sharedInstance] noteScreenWillTurnOn];
});
}
%end
%ctor{
loadPrefs();
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)loadPrefs, CFSTR("com.gilshahar7.pearlretryprefs.settingschanged"), NULL, CFNotificationSuspensionBehaviorCoalesce);
}