Browse Source

Improve preferences

master
lint 3 years ago
parent
commit
470c651166
26 changed files with 76 additions and 1 deletions
  1. +55
    -1
      prefs/Resources/Root.plist
  2. BIN
      prefs/Resources/app_icons/AlienBlue.png
  3. BIN
      prefs/Resources/app_icons/AlienBlue@2x.png
  4. BIN
      prefs/Resources/app_icons/AlienBlue@3x.png
  5. BIN
      prefs/Resources/app_icons/Antenna.png
  6. BIN
      prefs/Resources/app_icons/Antenna@2x.png
  7. BIN
      prefs/Resources/app_icons/Antenna@3x.png
  8. BIN
      prefs/Resources/app_icons/Apollo.png
  9. BIN
      prefs/Resources/app_icons/Apollo@2x.png
  10. BIN
      prefs/Resources/app_icons/Apollo@3x.png
  11. BIN
      prefs/Resources/app_icons/BaconReader.png
  12. BIN
      prefs/Resources/app_icons/BaconReader@2x.png
  13. BIN
      prefs/Resources/app_icons/BaconReader@3x.png
  14. BIN
      prefs/Resources/app_icons/Beam.png
  15. BIN
      prefs/Resources/app_icons/Beam@2x.png
  16. BIN
      prefs/Resources/app_icons/Beam@3x.png
  17. BIN
      prefs/Resources/app_icons/Narwhal.png
  18. BIN
      prefs/Resources/app_icons/Narwhal@2x.png
  19. BIN
      prefs/Resources/app_icons/Narwhal@3x.png
  20. BIN
      prefs/Resources/app_icons/Reddit.png
  21. BIN
      prefs/Resources/app_icons/Reddit@2x.png
  22. BIN
      prefs/Resources/app_icons/Reddit@3x.png
  23. BIN
      prefs/Resources/app_icons/Slide.png
  24. BIN
      prefs/Resources/app_icons/Slide@2x.png
  25. BIN
      prefs/Resources/app_icons/Slide@3x.png
  26. +21
    -0
      prefs/TFDTSRootListController.m

+ 55
- 1
prefs/Resources/Root.plist View File

@@ -8,10 +8,32 @@
<key>cell</key>
<string>PSGroupCell</string>
<key>footerText</key>
<string>To enable/disable, restart the app.</string>
<string>Fully enable/disable the tweak.</string>
<key>label</key>
<string>Enabled</string>
</dict>
<dict>
<key>PostNotification</key>
<string>com.lint.undelete.prefs.changed</string>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>defaults</key>
<string>com.lint.undelete.prefs</string>
<key>key</key>
<string>isEnabled</string>
<key>label</key>
<string>Enabled</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Enabled Applications</string>
<key>footerText</key>
<string>To enable/disable, restart the app.</string>
</dict>
<dict>
<key>PostNotification</key>
<string>com.lint.undelete.prefs.changed</string>
@@ -25,6 +47,10 @@
<string>isAlienBlueEnabled</string>
<key>label</key>
<string>Enable Alien Blue</string>
<key>hasIcon</key>
<true/>
<key>icon</key>
<string>app_icons/AlienBlue.png</string>
</dict>
<dict>
<key>PostNotification</key>
@@ -39,6 +65,10 @@
<string>isAntennaEnabled</string>
<key>label</key>
<string>Enable Antenna</string>
<key>hasIcon</key>
<true/>
<key>icon</key>
<string>app_icons/Antenna.png</string>
</dict>
<dict>
<key>PostNotification</key>
@@ -53,6 +83,10 @@
<string>isApolloEnabled</string>
<key>label</key>
<string>Enable Apollo</string>
<key>hasIcon</key>
<true/>
<key>icon</key>
<string>app_icons/Apollo.png</string>
</dict>
<dict>
<key>PostNotification</key>
@@ -67,6 +101,10 @@
<string>isBaconReaderEnabled</string>
<key>label</key>
<string>Enable BaconReader</string>
<key>hasIcon</key>
<true/>
<key>icon</key>
<string>app_icons/BaconReader.png</string>
</dict>
<dict>
<key>PostNotification</key>
@@ -81,6 +119,10 @@
<string>isBeamEnabled</string>
<key>label</key>
<string>Enable Beam</string>
<key>hasIcon</key>
<true/>
<key>icon</key>
<string>app_icons/Beam.png</string>
</dict>
<dict>
<key>PostNotification</key>
@@ -95,6 +137,10 @@
<string>isNarwhalEnabled</string>
<key>label</key>
<string>Enable Narwhal</string>
<key>hasIcon</key>
<true/>
<key>icon</key>
<string>app_icons/Narwhal.png</string>
</dict>
<dict>
<key>PostNotification</key>
@@ -109,6 +155,10 @@
<string>isRedditEnabled</string>
<key>label</key>
<string>Enable Reddit</string>
<key>hasIcon</key>
<true/>
<key>icon</key>
<string>app_icons/Reddit.png</string>
</dict>
<dict>
<key>PostNotification</key>
@@ -123,6 +173,10 @@
<string>isSlideEnabled</string>
<key>label</key>
<string>Enable Slide</string>
<key>hasIcon</key>
<true/>
<key>icon</key>
<string>app_icons/Slide.png</string>
</dict>
<dict>
<key>cell</key>

