@@ -0,0 +1,13 @@ | |||
ARCHS = armv7 arm64 | |||
include $(THEOS)/makefiles/common.mk | |||
TWEAK_NAME = PearlRetry | |||
PearlRetry_FILES = Tweak.xm | |||
PearlRetry_PRIVATE_FRAMEWORKS = SpringBoardUIServices | |||
include $(THEOS_MAKE_PATH)/tweak.mk | |||
after-install:: | |||
install.exec "killall -9 SpringBoard" | |||
SUBPROJECTS += pearlretryprefs | |||
include $(THEOS_MAKE_PATH)/aggregate.mk |
@@ -0,0 +1 @@ | |||
{ Filter = { Bundles = ( "com.apple.springboard" ); }; } |
@@ -0,0 +1,42 @@ | |||
#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]; | |||
} | |||
void pearlretry_settingsDidUpdate(CFNotificationCenterRef center, | |||
void * observer, | |||
CFStringRef name, | |||
const void * object, | |||
CFDictionaryRef userInfo) { | |||
} | |||
%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); | |||
} |
@@ -0,0 +1,9 @@ | |||
Package: com.gilshahar7.pearlretry | |||
Name: PearlRetry | |||
Depends: mobilesubstrate | |||
Version: 1.0 | |||
Architecture: iphoneos-arm | |||
Description: Retry FaceID when failed to recognize. | |||
Maintainer: gilshahar7 | |||
Author: gilshahar7 | |||
Section: Tweaks |
@@ -0,0 +1,14 @@ | |||
ARCHS = armv7 arm64 | |||
include $(THEOS)/makefiles/common.mk | |||
BUNDLE_NAME = PearlRetryPrefs | |||
PearlRetryPrefs_FILES = prpRootListController.m | |||
PearlRetryPrefs_INSTALL_PATH = /Library/PreferenceBundles | |||
PearlRetryPrefs_FRAMEWORKS = UIKit | |||
PearlRetryPrefs_PRIVATE_FRAMEWORKS = Preferences | |||
include $(THEOS_MAKE_PATH)/bundle.mk | |||
internal-stage:: | |||
$(ECHO_NOTHING)mkdir -p $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences$(ECHO_END) | |||
$(ECHO_NOTHING)cp entry.plist $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences/PearlRetryPrefs.plist$(ECHO_END) |
@@ -0,0 +1,24 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |||
<plist version="1.0"> | |||
<dict> | |||
<key>CFBundleDevelopmentRegion</key> | |||
<string>English</string> | |||
<key>CFBundleExecutable</key> | |||
<string>PearlRetryPrefs</string> | |||
<key>CFBundleIdentifier</key> | |||
<string>com.gilshahar7.pearlretryprefs</string> | |||
<key>CFBundleInfoDictionaryVersion</key> | |||
<string>6.0</string> | |||
<key>CFBundlePackageType</key> | |||
<string>BNDL</string> | |||
<key>CFBundleShortVersionString</key> | |||
<string>1.0.0</string> | |||
<key>CFBundleSignature</key> | |||
<string>????</string> | |||
<key>CFBundleVersion</key> | |||
<string>1.0</string> | |||
<key>NSPrincipalClass</key> | |||
<string>prpRootListController</string> | |||
</dict> | |||
</plist> |
@@ -0,0 +1,45 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |||
<plist version="1.0"> | |||
<dict> | |||
<key>items</key> | |||
<array> | |||
<dict> | |||
<key>cell</key> | |||
<string>PSGroupCell</string> | |||
<key>label</key> | |||
<string>PearlRetry</string> | |||
</dict> | |||
<dict> | |||
<key>cell</key> | |||
<string>PSStaticTextCell</string> | |||
<key>label</key> | |||
<string>Retry delay in seconds</string> | |||
</dict> | |||
<dict> | |||
<key>cell</key> | |||
<string>PSSliderCell</string> | |||
<key>default</key> | |||
<real>0.7</real> | |||
<key>min</key> | |||
<real>0.0</real> | |||
<key>max</key> | |||
<real>1.5</real> | |||
<key>showValue</key> | |||
<true/> | |||
<key>isSegmented</key> | |||
<true/> | |||
<key>segmentCount</key> | |||
<integer>30</integer> | |||
<key>defaults</key> | |||
<string>com.gilshahar7.pearlretryprefs</string> | |||
<key>key</key> | |||
<string>delay</string> | |||
<key>PostNotification</key> | |||
<string>com.gilshahar7.pearlretryprefs.settingschanged</string> | |||
</dict> | |||
</array> | |||
<key>title</key> | |||
<string>PearlRetryPrefs</string> | |||
</dict> | |||
</plist> |
@@ -0,0 +1,21 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |||
<plist version="1.0"> | |||
<dict> | |||
<key>entry</key> | |||
<dict> | |||
<key>bundle</key> | |||
<string>PearlRetryPrefs</string> | |||
<key>cell</key> | |||
<string>PSLinkCell</string> | |||
<key>detail</key> | |||
<string>prpRootListController</string> | |||
<key>icon</key> | |||
<string>icon.png</string> | |||
<key>isController</key> | |||
<true/> | |||
<key>label</key> | |||
<string>PearlRetry</string> | |||
</dict> | |||
</dict> | |||
</plist> |
@@ -0,0 +1,5 @@ | |||
#import <Preferences/PSListController.h> | |||
@interface prpRootListController : PSListController | |||
@end |
@@ -0,0 +1,33 @@ | |||
#import <Preferences/PSSpecifier.h> | |||
#include "prpRootListController.h" | |||
@implementation prpRootListController | |||
- (id)readPreferenceValue:(PSSpecifier*)specifier { | |||
NSString *path = [NSString stringWithFormat:@"/User/Library/Preferences/%@.plist", specifier.properties[@"defaults"]]; | |||
NSMutableDictionary *settings = [NSMutableDictionary dictionary]; | |||
[settings addEntriesFromDictionary:[NSDictionary dictionaryWithContentsOfFile:path]]; | |||
return (settings[specifier.properties[@"key"]]) ?: specifier.properties[@"default"]; | |||
} | |||
- (void)setPreferenceValue:(id)value specifier:(PSSpecifier*)specifier { | |||
NSString *path = [NSString stringWithFormat:@"/User/Library/Preferences/%@.plist", specifier.properties[@"defaults"]]; | |||
NSMutableDictionary *settings = [NSMutableDictionary dictionary]; | |||
[settings addEntriesFromDictionary:[NSDictionary dictionaryWithContentsOfFile:path]]; | |||
[settings setObject:value forKey:specifier.properties[@"key"]]; | |||
[settings writeToFile:path atomically:YES]; | |||
CFStringRef notificationName = (CFStringRef)specifier.properties[@"PostNotification"]; | |||
if (notificationName) { | |||
CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), notificationName, NULL, NULL, YES); | |||
} | |||
} | |||
- (NSArray *)specifiers { | |||
if (!_specifiers) { | |||
_specifiers = [[self loadSpecifiersFromPlistName:@"Root" target:self] retain]; | |||
} | |||
return _specifiers; | |||
} | |||
@end |