forked from BandarHL/BHTwitter
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Tweak.x
1304 lines (1159 loc) · 56.3 KB
/
Tweak.x
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#import "SAMKeychain/AuthViewController.h"
#import "Colours/Colours.h"
#import "BHTManager.h"
#import "BHTBundle/BHTBundle.h"
static UIFont * _Nullable TAEStandardFontGroupReplacement(UIFont *self, SEL _cmd, CGFloat arg1, CGFloat arg2) {
BH_BaseImp orig = originalFontsIMP[NSStringFromSelector(_cmd)].pointerValue;
NSUInteger nArgs = [[self class] instanceMethodSignatureForSelector:_cmd].numberOfArguments;
UIFont *origFont;
switch (nArgs) {
case 2:
origFont = orig(self, _cmd);
break;
case 3:
origFont = orig(self, _cmd, arg1);
break;
case 4:
origFont = orig(self, _cmd, arg1, arg2);
break;
default:
// Should not be reachable, as it was verified before swizzling
origFont = orig(self, _cmd);
break;
};
UIFont *newFont = BH_getDefaultFont(origFont);
return newFont != nil ? newFont : origFont;
}
static void batchSwizzlingOnClass(Class cls, NSArray<NSString*>*origSelectors, IMP newIMP){
for (NSString *sel in origSelectors) {
SEL origSel = NSSelectorFromString(sel);
Method origMethod = class_getInstanceMethod(cls, origSel);
if (origMethod != NULL) {
IMP oldImp = class_replaceMethod(cls, origSel, newIMP, method_getTypeEncoding(origMethod));
[originalFontsIMP setObject:[NSValue valueWithPointer:oldImp] forKey:sel];
} else {
NSLog(@"[BHTwitter] Can't find method (%@) in Class (%@)", sel, NSStringFromClass(cls));
}
}
}
// MARK: Clean cache and Padlock
%hook T1AppDelegate
- (_Bool)application:(UIApplication *)application didFinishLaunchingWithOptions:(id)arg2 {
%orig;
if (![[NSUserDefaults standardUserDefaults] objectForKey:@"FirstRun_4.3"]) {
[[NSUserDefaults standardUserDefaults] setValue:@"1strun" forKey:@"FirstRun_4.3"];
[[NSUserDefaults standardUserDefaults] setBool:true forKey:@"dw_v"];
[[NSUserDefaults standardUserDefaults] setBool:true forKey:@"hide_promoted"];
[[NSUserDefaults standardUserDefaults] setBool:true forKey:@"voice"];
[[NSUserDefaults standardUserDefaults] setBool:true forKey:@"undo_tweet"];
[[NSUserDefaults standardUserDefaults] setBool:true forKey:@"TrustedFriends"];
[[NSUserDefaults standardUserDefaults] setBool:true forKey:@"disableSensitiveTweetWarnings"];
[[NSUserDefaults standardUserDefaults] setBool:true forKey:@"disable_immersive_player"];
[[NSUserDefaults standardUserDefaults] setBool:true forKey:@"custom_voice_upload"];
}
[BHTManager cleanCache];
if ([BHTManager FLEX]) {
[[%c(FLEXManager) sharedManager] showExplorer];
}
return true;
}
- (void)applicationDidBecomeActive:(id)arg1 {
%orig;
if ([BHTManager Padlock]) {
NSDictionary *keychainData = [[keychain shared] getData];
if (keychainData != nil) {
id isAuthenticated = [keychainData valueForKey:@"isAuthenticated"];
if (isAuthenticated == nil || [isAuthenticated isEqual:@NO]) {
dispatch_async(dispatch_get_main_queue(), ^{
AuthViewController *auth = [[AuthViewController alloc] init];
[auth setModalPresentationStyle:UIModalPresentationFullScreen];
[self.window.rootViewController presentViewController:auth animated:true completion:nil];
});
}
}
UIImageView *image = [self.window viewWithTag:909];
if (image != nil) {
[image removeFromSuperview];
}
}
}
- (void)applicationWillTerminate:(id)arg1 {
%orig;
if ([BHTManager Padlock]) {
[[keychain shared] saveDictionary:@{@"isAuthenticated": @NO}];
}
}
- (void)applicationWillResignActive:(id)arg1 {
%orig;
if ([BHTManager Padlock]) {
UIImageView *image = [[UIImageView alloc] initWithFrame:self.window.bounds];
[image setTag:909];
[image setBackgroundColor:UIColor.systemBackgroundColor];
[image setContentMode:UIViewContentModeCenter];
[self.window addSubview:image];
}
if ([BHTManager FLEX]) {
[[%c(FLEXManager) sharedManager] showExplorer];
}
}
%end
// MARK: Custom Tab bar
%hook T1TabBarViewController
- (void)loadView {
%orig;
NSArray <NSString *> *hiddenBars = [BHCustomTabBarUtility getHiddenTabBars];
for (T1TabView *tabView in self.tabViews) {
if ([hiddenBars containsObject:tabView.scribePage]) {
[tabView setHidden:true];
}
}
}
- (void)setTabBarHidden:(BOOL)arg1 withDuration:(CGFloat)arg2 {
if ([BHTManager stopHidingTabBar]) {
return;
}
return %orig;
}
- (void)setTabBarHidden:(BOOL)arg1 {
if ([BHTManager stopHidingTabBar]) {
return;
}
return %orig;
}
%end
%hook T1DirectMessageConversationEntriesViewController
- (void)viewDidLoad {
%orig;
if ([BHTManager changeBackground]) {
if ([BHTManager backgroundImage]) { // set the backgeound as image
NSFileManager *manager = [NSFileManager defaultManager];
NSString *DocPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, true).firstObject;
NSURL *imagePath = [[NSURL fileURLWithPath:DocPath] URLByAppendingPathComponent:@"msg_background.png"];
if ([manager fileExistsAtPath:imagePath.path]) {
UIImageView *backgroundImage = [[UIImageView alloc] initWithFrame:UIScreen.mainScreen.bounds];
backgroundImage.image = [UIImage imageNamed:imagePath.path];
[backgroundImage setContentMode:UIViewContentModeScaleAspectFill];
[self.view insertSubview:backgroundImage atIndex:0];
}
}
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"background_color"]) { // set the backgeound as color
NSString *hexCode = [[NSUserDefaults standardUserDefaults] objectForKey:@"background_color"];
UIColor *selectedColor = [UIColor colorFromHexString:hexCode];
self.view.backgroundColor = selectedColor;
}
}
}
%end
// MARK: Copy user information
%hook T1ProfileHeaderViewController
- (void)viewDidAppear:(_Bool)arg1 {
%orig(arg1);
if ([BHTManager CopyProfileInfo]) {
T1ProfileHeaderView *headerView = [self valueForKey:@"_headerView"];
UIView *innerContentView = [headerView.actionButtonsView valueForKey:@"_innerContentView"];
UIButton *copyButton = [UIButton buttonWithType:UIButtonTypeCustom];
[copyButton setImage:[UIImage systemImageNamed:@"doc.on.clipboard"] forState:UIControlStateNormal];
if (@available(iOS 14.0, *)) {
[copyButton setShowsMenuAsPrimaryAction:true];
[copyButton setMenu:[UIMenu menuWithTitle:@"" children:@[
[UIAction actionWithTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"COPY_PROFILE_INFO_MENU_OPTION_1"] image:[UIImage systemImageNamed:@"doc.on.clipboard"] identifier:nil handler:^(__kindof UIAction * _Nonnull action) {
if (self.viewModel.bio != nil)
UIPasteboard.generalPasteboard.string = self.viewModel.bio;
}],
[UIAction actionWithTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"COPY_PROFILE_INFO_MENU_OPTION_2"] image:[UIImage systemImageNamed:@"doc.on.clipboard"] identifier:nil handler:^(__kindof UIAction * _Nonnull action) {
if (self.viewModel.username != nil)
UIPasteboard.generalPasteboard.string = self.viewModel.username;
}],
[UIAction actionWithTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"COPY_PROFILE_INFO_MENU_OPTION_3"] image:[UIImage systemImageNamed:@"doc.on.clipboard"] identifier:nil handler:^(__kindof UIAction * _Nonnull action) {
if (self.viewModel.fullName != nil)
UIPasteboard.generalPasteboard.string = self.viewModel.fullName;
}],
[UIAction actionWithTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"COPY_PROFILE_INFO_MENU_OPTION_4"] image:[UIImage systemImageNamed:@"doc.on.clipboard"] identifier:nil handler:^(__kindof UIAction * _Nonnull action) {
if (self.viewModel.url != nil)
UIPasteboard.generalPasteboard.string = self.viewModel.url;
}],
[UIAction actionWithTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"COPY_PROFILE_INFO_MENU_OPTION_5"] image:[UIImage systemImageNamed:@"doc.on.clipboard"] identifier:nil handler:^(__kindof UIAction * _Nonnull action) {
if (self.viewModel.location != nil)
UIPasteboard.generalPasteboard.string = self.viewModel.location;
}],
]]];
} else {
[copyButton addTarget:self action:@selector(copyButtonHandler:) forControlEvents:UIControlEventTouchUpInside];
}
[copyButton setTintColor:UIColor.labelColor];
[copyButton.layer setCornerRadius:32/2];
[copyButton.layer setBorderWidth:1];
[copyButton.layer setBorderColor:[UIColor colorFromHexString:@"2F3336"].CGColor];
[copyButton setTranslatesAutoresizingMaskIntoConstraints:false];
[headerView.actionButtonsView addSubview:copyButton];
[NSLayoutConstraint activateConstraints:@[
[copyButton.centerYAnchor constraintEqualToAnchor:headerView.actionButtonsView.centerYAnchor],
[copyButton.widthAnchor constraintEqualToConstant:32],
[copyButton.heightAnchor constraintEqualToConstant:32],
]];
if (isDeviceLanguageRTL()) {
[NSLayoutConstraint activateConstraints:@[
[copyButton.leadingAnchor constraintEqualToAnchor:innerContentView.trailingAnchor constant:7],
]];
} else {
[NSLayoutConstraint activateConstraints:@[
[copyButton.trailingAnchor constraintEqualToAnchor:innerContentView.leadingAnchor constant:-7],
]];
}
}
}
%new - (void)copyButtonHandler:(UIButton *)sender {
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"hi" message:nil preferredStyle:UIAlertControllerStyleActionSheet];
if (is_iPad()) {
alert.popoverPresentationController.sourceView = self.view;
alert.popoverPresentationController.sourceRect = sender.frame;
}
UIAlertAction *bio = [UIAlertAction actionWithTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"COPY_PROFILE_INFO_MENU_OPTION_1"] style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
if (self.viewModel.bio != nil)
UIPasteboard.generalPasteboard.string = self.viewModel.bio;
}];
UIAlertAction *username = [UIAlertAction actionWithTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"COPY_PROFILE_INFO_MENU_OPTION_2"] style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
if (self.viewModel.username != nil)
UIPasteboard.generalPasteboard.string = self.viewModel.username;
}];
UIAlertAction *fullusername = [UIAlertAction actionWithTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"COPY_PROFILE_INFO_MENU_OPTION_3"] style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
if (self.viewModel.fullName != nil)
UIPasteboard.generalPasteboard.string = self.viewModel.fullName;
}];
UIAlertAction *url = [UIAlertAction actionWithTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"COPY_PROFILE_INFO_MENU_OPTION_4"] style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
if (self.viewModel.url != nil)
UIPasteboard.generalPasteboard.string = self.viewModel.url;
}];
UIAlertAction *location = [UIAlertAction actionWithTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"COPY_PROFILE_INFO_MENU_OPTION_5"] style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
if (self.viewModel.location != nil)
UIPasteboard.generalPasteboard.string = self.viewModel.location;
}];
[alert addAction:bio];
[alert addAction:username];
[alert addAction:fullusername];
[alert addAction:url];
[alert addAction:location];
[alert addAction:[UIAlertAction actionWithTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"CANCEL_BUTTON_TITLE"] style:UIAlertActionStyleCancel handler:nil]];
[self presentViewController:alert animated:true completion:nil];
}
%end
// MARK: hide ADs
// credit goes to haoict https://github.com/haoict/twitter-no-ads
%hook TFNItemsDataViewController
- (id)tableViewCellForItem:(id)arg1 atIndexPath:(id)arg2 {
UITableViewCell *_orig = %orig;
id tweet = [self itemAtIndexPath:arg2];
NSString *class_name = NSStringFromClass([tweet classForCoder]);
if ([BHTManager HidePromoted] && [tweet respondsToSelector:@selector(isPromoted)] && [tweet performSelector:@selector(isPromoted)]) {
[_orig setHidden:YES];
}
if ([self.adDisplayLocation isEqualToString:@"PROFILE_TWEETS"]) {
if ([BHTManager hideWhoToFollow]) {
if ([class_name isEqualToString:@"T1URTTimelineUserItemViewModel"] || [class_name isEqualToString:@"TwitterURT.URTModuleHeaderViewModel"] || [class_name isEqualToString:@"TwitterURT.URTModuleFooterViewModel"]) {
[_orig setHidden:true];
}
}
if ([BHTManager hideTopicsToFollow]) {
if ([class_name isEqualToString:@"T1TwitterSwift.URTTimelineTopicCollectionViewModel"] || [class_name isEqualToString:@"TwitterURT.URTModuleHeaderViewModel"] || [class_name isEqualToString:@"TwitterURT.URTModuleFooterViewModel"] || [class_name isEqualToString:@"TwitterURT.URTTimelineCarouselViewModel"]) {
[_orig setHidden:true];
}
}
}
if ([self.adDisplayLocation isEqualToString:@"OTHER"]) {
if ([BHTManager HidePromoted] && ([class_name isEqualToString:@"TwitterURT.URTModuleHeaderViewModel"] || [class_name isEqualToString:@"TwitterURT.URTModuleFooterViewModel"] || [class_name isEqualToString:@"T1URTTimelineMessageItemViewModel"])) {
[_orig setHidden:true];
}
if ([BHTManager HidePromoted] && [class_name isEqualToString:@"TwitterURT.URTTimelineEventSummaryViewModel"]) {
_TtC10TwitterURT32URTTimelineEventSummaryViewModel *trendModel = tweet;
if ([[trendModel.scribeItem allKeys] containsObject:@"promoted_id"]) {
[_orig setHidden:true];
}
}
if ([BHTManager HidePromoted] && [class_name isEqualToString:@"TwitterURT.URTTimelineTrendViewModel"]) {
_TtC10TwitterURT25URTTimelineTrendViewModel *trendModel = tweet;
if ([[trendModel.scribeItem allKeys] containsObject:@"promoted_id"]) {
[_orig setHidden:true];
}
}
}
if ([self.adDisplayLocation isEqualToString:@"TIMELINE_HOME"]) {
if ([tweet isKindOfClass:%c(T1URTTimelineStatusItemViewModel)]) {
T1URTTimelineStatusItemViewModel *fullTweet = tweet;
if ([BHTManager HideTopics]) {
if ((fullTweet.banner != nil) && [fullTweet.banner isKindOfClass:%c(TFNTwitterURTTimelineStatusTopicBanner)]) {
[_orig setHidden:true];
}
}
}
if ([BHTManager HideTopics]) {
if ([tweet isKindOfClass:%c(_TtC10TwitterURT26URTTimelinePromptViewModel)]) {
[_orig setHidden:true];
}
}
}
return _orig;
}
- (double)tableView:(id)arg1 heightForRowAtIndexPath:(id)arg2 {
id tweet = [self itemAtIndexPath:arg2];
NSString *class_name = NSStringFromClass([tweet classForCoder]);
if ([BHTManager HidePromoted] && [tweet respondsToSelector:@selector(isPromoted)] && [tweet performSelector:@selector(isPromoted)]) {
return 0;
}
if ([self.adDisplayLocation isEqualToString:@"PROFILE_TWEETS"]) {
if ([BHTManager hideWhoToFollow]) {
if ([class_name isEqualToString:@"T1URTTimelineUserItemViewModel"] || [class_name isEqualToString:@"TwitterURT.URTModuleHeaderViewModel"] || [class_name isEqualToString:@"TwitterURT.URTModuleFooterViewModel"]) {
return 0;
}
}
if ([BHTManager hideTopicsToFollow]) {
if ([class_name isEqualToString:@"T1TwitterSwift.URTTimelineTopicCollectionViewModel"] || [class_name isEqualToString:@"TwitterURT.URTModuleHeaderViewModel"] || [class_name isEqualToString:@"TwitterURT.URTModuleFooterViewModel"] || [class_name isEqualToString:@"TwitterURT.URTTimelineCarouselViewModel"]) {
return 0;
}
}
}
if ([self.adDisplayLocation isEqualToString:@"OTHER"]) {
if ([BHTManager HidePromoted] && ([class_name isEqualToString:@"TwitterURT.URTModuleHeaderViewModel"] || [class_name isEqualToString:@"TwitterURT.URTModuleFooterViewModel"] || [class_name isEqualToString:@"T1URTTimelineMessageItemViewModel"])) {
return 0;
}
if ([BHTManager HidePromoted] && [class_name isEqualToString:@"TwitterURT.URTTimelineEventSummaryViewModel"]) {
_TtC10TwitterURT32URTTimelineEventSummaryViewModel *trendModel = tweet;
if ([[trendModel.scribeItem allKeys] containsObject:@"promoted_id"]) {
return 0;
}
}
if ([BHTManager HidePromoted] && [class_name isEqualToString:@"TwitterURT.URTTimelineTrendViewModel"]) {
_TtC10TwitterURT25URTTimelineTrendViewModel *trendModel = tweet;
if ([[trendModel.scribeItem allKeys] containsObject:@"promoted_id"]) {
return 0;
}
}
}
if ([self.adDisplayLocation isEqualToString:@"TIMELINE_HOME"]) {
if ([tweet isKindOfClass:%c(T1URTTimelineStatusItemViewModel)]) {
T1URTTimelineStatusItemViewModel *fullTweet = tweet;
if ([BHTManager HideTopics]) {
if ((fullTweet.banner != nil) && [fullTweet.banner isKindOfClass:%c(TFNTwitterURTTimelineStatusTopicBanner)]) {
return 0;
}
}
}
if ([BHTManager HideTopics]) {
if ([tweet isKindOfClass:%c(_TtC10TwitterURT26URTTimelinePromptViewModel)]) {
return 0;
}
}
}
return %orig;
}
- (double)tableView:(id)arg1 heightForHeaderInSection:(long long)arg2 {
if (self.sections && self.sections[arg2] && ((NSArray* )self.sections[arg2]).count && self.sections[arg2][0]) {
NSString *sectionClassName = NSStringFromClass([self.sections[arg2][0] classForCoder]);
if ([sectionClassName isEqualToString:@"TFNTwitterUser"]) {
return 0;
}
}
return %orig;
}
%end
%hook TFNTwitterStatus
- (_Bool)isCardHidden {
return ([BHTManager HidePromoted] && [self isPromoted]) ? true : %orig;
}
%end
// MARK: DM download
%hook T1DirectMessageEntryMediaCell
%property (nonatomic, strong) JGProgressHUD *hud;
- (void)setEntryViewModel:(id)arg1 {
%orig;
if ([BHTManager DownloadingVideos]) {
UIContextMenuInteraction *menuInteraction = [[UIContextMenuInteraction alloc] initWithDelegate:self];
[self setUserInteractionEnabled:true];
if ([BHTManager isDMVideoCell:self.inlineMediaView]) {
[self addInteraction:menuInteraction];
}
}
}
%new - (UIContextMenuConfiguration *)contextMenuInteraction:(UIContextMenuInteraction *)interaction configurationForMenuAtLocation:(CGPoint)location {
return [UIContextMenuConfiguration configurationWithIdentifier:nil previewProvider:nil actionProvider:^UIMenu * _Nullable(NSArray<UIMenuElement *> * _Nonnull suggestedActions) {
UIAction *saveAction = [UIAction actionWithTitle:@"Download" image:[UIImage systemImageNamed:@"square.and.arrow.down"] identifier:nil handler:^(__kindof UIAction * _Nonnull action) {
[self DownloadHandler];
}];
return [UIMenu menuWithTitle:@"" children:@[saveAction]];
}];
}
%new - (void)DownloadHandler {
NSAttributedString *AttString = [[NSAttributedString alloc] initWithString:[[BHTBundle sharedBundle] localizedStringForKey:@"DOWNLOAD_MENU_TITLE"] attributes:@{
NSFontAttributeName: [[%c(TAEStandardFontGroup) sharedFontGroup] headline2BoldFont],
NSForegroundColorAttributeName: UIColor.labelColor
}];
TFNActiveTextItem *title = [[%c(TFNActiveTextItem) alloc] initWithTextModel:[[%c(TFNAttributedTextModel) alloc] initWithAttributedString:AttString] activeRanges:nil];
NSMutableArray *actions = [[NSMutableArray alloc] init];
[actions addObject:title];
T1PlayerMediaEntitySessionProducible *session = self.inlineMediaView.viewModel.playerSessionProducer.sessionProducible;
for (TFSTwitterEntityMediaVideoVariant *i in session.mediaEntity.videoInfo.variants) {
if ([i.contentType isEqualToString:@"video/mp4"]) {
TFNActionItem *download = [%c(TFNActionItem) actionItemWithTitle:[BHTManager getVideoQuality:i.url] imageName:@"arrow_down_circle_stroke" action:^{
BHDownload *DownloadManager = [[BHDownload alloc] init];
self.hud = [JGProgressHUD progressHUDWithStyle:JGProgressHUDStyleDark];
self.hud.textLabel.text = [[BHTBundle sharedBundle] localizedStringForKey:@"PROGRESS_DOWNLOADING_STATUS_TITLE"];
[DownloadManager downloadFileWithURL:[NSURL URLWithString:i.url]];
[DownloadManager setDelegate:self];
[self.hud showInView:topMostController().view];
}];
[actions addObject:download];
}
if ([i.contentType isEqualToString:@"application/x-mpegURL"]) {
TFNActionItem *option = [objc_getClass("TFNActionItem") actionItemWithTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"FFMPEG_DOWNLOAD_OPTION_TITLE"] imageName:@"arrow_down_circle_stroke" action:^{
self.hud = [JGProgressHUD progressHUDWithStyle:JGProgressHUDStyleDark];
self.hud.textLabel.text = [[BHTBundle sharedBundle] localizedStringForKey:@"FETCHING_PROGRESS_TITLE"];
[self.hud showInView:topMostController().view];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
MediaInformation *mediaInfo = [BHTManager getM3U8Information:[NSURL URLWithString:i.url]];
dispatch_async(dispatch_get_main_queue(), ^(void) {
[self.hud dismiss];
TFNMenuSheetViewController *alert2 = [BHTManager newFFmpegDownloadSheet:mediaInfo downloadingURL:[NSURL URLWithString:i.url] progressView:self.hud];
[alert2 tfnPresentedCustomPresentFromViewController:topMostController() animated:YES completion:nil];
});
});
}];
[actions addObject:option];
}
}
TFNMenuSheetViewController *alert = [[%c(TFNMenuSheetViewController) alloc] initWithActionItems:[NSArray arrayWithArray:actions]];
[alert tfnPresentedCustomPresentFromViewController:topMostController() animated:YES completion:nil];
}
%new - (void)downloadProgress:(float)progress {
self.hud.detailTextLabel.text = [BHTManager getDownloadingPersent:progress];
}
%new - (void)downloadDidFinish:(NSURL *)filePath Filename:(NSString *)fileName {
NSString *DocPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, true).firstObject;
NSFileManager *manager = [NSFileManager defaultManager];
NSURL *newFilePath = [[NSURL fileURLWithPath:DocPath] URLByAppendingPathComponent:[NSString stringWithFormat:@"%@.mp4", NSUUID.UUID.UUIDString]];
[manager moveItemAtURL:filePath toURL:newFilePath error:nil];
[self.hud dismiss];
[BHTManager showSaveVC:newFilePath];
}
%new - (void)downloadDidFailureWithError:(NSError *)error {
if (error) {
[self.hud dismiss];
}
}
%end
// upload custom voice
%hook T1MediaAttachmentsViewCell
%property (nonatomic, strong) UIButton *uploadButton;
- (void)updateCellElements {
%orig;
if ([BHTManager customVoice]) {
TFNButton *removeButton = [self valueForKey:@"_removeButton"];
if ([self.attachment isKindOfClass:%c(TTMAssetVoiceRecording)]) {
if (self.uploadButton == nil) {
self.uploadButton = [UIButton buttonWithType:UIButtonTypeCustom];
UIImageSymbolConfiguration *smallConfig = [UIImageSymbolConfiguration configurationWithScale:UIImageSymbolScaleSmall];
UIImage *arrowUpImage = [UIImage systemImageNamed:@"arrow.up" withConfiguration:smallConfig];
[self.uploadButton setImage:arrowUpImage forState:UIControlStateNormal];
[self.uploadButton addTarget:self action:@selector(handleUploadButton:) forControlEvents:UIControlEventTouchUpInside];
[self.uploadButton setTintColor:UIColor.labelColor];
[self.uploadButton setBackgroundColor:[UIColor blackColor]];
[self.uploadButton.layer setCornerRadius:29/2];
[self.uploadButton setTranslatesAutoresizingMaskIntoConstraints:false];
if (self.uploadButton.superview == nil) {
[self addSubview:self.uploadButton];
[NSLayoutConstraint activateConstraints:@[
[self.uploadButton.trailingAnchor constraintEqualToAnchor:removeButton.leadingAnchor constant:-10],
[self.uploadButton.topAnchor constraintEqualToAnchor:removeButton.topAnchor],
[self.uploadButton.widthAnchor constraintEqualToConstant:29],
[self.uploadButton.heightAnchor constraintEqualToConstant:29],
]];
}
}
}
}
}
%new - (void)handleUploadButton:(UIButton *)sender {
UIImagePickerController *videoPicker = [[UIImagePickerController alloc] init];
videoPicker.mediaTypes = @[(NSString*)kUTTypeMovie];
videoPicker.delegate = self;
[topMostController() presentViewController:videoPicker animated:YES completion:nil];
}
%new - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<UIImagePickerControllerInfoKey,id> *)info {
NSURL *videoURL = info[UIImagePickerControllerMediaURL];
TTMAssetVoiceRecording *attachment = self.attachment;
NSURL *recorder_url = [NSURL fileURLWithPath:attachment.filePath];
if (recorder_url != nil) {
NSFileManager *fileManager = [NSFileManager defaultManager];
NSError *error = nil;
if ([fileManager fileExistsAtPath:[recorder_url path]]) {
[fileManager removeItemAtURL:recorder_url error:&error];
if (error) {
NSLog(@"[BHTwitter] Error removing existing file: %@", error);
}
}
[fileManager copyItemAtURL:videoURL toURL:recorder_url error:&error];
if (error) {
NSLog(@"[BHTwitter] Error copying file: %@", error);
}
}
[picker dismissViewControllerAnimated:true completion:nil];
}
%new - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
[picker dismissViewControllerAnimated:true completion:nil];
}
%end
// MARK: Color theme
%hook TFNPagingViewController
- (void)viewDidAppear:(_Bool)animated {
%orig(animated);
static dispatch_once_t once;
dispatch_once(&once, ^ {
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"bh_color_theme_selectedColor"]) {
BH_changeTwitterColor([[NSUserDefaults standardUserDefaults] integerForKey:@"bh_color_theme_selectedColor"]);
}
});
}
%end
%hook TFNNavigationController
- (void)viewDidAppear:(_Bool)animated {
%orig(animated);
static dispatch_once_t once;
dispatch_once(&once, ^ {
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"bh_color_theme_selectedColor"]) {
BH_changeTwitterColor([[NSUserDefaults standardUserDefaults] integerForKey:@"bh_color_theme_selectedColor"]);
}
});
}
%end
%hook T1AppSplitViewController
- (void)viewDidAppear:(_Bool)animated {
%orig(animated);
static dispatch_once_t once;
dispatch_once(&once, ^ {
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"bh_color_theme_selectedColor"]) {
BH_changeTwitterColor([[NSUserDefaults standardUserDefaults] integerForKey:@"bh_color_theme_selectedColor"]);
}
});
}
%end
%hook NSUserDefaults
- (void)setObject:(id)value forKey:(NSString *)defaultName {
if ([defaultName isEqualToString:@"T1ColorSettingsPrimaryColorOptionKey"]) {
id selectedColor = [[NSUserDefaults standardUserDefaults] objectForKey:@"bh_color_theme_selectedColor"];
if (selectedColor != nil) {
if ([value isEqual:selectedColor]) {
return %orig;
} else {
return;
}
}
return %orig;
}
return %orig;
}
%end
%hook TFNNavigationBar
- (void)setPrefersLargeTitles:(BOOL)largeTitles {
largeTitles = false;
return %orig(largeTitles);
}
%end
// MARK: Save tweet as an image
// Twitter 9.31 and higher
%hook TTAStatusInlineShareButton
- (void)didLongPressActionButton:(UILongPressGestureRecognizer *)gestureRecognizer {
if ([BHTManager tweetToImage]) {
if (gestureRecognizer.state == UIGestureRecognizerStateBegan) {
T1StatusInlineActionsView *actionsView = (T1StatusInlineActionsView *)self.delegate;
T1StatusCell *tweetView;
if ([actionsView.superview isKindOfClass:%c(T1StandardStatusView)]) { // normal tweet in the time line
tweetView = [(T1StandardStatusView *)actionsView.superview eventHandler];
} else if ([actionsView.superview isKindOfClass:%c(T1TweetDetailsFocalStatusView)]) { // Focus tweet
tweetView = [(T1TweetDetailsFocalStatusView *)actionsView.superview eventHandler];
} else if ([actionsView.superview isKindOfClass:%c(T1ConversationFocalStatusView)]) { // Focus tweet
tweetView = [(T1ConversationFocalStatusView *)actionsView.superview eventHandler];
} else {
return %orig;
}
UIImage *tweetImage = BH_imageFromView(tweetView);
UIActivityViewController *acVC = [[UIActivityViewController alloc] initWithActivityItems:@[tweetImage] applicationActivities:nil];
if (is_iPad()) {
acVC.popoverPresentationController.sourceView = self;
acVC.popoverPresentationController.sourceRect = self.frame;
}
[topMostController() presentViewController:acVC animated:true completion:nil];
return;
}
}
return %orig;
}
%end
// Twitter 9.30 and lower
%hook T1StatusInlineShareButton
- (void)didLongPressActionButton:(UILongPressGestureRecognizer *)gestureRecognizer {
if ([BHTManager tweetToImage]) {
if (gestureRecognizer.state == UIGestureRecognizerStateBegan) {
T1StatusInlineActionsView *actionsView = self.delegate;
T1StatusCell *tweetView;
if ([actionsView.superview isKindOfClass:%c(T1StandardStatusView)]) { // normal tweet in the time line
tweetView = [(T1StandardStatusView *)actionsView.superview eventHandler];
} else if ([actionsView.superview isKindOfClass:%c(T1TweetDetailsFocalStatusView)]) { // Focus tweet
tweetView = [(T1TweetDetailsFocalStatusView *)actionsView.superview eventHandler];
} else if ([actionsView.superview isKindOfClass:%c(T1ConversationFocalStatusView)]) { // Focus tweet
tweetView = [(T1ConversationFocalStatusView *)actionsView.superview eventHandler];
} else {
return %orig;
}
UIImage *tweetImage = BH_imageFromView(tweetView);
UIActivityViewController *acVC = [[UIActivityViewController alloc] initWithActivityItems:@[tweetImage] applicationActivities:nil];
if (is_iPad()) {
acVC.popoverPresentationController.sourceView = self;
acVC.popoverPresentationController.sourceRect = self.frame;
}
[topMostController() presentViewController:acVC animated:true completion:nil];
return;
}
}
return %orig;
}
%end
// MARK: Timeline download
// THIS SOLUTION WAS TAKEN FROM Translomatic AFTER DISASSEMBLING THE DYLIB
// SO THANKS: @foxfortmobile
// Twitter 9.31 and higher
%hook TTAStatusInlineActionsView
+ (NSArray *)_t1_inlineActionViewClassesForViewModel:(id)arg1 options:(NSUInteger)arg2 displayType:(NSUInteger)arg3 account:(id)arg4 {
NSArray *_orig = %orig;
NSMutableArray *newOrig = [_orig mutableCopy];
if ([BHTManager isVideoCell:arg1] && [BHTManager DownloadingVideos]) {
[newOrig addObject:%c(BHDownloadInlineButton)];
}
if ([newOrig containsObject:%c(TTAStatusInlineAnalyticsButton)] && [BHTManager hideViewCount]) {
[newOrig removeObject:%c(TTAStatusInlineAnalyticsButton)];
}
if ([newOrig containsObject:%c(TTAStatusInlineBookmarkButton)] && [BHTManager hideBookmarkButton]) {
[newOrig removeObject:%c(TTAStatusInlineBookmarkButton)];
}
return [newOrig copy];
}
%end
// Twitter 9.30 and lower
%hook T1StatusInlineActionsView
+ (NSArray *)_t1_inlineActionViewClassesForViewModel:(id)arg1 options:(NSUInteger)arg2 displayType:(NSUInteger)arg3 account:(id)arg4 {
NSArray *_orig = %orig;
NSMutableArray *newOrig = [_orig mutableCopy];
if ([BHTManager isVideoCell:arg1] && [BHTManager DownloadingVideos]) {
[newOrig addObject:%c(BHDownloadInlineButton)];
}
return [newOrig copy];
}
%end
// MARK: Always open in Safrai
// Thanks nyuszika7h https://github.com/nyuszika7h/noinappsafari/
%hook SFSafariViewController
- (void)viewWillAppear:(BOOL)animated {
if (![BHTManager alwaysOpenSafari]) {
return %orig;
}
NSURL *url = [self initialURL];
NSString *urlStr = [url absoluteString];
// In-app browser is used for two-factor authentication with security key,
// login will not complete successfully if it's redirected to Safari
if ([urlStr containsString:@"twitter.com/account/"] || [urlStr containsString:@"twitter.com/i/flow/"]) {
return %orig;
}
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
[self dismissViewControllerAnimated:NO completion:nil];
}
%end
%hook SFInteractiveDismissController
- (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext {
if (![BHTManager alwaysOpenSafari]) {
return %orig;
}
[transitionContext completeTransition:NO];
}
%end
%hook TFSTwitterEntityURL
- (NSString *)url {
// https://github.com/haoict/twitter-no-ads/blob/master/Tweak.xm#L195
return self.expandedURL;
}
%end
// MARK: Disable RTL
%hook NSParagraphStyle
+ (NSWritingDirection)defaultWritingDirectionForLanguage:(id)lang {
return [BHTManager disableRTL] ? NSWritingDirectionLeftToRight : %orig;
}
+ (NSWritingDirection)_defaultWritingDirection {
return [BHTManager disableRTL] ? NSWritingDirectionLeftToRight : %orig;
}
%end
// MARK: Bio Translate
%hook TFNTwitterCanonicalUser
- (_Bool)isProfileBioTranslatable {
return [BHTManager BioTranslate] ? true : %orig;
}
%end
// MARK: No search history
%hook T1SearchTypeaheadViewController // for old Twitter versions
- (void)viewDidLoad {
if ([BHTManager NoHistory]) { // thanks @CrazyMind90
if ([self respondsToSelector:@selector(clearActionControlWantsClear:)]) {
[self performSelector:@selector(clearActionControlWantsClear:)];
}
}
%orig;
}
%end
%hook TTSSearchTypeaheadViewController
- (void)viewDidLoad {
if ([BHTManager NoHistory]) { // thanks @CrazyMind90
if ([self respondsToSelector:@selector(clearActionControlWantsClear:)]) {
[self performSelector:@selector(clearActionControlWantsClear:)];
}
}
%orig;
}
%end
// MARK: Voice, SensitiveTweetWarnings, autoHighestLoad, VideoZoom, VODCaptions, disableSpacesBar feature
%hook TPSTwitterFeatureSwitches
// Twitter save all the features and keys in side JSON file in bundle of application fs_embedded_defaults_production.json, and use it in TFNTwitterAccount class but with DM voice maybe developers forget to add boolean variable in the class, so i had to change it from the file.
// also, you can find every key for every feature i used in this tweak, i can remove all the codes below and find every key for it but I'm lazy to do that, :)
- (BOOL)boolForKey:(NSString *)key {
if ([key isEqualToString:@"edit_tweet_enabled"] || [key isEqualToString:@"edit_tweet_ga_composition_enabled"] || [key isEqualToString:@"edit_tweet_pdp_dialog_enabled"] || [key isEqualToString:@"edit_tweet_upsell_enabled"]) {
return true;
}
if ([key isEqualToString:@"conversational_replies_ios_pinned_replies_consumption_enabled"] || [key isEqualToString:@"conversational_replies_ios_pinned_replies_creation_enabled"]) {
return true;
}
return %orig;
}
%end
// MARK: Force Tweets to show images as Full frame: https://github.com/BandarHL/BHTwitter/issues/101
%hook T1StandardStatusAttachmentViewAdapter
- (NSUInteger)displayType {
if (self.attachmentType == 2) {
return [BHTManager forceTweetFullFrame] ? 1 : %orig;
}
return %orig;
}
%end
%hook T1HomeTimelineItemsViewController
- (void)_t1_initializeFleets {
if ([BHTManager hideSpacesBar]) {
return;
}
return %orig;
}
%end
%hook THFHomeTimelineItemsViewController
- (void)_t1_initializeFleets {
if ([BHTManager hideSpacesBar]) {
return;
}
return %orig;
}
%end
%hook TFNTwitterMediaUploadConfiguration
- (_Bool)photoUploadHighQualityImagesSettingIsVisible {
return [BHTManager autoHighestLoad] ? true : %orig;
}
%end
%hook T1SlideshowViewController
- (_Bool)_t1_shouldDisplayLoadHighQualityImageItemForImageDisplayView:(id)arg1 highestQuality:(_Bool)arg2 {
return [BHTManager autoHighestLoad] ? true : %orig;
}
- (id)_t1_loadHighQualityActionItemWithTitle:(id)arg1 forImageDisplayView:(id)arg2 highestQuality:(_Bool)arg3 {
if ([BHTManager autoHighestLoad]) {
arg3 = true;
}
return %orig(arg1, arg2, arg3);
}
%end
%hook T1ImageDisplayView
- (_Bool)_tfn_shouldUseHighestQualityImage {
return [BHTManager autoHighestLoad] ? true : %orig;
}
- (_Bool)_tfn_shouldUseHighQualityImage {
return [BHTManager autoHighestLoad] ? true : %orig;
}
%end
%hook T1HighQualityImagesUploadSettings
- (_Bool)shouldUploadHighQualityImages {
return [BHTManager autoHighestLoad] ? true : %orig;
}
%end
%hook TFSTwitterAPICommandAccountStateProvider
- (_Bool)allowPromotedContent {
return [BHTManager HidePromoted] ? true : %orig;
}
%end
%hook TFNTwitterAccount
- (_Bool)isEditProfileUsernameEnabled {
return true;
}
- (_Bool)isEditTweetConsumptionEnabled {
return true;
}
- (_Bool)isSensitiveTweetWarningsComposeEnabled {
return [BHTManager disableSensitiveTweetWarnings] ? false : %orig;
}
- (_Bool)isSensitiveTweetWarningsConsumeEnabled {
return [BHTManager disableSensitiveTweetWarnings] ? false : %orig;
}
- (_Bool)isVideoDynamicAdEnabled {
return [BHTManager HidePromoted] ? false : %orig;
}
- (_Bool)isVODCaptionsEnabled {
return [BHTManager DisableVODCaptions] ? false : %orig;
}
- (_Bool)photoUploadHighQualityImagesSettingIsVisible {
return [BHTManager autoHighestLoad] ? true : %orig;
}
- (_Bool)loadingHighestQualityImageVariantPermitted {
return [BHTManager autoHighestLoad] ? true : %orig;
}
- (_Bool)isDoubleMaxZoomFor4KImagesEnabled {
return [BHTManager autoHighestLoad] ? true : %orig;
}
%end
// MARK: Tweet confirm
%hook T1TweetComposeViewController
- (void)_t1_didTapSendButton:(UIButton *)tweetButton {
if ([BHTManager TweetConfirm]) {
[%c(FLEXAlert) makeAlert:^(FLEXAlert *make) {
make.message([[BHTBundle sharedBundle] localizedStringForKey:@"CONFIRM_ALERT_MESSAGE"]);
make.button([[BHTBundle sharedBundle] localizedStringForKey:@"YES_BUTTON_TITLE"]).handler(^(NSArray<NSString *> *strings) {
%orig;
});
make.button([[BHTBundle sharedBundle] localizedStringForKey:@"NO_BUTTON_TITLE"]).cancelStyle();
} showFrom:topMostController()];
} else {
return %orig;
}
}
- (void)_t1_handleTweet {
if ([BHTManager TweetConfirm]) {
[%c(FLEXAlert) makeAlert:^(FLEXAlert *make) {
make.message([[BHTBundle sharedBundle] localizedStringForKey:@"CONFIRM_ALERT_MESSAGE"]);
make.button([[BHTBundle sharedBundle] localizedStringForKey:@"YES_BUTTON_TITLE"]).handler(^(NSArray<NSString *> *strings) {
%orig;
});
make.button([[BHTBundle sharedBundle] localizedStringForKey:@"NO_BUTTON_TITLE"]).cancelStyle();
} showFrom:topMostController()];
} else {
return %orig;
}
}
// MARK: Status tweet
- (BOOL)_t1_isVibeCompositionEnabled {
return true;
}
// MARK: CoTweet
- (BOOL)isTweetCollaborationEnabled {
return true;
}
- (BOOL)_t1_canEnableCollaboration {
return true;
}
%end
// MARK: Follow confirm
%hook TUIFollowControl
- (void)_followUser:(id)arg1 event:(id)arg2 {
if ([BHTManager FollowConfirm]) {
[%c(FLEXAlert) makeAlert:^(FLEXAlert *make) {
make.message([[BHTBundle sharedBundle] localizedStringForKey:@"CONFIRM_ALERT_MESSAGE"]);
make.button([[BHTBundle sharedBundle] localizedStringForKey:@"YES_BUTTON_TITLE"]).handler(^(NSArray<NSString *> *strings) {
%orig;
});
make.button([[BHTBundle sharedBundle] localizedStringForKey:@"NO_BUTTON_TITLE"]).cancelStyle();
} showFrom:topMostController()];
} else {
return %orig;
}
}
%end
// MARK: Like confirm
%hook TTAStatusInlineFavoriteButton
- (void)didTap {
if ([BHTManager LikeConfirm]) {
[%c(FLEXAlert) makeAlert:^(FLEXAlert *make) {
make.message([[BHTBundle sharedBundle] localizedStringForKey:@"CONFIRM_ALERT_MESSAGE"]);
make.button([[BHTBundle sharedBundle] localizedStringForKey:@"YES_BUTTON_TITLE"]).handler(^(NSArray<NSString *> *strings) {
%orig;
});
make.button([[BHTBundle sharedBundle] localizedStringForKey:@"NO_BUTTON_TITLE"]).cancelStyle();
} showFrom:topMostController()];
} else {
return %orig;
}
}