<dict> | <dict> | ||||
<key>cell</key> | <key>cell</key> | ||||
<string>PSGroupCell</string> | <string>PSGroupCell</string> | ||||
<key>footerText</key> | |||||
<string>To enable/disable, restart the app.</string> | |||||
<key>label</key> | <key>label</key> | ||||
<string>Enabled</string> | <string>Enabled</string> | ||||
</dict> | </dict> | ||||
<dict> | <dict> | ||||
<key>PostNotification</key> | |||||
<string>com.lint.undelete.prefs.changed</string> | |||||
<key>cell</key> | <key>cell</key> | ||||
<string>PSSwitchCell</string> | <string>PSSwitchCell</string> | ||||
<key>default</key> | <key>default</key> | ||||
<string>Enable Reddit</string> | <string>Enable Reddit</string> | ||||
</dict> | </dict> | ||||
<dict> | <dict> | ||||
<key>PostNotification</key> | |||||
<string>com.lint.undelete.prefs.changed</string> | |||||
<key>cell</key> | <key>cell</key> | ||||
<string>PSSwitchCell</string> | <string>PSSwitchCell</string> | ||||
<key>default</key> | <key>default</key> | ||||
<string>Enable Apollo</string> | <string>Enable Apollo</string> | ||||
</dict> | </dict> | ||||
<dict> | <dict> | ||||
<key>PostNotification</key> | |||||
<string>com.lint.undelete.prefs.changed</string> | |||||
<key>cell</key> | <key>cell</key> | ||||
<string>PSSwitchCell</string> | <string>PSSwitchCell</string> | ||||
<key>default</key> | <key>default</key> | ||||
<string>Apollo </string> | <string>Apollo </string> | ||||
</dict> | </dict> | ||||
<dict> | <dict> | ||||
<key>PostNotification</key> | |||||
<string>com.lint.undelete.prefs.changed</string> | |||||
<key>cell</key> | <key>cell</key> | ||||
<string>PSSwitchCell</string> | <string>PSSwitchCell</string> | ||||
<key>default</key> | <key>default</key> | ||||
<string>Request timeout (seconds)</string> | <string>Request timeout (seconds)</string> | ||||
</dict> | </dict> | ||||
<dict> | <dict> | ||||
<key>PostNotification</key> | |||||
<string>com.lint.undelete.prefs.changed</string> | |||||
<key>cell</key> | <key>cell</key> | ||||
<string>PSSliderCell</string> | <string>PSSliderCell</string> | ||||
<key>default</key> | <key>default</key> | ||||
<key>showValue</key> | <key>showValue</key> | ||||
<true/> | <true/> | ||||
</dict> | </dict> | ||||
<dict> | |||||
<key>cell</key> | |||||
<string>PSGroupCell</string> | |||||
<key>footerText</key> | |||||
<string>In order to apply preferences, restart the app. If changes do not immediately take effect, wait a few seconds and try again.</string> | |||||
</dict> | |||||
</array> | </array> | ||||
<key>title</key> | <key>title</key> | ||||
<string>TFDidThatSay?</string> | <string>TFDidThatSay?</string> |
} | } | ||||
} | } | ||||
static void prefsChanged(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) { | |||||
loadPrefs(); | |||||
} | |||||
%ctor { | %ctor { | ||||
loadPrefs(); | loadPrefs(); | ||||
if ([processName isEqualToString:@"Apollo"]){ | if ([processName isEqualToString:@"Apollo"]){ | ||||
if (isApolloEnabled){ | if (isApolloEnabled){ | ||||
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, prefsChanged, CFSTR("com.lint.undelete.prefs.changed"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately); | |||||
%init(Apollo, ApolloCommentsHeaderCellNode = objc_getClass("Apollo.CommentsHeaderCellNode"), ApolloCommentCellNode = objc_getClass("Apollo.CommentCellNode"), ApolloApolloButtonNode = objc_getClass("Apollo.ApolloButtonNode")); | %init(Apollo, ApolloCommentsHeaderCellNode = objc_getClass("Apollo.CommentsHeaderCellNode"), ApolloCommentCellNode = objc_getClass("Apollo.CommentCellNode"), ApolloApolloButtonNode = objc_getClass("Apollo.ApolloButtonNode")); | ||||
} | } | ||||
} | } |
} | } | ||||
} | } | ||||
static void prefsChanged(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) { | |||||
loadPrefs(); | |||||
} | |||||
%ctor { | %ctor { | ||||
loadPrefs(); | loadPrefs(); | ||||
if ([processName isEqualToString:@"narwhal"]){ | if ([processName isEqualToString:@"narwhal"]){ | ||||
if (isNarwhalEnabled){ | if (isNarwhalEnabled){ | ||||
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, prefsChanged, CFSTR("com.lint.undelete.prefs.changed"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately); | |||||
%init(Narwhal); | %init(Narwhal); | ||||
} | } | ||||
} | } |
static CGFloat pushshiftRequestTimeoutValue; | static CGFloat pushshiftRequestTimeoutValue; | ||||
static BOOL isRedditEnabled; | static BOOL isRedditEnabled; | ||||
NSArray *redditVersion; | |||||
static NSArray *redditVersion; | |||||
%group Reddit_v4_current | %group Reddit_v4_current | ||||
} | } | ||||
} | } | ||||
static void prefsChanged(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) { | |||||
loadPrefs(); | |||||
} | |||||
%ctor{ | %ctor{ | ||||
loadPrefs(); | loadPrefs(); | ||||
redditVersion = [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"] componentsSeparatedByString:@"."]; | redditVersion = [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"] componentsSeparatedByString:@"."]; | ||||
if ([processName isEqualToString:@"Reddit"]){ | if ([processName isEqualToString:@"Reddit"]){ | ||||
if (isRedditEnabled) { | |||||
if (isRedditEnabled) { | |||||
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, prefsChanged, CFSTR("com.lint.undelete.prefs.changed"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately); | |||||
if ([redditVersion[0] isEqualToString:@"4"]){ | if ([redditVersion[0] isEqualToString:@"4"]){ | ||||
if ([redditVersion[1] integerValue] <= 32){ | if ([redditVersion[1] integerValue] <= 32){ | ||||
%init(Reddit_v4_ios10); | %init(Reddit_v4_ios10); |