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] 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