Browse Source

Version 1.0

master
Gil Shahar 5 years ago
parent
commit
5b69959aea
No account linked to committer's email address
12 changed files with 207 additions and 0 deletions
  1. +13
    -0
      Makefile
  2. +1
    -0
      PearlRetry.plist
  3. +42
    -0
      Tweak.xm
  4. +9
    -0
      control
  5. BIN
      packages/com.gilshahar7.pearlretry_1.0_iphoneos-arm.deb
  6. +14
    -0
      pearlretryprefs/Makefile
  7. +24
    -0
      pearlretryprefs/Resources/Info.plist
  8. +45
    -0
      pearlretryprefs/Resources/Root.plist
  9. BIN
      pearlretryprefs/Resources/icon@3x.png
  10. +21
    -0
      pearlretryprefs/entry.plist
  11. +5
    -0
      pearlretryprefs/prpRootListController.h
  12. +33
    -0
      pearlretryprefs/prpRootListController.m

+ 13
- 0
Makefile 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
- 0
PearlRetry.plist View File

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

+ 42
- 0
Tweak.xm 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
- 0
control 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

BIN
packages/com.gilshahar7.pearlretry_1.0_iphoneos-arm.deb View File


+ 14
- 0
pearlretryprefs/Makefile 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)

+ 24
- 0
pearlretryprefs/Resources/Info.plist 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>

+ 45
- 0
pearlretryprefs/Resources/Root.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>

BIN
pearlretryprefs/Resources/icon@3x.png View File

Before After
Width: 87  |  Height: 87  |  Size: 27KB

+ 21
- 0
pearlretryprefs/entry.plist 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>

+ 5
- 0
pearlretryprefs/prpRootListController.h View File

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

@interface prpRootListController : PSListController

@end

+ 33
- 0
pearlretryprefs/prpRootListController.m 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

Loading…
Cancel
Save