Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
qnblackcat committed Jun 26, 2022
1 parent 4258986 commit ef153f5
Showing 1 changed file with 59 additions and 52 deletions.
111 changes: 59 additions & 52 deletions uYouPlus.xm
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ BOOL ytMiniPlayer() {
if (hidePreviousAndNextButton()) {
MSHookIvar<YTMainAppControlsOverlayView *>(self, "_nextButton").hidden = YES;
MSHookIvar<YTMainAppControlsOverlayView *>(self, "_previousButton").hidden = YES;
// YouTube love beta testing :/
// MSHookIvar<YTTransportControlsButtonView *>(self, "_nextButtonView").hidden = YES;
// MSHookIvar<YTTransportControlsButtonView *>(self, "_previousButtonView").hidden = YES;
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -268,6 +266,7 @@ BOOL ytMiniPlayer() {
}
return %orig;
}

%new
- (void)removeShortsAndFeaturesAdsAtIndexPath:(NSIndexPath *)indexPath {
[self deleteItemsAtIndexPaths:[NSArray arrayWithObject:indexPath]];
Expand Down Expand Up @@ -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;
}
Expand All @@ -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];
}
}
Expand All @@ -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];
}
}
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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()) {
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down

0 comments on commit ef153f5

Please sign in to comment.