Version 2.0 - Combined all of the ExactTime tweaks.
@ -1,20 +1,148 @@
|
||||
#import <Preferences/PSListController.h>
|
||||
#import <Preferences/PSSpecifier.h>
|
||||
|
||||
@interface ExactTimeprefsListController: PSListController {
|
||||
}
|
||||
@interface PSListController (iOS12Plus)
|
||||
-(BOOL)containsSpecifier:(id)arg1;
|
||||
@end
|
||||
|
||||
@interface ExactTimeprefsListController : PSListController
|
||||
@property (nonatomic, retain) NSMutableDictionary *savedSpecifiers;
|
||||
@end
|
||||
|
||||
@implementation ExactTimeprefsListController
|
||||
|
||||
- (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);
|
||||
}
|
||||
|
||||
//Here we check if the switch is on based of the key of the PSSwitchCell, then hide the specifier
|
||||
//We then hide the cell using the id of it. If its already hidden we reinsert the cell below a certain specifier based on its ID
|
||||
NSString *key = [specifier propertyForKey:@"key"];
|
||||
if([key isEqualToString:@"notifications"]) {
|
||||
if([value boolValue]) {
|
||||
[self insertContiguousSpecifiers:@[self.savedSpecifiers[@"96"]] afterSpecifierID:@"95" animated:YES];
|
||||
[self insertContiguousSpecifiers:@[self.savedSpecifiers[@"97"]] afterSpecifierID:@"96" animated:YES];
|
||||
[self insertContiguousSpecifiers:@[self.savedSpecifiers[@"98"]] afterSpecifierID:@"97" animated:YES];
|
||||
[self insertContiguousSpecifiers:@[self.savedSpecifiers[@"99"]] afterSpecifierID:@"98" animated:YES];
|
||||
[self insertContiguousSpecifiers:@[self.savedSpecifiers[@"100"]] afterSpecifierID:@"99" animated:YES];
|
||||
[self insertContiguousSpecifiers:@[self.savedSpecifiers[@"101"]] afterSpecifierID:@"100" animated:YES];
|
||||
[self insertContiguousSpecifiers:@[self.savedSpecifiers[@"102"]] afterSpecifierID:@"101" animated:YES];
|
||||
} else if([self containsSpecifier:self.savedSpecifiers[@"96"]]) {
|
||||
[self removeContiguousSpecifiers:@[self.savedSpecifiers[@"96"]] animated:YES];
|
||||
[self removeContiguousSpecifiers:@[self.savedSpecifiers[@"97"]] animated:YES];
|
||||
[self removeContiguousSpecifiers:@[self.savedSpecifiers[@"98"]] animated:YES];
|
||||
[self removeContiguousSpecifiers:@[self.savedSpecifiers[@"99"]] animated:YES];
|
||||
[self removeContiguousSpecifiers:@[self.savedSpecifiers[@"100"]] animated:YES];
|
||||
[self removeContiguousSpecifiers:@[self.savedSpecifiers[@"101"]] animated:YES];
|
||||
[self removeContiguousSpecifiers:@[self.savedSpecifiers[@"102"]] animated:YES];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (id)specifiers {
|
||||
if(_specifiers == nil) {
|
||||
_specifiers = [[self loadSpecifiersFromPlistName:@"ExactTimeprefs" target:self] retain];
|
||||
}
|
||||
//Code to save certain specifiers
|
||||
//Add the id of the specifier to the chosenIDs array.
|
||||
//Only add the IDs of the specifiers you want to hide
|
||||
NSArray *chosenIDs = @[@"96", @"97", @"98", @"99", @"100", @"101", @"102"];
|
||||
self.savedSpecifiers = (!self.savedSpecifiers) ? [[NSMutableDictionary alloc] init] : self.savedSpecifiers;
|
||||
for(PSSpecifier *specifier in _specifiers) {
|
||||
if([chosenIDs containsObject:[specifier propertyForKey:@"id"]]) {
|
||||
[self.savedSpecifiers setObject:specifier forKey:[specifier propertyForKey:@"id"]];
|
||||
}
|
||||
}
|
||||
return _specifiers;
|
||||
}
|
||||
|
||||
-(void)apply{
|
||||
[self.view endEditing:YES];
|
||||
-(void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
//From my testing, at this point we can't get the value of a specifier yet as they haven't loaded
|
||||
//Instead you can just read your switch value from your preferences file
|
||||
|
||||
NSDictionary *preferences = [NSDictionary dictionaryWithContentsOfFile:@"/var/mobile/Library/Preferences/com.gilshahar7.exacttimeprefs.plist"];
|
||||
if(![preferences[@"notifications"] boolValue] == true) {
|
||||
[self removeContiguousSpecifiers:@[self.savedSpecifiers[@"96"]] animated:NO];
|
||||
[self removeContiguousSpecifiers:@[self.savedSpecifiers[@"97"]] animated:NO];
|
||||
[self removeContiguousSpecifiers:@[self.savedSpecifiers[@"98"]] animated:NO];
|
||||
[self removeContiguousSpecifiers:@[self.savedSpecifiers[@"99"]] animated:NO];
|
||||
[self removeContiguousSpecifiers:@[self.savedSpecifiers[@"100"]] animated:NO];
|
||||
[self removeContiguousSpecifiers:@[self.savedSpecifiers[@"101"]] animated:NO];
|
||||
[self removeContiguousSpecifiers:@[self.savedSpecifiers[@"102"]] animated:NO];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)reloadSpecifiers {
|
||||
[super reloadSpecifiers];
|
||||
|
||||
//This will look the exact same as step 5, where we only check if specifiers need to be removed
|
||||
NSDictionary *preferences = [NSDictionary dictionaryWithContentsOfFile:@"/var/mobile/Library/Preferences/com.gilshahar7.exacttimeprefs.plist"];
|
||||
if([preferences[@"notifications"] boolValue] == false) {
|
||||
[self removeContiguousSpecifiers:@[self.savedSpecifiers[@"96"]] animated:NO];
|
||||
[self removeContiguousSpecifiers:@[self.savedSpecifiers[@"97"]] animated:NO];
|
||||
[self removeContiguousSpecifiers:@[self.savedSpecifiers[@"98"]] animated:NO];
|
||||
[self removeContiguousSpecifiers:@[self.savedSpecifiers[@"99"]] animated:NO];
|
||||
[self removeContiguousSpecifiers:@[self.savedSpecifiers[@"100"]] animated:NO];
|
||||
[self removeContiguousSpecifiers:@[self.savedSpecifiers[@"101"]] animated:NO];
|
||||
[self removeContiguousSpecifiers:@[self.savedSpecifiers[@"102"]] animated:NO];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)loadView {
|
||||
[super loadView];
|
||||
((UITableView *)[self table]).keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
|
||||
}
|
||||
|
||||
-(void)_returnKeyPressed:(id)arg1 { [self.view endEditing:YES]; }
|
||||
|
||||
-(void)apply{
|
||||
[self.view endEditing:YES];
|
||||
}
|
||||
|
||||
- (void)sourceLink
|
||||
{
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://github.com/gilshahar7/ExactTime"]];
|
||||
}
|
||||
|
||||
- (void)donationLink
|
||||
{
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.paypal.me/gilshahar7"]];
|
||||
}
|
||||
|
||||
|
||||
- (void)openTwitterWithUsername:(NSString*)username
|
||||
{
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://twitter.com/%@", username]]];
|
||||
}
|
||||
- (void)openTwitter
|
||||
{
|
||||
[self openTwitterWithUsername:@"gilshahar7"];
|
||||
}
|
||||
|
||||
- (void)reddit {
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.reddit.com/user/gilshahar7/"]];
|
||||
}
|
||||
|
||||
- (void)sendEmail {
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto:gilshahardex99@gmail.com?subject=ExactTime"]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
// vim:ft=objc
|
||||
|
@ -2,6 +2,8 @@ ARCHS = armv7 arm64 arm64e
|
||||
export TARGET = iphone:clang:11.2:7.0
|
||||
include $(THEOS)/makefiles/common.mk
|
||||
|
||||
DEBUG=0
|
||||
|
||||
BUNDLE_NAME = ExactTimeprefs
|
||||
ExactTimeprefs_FILES = ExactTimeprefs.mm
|
||||
ExactTimeprefs_INSTALL_PATH = /Library/PreferenceBundles
|
||||
|
BIN
exacttimeprefs/Resources/Donate@2x.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
exacttimeprefs/Resources/Donate@3x.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
exacttimeprefs/Resources/Email@2x.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
exacttimeprefs/Resources/Email@3x.png
Normal file
After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 21 KiB |
BIN
exacttimeprefs/Resources/ExactTime@3x.png
Normal file
After Width: | Height: | Size: 22 KiB |
@ -7,8 +7,70 @@
|
||||
<dict>
|
||||
<key>cell</key>
|
||||
<string>PSGroupCell</string>
|
||||
<key>label</key>
|
||||
<string>Choose extentions</string>
|
||||
<key>footerText</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>cell</key>
|
||||
<string>PSSwitchCell</string>
|
||||
<key>default</key>
|
||||
<false/>
|
||||
<key>defaults</key>
|
||||
<string>com.gilshahar7.exacttimeprefs</string>
|
||||
<key>key</key>
|
||||
<string>notifications</string>
|
||||
<key>label</key>
|
||||
<string>Notifications</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>cell</key>
|
||||
<string>PSSwitchCell</string>
|
||||
<key>default</key>
|
||||
<false/>
|
||||
<key>defaults</key>
|
||||
<string>com.gilshahar7.exacttimeprefs</string>
|
||||
<key>key</key>
|
||||
<string>messages</string>
|
||||
<key>label</key>
|
||||
<string>Messages</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>cell</key>
|
||||
<string>PSSwitchCell</string>
|
||||
<key>default</key>
|
||||
<false/>
|
||||
<key>defaults</key>
|
||||
<string>com.gilshahar7.exacttimeprefs</string>
|
||||
<key>key</key>
|
||||
<string>phone</string>
|
||||
<key>label</key>
|
||||
<string>Phone</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>cell</key>
|
||||
<string>PSSwitchCell</string>
|
||||
<key>default</key>
|
||||
<false/>
|
||||
<key>defaults</key>
|
||||
<string>com.gilshahar7.exacttimeprefs</string>
|
||||
<key>key</key>
|
||||
<string>mail</string>
|
||||
<key>label</key>
|
||||
<string>Mail</string>
|
||||
<key>id</key>
|
||||
<string>95</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>cell</key>
|
||||
<string>PSGroupCell</string>
|
||||
<key>label</key>
|
||||
<string>Notifications settings</string>
|
||||
<key>footerText</key>
|
||||
<string>Only show the exact time for notifications older than this value (0~240). Default value for stock iOS is 240 minutes (4 hours)</string>
|
||||
<key>id</key>
|
||||
<string>96</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>cell</key>
|
||||
@ -23,21 +85,28 @@
|
||||
<true/>
|
||||
<key>label</key>
|
||||
<string>Affect after (in minutes)</string>
|
||||
<key>id</key>
|
||||
<string>97</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>cell</key>
|
||||
<string>PSButtonCell</string>
|
||||
<key>defaults</key> <string>com.gilshahar7.exacttimeprefs</string>
|
||||
<key>defaults</key>
|
||||
<string>com.gilshahar7.exacttimeprefs</string>
|
||||
<key>label</key>
|
||||
<string>Apply</string>
|
||||
<key>action</key>
|
||||
<string>apply</string>
|
||||
<key>id</key>
|
||||
<string>98</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>cell</key>
|
||||
<string>PSGroupCell</string>
|
||||
<key>footerText</key>
|
||||
<string>This will add "Xh ago" where there is an exact time, separated by a ' • ' Note: this will override any language</string>
|
||||
<key>id</key>
|
||||
<string>99</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>cell</key>
|
||||
@ -50,12 +119,16 @@
|
||||
<string>addToCurrent</string>
|
||||
<key>label</key>
|
||||
<string>Add estimated time to exact time</string>
|
||||
<key>id</key>
|
||||
<string>100</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>cell</key>
|
||||
<string>PSGroupCell</string>
|
||||
<key>footerText</key>
|
||||
<string>This will add minutes to all "Xh ago" Note: this will override any language</string>
|
||||
<key>id</key>
|
||||
<string>101</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>cell</key>
|
||||
@ -68,12 +141,66 @@
|
||||
<string>addMinutes</string>
|
||||
<key>label</key>
|
||||
<string>Change "2h ago" to "2h 17m ago"</string>
|
||||
<key>id</key>
|
||||
<string>102</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>cell</key>
|
||||
<string>PSGroupCell</string>
|
||||
<key>label</key>
|
||||
<string>About</string>
|
||||
<key>footerText</key>
|
||||
<string>Made by: gilshahar7.</string>
|
||||
<string>Made by gilshahar7</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>action</key>
|
||||
<string>reddit</string>
|
||||
<key>cell</key>
|
||||
<string>PSButtonCell</string>
|
||||
<key>icon</key>
|
||||
<string>Reddit</string>
|
||||
<key>label</key>
|
||||
<string>Reddit (u/gilshahar7)</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>action</key>
|
||||
<string>sendEmail</string>
|
||||
<key>cell</key>
|
||||
<string>PSButtonCell</string>
|
||||
<key>icon</key>
|
||||
<string>Email</string>
|
||||
<key>label</key>
|
||||
<string>Email</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>action</key>
|
||||
<string>openTwitter</string>
|
||||
<key>cell</key>
|
||||
<string>PSButtonCell</string>
|
||||
<key>icon</key>
|
||||
<string>Twitter</string>
|
||||
<key>label</key>
|
||||
<string>Twitter (@gilshahar7)</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>action</key>
|
||||
<string>sourceLink</string>
|
||||
<key>cell</key>
|
||||
<string>PSButtonCell</string>
|
||||
<key>icon</key>
|
||||
<string>GitHub</string>
|
||||
<key>label</key>
|
||||
<string>Source Code</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>action</key>
|
||||
<string>donationLink</string>
|
||||
<key>cell</key>
|
||||
<string>PSButtonCell</string>
|
||||
<key>icon</key>
|
||||
<string>Donate</string>
|
||||
<key>label</key>
|
||||
<string>Donate</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>title</key>
|
||||
|
BIN
exacttimeprefs/Resources/GitHub@2x.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
exacttimeprefs/Resources/GitHub@3x.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
exacttimeprefs/Resources/Reddit@2x.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
exacttimeprefs/Resources/Reddit@3x.png
Normal file
After Width: | Height: | Size: 24 KiB |
@ -1,82 +0,0 @@
|
||||
<?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>footerText</key>
|
||||
<string>Only show the exact time for notifications older than this value (0~240). Default value for stock iOS is 240 minutes (4 hours)</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>cell</key>
|
||||
<string>PSEditTextCell</string>
|
||||
<key>defaults</key>
|
||||
<string>com.gilshahar7.exacttimeprefs</string>
|
||||
<key>key</key>
|
||||
<string>affectTime</string>
|
||||
<key>default</key>
|
||||
<string>10</string>
|
||||
<key>isNumeric</key>
|
||||
<true/>
|
||||
<key>label</key>
|
||||
<string>Affect after (in minutes)</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>cell</key>
|
||||
<string>PSButtonCell</string>
|
||||
<key>defaults</key> <string>com.gilshahar7.exacttimeprefs</string>
|
||||
<key>label</key>
|
||||
<string>Apply</string>
|
||||
<key>action</key>
|
||||
<string>apply</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>cell</key>
|
||||
<string>PSGroupCell</string>
|
||||
<key>footerText</key>
|
||||
<string>This will add "Xh ago" where there is an exact time, separated by a ' • ' Note: this will override any language</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>cell</key>
|
||||
<string>PSSwitchCell</string>
|
||||
<key>default</key>
|
||||
<false/>
|
||||
<key>defaults</key>
|
||||
<string>com.gilshahar7.exacttimeprefs</string>
|
||||
<key>key</key>
|
||||
<string>addToCurrent</string>
|
||||
<key>label</key>
|
||||
<string>Add estimated time to exact time</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>cell</key>
|
||||
<string>PSGroupCell</string>
|
||||
<key>footerText</key>
|
||||
<string>This will add minutes to all "Xh ago" Note: this will override any language</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>cell</key>
|
||||
<string>PSSwitchCell</string>
|
||||
<key>default</key>
|
||||
<false/>
|
||||
<key>defaults</key>
|
||||
<string>com.gilshahar7.exacttimeprefs</string>
|
||||
<key>key</key>
|
||||
<string>addMinutes</string>
|
||||
<key>label</key>
|
||||
<string>Change "2h ago" to "2h 17m ago"</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>cell</key>
|
||||
<string>PSGroupCell</string>
|
||||
<key>footerText</key>
|
||||
<string>Made by: gilshahar7.</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>title</key>
|
||||
<string>ExactTime</string>
|
||||
</dict>
|
||||
</plist>
|
BIN
exacttimeprefs/Resources/Twitter@2x.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
exacttimeprefs/Resources/Twitter@3x.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
@ -1,5 +0,0 @@
|
||||
#import <Preferences/PSListController.h>
|
||||
|
||||
@interface RootListController : PSListController
|
||||
|
||||
@end
|
@ -1,17 +0,0 @@
|
||||
#include "RootListController.h"
|
||||
|
||||
@implementation RootListController
|
||||
|
||||
- (NSArray *)specifiers {
|
||||
if (!_specifiers) {
|
||||
_specifiers = [[self loadSpecifiersFromPlistName:@"Root" target:self] retain];
|
||||
}
|
||||
|
||||
return _specifiers;
|
||||
}
|
||||
|
||||
-(void)apply{
|
||||
[self.view endEditing:YES];
|
||||
}
|
||||
|
||||
@end
|