diff --git a/prefs/Resources/Root.plist b/prefs/Resources/Root.plist
index 2869a5c..74da805 100644
--- a/prefs/Resources/Root.plist
+++ b/prefs/Resources/Root.plist
@@ -7,10 +7,14 @@
cell
PSGroupCell
+ footerText
+ To enable/disable, restart the app.
label
Enabled
+ PostNotification
+ com.lint.undelete.prefs.changed
cell
PSSwitchCell
default
@@ -23,6 +27,8 @@
Enable Reddit
+ PostNotification
+ com.lint.undelete.prefs.changed
cell
PSSwitchCell
default
@@ -35,6 +41,8 @@
Enable Apollo
+ PostNotification
+ com.lint.undelete.prefs.changed
cell
PSSwitchCell
default
@@ -53,6 +61,8 @@
Apollo
+ PostNotification
+ com.lint.undelete.prefs.changed
cell
PSSwitchCell
default
@@ -75,6 +85,8 @@
Request timeout (seconds)
+ PostNotification
+ com.lint.undelete.prefs.changed
cell
PSSliderCell
default
@@ -90,12 +102,6 @@
showValue
-
- cell
- PSGroupCell
- footerText
- In order to apply preferences, restart the app. If changes do not immediately take effect, wait a few seconds and try again.
-
title
TFDidThatSay?
diff --git a/tweak/Apollo.xm b/tweak/Apollo.xm
index 319c111..cb70230 100644
--- a/tweak/Apollo.xm
+++ b/tweak/Apollo.xm
@@ -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"));
}
}
diff --git a/tweak/Narwhal.xm b/tweak/Narwhal.xm
index 3d1543b..47cbcb5 100644
--- a/tweak/Narwhal.xm
+++ b/tweak/Narwhal.xm
@@ -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);
}
}
diff --git a/tweak/Reddit.xm b/tweak/Reddit.xm
index 1e88d9a..11ab2fb 100644
--- a/tweak/Reddit.xm
+++ b/tweak/Reddit.xm
@@ -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);