You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1007B

  1. #define PLIST_PATH @"/var/mobile/Library/Preferences/com.gilshahar7.pearlretryprefs.plist"
  2. @interface SBUIBiometricResource : NSObject
  3. + (id)sharedInstance;
  4. - (void)noteScreenDidTurnOff;
  5. - (void)noteScreenWillTurnOn;
  6. @end
  7. float delay = 0;
  8. static void loadPrefs() {
  9. NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:PLIST_PATH];
  10. delay = [[prefs objectForKey:@"delay"] floatValue];
  11. }
  12. %hook SBDashBoardPearlUnlockBehavior
  13. -(void)_handlePearlFailure{
  14. %orig;
  15. [[%c(SBUIBiometricResource) sharedInstance] noteScreenDidTurnOff];
  16. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delay * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  17. [[%c(SBUIBiometricResource) sharedInstance] noteScreenWillTurnOn];
  18. });
  19. }
  20. %end
  21. %ctor{
  22. loadPrefs();
  23. CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)loadPrefs, CFSTR("com.gilshahar7.pearlretryprefs.settingschanged"), NULL, CFNotificationSuspensionBehaviorCoalesce);
  24. }