mirror of
https://github.com/gilshahar7/PearlRetry.git
synced 2025-06-28 00:16:46 +00:00
Version 1.0
This commit is contained in:
14
pearlretryprefs/Makefile
Normal file
14
pearlretryprefs/Makefile
Normal 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
pearlretryprefs/Resources/Info.plist
Normal file
24
pearlretryprefs/Resources/Info.plist
Normal 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
pearlretryprefs/Resources/Root.plist
Normal file
45
pearlretryprefs/Resources/Root.plist
Normal 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
Normal file
BIN
pearlretryprefs/Resources/icon@3x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
21
pearlretryprefs/entry.plist
Normal file
21
pearlretryprefs/entry.plist
Normal 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
pearlretryprefs/prpRootListController.h
Normal file
5
pearlretryprefs/prpRootListController.h
Normal file
@ -0,0 +1,5 @@
|
||||
#import <Preferences/PSListController.h>
|
||||
|
||||
@interface prpRootListController : PSListController
|
||||
|
||||
@end
|
33
pearlretryprefs/prpRootListController.m
Normal file
33
pearlretryprefs/prpRootListController.m
Normal 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
|
Reference in New Issue
Block a user