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.

43 lines
1.3KB

  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. void pearlretry_settingsDidUpdate(CFNotificationCenterRef center,
  13. void * observer,
  14. CFStringRef name,
  15. const void * object,
  16. CFDictionaryRef userInfo) {
  17. }
  18. %hook SBDashBoardPearlUnlockBehavior
  19. -(void)_handlePearlFailure{
  20. %orig;
  21. [[%c(SBUIBiometricResource) sharedInstance] noteScreenDidTurnOff];
  22. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delay * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  23. [[%c(SBUIBiometricResource) sharedInstance] noteScreenWillTurnOn];
  24. });
  25. }
  26. %end
  27. %ctor{
  28. loadPrefs();
  29. CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)loadPrefs, CFSTR("com.gilshahar7.pearlretryprefs.settingschanged"), NULL, CFNotificationSuspensionBehaviorCoalesce);
  30. }