1
0
зеркало из https://github.com/gilshahar7/PearlRetry.git synced 2025-07-03 02:06:46 +00:00
Files
PearlRetry/Tweak.xm
2021-03-02 01:50:06 +02:00

34 строки
1007 B
Plaintext

#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);
}