From ef153f5d9c77dbfb3cc21b5869b69497148ebcd6 Mon Sep 17 00:00:00 2001 From: qnblackcat Date: Sun, 26 Jun 2022 10:11:19 +0700 Subject: [PATCH] clean up --- uYouPlus.xm | 111 ++++++++++++++++++++++++++++------------------------ 1 file changed, 59 insertions(+), 52 deletions(-) diff --git a/uYouPlus.xm b/uYouPlus.xm index f834d5d..dfcd086 100644 --- a/uYouPlus.xm +++ b/uYouPlus.xm @@ -91,7 +91,6 @@ BOOL ytMiniPlayer() { if (hidePreviousAndNextButton()) { MSHookIvar(self, "_nextButton").hidden = YES; MSHookIvar(self, "_previousButton").hidden = YES; - // YouTube love beta testing :/ // MSHookIvar(self, "_nextButtonView").hidden = YES; // MSHookIvar(self, "_previousButtonView").hidden = YES; } @@ -239,7 +238,6 @@ BOOL ytMiniPlayer() { %end // Hide the download playlist button of uYou cuz it's broken ?! -// Why aren't you working?? :/ // %hook YTPlaylistHeaderViewController // - (void)viewDidLoad { // %orig; @@ -268,6 +266,7 @@ BOOL ytMiniPlayer() { } return %orig; } + %new - (void)removeShortsAndFeaturesAdsAtIndexPath:(NSIndexPath *)indexPath { [self deleteItemsAtIndexPaths:[NSArray arrayWithObject:indexPath]]; @@ -330,38 +329,35 @@ BOOL ytMiniPlayer() { %end # pragma mark - OLED dark mode by BandarHL - -UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0]; - %group gOLED %hook YTCommonColorPalette - (UIColor *)brandBackgroundSolid { if (self.pageStyle == 1) { - return oledColor; + return [UIColor blackColor]; } return %orig; } - (UIColor *)brandBackgroundPrimary { if (self.pageStyle == 1) { - return oledColor; + return [UIColor blackColor]; } return %orig; } - (UIColor *)brandBackgroundSecondary { if (self.pageStyle == 1) { - return oledColor; + return [UIColor blackColor]; } return %orig; } - (UIColor *)staticBrandBlack { if (self.pageStyle == 1) { - return oledColor; + return [UIColor blackColor]; } return %orig; } - (UIColor *)generalBackgroundA { if (self.pageStyle == 1) { - return oledColor; + return [UIColor blackColor]; } return %orig; } @@ -371,26 +367,26 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0]; %hook YTAccountPanelBodyViewController - (UIColor *)backgroundColor:(NSInteger)pageStyle { if (pageStyle == 1) { - return oledColor; + return [UIColor blackColor]; } return %orig; } %end -%hook YTInnerTubeCollectionViewController -- (UIColor *)backgroundColor:(NSInteger)pageStyle { - if (pageStyle == 1) { - return oledColor; - } - return %orig; -} -%end +// %hook YTInnerTubeCollectionViewController +// - (UIColor *)backgroundColor:(NSInteger)pageStyle { +// if (pageStyle == 1) { +// return [UIColor blackColor]; +// } +// return %orig; +// } +// %end // Explore %hook ASScrollView - (void)didMoveToWindow { - if (isDarkMode()) { - %orig; + %orig; + if (isDarkMode()) { self.backgroundColor = [UIColor clearColor]; } } @@ -399,8 +395,8 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0]; // Your videos %hook ASCollectionView - (void)didMoveToWindow { + %orig; if (isDarkMode() && [self.nextResponder isKindOfClass:%c(_ASDisplayView)]) { - %orig; self.superview.backgroundColor = [UIColor clearColor]; } } @@ -411,7 +407,7 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0]; - (void)viewDidLoad { if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) { %orig; - self.tableView.backgroundColor = oledColor; + self.tableView.backgroundColor = [UIColor blackColor]; } else { return %orig; } } %end @@ -420,7 +416,7 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0]; - (void)viewDidLoad { if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) { %orig; - self.view.backgroundColor = oledColor; + self.view.backgroundColor = [UIColor blackColor]; } else { return %orig; } } %end @@ -429,7 +425,7 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0]; %hook YTWatchMiniBarView - (void)setBackgroundColor:(UIColor *)color { if (isDarkMode()) { - return %orig([UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.9]); + return %orig([[UIColor blackColor] colorWithAlphaComponent:0.88]); } return %orig; } @@ -439,7 +435,7 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0]; %hook YTSearchBarView - (void)setBackgroundColor:(UIColor *)color { if (isDarkMode()) { - return %orig(oledColor); + return %orig([UIColor blackColor]); } return %orig; } @@ -449,7 +445,7 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0]; %hook YTSearchBoxView - (void)setBackgroundColor:(UIColor *)color { if (isDarkMode()) { - return %orig(oledColor); + return %orig([UIColor blackColor]); } return %orig; } @@ -459,7 +455,7 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0]; %hook YTCommentView - (void)setBackgroundColor:(UIColor *)color { if (isDarkMode()) { - return %orig(oledColor); + return %orig([UIColor blackColor]); } return %orig; } @@ -468,7 +464,7 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0]; %hook YTCreateCommentAccessoryView - (void)setBackgroundColor:(UIColor *)color { if (isDarkMode()) { - return %orig(oledColor); + return %orig([UIColor blackColor]); } return %orig; } @@ -477,7 +473,7 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0]; %hook YTCreateCommentTextView - (void)setBackgroundColor:(UIColor *)color { if (isDarkMode()) { - return %orig(oledColor); + return %orig([UIColor blackColor]); } return %orig; } @@ -489,6 +485,15 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0]; } %end +%hook YTCommentDetailHeaderCell +- (void)didMoveToWindow { + %orig; + if (isDarkMode()) { + self.subviews[2].backgroundColor = [UIColor blackColor]; + } +} +%end + %hook YTFormattedStringLabel // YT is werid... - (void)setBackgroundColor:(UIColor *)color { if (isDarkMode()) { @@ -502,7 +507,7 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0]; %hook YCHLiveChatActionPanelView - (void)setBackgroundColor:(UIColor *)color { if (isDarkMode()) { - return %orig(oledColor); + return %orig([UIColor blackColor]); } return %orig; } @@ -511,7 +516,7 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0]; %hook YTEmojiTextView - (void)setBackgroundColor:(UIColor *)color { if (isDarkMode()) { - return %orig(oledColor); + return %orig([UIColor blackColor]); } return %orig; } @@ -522,17 +527,17 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0]; - (void)didMoveToWindow { %orig; if (isDarkMode()) { - if ([self.nextResponder isKindOfClass:%c(ASScrollView)]) { self.backgroundColor = [UIColor clearColor]; } - if ([self.accessibilityIdentifier isEqualToString:@"eml.cvr"]) { self.backgroundColor = oledColor; } - if ([self.accessibilityIdentifier isEqualToString:@"rich_header"]) { self.backgroundColor = oledColor; } - if ([self.accessibilityIdentifier isEqualToString:@"id.ui.comment_cell"]) { self.backgroundColor = oledColor; } - if ([self.accessibilityIdentifier isEqualToString:@"id.ui.cancel.button"]) { self.superview.backgroundColor = oledColor; } - if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.comment_composer"]) { self.backgroundColor = oledColor; } - if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.video_list_entry"]) { self.backgroundColor = oledColor; } - if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.filter_chip_bar"]) { self.backgroundColor = oledColor; } - if ([self.accessibilityIdentifier isEqualToString:@"id.comment.guidelines_text"]) { self.superview.backgroundColor = oledColor; } - if ([self.accessibilityIdentifier isEqualToString:@"id.comment.channel_guidelines_bottom_sheet_container"]) { self.backgroundColor = oledColor; } - if ([self.accessibilityIdentifier isEqualToString:@"id.comment.channel_guidelines_entry_banner_container"]) { self.superview.backgroundColor = oledColor; } + if ([self.nextResponder isKindOfClass:%c(ASScrollView)]) { self.backgroundColor = [UIColor clearColor]; } + if ([self.accessibilityIdentifier isEqualToString:@"eml.cvr"]) { self.backgroundColor = [UIColor blackColor]; } + if ([self.accessibilityIdentifier isEqualToString:@"rich_header"]) { self.backgroundColor = [UIColor blackColor]; } + if ([self.accessibilityIdentifier isEqualToString:@"id.ui.comment_cell"]) { self.backgroundColor = [UIColor blackColor]; } + if ([self.accessibilityIdentifier isEqualToString:@"id.ui.cancel.button"]) { self.superview.backgroundColor = [UIColor blackColor]; } + if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.filter_chip_bar"]) { self.backgroundColor = [UIColor blackColor]; } + if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.comment_composer"]) { self.backgroundColor = [UIColor blackColor]; } + if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.video_list_entry"]) { self.backgroundColor = [UIColor blackColor]; } + if ([self.accessibilityIdentifier isEqualToString:@"id.comment.guidelines_text"]) { self.superview.backgroundColor = [UIColor blackColor]; } + if ([self.accessibilityIdentifier isEqualToString:@"id.comment.channel_guidelines_bottom_sheet_container"]) { self.backgroundColor = [UIColor blackColor]; } + if ([self.accessibilityIdentifier isEqualToString:@"id.comment.channel_guidelines_entry_banner_container"]) { self.backgroundColor = [UIColor blackColor]; } } } %end @@ -541,25 +546,27 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0]; %hook ASWAppSwitchingSheetHeaderView - (void)setBackgroundColor:(UIColor *)color { if (isDarkMode()) { - return %orig(oledColor); + return %orig([UIColor blackColor]); } + return %orig; } %end %hook ASWAppSwitchingSheetFooterView - (void)setBackgroundColor:(UIColor *)color { if (isDarkMode()) { - return %orig(oledColor); + return %orig([UIColor blackColor]); } + return %orig; } %end %hook ASWAppSwitcherCollectionViewCell - (void)didMoveToWindow { + %orig; if (isDarkMode()) { - %orig; - self.subviews[1].backgroundColor = oledColor; - self.superview.backgroundColor = oledColor; + self.subviews[1].backgroundColor = [UIColor blackColor]; + self.superview.backgroundColor = [UIColor blackColor]; } } %end @@ -570,28 +577,28 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0]; %hook UIPredictionViewController - (void)loadView { %orig; - [self.view setBackgroundColor:oledColor]; + [self.view setBackgroundColor:[UIColor blackColor]]; } %end %hook UICandidateViewController - (void)loadView { %orig; - [self.view setBackgroundColor:oledColor]; + [self.view setBackgroundColor:[UIColor blackColor]]; } %end %hook UIKeyboardDockView - (void)didMoveToWindow { %orig; - self.backgroundColor = oledColor; + self.backgroundColor = [UIColor blackColor]; } %end %hook UIKeyboardLayoutStar - (void)didMoveToWindow { %orig; - self.backgroundColor = oledColor; + self.backgroundColor = [UIColor blackColor]; } %end