forked from lint/TFDidThatSay
		
	Style and prefs loading improvements
This commit is contained in:
		@ -3,6 +3,7 @@
 | 
				
			|||||||
#import "assets/TFHelper.h"
 | 
					#import "assets/TFHelper.h"
 | 
				
			||||||
#import "assets/MMMarkdown/MMMarkdown.h"
 | 
					#import "assets/MMMarkdown/MMMarkdown.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static BOOL isEnabled;
 | 
				
			||||||
static BOOL isAlienBlueEnabled;
 | 
					static BOOL isAlienBlueEnabled;
 | 
				
			||||||
static BOOL isTFDeletedOnly;
 | 
					static BOOL isTFDeletedOnly;
 | 
				
			||||||
static CGFloat pushshiftRequestTimeoutValue;
 | 
					static CGFloat pushshiftRequestTimeoutValue;
 | 
				
			||||||
@ -116,26 +117,12 @@ static void loadPrefs(){
 | 
				
			|||||||
	NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/User/Library/Preferences/com.lint.undelete.prefs.plist"];
 | 
						NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/User/Library/Preferences/com.lint.undelete.prefs.plist"];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (prefs){
 | 
						if (prefs){
 | 
				
			||||||
		
 | 
							isEnabled = [prefs objectForKey:@"isEnabled"] ? [[prefs objectForKey:@"isEnabled"] boolValue] : YES;
 | 
				
			||||||
		if ([prefs objectForKey:@"isAlienBlueEnabled"] != nil){
 | 
							isAlienBlueEnabled = [prefs objectForKey:@"isAlienBlueEnabled"] ? [[prefs objectForKey:@"isAlienBlueEnabled"] boolValue] : YES;
 | 
				
			||||||
			isAlienBlueEnabled = [[prefs objectForKey:@"isAlienBlueEnabled"] boolValue];
 | 
							isTFDeletedOnly = [prefs objectForKey:@"isTFDeletedOnly"] ? [[prefs objectForKey:@"isTFDeletedOnly"] boolValue] : YES;
 | 
				
			||||||
		} else {
 | 
							pushshiftRequestTimeoutValue = [prefs objectForKey:@"requestTimeoutValue"] ? [[prefs objectForKey:@"requestTimeoutValue"] doubleValue] : 10;
 | 
				
			||||||
			isAlienBlueEnabled = YES;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if ([prefs objectForKey:@"isTFDeletedOnly"] != nil){
 | 
					 | 
				
			||||||
			isTFDeletedOnly = [[prefs objectForKey:@"isTFDeletedOnly"] boolValue];
 | 
					 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
			isTFDeletedOnly = YES;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if ([prefs objectForKey:@"requestTimeoutValue"] != nil){
 | 
					 | 
				
			||||||
			pushshiftRequestTimeoutValue = [[prefs objectForKey:@"requestTimeoutValue"] doubleValue];
 | 
					 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
			pushshiftRequestTimeoutValue = 10;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
 | 
							isEnabled = YES;
 | 
				
			||||||
		isAlienBlueEnabled = YES;
 | 
							isAlienBlueEnabled = YES;
 | 
				
			||||||
		isTFDeletedOnly = YES;
 | 
							isTFDeletedOnly = YES;
 | 
				
			||||||
		pushshiftRequestTimeoutValue = 10;
 | 
							pushshiftRequestTimeoutValue = 10;
 | 
				
			||||||
@ -153,9 +140,9 @@ static void prefsChanged(CFNotificationCenterRef center, void *observer, CFStrin
 | 
				
			|||||||
	NSString* processName = [[NSProcessInfo processInfo] processName];
 | 
						NSString* processName = [[NSProcessInfo processInfo] processName];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ([processName isEqualToString:@"AlienBlue"]){
 | 
						if ([processName isEqualToString:@"AlienBlue"]){
 | 
				
			||||||
		if (isAlienBlueEnabled){
 | 
							if (isAlienBlueEnabled && isEnabled){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, prefsChanged, CFSTR("com.lint.undelete.prefs.changed"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
 | 
								CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)prefsChanged, CFSTR("com.lint.undelete.prefs.changed"), NULL, CFNotificationSuspensionBehaviorCoalesce);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			%init(AlienBlue);
 | 
								%init(AlienBlue);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
				
			|||||||
@ -3,6 +3,7 @@
 | 
				
			|||||||
#import "assets/TFHelper.h"
 | 
					#import "assets/TFHelper.h"
 | 
				
			||||||
#import "assets/MMMarkdown/MMMarkdown.h"
 | 
					#import "assets/MMMarkdown/MMMarkdown.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static BOOL isEnabled;
 | 
				
			||||||
static BOOL isAntennaEnabled;
 | 
					static BOOL isAntennaEnabled;
 | 
				
			||||||
static BOOL isTFDeletedOnly;
 | 
					static BOOL isTFDeletedOnly;
 | 
				
			||||||
static CGFloat pushshiftRequestTimeoutValue;
 | 
					static CGFloat pushshiftRequestTimeoutValue;
 | 
				
			||||||
@ -193,26 +194,12 @@ static void loadPrefs(){
 | 
				
			|||||||
	NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/User/Library/Preferences/com.lint.undelete.prefs.plist"];
 | 
						NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/User/Library/Preferences/com.lint.undelete.prefs.plist"];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (prefs){
 | 
						if (prefs){
 | 
				
			||||||
		
 | 
							isEnabled = [prefs objectForKey:@"isEnabled"] ? [[prefs objectForKey:@"isEnabled"] boolValue] : YES;
 | 
				
			||||||
		if ([prefs objectForKey:@"isAntennaEnabled"] != nil){
 | 
							isAntennaEnabled = [prefs objectForKey:@"isAntennaEnabled"] ? [[prefs objectForKey:@"isAntennaEnabled"] boolValue] : YES;
 | 
				
			||||||
			isAntennaEnabled = [[prefs objectForKey:@"isAntennaEnabled"] boolValue];
 | 
							isTFDeletedOnly = [prefs objectForKey:@"isTFDeletedOnly"] ? [[prefs objectForKey:@"isTFDeletedOnly"] boolValue] : YES;
 | 
				
			||||||
		} else {
 | 
							pushshiftRequestTimeoutValue = [prefs objectForKey:@"requestTimeoutValue"] ? [[prefs objectForKey:@"requestTimeoutValue"] doubleValue] : 10;
 | 
				
			||||||
			isAntennaEnabled = YES;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if ([prefs objectForKey:@"isTFDeletedOnly"] != nil){
 | 
					 | 
				
			||||||
			isTFDeletedOnly = [[prefs objectForKey:@"isTFDeletedOnly"] boolValue];
 | 
					 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
			isTFDeletedOnly = YES;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if ([prefs objectForKey:@"requestTimeoutValue"] != nil){
 | 
					 | 
				
			||||||
			pushshiftRequestTimeoutValue = [[prefs objectForKey:@"requestTimeoutValue"] doubleValue];
 | 
					 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
			pushshiftRequestTimeoutValue = 10;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
 | 
							isEnabled = YES;
 | 
				
			||||||
		isAntennaEnabled = YES;
 | 
							isAntennaEnabled = YES;
 | 
				
			||||||
		isTFDeletedOnly = YES;
 | 
							isTFDeletedOnly = YES;
 | 
				
			||||||
		pushshiftRequestTimeoutValue = 10;
 | 
							pushshiftRequestTimeoutValue = 10;
 | 
				
			||||||
@ -230,9 +217,9 @@ static void prefsChanged(CFNotificationCenterRef center, void *observer, CFStrin
 | 
				
			|||||||
	NSString* processName = [[NSProcessInfo processInfo] processName];
 | 
						NSString* processName = [[NSProcessInfo processInfo] processName];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ([processName isEqualToString:@"amrc"]){
 | 
						if ([processName isEqualToString:@"amrc"]){
 | 
				
			||||||
		if (isAntennaEnabled){
 | 
							if (isAntennaEnabled && isEnabled){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, prefsChanged, CFSTR("com.lint.undelete.prefs.changed"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
 | 
								CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)prefsChanged, CFSTR("com.lint.undelete.prefs.changed"), NULL, CFNotificationSuspensionBehaviorCoalesce);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			%init(Antenna, RCCommentSwift = objc_getClass("amrc.RCCommentSwift"), RCPostSwift = objc_getClass("amrc.RCPostSwift"), RCCommentTextSwift = objc_getClass("amrc.RCCommentTextSwift"));
 | 
								%init(Antenna, RCCommentSwift = objc_getClass("amrc.RCCommentSwift"), RCPostSwift = objc_getClass("amrc.RCPostSwift"), RCCommentTextSwift = objc_getClass("amrc.RCCommentTextSwift"));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
				
			|||||||
@ -2,8 +2,9 @@
 | 
				
			|||||||
#import "Apollo.h"
 | 
					#import "Apollo.h"
 | 
				
			||||||
#import "assets/TFHelper.h"
 | 
					#import "assets/TFHelper.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static BOOL isTFDeletedOnly;
 | 
					static BOOL isEnabled;
 | 
				
			||||||
static BOOL isApolloEnabled;
 | 
					static BOOL isApolloEnabled;
 | 
				
			||||||
 | 
					static BOOL isTFDeletedOnly;
 | 
				
			||||||
static CGFloat pushshiftRequestTimeoutValue;
 | 
					static CGFloat pushshiftRequestTimeoutValue;
 | 
				
			||||||
static BOOL shouldApolloHaveButton;
 | 
					static BOOL shouldApolloHaveButton;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -94,12 +95,20 @@ id apolloCommentController;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			UIImage *undeleteImage;
 | 
								UIImage *undeleteImage;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (@available(iOS 13.0, *)){
 | 
								//if (@available(iOS 13.0, *)){
 | 
				
			||||||
 | 
								if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"13.0")) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				undeleteImage = [UIImage systemImageNamed:@"eye"];
 | 
									undeleteImage = [UIImage systemImageNamed:@"eye"];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (!undeleteImage){
 | 
									if (!undeleteImage){
 | 
				
			||||||
					undeleteImage = [UIImage imageWithContentsOfFile:@"/var/mobile/Library/Application Support/TFDidThatSay/eye160dark.png"];
 | 
										undeleteImage = [UIImage imageWithContentsOfFile:@"/var/mobile/Library/Application Support/TFDidThatSay/eye160dark.png"];
 | 
				
			||||||
 | 
									} else {
 | 
				
			||||||
 | 
										CGSize squareSize = CGSizeMake(undeleteImage.size.width, undeleteImage.size.width);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										UIGraphicsBeginImageContextWithOptions(squareSize, NO, 0);
 | 
				
			||||||
 | 
										[undeleteImage drawInRect:CGRectMake(0, (squareSize.height - undeleteImage.size.height) / 2, squareSize.width, undeleteImage.size.height)];
 | 
				
			||||||
 | 
										undeleteImage = UIGraphicsGetImageFromCurrentImageContext();
 | 
				
			||||||
 | 
					    				UIGraphicsEndImageContext();
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				undeleteImage = [UIImage imageWithContentsOfFile:@"/var/mobile/Library/Application Support/TFDidThatSay/eye160dark.png"];
 | 
									undeleteImage = [UIImage imageWithContentsOfFile:@"/var/mobile/Library/Application Support/TFDidThatSay/eye160dark.png"];
 | 
				
			||||||
@ -383,32 +392,13 @@ static void loadPrefs(){
 | 
				
			|||||||
	NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/User/Library/Preferences/com.lint.undelete.prefs.plist"];
 | 
						NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/User/Library/Preferences/com.lint.undelete.prefs.plist"];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (prefs){
 | 
						if (prefs){
 | 
				
			||||||
		
 | 
							isEnabled = [prefs objectForKey:@"isEnabled"] ? [[prefs objectForKey:@"isEnabled"] boolValue] : YES;
 | 
				
			||||||
		if ([prefs objectForKey:@"isApolloEnabled"] != nil) {
 | 
							isApolloEnabled = [prefs objectForKey:@"isApolloEnabled"] ? [[prefs objectForKey:@"isApolloEnabled"] boolValue] : YES;
 | 
				
			||||||
			isApolloEnabled = [[prefs objectForKey:@"isApolloEnabled"] boolValue];
 | 
							isTFDeletedOnly = [prefs objectForKey:@"isTFDeletedOnly"] ? [[prefs objectForKey:@"isTFDeletedOnly"] boolValue] : YES;
 | 
				
			||||||
		} else {
 | 
							pushshiftRequestTimeoutValue = [prefs objectForKey:@"requestTimeoutValue"] ? [[prefs objectForKey:@"requestTimeoutValue"] doubleValue] : 10;
 | 
				
			||||||
			isApolloEnabled = YES;
 | 
							shouldApolloHaveButton = [prefs objectForKey:@"shouldApolloHaveButton"] ? [[prefs objectForKey:@"shouldApolloHaveButton"] boolValue] : NO;
 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if ([prefs objectForKey:@"isTFDeletedOnly"] != nil) {
 | 
					 | 
				
			||||||
			isTFDeletedOnly = [[prefs objectForKey:@"isTFDeletedOnly"] boolValue];
 | 
					 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
			isTFDeletedOnly = YES;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if ([prefs objectForKey:@"requestTimeoutValue"] != nil){
 | 
					 | 
				
			||||||
			pushshiftRequestTimeoutValue = [[prefs objectForKey:@"requestTimeoutValue"] doubleValue];
 | 
					 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
			pushshiftRequestTimeoutValue = 10;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if ([prefs objectForKey:@"shouldApolloHaveButton"] != nil){
 | 
					 | 
				
			||||||
			shouldApolloHaveButton = [[prefs objectForKey:@"shouldApolloHaveButton"] boolValue];
 | 
					 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
			shouldApolloHaveButton = NO;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
 | 
							isEnabled = YES;
 | 
				
			||||||
		isApolloEnabled = YES;
 | 
							isApolloEnabled = YES;
 | 
				
			||||||
		isTFDeletedOnly = YES;
 | 
							isTFDeletedOnly = YES;
 | 
				
			||||||
		pushshiftRequestTimeoutValue = 10;
 | 
							pushshiftRequestTimeoutValue = 10;
 | 
				
			||||||
@ -427,9 +417,9 @@ static void prefsChanged(CFNotificationCenterRef center, void *observer, CFStrin
 | 
				
			|||||||
	NSString* processName = [[NSProcessInfo processInfo] processName];
 | 
						NSString* processName = [[NSProcessInfo processInfo] processName];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ([processName isEqualToString:@"Apollo"]){
 | 
						if ([processName isEqualToString:@"Apollo"]){
 | 
				
			||||||
		if (isApolloEnabled){
 | 
							if (isApolloEnabled && isEnabled){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, prefsChanged, CFSTR("com.lint.undelete.prefs.changed"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
 | 
								CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)prefsChanged, CFSTR("com.lint.undelete.prefs.changed"), NULL, CFNotificationSuspensionBehaviorCoalesce);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			%init(Apollo, CommentsHeaderCellNode = objc_getClass("Apollo.CommentsHeaderCellNode"), CommentCellNode = objc_getClass("Apollo.CommentCellNode"), ApolloButtonNode = objc_getClass("Apollo.ApolloButtonNode"), ActionController = objc_getClass("Apollo.ActionController"), IconActionTableViewCell = objc_getClass("Apollo.IconActionTableViewCell"), CommentsViewController = objc_getClass("Apollo.CommentsViewController"));
 | 
								%init(Apollo, CommentsHeaderCellNode = objc_getClass("Apollo.CommentsHeaderCellNode"), CommentCellNode = objc_getClass("Apollo.CommentCellNode"), ApolloButtonNode = objc_getClass("Apollo.ApolloButtonNode"), ActionController = objc_getClass("Apollo.ActionController"), IconActionTableViewCell = objc_getClass("Apollo.IconActionTableViewCell"), CommentsViewController = objc_getClass("Apollo.CommentsViewController"));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
				
			|||||||
@ -3,6 +3,7 @@
 | 
				
			|||||||
#import "assets/TFHelper.h"
 | 
					#import "assets/TFHelper.h"
 | 
				
			||||||
#import "assets/MMMarkdown/MMMarkdown.h"
 | 
					#import "assets/MMMarkdown/MMMarkdown.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static BOOL isEnabled;
 | 
				
			||||||
static BOOL isBaconReaderEnabled;
 | 
					static BOOL isBaconReaderEnabled;
 | 
				
			||||||
static BOOL isTFDeletedOnly;
 | 
					static BOOL isTFDeletedOnly;
 | 
				
			||||||
static CGFloat pushshiftRequestTimeoutValue;
 | 
					static CGFloat pushshiftRequestTimeoutValue;
 | 
				
			||||||
@ -172,26 +173,12 @@ static void loadPrefs(){
 | 
				
			|||||||
	NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/User/Library/Preferences/com.lint.undelete.prefs.plist"];
 | 
						NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/User/Library/Preferences/com.lint.undelete.prefs.plist"];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (prefs){
 | 
						if (prefs){
 | 
				
			||||||
		
 | 
							isEnabled = [prefs objectForKey:@"isEnabled"] ? [[prefs objectForKey:@"isEnabled"] boolValue] : YES;
 | 
				
			||||||
		if ([prefs objectForKey:@"isBaconReaderEnabled"] != nil){
 | 
							isBaconReaderEnabled = [prefs objectForKey:@"isBaconReaderEnabled"] ? [[prefs objectForKey:@"isBaconReaderEnabled"] boolValue] : YES;
 | 
				
			||||||
			isBaconReaderEnabled = [[prefs objectForKey:@"isBaconReaderEnabled"] boolValue];
 | 
							isTFDeletedOnly = [prefs objectForKey:@"isTFDeletedOnly"] ? [[prefs objectForKey:@"isTFDeletedOnly"] boolValue] : YES;
 | 
				
			||||||
		} else {
 | 
							pushshiftRequestTimeoutValue = [prefs objectForKey:@"requestTimeoutValue"] ? [[prefs objectForKey:@"requestTimeoutValue"] doubleValue] : 10;
 | 
				
			||||||
			isBaconReaderEnabled = YES;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if ([prefs objectForKey:@"isTFDeletedOnly"] != nil) {
 | 
					 | 
				
			||||||
			isTFDeletedOnly = [[prefs objectForKey:@"isTFDeletedOnly"] boolValue];
 | 
					 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
			isTFDeletedOnly = YES;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if ([prefs objectForKey:@"requestTimeoutValue"] != nil){
 | 
					 | 
				
			||||||
			pushshiftRequestTimeoutValue = [[prefs objectForKey:@"requestTimeoutValue"] doubleValue];
 | 
					 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
			pushshiftRequestTimeoutValue = 10;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
 | 
							isEnabled = YES;
 | 
				
			||||||
		isBaconReaderEnabled = YES;
 | 
							isBaconReaderEnabled = YES;
 | 
				
			||||||
		isTFDeletedOnly = YES;
 | 
							isTFDeletedOnly = YES;
 | 
				
			||||||
		pushshiftRequestTimeoutValue = 10;
 | 
							pushshiftRequestTimeoutValue = 10;
 | 
				
			||||||
@ -209,9 +196,9 @@ static void prefsChanged(CFNotificationCenterRef center, void *observer, CFStrin
 | 
				
			|||||||
	NSString* processName = [[NSProcessInfo processInfo] processName];
 | 
						NSString* processName = [[NSProcessInfo processInfo] processName];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ([processName isEqualToString:@"BaconReader"]){
 | 
						if ([processName isEqualToString:@"BaconReader"]){
 | 
				
			||||||
		if (isBaconReaderEnabled){
 | 
							if (isBaconReaderEnabled && isEnabled){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, prefsChanged, CFSTR("com.lint.undelete.prefs.changed"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
 | 
								CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)prefsChanged, CFSTR("com.lint.undelete.prefs.changed"), NULL, CFNotificationSuspensionBehaviorCoalesce);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			%init(BaconReader, StoryDetailView = objc_getClass("BaconReader.StoryDetailView"), StoryDetailViewController = objc_getClass("BaconReader.StoryDetailViewController"), CommentCellView = objc_getClass("BaconReader.CommentCellView"), CommentCell = objc_getClass("BaconReader.CommentCell"));
 | 
								%init(BaconReader, StoryDetailView = objc_getClass("BaconReader.StoryDetailView"), StoryDetailViewController = objc_getClass("BaconReader.StoryDetailViewController"), CommentCellView = objc_getClass("BaconReader.CommentCellView"), CommentCell = objc_getClass("BaconReader.CommentCell"));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
				
			|||||||
@ -2,6 +2,7 @@
 | 
				
			|||||||
#import "Beam.h"
 | 
					#import "Beam.h"
 | 
				
			||||||
#import "assets/TFHelper.h"
 | 
					#import "assets/TFHelper.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static BOOL isEnabled;
 | 
				
			||||||
static BOOL isBeamEnabled;
 | 
					static BOOL isBeamEnabled;
 | 
				
			||||||
static BOOL isTFDeletedOnly;
 | 
					static BOOL isTFDeletedOnly;
 | 
				
			||||||
static CGFloat pushshiftRequestTimeoutValue;
 | 
					static CGFloat pushshiftRequestTimeoutValue;
 | 
				
			||||||
@ -186,26 +187,12 @@ static void loadPrefs(){
 | 
				
			|||||||
	NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/User/Library/Preferences/com.lint.undelete.prefs.plist"];
 | 
						NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/User/Library/Preferences/com.lint.undelete.prefs.plist"];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (prefs){
 | 
						if (prefs){
 | 
				
			||||||
		
 | 
							isEnabled = [prefs objectForKey:@"isEnabled"] ? [[prefs objectForKey:@"isEnabled"] boolValue] : YES;
 | 
				
			||||||
		if ([prefs objectForKey:@"isBeamEnabled"] != nil){
 | 
							isBeamEnabled = [prefs objectForKey:@"isBeamEnabled"] ? [[prefs objectForKey:@"isBeamEnabled"] boolValue] : YES;
 | 
				
			||||||
			isBeamEnabled = [[prefs objectForKey:@"isBeamEnabled"] boolValue];
 | 
							isTFDeletedOnly = [prefs objectForKey:@"isTFDeletedOnly"] ? [[prefs objectForKey:@"isTFDeletedOnly"] boolValue] : YES;
 | 
				
			||||||
		} else {
 | 
							pushshiftRequestTimeoutValue = [prefs objectForKey:@"requestTimeoutValue"] ? [[prefs objectForKey:@"requestTimeoutValue"] doubleValue] : 10;
 | 
				
			||||||
			isBeamEnabled = YES;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if ([prefs objectForKey:@"isTFDeletedOnly"] != nil) {
 | 
					 | 
				
			||||||
			isTFDeletedOnly = [[prefs objectForKey:@"isTFDeletedOnly"] boolValue];
 | 
					 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
			isTFDeletedOnly = YES;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if ([prefs objectForKey:@"requestTimeoutValue"] != nil){
 | 
					 | 
				
			||||||
			pushshiftRequestTimeoutValue = [[prefs objectForKey:@"requestTimeoutValue"] doubleValue];
 | 
					 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
			pushshiftRequestTimeoutValue = 10;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
 | 
							isEnabled = YES;
 | 
				
			||||||
		isBeamEnabled = YES;
 | 
							isBeamEnabled = YES;
 | 
				
			||||||
		isTFDeletedOnly = YES;
 | 
							isTFDeletedOnly = YES;
 | 
				
			||||||
		pushshiftRequestTimeoutValue = 10;
 | 
							pushshiftRequestTimeoutValue = 10;
 | 
				
			||||||
@ -223,9 +210,9 @@ static void prefsChanged(CFNotificationCenterRef center, void *observer, CFStrin
 | 
				
			|||||||
	NSString* processName = [[NSProcessInfo processInfo] processName];
 | 
						NSString* processName = [[NSProcessInfo processInfo] processName];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ([processName isEqualToString:@"beam"]){
 | 
						if ([processName isEqualToString:@"beam"]){
 | 
				
			||||||
		if (isBeamEnabled){
 | 
							if (isBeamEnabled && isEnabled){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, prefsChanged, CFSTR("com.lint.undelete.prefs.changed"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
 | 
								CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)prefsChanged, CFSTR("com.lint.undelete.prefs.changed"), NULL, CFNotificationSuspensionBehaviorCoalesce);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			%init(Beam, CommentCell = objc_getClass("beam.CommentCell"), PostDetailEmbeddedViewController = objc_getClass("beam.PostDetailEmbeddedViewController"), PostToolbarView = objc_getClass("beam.PostToolbarView"), PostSelfTextPartCell = objc_getClass("beam.PostSelfTextPartCell"), PostMetadataView = objc_getClass("beam.PostMetadataView"));
 | 
								%init(Beam, CommentCell = objc_getClass("beam.CommentCell"), PostDetailEmbeddedViewController = objc_getClass("beam.PostDetailEmbeddedViewController"), PostToolbarView = objc_getClass("beam.PostToolbarView"), PostSelfTextPartCell = objc_getClass("beam.PostSelfTextPartCell"), PostMetadataView = objc_getClass("beam.PostMetadataView"));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
				
			|||||||
@ -117,15 +117,3 @@
 | 
				
			|||||||
//custom elements
 | 
					//custom elements
 | 
				
			||||||
- (void)handleUndeleteCommentAction:(id)comment;
 | 
					- (void)handleUndeleteCommentAction:(id)comment;
 | 
				
			||||||
@end
 | 
					@end
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
				
			|||||||
@ -2,6 +2,7 @@
 | 
				
			|||||||
#import "Narwhal.h"
 | 
					#import "Narwhal.h"
 | 
				
			||||||
#import "assets/TFHelper.h"
 | 
					#import "assets/TFHelper.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static BOOL isEnabled;
 | 
				
			||||||
static BOOL isNarwhalEnabled;
 | 
					static BOOL isNarwhalEnabled;
 | 
				
			||||||
static BOOL isTFDeletedOnly;
 | 
					static BOOL isTFDeletedOnly;
 | 
				
			||||||
static CGFloat pushshiftRequestTimeoutValue;
 | 
					static CGFloat pushshiftRequestTimeoutValue;
 | 
				
			||||||
@ -163,26 +164,12 @@ static void loadPrefs(){
 | 
				
			|||||||
	NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/User/Library/Preferences/com.lint.undelete.prefs.plist"];
 | 
						NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/User/Library/Preferences/com.lint.undelete.prefs.plist"];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (prefs){
 | 
						if (prefs){
 | 
				
			||||||
		
 | 
							isEnabled = [prefs objectForKey:@"isEnabled"] ? [[prefs objectForKey:@"isEnabled"] boolValue] : YES;
 | 
				
			||||||
		if ([prefs objectForKey:@"isNarwhalEnabled"] != nil){
 | 
							isNarwhalEnabled = [prefs objectForKey:@"isNarwhalEnabled"] ? [[prefs objectForKey:@"isNarwhalEnabled"] boolValue] : YES;
 | 
				
			||||||
			isNarwhalEnabled = [[prefs objectForKey:@"isNarwhalEnabled"] boolValue];
 | 
							isTFDeletedOnly = [prefs objectForKey:@"isTFDeletedOnly"] ? [[prefs objectForKey:@"isTFDeletedOnly"] boolValue] : YES;
 | 
				
			||||||
		} else {
 | 
							pushshiftRequestTimeoutValue = [prefs objectForKey:@"requestTimeoutValue"] ? [[prefs objectForKey:@"requestTimeoutValue"] doubleValue] : 10;
 | 
				
			||||||
			isNarwhalEnabled = YES;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if ([prefs objectForKey:@"isTFDeletedOnly"] != nil) {
 | 
					 | 
				
			||||||
			isTFDeletedOnly = [[prefs objectForKey:@"isTFDeletedOnly"] boolValue];
 | 
					 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
			isTFDeletedOnly = YES;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if ([prefs objectForKey:@"requestTimeoutValue"] != nil){
 | 
					 | 
				
			||||||
			pushshiftRequestTimeoutValue = [[prefs objectForKey:@"requestTimeoutValue"] doubleValue];
 | 
					 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
			pushshiftRequestTimeoutValue = 10;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
 | 
							isEnabled = YES;
 | 
				
			||||||
		isNarwhalEnabled = YES;
 | 
							isNarwhalEnabled = YES;
 | 
				
			||||||
		isTFDeletedOnly = YES;
 | 
							isTFDeletedOnly = YES;
 | 
				
			||||||
		pushshiftRequestTimeoutValue = 10;
 | 
							pushshiftRequestTimeoutValue = 10;
 | 
				
			||||||
@ -200,9 +187,9 @@ static void prefsChanged(CFNotificationCenterRef center, void *observer, CFStrin
 | 
				
			|||||||
	NSString* processName = [[NSProcessInfo processInfo] processName];
 | 
						NSString* processName = [[NSProcessInfo processInfo] processName];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ([processName isEqualToString:@"narwhal"]){
 | 
						if ([processName isEqualToString:@"narwhal"]){
 | 
				
			||||||
		if (isNarwhalEnabled){
 | 
							if (isNarwhalEnabled && isEnabled){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, prefsChanged, CFSTR("com.lint.undelete.prefs.changed"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
 | 
								CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)prefsChanged, CFSTR("com.lint.undelete.prefs.changed"), NULL, CFNotificationSuspensionBehaviorCoalesce);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			%init(Narwhal);
 | 
								%init(Narwhal);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
				
			|||||||
@ -176,6 +176,7 @@
 | 
				
			|||||||
+ (id)sharedManager;
 | 
					+ (id)sharedManager;
 | 
				
			||||||
@end
 | 
					@end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* ---- Reddit v3 ---- */
 | 
					/* ---- Reddit v3 ---- */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -2,6 +2,7 @@
 | 
				
			|||||||
#import "Reddit.h"
 | 
					#import "Reddit.h"
 | 
				
			||||||
#import "assets/TFHelper.h"
 | 
					#import "assets/TFHelper.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static BOOL isEnabled;
 | 
				
			||||||
static BOOL isRedditEnabled;
 | 
					static BOOL isRedditEnabled;
 | 
				
			||||||
static BOOL isTFDeletedOnly;
 | 
					static BOOL isTFDeletedOnly;
 | 
				
			||||||
static CGFloat pushshiftRequestTimeoutValue;
 | 
					static CGFloat pushshiftRequestTimeoutValue;
 | 
				
			||||||
@ -50,9 +51,9 @@ int secondVersionPart = 0;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
- (void)setItems:(id)arg1 {
 | 
					- (void)setItems:(id)arg1 {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	NSString *commentBody = [[self comment] bodyText];
 | 
						NSString *commentAuthor = [[self comment] author];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:commentBody isDeletedOnly:isTFDeletedOnly]){
 | 
						if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:commentAuthor isDeletedOnly:isTFDeletedOnly]) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		UIImage* origImage = [UIImage imageWithContentsOfFile:@"/var/mobile/Library/Application Support/TFDidThatSay/eye160dark.png"];
 | 
							UIImage* origImage = [UIImage imageWithContentsOfFile:@"/var/mobile/Library/Application Support/TFDidThatSay/eye160dark.png"];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -350,9 +351,9 @@ int secondVersionPart = 0;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
- (void)setItems:(id)arg1 {
 | 
					- (void)setItems:(id)arg1 {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	NSString *commentBody = [[self comment] bodyText];
 | 
						NSString *commentAuthor = [[self comment] author];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:commentBody isDeletedOnly:isTFDeletedOnly]){
 | 
						if ([%c(TFHelper) shouldShowUndeleteButtonWithInfo:commentAuthor isDeletedOnly:isTFDeletedOnly]) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		UIImage* origImage = [UIImage imageWithContentsOfFile:@"/var/mobile/Library/Application Support/TFDidThatSay/eye160dark.png"];
 | 
							UIImage* origImage = [UIImage imageWithContentsOfFile:@"/var/mobile/Library/Application Support/TFDidThatSay/eye160dark.png"];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -474,7 +475,6 @@ int secondVersionPart = 0;
 | 
				
			|||||||
		Post *post = [self post];
 | 
							Post *post = [self post];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if ([post isSelfPost]) {
 | 
							if ([post isSelfPost]) {
 | 
				
			||||||
			
 | 
					 | 
				
			||||||
			[%c(TFHelper) getUndeleteDataWithID:[[post pk] componentsSeparatedByString:@"_"][1] isComment:NO timeout:pushshiftRequestTimeoutValue extraData:nil completionTarget:self completionSelector:@selector(completeUndeletePostAction:)];
 | 
								[%c(TFHelper) getUndeleteDataWithID:[[post pk] componentsSeparatedByString:@"_"][1] isComment:NO timeout:pushshiftRequestTimeoutValue extraData:nil completionTarget:self completionSelector:@selector(completeUndeletePostAction:)];
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -615,26 +615,12 @@ static void loadPrefs(){
 | 
				
			|||||||
	NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/User/Library/Preferences/com.lint.undelete.prefs.plist"];
 | 
						NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/User/Library/Preferences/com.lint.undelete.prefs.plist"];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (prefs){
 | 
						if (prefs){
 | 
				
			||||||
		
 | 
							isEnabled = [prefs objectForKey:@"isEnabled"] ? [[prefs objectForKey:@"isEnabled"] boolValue] : YES;
 | 
				
			||||||
		if ([prefs objectForKey:@"isRedditEnabled"] != nil){
 | 
							isRedditEnabled = [prefs objectForKey:@"isRedditEnabled"] ? [[prefs objectForKey:@"isRedditEnabled"] boolValue] : YES;
 | 
				
			||||||
			isRedditEnabled = [[prefs objectForKey:@"isRedditEnabled"] boolValue];
 | 
							isTFDeletedOnly = [prefs objectForKey:@"isTFDeletedOnly"] ? [[prefs objectForKey:@"isTFDeletedOnly"] boolValue] : YES;
 | 
				
			||||||
		} else {
 | 
							pushshiftRequestTimeoutValue = [prefs objectForKey:@"requestTimeoutValue"] ? [[prefs objectForKey:@"requestTimeoutValue"] doubleValue] : 10;
 | 
				
			||||||
			isRedditEnabled = YES;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if ([prefs objectForKey:@"isTFDeletedOnly"] != nil) {
 | 
					 | 
				
			||||||
			isTFDeletedOnly = [[prefs objectForKey:@"isTFDeletedOnly"] boolValue];
 | 
					 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
			isTFDeletedOnly = YES;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if ([prefs objectForKey:@"requestTimeoutValue"] != nil){
 | 
					 | 
				
			||||||
			pushshiftRequestTimeoutValue = [[prefs objectForKey:@"requestTimeoutValue"] doubleValue];
 | 
					 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
			pushshiftRequestTimeoutValue = 10;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
 | 
							isEnabled = YES;
 | 
				
			||||||
		isRedditEnabled = YES;
 | 
							isRedditEnabled = YES;
 | 
				
			||||||
		isTFDeletedOnly = YES;
 | 
							isTFDeletedOnly = YES;
 | 
				
			||||||
		pushshiftRequestTimeoutValue = 10;
 | 
							pushshiftRequestTimeoutValue = 10;
 | 
				
			||||||
@ -663,9 +649,9 @@ static void prefsChanged(CFNotificationCenterRef center, void *observer, CFStrin
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ([processName isEqualToString:@"Reddit"]){
 | 
						if ([processName isEqualToString:@"Reddit"]){
 | 
				
			||||||
		if (isRedditEnabled) {
 | 
							if (isRedditEnabled && isEnabled) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, prefsChanged, CFSTR("com.lint.undelete.prefs.changed"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
 | 
								CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)prefsChanged, CFSTR("com.lint.undelete.prefs.changed"), NULL, CFNotificationSuspensionBehaviorCoalesce);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (firstVersionPart == 4 || firstVersionPart == 2020) {
 | 
								if (firstVersionPart == 4 || firstVersionPart == 2020) {
 | 
				
			||||||
				if (secondVersionPart <= 32 && firstVersionPart != 2020) {
 | 
									if (secondVersionPart <= 32 && firstVersionPart != 2020) {
 | 
				
			||||||
 | 
				
			|||||||
@ -3,6 +3,7 @@
 | 
				
			|||||||
#import "assets/TFHelper.h"
 | 
					#import "assets/TFHelper.h"
 | 
				
			||||||
#import "assets/MMMarkdown/MMMarkdown.h"
 | 
					#import "assets/MMMarkdown/MMMarkdown.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static BOOL isEnabled;
 | 
				
			||||||
static BOOL isSlideEnabled;
 | 
					static BOOL isSlideEnabled;
 | 
				
			||||||
static BOOL isTFDeletedOnly;
 | 
					static BOOL isTFDeletedOnly;
 | 
				
			||||||
static CGFloat pushshiftRequestTimeoutValue;
 | 
					static CGFloat pushshiftRequestTimeoutValue;
 | 
				
			||||||
@ -529,26 +530,13 @@ static void loadPrefs(){
 | 
				
			|||||||
	NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/User/Library/Preferences/com.lint.undelete.prefs.plist"];
 | 
						NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/User/Library/Preferences/com.lint.undelete.prefs.plist"];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (prefs){
 | 
						if (prefs){
 | 
				
			||||||
		
 | 
							isEnabled = [prefs objectForKey:@"isEnabled"] ? [[prefs objectForKey:@"isEnabled"] boolValue] : YES;
 | 
				
			||||||
		if ([prefs objectForKey:@"isSlideEnabled"] != nil){
 | 
							isSlideEnabled = [prefs objectForKey:@"isSlideEnabled"] ? [[prefs objectForKey:@"isSlideEnabled"] boolValue] : YES;
 | 
				
			||||||
			isSlideEnabled = [[prefs objectForKey:@"isSlideEnabled"] boolValue];
 | 
							isTFDeletedOnly = [prefs objectForKey:@"isTFDeletedOnly"] ? [[prefs objectForKey:@"isTFDeletedOnly"] boolValue] : YES;
 | 
				
			||||||
		} else {
 | 
							pushshiftRequestTimeoutValue = [prefs objectForKey:@"requestTimeoutValue"] ? [[prefs objectForKey:@"requestTimeoutValue"] doubleValue] : 10;
 | 
				
			||||||
			isSlideEnabled = YES;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if ([prefs objectForKey:@"isTFDeletedOnly"] != nil){
 | 
					 | 
				
			||||||
			isTFDeletedOnly = [[prefs objectForKey:@"isTFDeletedOnly"] boolValue];
 | 
					 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
			isTFDeletedOnly = YES;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if ([prefs objectForKey:@"requestTimeoutValue"] != nil){
 | 
					 | 
				
			||||||
			pushshiftRequestTimeoutValue = [[prefs objectForKey:@"requestTimeoutValue"] doubleValue];
 | 
					 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
			pushshiftRequestTimeoutValue = 10;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
 | 
							isEnabled = YES;
 | 
				
			||||||
		isSlideEnabled = YES;
 | 
							isSlideEnabled = YES;
 | 
				
			||||||
		isTFDeletedOnly = YES;
 | 
							isTFDeletedOnly = YES;
 | 
				
			||||||
		pushshiftRequestTimeoutValue = 10;
 | 
							pushshiftRequestTimeoutValue = 10;
 | 
				
			||||||
@ -566,9 +554,9 @@ static void prefsChanged(CFNotificationCenterRef center, void *observer, CFStrin
 | 
				
			|||||||
	NSString* processName = [[NSProcessInfo processInfo] processName];
 | 
						NSString* processName = [[NSProcessInfo processInfo] processName];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ([processName isEqualToString:@"Slide for Reddit"]){
 | 
						if ([processName isEqualToString:@"Slide for Reddit"]){
 | 
				
			||||||
		if (isSlideEnabled){
 | 
							if (isSlideEnabled && isEnabled){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, prefsChanged, CFSTR("com.lint.undelete.prefs.changed"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
 | 
								CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)prefsChanged, CFSTR("com.lint.undelete.prefs.changed"), NULL, CFNotificationSuspensionBehaviorCoalesce);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			%init(Slide, CommentDepthCell = objc_getClass("Slide_for_Reddit.CommentDepthCell"), RSubmission = objc_getClass("Slide_for_Reddit.RSubmission"), CommentViewController = objc_getClass("Slide_for_Reddit.CommentViewController"));
 | 
								%init(Slide, CommentDepthCell = objc_getClass("Slide_for_Reddit.CommentDepthCell"), RSubmission = objc_getClass("Slide_for_Reddit.RSubmission"), CommentViewController = objc_getClass("Slide_for_Reddit.CommentViewController"));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@interface TFHelper : NSObject
 | 
					@interface TFHelper : NSObject
 | 
				
			||||||
 | 
					
 | 
				
			||||||
+ (void)getUndeleteDataWithID:(NSString *)ident isComment:(BOOL)isComment timeout:(CGFloat)timeout extraData:(NSDictionary *)extra completionTarget:(id)target completionSelector:(SEL)sel;
 | 
					+ (void)getUndeleteDataWithID:(NSString *)ident isComment:(BOOL)isComment timeout:(CGFloat)timeout extraData:(NSDictionary *)extra completionTarget:(id)target completionSelector:(SEL)sel;
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user