-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathCercubePlus.x
129 lines (100 loc) · 3.45 KB
/
CercubePlus.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
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
// NOYTPremium: https://github.com/PoomSmart/NoYTPremium
%hook YTCommerceEventGroupHandler
- (void)addEventHandlers {}
%end
%hook YTInterstitialPromoEventGroupHandler
- (void)addEventHandlers {}
%end
%hook YTIShowFullscreenInterstitialCommand
- (BOOL)shouldThrottleInterstitial { return YES; }
%end
%hook YTPromoThrottleController
- (BOOL)canShowThrottledPromo { return NO; }
- (BOOL)canShowThrottledPromoWithFrequencyCap:(id)frequencyCap { return NO; }
%end
%hook YTSurveyController
- (void)showSurveyWithRenderer:(id)arg1 surveyParentResponder:(id)arg2 {}
%end
// YTABGoodies: https://poomsmart.github.io/repo/depictions/ytabgoodies.html
// YouAreThere
%hook YTColdConfig
- (BOOL)enableYouthereCommandsOnIos {
return NO;
}
%end
%hook YTYouThereController
- (BOOL)shouldShowYouTherePrompt {
return NO;
}
%end
// YouRememberCaption
%hook YTColdConfig
- (BOOL)respectDeviceCaptionSetting {
return NO;
}
%end
// YTNOCheckLocalNetWork
%hook YTHotConfig
- (BOOL)isPromptForLocalNetworkPermissionsEnabled {
return NO;
}
%end
// YTSystemAppearance
%hook YTColdConfig
- (BOOL)shouldUseAppThemeSetting {
return YES;
}
%end
// YTClassicVideoQuality: https://poomsmart.github.io/repo/depictions/ytclassicvideoquality.html
@interface YTVideoQualitySwitchOriginalController : NSObject
- (instancetype)initWithParentResponder:(id)responder;
@end
%hook YTVideoQualitySwitchControllerFactory
- (id)videoQualitySwitchControllerWithParentResponder:(id)responder {
Class originalClass = %c(YTVideoQualitySwitchOriginalController);
return originalClass ? [[originalClass alloc] initWithParentResponder:responder] : %orig;
}
%end
// YTNoHoverCards 0.0.3: https://github.com/level3tjg/YTNoHoverCards
@interface YTCollectionViewCell : UICollectionViewCell
@end
@interface YTSettingsCell : YTCollectionViewCell
@end
@interface YTSettingsSectionItem : NSObject
@property BOOL hasSwitch;
@property BOOL switchVisible;
@property BOOL on;
@property BOOL (^switchBlock)(YTSettingsCell *, BOOL);
@property int settingItemId;
- (instancetype)initWithTitle:(NSString *)title titleDescription:(NSString *)titleDescription;
@end
%hook YTSettingsViewController
- (void)setSectionItems:(NSMutableArray <YTSettingsSectionItem *>*)sectionItems forCategory:(NSInteger)category title:(NSString *)title titleDescription:(NSString *)titleDescription headerHidden:(BOOL)headerHidden {
if (category == 1) {
NSInteger appropriateIdx = [sectionItems indexOfObjectPassingTest:^BOOL(YTSettingsSectionItem *item, NSUInteger idx, BOOL *stop) {
return item.settingItemId == 294;
}];
if (appropriateIdx != NSNotFound) {
YTSettingsSectionItem *hoverCardItem = [[%c(YTSettingsSectionItem) alloc] initWithTitle:@"Show End screens hover cards" titleDescription:@"Allows creator End screens (thumbnails) to appear at the end of videos"];
hoverCardItem.hasSwitch = YES;
hoverCardItem.switchVisible = YES;
hoverCardItem.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"hover_cards_enabled"];
hoverCardItem.switchBlock = ^BOOL (YTSettingsCell *cell, BOOL enabled) {
[[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"hover_cards_enabled"];
return YES;
};
[sectionItems insertObject:hoverCardItem atIndex:appropriateIdx + 1];
}
}
%orig;
}
%end
%hook YTCreatorEndscreenView
- (void)setHidden:(BOOL)hidden {
if (![[NSUserDefaults standardUserDefaults] boolForKey:@"hover_cards_enabled"])
hidden = YES;
%orig;
}
%end