You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. #import "Reddit.h"
  2. %group Reddit_v4_current
  3. %hook CommentTreeNode
  4. %property(assign,nonatomic)id commentTreeHeaderNode;
  5. %property(assign,nonatomic)id commentTreeCommandBarNode;
  6. %end
  7. %hook CommentTreeHeaderView
  8. -(void) layoutSubviews{
  9. %orig;
  10. [[self commentTreeNode] setCommentTreeHeaderNode:self];
  11. }
  12. %end
  13. %hook CommentTreeHeaderNode
  14. -(void) didLoad{
  15. %orig;
  16. [[self commentTreeNode] setCommentTreeHeaderNode:self];
  17. }
  18. %end
  19. %hook CommentTreeCommandBarNode
  20. -(void) didLoad{
  21. %orig;
  22. [[self commentTreeNode] setCommentTreeCommandBarNode:self];
  23. }
  24. %end
  25. %hook CommentActionSheetViewController
  26. -(void) setItems:(id) arg1{
  27. UIImage* origImage = [UIImage imageWithContentsOfFile:@"/var/mobile/Library/Application Support/TFDidThatSay/eye160dark.png"];
  28. CGSize existingImageSize = [[arg1[0] leftIconImage] size];
  29. CGFloat scale = origImage.size.width / existingImageSize.width;
  30. UIImage *newImage = [UIImage imageWithCGImage:[origImage CGImage] scale:scale orientation:origImage.imageOrientation];
  31. id undeleteItem = [[%c(RUIActionSheetItem) alloc] initWithLeftIconImage:newImage text:@"TF did that say?" identifier:@"undeleteItemIdentifier" context:[self comment]];
  32. %orig([arg1 arrayByAddingObject:undeleteItem]);
  33. [undeleteItem release];
  34. }
  35. -(void) handleDidSelectActionSheetItem:(id) arg1{
  36. %orig;
  37. if ([[arg1 identifier] isEqualToString:@"undeleteItemIdentifier"]){
  38. [self dismissViewControllerAnimated:YES completion:nil];
  39. id commentTreeNode = [self commentTreeNode];
  40. Comment *comment = [commentTreeNode comment];
  41. NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
  42. NSOperationQueue *queue = [[NSOperationQueue alloc] init];
  43. [request setURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://api.pushshift.io/reddit/search/comment/?ids=%@&fields=author,body",[[comment pk] componentsSeparatedByString:@"_"][1]]]];
  44. [request setHTTPMethod:@"GET"];
  45. [NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
  46. NSString *author = @"[author]";
  47. NSString *body = @"[body]";
  48. if (data != nil && error == nil){
  49. id jsonData = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
  50. if ([[jsonData objectForKey:@"data"] count] != 0){
  51. author = [[jsonData objectForKey:@"data"][0] objectForKey:@"author"];
  52. body = [[jsonData objectForKey:@"data"][0] objectForKey:@"body"];
  53. if ([body isEqualToString:@"[deleted]"] || [body isEqualToString:@"[removed]"]){
  54. body = @"[pushshift was unable to archive this]";
  55. }
  56. } else {
  57. body = @"[pushshift has not archived this yet]";
  58. }
  59. } else if (error != nil || data == nil){
  60. body = @"[an error occured]";
  61. }
  62. NSArray* appVersion = [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"] componentsSeparatedByString:@"."];
  63. NSMutableAttributedString *bodyMutableAttributedText;
  64. id themeManager;
  65. id isNightMode;
  66. id textColor;
  67. if ([appVersion[1] integerValue] >= 45){
  68. themeManager = [[%c(ThemeManager) alloc] initWithAppSettings:[%c(AppSettings) sharedSettings]];
  69. isNightMode = [[[%c(AccountManager) sharedManager] defaults] objectForKey:@"kUseNightKey"];
  70. if (isNightMode) {
  71. textColor = [[themeManager darkTheme] bodyTextColor];
  72. } else{
  73. textColor = [[themeManager lightTheme] bodyTextColor];
  74. }
  75. [themeManager release];
  76. } else if ([appVersion[1] integerValue] >= 37){
  77. themeManager = [[%c(ThemeManager) alloc] initWithTraitCollection:nil appSettings:[%c(AppSettings) sharedSettings]];
  78. isNightMode = [[[%c(AccountManager) sharedManager] defaults] objectForKey:@"kUseNightKey"];
  79. if (isNightMode) {
  80. textColor = [[themeManager nightTheme] bodyTextColor];
  81. } else{
  82. textColor = [[themeManager dayTheme] bodyTextColor];
  83. }
  84. [themeManager release];
  85. } else {
  86. themeManager = [%c(ThemeManager) sharedManager];
  87. isNightMode = [[[%c(AccountManager) sharedManager] defaults] objectForKey:@"kUseNightKey"];
  88. if (isNightMode) {
  89. textColor = [[themeManager nightTheme] bodyTextColor];
  90. } else{
  91. textColor = [[themeManager dayTheme] bodyTextColor];
  92. }
  93. }
  94. bodyMutableAttributedText = [[NSMutableAttributedString alloc] initWithAttributedString:[%c(NSAttributedStringMarkdownParser) attributedStringUsingCurrentConfig:body]];
  95. [bodyMutableAttributedText beginEditing];
  96. [bodyMutableAttributedText enumerateAttribute:NSForegroundColorAttributeName inRange:NSMakeRange(0, bodyMutableAttributedText.length) options:0 usingBlock:^(id _Nullable value, NSRange range, BOOL * _Nonnull stop) {
  97. [bodyMutableAttributedText removeAttribute:NSForegroundColorAttributeName range:range];
  98. [bodyMutableAttributedText addAttribute:NSForegroundColorAttributeName value:textColor range:range];
  99. }];
  100. [bodyMutableAttributedText endEditing];
  101. [comment setAuthor:author];
  102. [comment setBodyText:body];
  103. [comment setBodyRichTextAttributed:bodyMutableAttributedText];
  104. [comment setBodyAttributedText:bodyMutableAttributedText];
  105. [[commentTreeNode commentTreeHeaderNode] performSelectorOnMainThread:@selector(updateContentViewsForData:) withObject:comment waitUntilDone:NO];
  106. [request release];
  107. [queue release];
  108. [bodyMutableAttributedText release];
  109. }];
  110. }
  111. }
  112. %end
  113. %hook PostDetailViewController
  114. %property(strong,nonatomic) id feedPostTextWithThumbnailNode;
  115. %property(strong,nonatomic) id feedPostDetailCellNode;
  116. %end
  117. %hook FeedPostDetailCellNode
  118. -(void) didLoad{
  119. %orig;
  120. [[[self delegate] viewController] setFeedPostDetailCellNode:self];
  121. }
  122. %end
  123. %hook PostActionSheetViewController
  124. -(void) setItems:(id) arg1{
  125. Post *post = [self post];
  126. if ([post isSelfPost]){
  127. UIImage* origImage = [UIImage imageWithContentsOfFile:@"/var/mobile/Library/Application Support/TFDidThatSay/eye160dark.png"];
  128. CGSize existingImageSize = [[arg1[0] leftIconImage] size];
  129. CGFloat scale = origImage.size.width / existingImageSize.width;
  130. UIImage *newImage = [UIImage imageWithCGImage:[origImage CGImage] scale:scale orientation:origImage.imageOrientation];
  131. id undeleteItem = [[%c(RUIActionSheetItem) alloc] initWithLeftIconImage:newImage text:@"TF did that say?" identifier:@"undeleteItemIdentifier" context:[self post]];
  132. arg1 = [arg1 arrayByAddingObject:undeleteItem];
  133. [undeleteItem release];
  134. }
  135. %orig;
  136. }
  137. -(void) handleDidSelectActionSheetItem:(id) arg1{
  138. %orig;
  139. if ([[arg1 identifier] isEqualToString:@"undeleteItemIdentifier"]){
  140. [self dismissViewControllerAnimated:YES completion:nil];
  141. Post *post = [self post];
  142. if ([post isSelfPost]){
  143. NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
  144. NSOperationQueue *queue = [[NSOperationQueue alloc] init];
  145. [request setURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://api.pushshift.io/reddit/search/submission/?ids=%@&fields=author,selftext",[[post pk] componentsSeparatedByString:@"_"][1]]]];
  146. [request setHTTPMethod:@"GET"];
  147. [NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
  148. NSString *author = @"[author]";
  149. NSString *body = @"[body]";
  150. if (data != nil && error == nil){
  151. id jsonData = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
  152. if ([[jsonData objectForKey:@"data"] count] != 0){
  153. author = [[jsonData objectForKey:@"data"][0] objectForKey:@"author"];
  154. body = [[jsonData objectForKey:@"data"][0] objectForKey:@"selftext"];
  155. if ([body isEqualToString:@"[deleted]"] || [body isEqualToString:@"[removed]"]){
  156. body = @"[pushshift was unable to archive this]";
  157. }
  158. } else {
  159. body = @"[pushshift has not archived this yet]";
  160. }
  161. } else if (error != nil || data == nil){
  162. body = @"[an error occured]";
  163. }
  164. NSArray* appVersion = [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"] componentsSeparatedByString:@"."];
  165. id themeManager;
  166. id isNightMode;
  167. id textColor;
  168. if ([appVersion[1] integerValue] >= 45){
  169. themeManager = [[%c(ThemeManager) alloc] initWithAppSettings:[%c(AppSettings) sharedSettings]];
  170. isNightMode = [[[%c(AccountManager) sharedManager] defaults] objectForKey:@"kUseNightKey"];
  171. if (isNightMode) {
  172. textColor = [[themeManager darkTheme] bodyTextColor];
  173. } else{
  174. textColor = [[themeManager lightTheme] bodyTextColor];
  175. }
  176. [themeManager release];
  177. } else if ([appVersion[1] integerValue] >= 37){
  178. themeManager = [[%c(ThemeManager) alloc] initWithTraitCollection:nil appSettings:[%c(AppSettings) sharedSettings]];
  179. isNightMode = [[[%c(AccountManager) sharedManager] defaults] objectForKey:@"kUseNightKey"];
  180. if (isNightMode) {
  181. textColor = [[themeManager nightTheme] bodyTextColor];
  182. } else{
  183. textColor = [[themeManager dayTheme] bodyTextColor];
  184. }
  185. [themeManager release];
  186. } else {
  187. themeManager = [%c(ThemeManager) sharedManager];
  188. isNightMode = [[[%c(AccountManager) sharedManager] defaults] objectForKey:@"kUseNightKey"];
  189. if (isNightMode) {
  190. textColor = [[themeManager nightTheme] bodyTextColor];
  191. } else{
  192. textColor = [[themeManager dayTheme] bodyTextColor];
  193. }
  194. }
  195. NSMutableAttributedString *bodyMutableAttributedText = [[NSMutableAttributedString alloc] initWithAttributedString:[%c(NSAttributedStringMarkdownParser) attributedStringUsingCurrentConfig:body]];
  196. [bodyMutableAttributedText beginEditing];
  197. [bodyMutableAttributedText enumerateAttribute:NSForegroundColorAttributeName inRange:NSMakeRange(0, bodyMutableAttributedText.length) options:0 usingBlock:^(id _Nullable value, NSRange range, BOOL * _Nonnull stop) {
  198. [bodyMutableAttributedText removeAttribute:NSForegroundColorAttributeName range:range];
  199. [bodyMutableAttributedText addAttribute:NSForegroundColorAttributeName value:textColor range:range];
  200. }];
  201. [bodyMutableAttributedText endEditing];
  202. [post setSelfText:body];
  203. [post setAuthor:author];
  204. [post setSelfPostRichTextAttributed:bodyMutableAttributedText];
  205. [post setPreviewFeedPostTextString:bodyMutableAttributedText];
  206. if ([appVersion[1] integerValue] >= 44){
  207. [[[[[self postActionSheetDelegate] controller] feedPostDetailCellNode] contentNode] configureSelfTextNode];
  208. } else if ([appVersion[1] integerValue] >= 38) {
  209. [[[[self postActionSheetDelegate] controller] feedPostDetailCellNode] configureSelfTextNode];
  210. } else {
  211. [[[[self postActionSheetDelegate] controller] feedPostDetailCellNode] configureSelfTextNode];
  212. [[[[[self postActionSheetDelegate] controller] feedPostDetailCellNode] titleNode] configureNodes];
  213. }
  214. [request release];
  215. [queue release];
  216. [bodyMutableAttributedText release];
  217. }];
  218. }
  219. }
  220. }
  221. %end
  222. %end
  223. %group Reddit_v4_ios10
  224. %hook CommentsViewController
  225. %new
  226. -(void) updateComments{
  227. [self reloadCommentsWithNewCommentsHighlight:NO autoScroll:NO animated:NO];
  228. }
  229. %new
  230. -(void) updatePostText{
  231. [self reloadPostSection:YES];
  232. }
  233. %end
  234. %hook CommentActionSheetViewController
  235. -(void) setItems:(id) arg1{
  236. UIImage* origImage = [UIImage imageWithContentsOfFile:@"/var/mobile/Library/Application Support/TFDidThatSay/eye160dark.png"];
  237. CGSize existingImageSize = [[arg1[0] leftIconImage] size];
  238. CGFloat scale = origImage.size.width / existingImageSize.width;
  239. UIImage *newImage = [UIImage imageWithCGImage:[origImage CGImage] scale:scale orientation:origImage.imageOrientation];
  240. id undeleteItem = [[%c(RUIActionSheetItem) alloc] initWithLeftIconImage:newImage text:@"TF did that say?" identifier:@"undeleteItemIdentifier" context:[self comment]];
  241. %orig([arg1 arrayByAddingObject:undeleteItem]);
  242. [undeleteItem release];
  243. }
  244. -(void) handleDidSelectActionSheetItem:(id) arg1{
  245. %orig;
  246. if ([[arg1 identifier] isEqualToString:@"undeleteItemIdentifier"]){
  247. [self dismissViewControllerAnimated:YES completion:nil];
  248. Comment *comment = [self comment];
  249. NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
  250. NSOperationQueue *queue = [[NSOperationQueue alloc] init];
  251. [request setURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://api.pushshift.io/reddit/search/comment/?ids=%@&fields=author,body",[[comment pk] componentsSeparatedByString:@"_"][1]]]];
  252. [request setHTTPMethod:@"GET"];
  253. [NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
  254. NSString *author = @"[author]";
  255. NSString *body = @"[body]";
  256. if (data != nil && error == nil){
  257. id jsonData = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
  258. if ([[jsonData objectForKey:@"data"] count] != 0){
  259. author = [[jsonData objectForKey:@"data"][0] objectForKey:@"author"];
  260. body = [[jsonData objectForKey:@"data"][0] objectForKey:@"body"];
  261. if ([body isEqualToString:@"[deleted]"] || [body isEqualToString:@"[removed]"]){
  262. body = @"[pushshift was unable to archive this]";
  263. }
  264. } else {
  265. body = @"[pushshift has not archived this yet]";
  266. }
  267. } else if (error != nil || data == nil){
  268. body = @"[an error occured]";
  269. }
  270. NSMutableAttributedString *bodyMutableAttributedText = [[NSMutableAttributedString alloc] initWithAttributedString:[%c(NSAttributedStringMarkdownParser) attributedStringUsingCurrentConfig:body]];
  271. [comment setAuthor:author];
  272. [comment setBodyText:body];
  273. [comment setBodyRichTextAttributed:bodyMutableAttributedText];
  274. [comment setBodyAttributedText:bodyMutableAttributedText];
  275. [[self commentActionSheetDelegate] performSelectorOnMainThread:@selector(updateComments) withObject:nil waitUntilDone:NO];
  276. [request release];
  277. [queue release];
  278. [bodyMutableAttributedText release];
  279. }];
  280. }
  281. }
  282. %end
  283. %hook PostActionSheetViewController
  284. -(void) setItems:(id) arg1{
  285. Post *post = [self post];
  286. if ([post isSelfPost]){
  287. UIImage* origImage = [UIImage imageWithContentsOfFile:@"/var/mobile/Library/Application Support/TFDidThatSay/eye160dark.png"];
  288. CGSize existingImageSize = [[arg1[0] leftIconImage] size];
  289. CGFloat scale = origImage.size.width / existingImageSize.width;
  290. UIImage *newImage = [UIImage imageWithCGImage:[origImage CGImage] scale:scale orientation:origImage.imageOrientation];
  291. id undeleteItem = [[%c(RUIActionSheetItem) alloc] initWithLeftIconImage:newImage text:@"TF did that say?" identifier:@"undeleteItemIdentifier" context:[self post]];
  292. arg1 = [arg1 arrayByAddingObject:undeleteItem];
  293. [undeleteItem release];
  294. }
  295. %orig;
  296. }
  297. -(void) handleDidSelectActionSheetItem:(id) arg1{
  298. %orig;
  299. if ([[arg1 identifier] isEqualToString:@"undeleteItemIdentifier"]){
  300. [self dismissViewControllerAnimated:YES completion:nil];
  301. Post *post = [self post];
  302. if ([post isSelfPost]){
  303. NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
  304. NSOperationQueue *queue = [[NSOperationQueue alloc] init];
  305. [request setURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://api.pushshift.io/reddit/search/submission/?ids=%@&fields=author,selftext",[[post pk] componentsSeparatedByString:@"_"][1]]]];
  306. [request setHTTPMethod:@"GET"];
  307. [NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
  308. NSString *author = @"[author]";
  309. NSString *body = @"[body]";
  310. if (data != nil && error == nil){
  311. id jsonData = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
  312. if ([[jsonData objectForKey:@"data"] count] != 0){
  313. author = [[jsonData objectForKey:@"data"][0] objectForKey:@"author"];
  314. body = [[jsonData objectForKey:@"data"][0] objectForKey:@"selftext"];
  315. if ([body isEqualToString:@"[deleted]"] || [body isEqualToString:@"[removed]"]){
  316. body = @"[pushshift was unable to archive this]";
  317. }
  318. } else {
  319. body = @"[pushshift has not archived this yet]";
  320. }
  321. } else if (error != nil || data == nil){
  322. body = @"[an error occured]";
  323. }
  324. NSMutableAttributedString *bodyMutableAttributedText = [[NSMutableAttributedString alloc] initWithAttributedString:[%c(NSAttributedStringMarkdownParser) attributedStringUsingCurrentConfig:body]];
  325. [post setSelfText:body];
  326. [post setAuthor:author];
  327. [post setSelfPostRichTextAttributed:bodyMutableAttributedText];
  328. [post setPreviewFeedPostTextString:bodyMutableAttributedText];
  329. [[self postActionSheetDelegate] performSelectorOnMainThread:@selector(updatePostText) withObject:nil waitUntilDone:NO];
  330. [request release];
  331. [queue release];
  332. [bodyMutableAttributedText release];
  333. }];
  334. }
  335. }
  336. }
  337. %end
  338. %end
  339. %group Reddit_v3
  340. %hook CommentView
  341. %new
  342. -(void) buttonAction {
  343. id commentsViewController = [self delegate];
  344. id comment = [self comment];
  345. NSError* error;
  346. NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
  347. [request setURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://api.pushshift.io/reddit/search/comment/?ids=%@&fields=author,body",[comment pkWithoutPrefix]]]];
  348. [request setHTTPMethod:@"GET"];
  349. NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:&error];
  350. NSString *author = @"[author]";
  351. NSString *body = @"[body]";
  352. if (data != nil && error == nil){
  353. id jsonData = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
  354. author = [[jsonData objectForKey:@"data"][0] objectForKey:@"author"];
  355. body = [[jsonData objectForKey:@"data"][0] objectForKey:@"body"];
  356. if ([body isEqualToString:@"[deleted]"] || [body isEqualToString:@"[removed]"]){
  357. body = @"[comment was unable to be archived]";
  358. }
  359. } else if (error != nil || data == nil){
  360. body = @"[an error occured]";
  361. }
  362. [comment setValue:author forKey:@"author"];
  363. [comment setValue:[%c(MarkDownParser) attributedStringFromMarkdownString: body] forKey:@"bodyAttributedText"];
  364. [comment setValue:body forKey:@"bodyText"];
  365. [commentsViewController reloadCommentsWithNewCommentsHighlight:NO autoScroll:NO animated:NO];
  366. }
  367. -(id) initWithFrame:(id)arg1{
  368. id orig = %orig;
  369. id commandView = [self commandView];
  370. UIButton *undeleteButton = [UIButton buttonWithType:UIButtonTypeCustom];
  371. [undeleteButton addTarget:self action:@selector(buttonAction) forControlEvents:UIControlEventTouchUpInside];
  372. UIImage* undeleteImage = [UIImage imageWithContentsOfFile:@"/var/mobile/Library/Application Support/TFDidThatSay/eye160dark.png"];
  373. [undeleteButton setImage:undeleteImage forState:UIControlStateNormal];
  374. [commandView setUndeleteButton:undeleteButton];
  375. [commandView addSubview:undeleteButton];
  376. return orig;
  377. }
  378. %end
  379. %hook CommentCommandView
  380. %property (assign, nonatomic) id undeleteButton;
  381. -(void) layoutSubviews{
  382. %orig;
  383. UIButton *button = [self undeleteButton];
  384. button.frame = CGRectMake([[self overflowButton ] frame].origin.x - 32, 0, 32, 32);
  385. }
  386. %end
  387. %end
  388. %ctor{
  389. NSString* processName = [[NSProcessInfo processInfo] processName];
  390. NSArray* appVersion = [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"] componentsSeparatedByString:@"."];
  391. if ([processName isEqualToString:@"Reddit"]){
  392. if ([appVersion[0] isEqualToString:@"4"]){
  393. if ([appVersion[1] integerValue] <= 32){
  394. %init(Reddit_v4_ios10);
  395. } else{
  396. %init(Reddit_v4_current);
  397. }
  398. } else if ([appVersion[0] isEqualToString:@"3"]) {
  399. %init(Reddit_v3);
  400. }
  401. }
  402. }