remove unnecessary codes

This commit is contained in:
qnblackcat
2022-06-09 07:14:47 +07:00
parent 4bfb78634f
commit 6520ae2d53
+56 -77
View File
@@ -57,7 +57,7 @@ BOOL ytMiniPlayer() {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"ytMiniPlayer_enabled"]; return [[NSUserDefaults standardUserDefaults] boolForKey:@"ytMiniPlayer_enabled"];
} }
// Tweaks # pragma mark - Tweaks
// YTMiniPlayerEnabler: https://github.com/level3tjg/YTMiniplayerEnabler/ // YTMiniPlayerEnabler: https://github.com/level3tjg/YTMiniplayerEnabler/
%hook YTWatchMiniBarViewController %hook YTWatchMiniBarViewController
- (void)updateMiniBarPlayerStateFromRenderer { - (void)updateMiniBarPlayerStateFromRenderer {
@@ -211,16 +211,26 @@ BOOL ytMiniPlayer() {
- (BOOL)shouldEnablePlayerBar { return YES; } - (BOOL)shouldEnablePlayerBar { return YES; }
%end %end
// Hide the download playlist button of uYou cuz it's broken ?! /*
// Why aren't you working?? :/ Hide the download playlist button of uYou cuz it's broken ?!
// %hook YTPlaylistHeaderViewController Why aren't you working?? :/
// - (void)viewDidLoad { %hook YTPlaylistHeaderViewController
// %orig; - (void)viewDidLoad {
// self.downloadsButton.hidden = YES; %orig;
// } self.downloadsButton.hidden = YES;
// %end }
%end
// IAmYouTube - https://github.com/PoomSmart/IAmYouTube/ Workaround for issue #54
%hook YTMainAppVideoPlayerOverlayViewController
- (void)updateRelatedVideos {
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"relatedVideosAtTheEndOfYTVideos"] == NO) {}
else { return %orig; }
}
%end
*/
# pragma mark - IAmYouTube - https://github.com/PoomSmart/IAmYouTube/
%hook YTVersionUtils %hook YTVersionUtils
+ (NSString *)appName { return YT_NAME; } + (NSString *)appName { return YT_NAME; }
+ (NSString *)appID { return YT_BUNDLE_ID; } + (NSString *)appID { return YT_BUNDLE_ID; }
@@ -275,15 +285,8 @@ BOOL ytMiniPlayer() {
} }
%end %end
// Workaround for issue #54 # pragma mark - OLED dark mode by BandarHL
// %hook YTMainAppVideoPlayerOverlayViewController
// - (void)updateRelatedVideos {
// if ([[NSUserDefaults standardUserDefaults] boolForKey:@"relatedVideosAtTheEndOfYTVideos"] == NO) {}
// else { return %orig; }
// }
// %end
// OLED dark mode by BandarHL
UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0]; UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
%group gOLED %group gOLED
@@ -358,44 +361,7 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
} }
%end %end
// uYou's page // iSponsorBlock
%hook DownloadedVC
- (UIColor *)ytBackgroundColor {
if (isDarkMode()) {
return oledColor;
}
return %orig;
}
%end
%hook DownloadsPagerVC
- (UIColor *)ytBackgroundColor {
if (isDarkMode()) {
return oledColor;
}
return %orig;
}
%end
%hook DownloadingVC
- (UIColor *)ytBackgroundColor {
if (isDarkMode()) {
return oledColor;
}
return %orig;
}
%end
%hook PlayerVC
- (UIColor *)ytBackgroundColor {
if (isDarkMode()) {
return oledColor;
}
return %orig;
}
%end
// SponsorBlock settings
%hook SponsorBlockSettingsController %hook SponsorBlockSettingsController
- (void)viewDidLoad { - (void)viewDidLoad {
if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) { if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
@@ -405,7 +371,16 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
} }
%end %end
// YT player %hook SponsorBlockViewController
- (void)viewDidLoad {
if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
%orig;
self.view.backgroundColor = oledColor;
} else { return %orig; }
}
%end
// YT Miniplayer
%hook YTWatchMiniBarView %hook YTWatchMiniBarView
- (void)setBackgroundColor:(UIColor *)color { - (void)setBackgroundColor:(UIColor *)color {
if (isDarkMode()) { if (isDarkMode()) {
@@ -419,7 +394,7 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
%hook YTSearchBarView %hook YTSearchBarView
- (void)setBackgroundColor:(UIColor *)color { - (void)setBackgroundColor:(UIColor *)color {
if (isDarkMode()) { if (isDarkMode()) {
return %orig (oledColor); return %orig(oledColor);
} }
return %orig; return %orig;
} }
@@ -428,17 +403,26 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
%hook YTSearchBoxView %hook YTSearchBoxView
- (void)setBackgroundColor:(UIColor *)color { - (void)setBackgroundColor:(UIColor *)color {
if (isDarkMode()) { if (isDarkMode()) {
return %orig (oledColor); return %orig(oledColor);
} }
return %orig; return %orig;
} }
%end %end
// Comment view // Comment view
%hook YTCommentView
- (void)setBackgroundColor:(UIColor *)color {
if (isDarkMode()) {
return %orig(oledColor);
}
return %orig;
}
%end
%hook YTCreateCommentAccessoryView // community reply comment %hook YTCreateCommentAccessoryView // community reply comment
- (void)setBackgroundColor:(UIColor *)color { - (void)setBackgroundColor:(UIColor *)color {
if (isDarkMode()) { if (isDarkMode()) {
return %orig (oledColor); return %orig(oledColor);
} }
return %orig; return %orig;
} }
@@ -447,13 +431,13 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
%hook YTCreateCommentTextView %hook YTCreateCommentTextView
- (void)setBackgroundColor:(UIColor *)color { - (void)setBackgroundColor:(UIColor *)color {
if (isDarkMode()) { if (isDarkMode()) {
return %orig (oledColor); return %orig(oledColor);
} }
return %orig; return %orig;
} }
- (void)setTextColor:(UIColor *)color { // fix black text in #Shorts video's comment - (void)setTextColor:(UIColor *)color { // fix black text in #Shorts video's comment
if (isDarkMode()) { if (isDarkMode()) {
return %orig ([UIColor whiteColor]); return %orig([UIColor whiteColor]);
} }
return %orig; return %orig;
} }
@@ -463,7 +447,7 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
- (void)didMoveToWindow { - (void)didMoveToWindow {
%orig; %orig;
if (isDarkMode()) { if (isDarkMode()) {
if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.comment_composer"] || [self.accessibilityIdentifier isEqualToString:@"id.elements.components.video_list_entry"] || [self.accessibilityIdentifier isEqualToString:@"id.elements.components.filter_chip_bar"]) { if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.comment_composer"] || [self.accessibilityIdentifier isEqualToString:@"id.elements.components.video_list_entry"] || [self.accessibilityIdentifier isEqualToString:@"id.elements.components.filter_chip_bar"] || [self.accessibilityIdentifier isEqualToString:@"id.ui.comment_cell"]) {
self.backgroundColor = oledColor; self.backgroundColor = oledColor;
} }
if ([self.accessibilityIdentifier isEqualToString:@"id.comment.guidelines_text"]) { if ([self.accessibilityIdentifier isEqualToString:@"id.comment.guidelines_text"]) {
@@ -476,7 +460,7 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
%hook YTFormattedStringLabel // YT is werid... %hook YTFormattedStringLabel // YT is werid...
- (void)setBackgroundColor:(UIColor *)color { - (void)setBackgroundColor:(UIColor *)color {
if (isDarkMode()) { if (isDarkMode()) {
return %orig ([UIColor clearColor]); return %orig([UIColor clearColor]);
} }
return %orig; return %orig;
} }
@@ -485,7 +469,7 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
%hook YCHLiveChatActionPanelView // live chat comment %hook YCHLiveChatActionPanelView // live chat comment
- (void)setBackgroundColor:(UIColor *)color { - (void)setBackgroundColor:(UIColor *)color {
if (isDarkMode()) { if (isDarkMode()) {
return %orig (oledColor); return %orig(oledColor);
} }
return %orig; return %orig;
} }
@@ -494,25 +478,17 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
%hook YTEmojiTextView // live chat comment %hook YTEmojiTextView // live chat comment
- (void)setBackgroundColor:(UIColor *)color { - (void)setBackgroundColor:(UIColor *)color {
if (isDarkMode()) { if (isDarkMode()) {
return %orig (oledColor); return %orig(oledColor);
} }
return %orig; return %orig;
} }
%end %end
// Separation lines
%hook YTCollectionSeparatorView
- (void)didMoveToWindow {
if (isDarkMode()) {}
else { return %orig; }
}
%end
// Open link with... // Open link with...
%hook ASWAppSwitchingSheetHeaderView %hook ASWAppSwitchingSheetHeaderView
- (void)setBackgroundColor:(UIColor *)color { - (void)setBackgroundColor:(UIColor *)color {
if (isDarkMode()) { if (isDarkMode()) {
return %orig (oledColor); return %orig(oledColor);
} }
} }
%end %end
@@ -520,7 +496,7 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
%hook ASWAppSwitchingSheetFooterView %hook ASWAppSwitchingSheetFooterView
- (void)setBackgroundColor:(UIColor *)color { - (void)setBackgroundColor:(UIColor *)color {
if (isDarkMode()) { if (isDarkMode()) {
return %orig (oledColor); return %orig(oledColor);
} }
} }
%end %end
@@ -535,7 +511,8 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
%end %end
%end %end
%group gOLEDKB // OLED keyboard by @ichitaso <3 - http://gist.github.com/ichitaso/935100fd53a26f18a9060f7195a1be0e # pragma mark - OLED keyboard by @ichitaso <3 - http://gist.github.com/ichitaso/935100fd53a26f18a9060f7195a1be0e
%group gOLEDKB
%hook UIPredictionViewController %hook UIPredictionViewController
- (void)loadView { - (void)loadView {
%orig; %orig;
@@ -628,6 +605,7 @@ static void replaceTab(YTIGuideResponse *response) {
%end %end
%end %end
// Tweak's bundle for Localizations support - @PoomSmart - https://github.com/PoomSmart/YouPiP/commit/aea2473f64c75d73cab713e1e2d5d0a77675024f
NSBundle *uYouPlusBundle() { NSBundle *uYouPlusBundle() {
static NSBundle *bundle = nil; static NSBundle *bundle = nil;
static dispatch_once_t onceToken; static dispatch_once_t onceToken;
@@ -638,6 +616,7 @@ NSBundle *uYouPlusBundle() {
return bundle; return bundle;
} }
# pragma mark - ctor
%ctor { %ctor {
%init; %init;
if (oled()) { if (oled()) {