BIN
prefs/Resources/app_icons/AlienBlue.png View File

Before After
Width: 29  |  Height: 29  |  Size: 4.7KB

BIN
prefs/Resources/app_icons/AlienBlue@2x.png View File

Before After
Width: 58  |  Height: 58  |  Size: 7.4KB

BIN
prefs/Resources/app_icons/AlienBlue@3x.png View File

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

BIN
prefs/Resources/app_icons/Antenna.png View File

Before After
Width: 29  |  Height: 29  |  Size: 4.8KB

BIN
prefs/Resources/app_icons/Antenna@2x.png View File

Before After
Width: 58  |  Height: 58  |  Size: 8.0KB

BIN
prefs/Resources/app_icons/Antenna@3x.png View File

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

BIN
prefs/Resources/app_icons/Apollo.png View File

Before After
Width: 29  |  Height: 29  |  Size: 4.6KB

BIN
prefs/Resources/app_icons/Apollo@2x.png View File

Before After
Width: 58  |  Height: 58  |  Size: 8.0KB

BIN
prefs/Resources/app_icons/Apollo@3x.png View File

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

BIN
prefs/Resources/app_icons/BaconReader.png View File

Before After
Width: 29  |  Height: 29  |  Size: 4.5KB

BIN
prefs/Resources/app_icons/BaconReader@2x.png View File

Before After
Width: 58  |  Height: 58  |  Size: 7.4KB

BIN
prefs/Resources/app_icons/BaconReader@3x.png View File

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

BIN
prefs/Resources/app_icons/Beam.png View File

Before After
Width: 29  |  Height: 29  |  Size: 4.6KB

BIN
prefs/Resources/app_icons/Beam@2x.png View File

Before After
Width: 58  |  Height: 58  |  Size: 8.0KB

BIN
prefs/Resources/app_icons/Beam@3x.png View File

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

BIN
prefs/Resources/app_icons/Narwhal.png View File

Before After
Width: 29  |  Height: 29  |  Size: 4.4KB

BIN
prefs/Resources/app_icons/Narwhal@2x.png View File

Before After
Width: 58  |  Height: 58  |  Size: 6.8KB

BIN
prefs/Resources/app_icons/Narwhal@3x.png View File

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

BIN
prefs/Resources/app_icons/Reddit.png View File

Before After
Width: 29  |  Height: 29  |  Size: 4.3KB

BIN
prefs/Resources/app_icons/Reddit@2x.png View File

Before After
Width: 58  |  Height: 58  |  Size: 6.5KB

BIN
prefs/Resources/app_icons/Reddit@3x.png View File

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

BIN
prefs/Resources/app_icons/Slide.png View File

Before After
Width: 29  |  Height: 29  |  Size: 4.0KB

BIN
prefs/Resources/app_icons/Slide@2x.png View File

Before After
Width: 58  |  Height: 58  |  Size: 5.8KB

BIN
prefs/Resources/app_icons/Slide@3x.png View File

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

+ 21
- 0
prefs/TFDTSRootListController.m View File

@@ -1,4 +1,5 @@
#include "TFDTSRootListController.h"
#import <Preferences/PSSpecifier.h>

@implementation TFDTSRootListController

@@ -10,4 +11,24 @@
return _specifiers;
}

- (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 = (__bridge CFStringRef)specifier.properties[@"PostNotification"];

if (notificationName) {
CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), notificationName, NULL, NULL, YES);
}
}

@end

Loading…
Cancel
Save