1
0
mirror of https://github.com/lint/TFDidThatSay synced 2025-07-04 08:36:45 +00:00

Add preferences post notification

This commit is contained in:
lint
2019-11-26 10:43:55 -05:00
parent 3f3b9cf167
commit ab771d8317
4 changed files with 35 additions and 8 deletions

View File

@ -265,6 +265,10 @@ static void loadPrefs(){
}
}
static void prefsChanged(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) {
loadPrefs();
}
%ctor {
loadPrefs();
@ -273,6 +277,9 @@ static void loadPrefs(){
if ([processName isEqualToString:@"Apollo"]){
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"));
}
}

View File

@ -235,6 +235,10 @@ static void loadPrefs(){
}
}
static void prefsChanged(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) {
loadPrefs();
}
%ctor {
loadPrefs();
@ -243,6 +247,9 @@ static void loadPrefs(){
if ([processName isEqualToString:@"narwhal"]){
if (isNarwhalEnabled){
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, prefsChanged, CFSTR("com.lint.undelete.prefs.changed"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
%init(Narwhal);
}
}

View File

@ -4,7 +4,7 @@
static CGFloat pushshiftRequestTimeoutValue;
static BOOL isRedditEnabled;
NSArray *redditVersion;
static NSArray *redditVersion;
%group Reddit_v4_current
@ -734,6 +734,10 @@ static void loadPrefs(){
}
}
static void prefsChanged(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) {
loadPrefs();
}
%ctor{
loadPrefs();
@ -742,7 +746,10 @@ static void loadPrefs(){
redditVersion = [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"] componentsSeparatedByString:@"."];
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[1] integerValue] <= 32){
%init(Reddit_v4_ios10);