1
0
mirror of https://github.com/gilshahar7/PearlRetry.git synced 2025-06-27 16:06:47 +00:00

Version 1.0

This commit is contained in:
2018-06-17 08:03:52 +03:00
committed by GitHub
parent da090972bc
commit 5b69959aea
12 changed files with 207 additions and 0 deletions

13
Makefile Normal file
View File

@ -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

1
PearlRetry.plist Normal file
View File

@ -0,0 +1 @@
{ Filter = { Bundles = ( "com.apple.springboard" ); }; }

42
Tweak.xm Normal file
View File

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

9
control Normal file
View File

@ -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

14
pearlretryprefs/Makefile Normal file
View File

@ -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)

View File

@ -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>

View File

@ -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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -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>

View File

@ -0,0 +1,5 @@
#import <Preferences/PSListController.h>
@interface prpRootListController : PSListController
@end

View File

@ -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