From 915aac43d2a8743d93d6b1dc102bd5957ac0c57a Mon Sep 17 00:00:00 2001 From: Bryce Hackel <34104885+bhackel@users.noreply.github.com> Date: Tue, 30 Apr 2024 09:24:15 -0700 Subject: [PATCH 1/2] Hide home tab option --- Sources/uYouPlus.h | 7 +++++++ Sources/uYouPlus.xm | 21 +++++++++++++++++++++ Sources/uYouPlusSettings.xm | 2 ++ 3 files changed, 30 insertions(+) diff --git a/Sources/uYouPlus.h b/Sources/uYouPlus.h index 60176a8..bf5d832 100644 --- a/Sources/uYouPlus.h +++ b/Sources/uYouPlus.h @@ -61,6 +61,13 @@ @property (nonatomic, strong) UIView *scrimOverlay; @end +// Hide Home Tab - @bhackel +@interface YTPivotBarItemViewAccessibilityControl : UIControl +@end +@interface YTPivotBarItemView (uYouEnhanced) +@property (nonatomic, strong) YTPivotBarItemViewAccessibilityControl *hitTarget; +@end + // YTTapToSeek - https://github.com/bhackel/YTTapToSeek @interface YTMainAppVideoPlayerOverlayViewController : UIViewController - (CGFloat)totalTime; diff --git a/Sources/uYouPlus.xm b/Sources/uYouPlus.xm index 9d1746a..ade4fc8 100644 --- a/Sources/uYouPlus.xm +++ b/Sources/uYouPlus.xm @@ -1222,6 +1222,24 @@ static BOOL findCell(ASNodeController *nodeController, NSArray *ide %end // Miscellaneous + +// Hide Home Tab - @bhackel +%group gHideHomeTab +%hook YTPivotBarItemView +- (void)layoutSubviews { + %orig; + // Check if this is the home tab button + YTPivotBarItemViewAccessibilityControl *hitTarget = self.hitTarget; + if (!self.hidden && [hitTarget.accessibilityIdentifier isEqualToString:@"id.ui.pivotbar.FEwhat_to_watch.button"]) { + // Hide the home tab button + self.hidden = YES; + self.frame = CGRectZero; + [self removeFromSuperview]; + } +} +%end +%end + // YT startup animation %hook YTColdConfig - (BOOL)mainAppCoreClientIosEnableStartupAnimation { @@ -1490,6 +1508,9 @@ static BOOL findCell(ASNodeController *nodeController, NSArray *ide if (IS_ENABLED(@"uYouAdBlockingWorkaround_enabled")) { %init(uYouAdBlockingWorkaround); } + if (IS_ENABLED(@"hideHomeTab_enabled")) { + %init(gHideHomeTab); + } // YTNoModernUI - @arichorn BOOL ytNoModernUIEnabled = IS_ENABLED(@"ytNoModernUI_enabled"); diff --git a/Sources/uYouPlusSettings.xm b/Sources/uYouPlusSettings.xm index 7c65317..78f4dea 100644 --- a/Sources/uYouPlusSettings.xm +++ b/Sources/uYouPlusSettings.xm @@ -332,6 +332,8 @@ extern NSBundle *uYouPlusBundle(); # pragma mark - UI interface options SECTION_HEADER(LOC(@"UI Interface Options")); + SWITCH_ITEM2(LOC(@"Hide Home Tab"), LOC(@""), @"hideHomeTab_enabled"); + YTSettingsSectionItem *lowContrastMode = [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"Low Contrast Mode") titleDescription:LOC(@"This will lower the contrast of texts and buttons, similar to the old YouTube Interface. App restart is required.") From a752c59d60258260d8affcb5b33cf300686c66ff Mon Sep 17 00:00:00 2001 From: Bryce Hackel <34104885+bhackel@users.noreply.github.com> Date: Wed, 1 May 2024 13:34:19 -0700 Subject: [PATCH 2/2] Use renderer method to remove empty space --- Sources/YTReExplore.x | 1 - Sources/uYouPlus.h | 1 + Sources/uYouPlus.xm | 34 ++++++++++++++++++++++++---------- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/Sources/YTReExplore.x b/Sources/YTReExplore.x index e7f329d..070f426 100644 --- a/Sources/YTReExplore.x +++ b/Sources/YTReExplore.x @@ -1,4 +1,3 @@ -#import #import #import #import diff --git a/Sources/uYouPlus.h b/Sources/uYouPlus.h index bf5d832..7bbe66b 100644 --- a/Sources/uYouPlus.h +++ b/Sources/uYouPlus.h @@ -34,6 +34,7 @@ #import #import #import +#import // Hide buttons under the video player by @PoomSmart #import diff --git a/Sources/uYouPlus.xm b/Sources/uYouPlus.xm index ade4fc8..b0102a9 100644 --- a/Sources/uYouPlus.xm +++ b/Sources/uYouPlus.xm @@ -1225,17 +1225,31 @@ static BOOL findCell(ASNodeController *nodeController, NSArray *ide // Hide Home Tab - @bhackel %group gHideHomeTab -%hook YTPivotBarItemView -- (void)layoutSubviews { - %orig; - // Check if this is the home tab button - YTPivotBarItemViewAccessibilityControl *hitTarget = self.hitTarget; - if (!self.hidden && [hitTarget.accessibilityIdentifier isEqualToString:@"id.ui.pivotbar.FEwhat_to_watch.button"]) { - // Hide the home tab button - self.hidden = YES; - self.frame = CGRectZero; - [self removeFromSuperview]; +%hook YTPivotBarView +- (void)setRenderer:(YTIPivotBarRenderer *)renderer { + // Iterate over each renderer item + NSLog(@"bhackel: setting renderer"); + NSUInteger indexToRemove = -1; + NSMutableArray *itemsArray = renderer.itemsArray; + NSLog(@"bhackel: starting loop"); + for (NSUInteger i = 0; i < itemsArray.count; i++) { + NSLog(@"bhackel: iterating index %lu", (unsigned long)i); + YTIPivotBarSupportedRenderers *item = itemsArray[i]; + // Check if this is the home tab button + NSLog(@"bhackel: checking identifier"); + YTIPivotBarItemRenderer *pivotBarItemRenderer = item.pivotBarItemRenderer; + NSString *pivotIdentifier = pivotBarItemRenderer.pivotIdentifier; + if ([pivotIdentifier isEqualToString:@"FEwhat_to_watch"]) { + NSLog(@"bhackel: removing home tab button"); + // Remove the home tab button + indexToRemove = i; + break; + } } + if (indexToRemove != -1) { + [itemsArray removeObjectAtIndex:indexToRemove]; + } + %orig; } %end %end