From 43899908cec9432a73184df5778fc3c55af323ec Mon Sep 17 00:00:00 2001 From: arichorn <78001398+arichorn@users.noreply.github.com> Date: Tue, 11 Jul 2023 11:36:53 -0500 Subject: [PATCH] =?UTF-8?q?Re-added=20=E2=80=9CHide=20uYou=20Tab=E2=80=9D?= =?UTF-8?q?=20Option?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue #45 suggested to reinject the option but this time it should actually work. --- uYouPlus.xm | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/uYouPlus.xm b/uYouPlus.xm index 5bcd4ef..e42307b 100644 --- a/uYouPlus.xm +++ b/uYouPlus.xm @@ -510,6 +510,36 @@ BOOL isAd(id node) { %end %end +%group gHideuYouTab +%hook YTPivotBarView +- (void)setRenderer:(YTIPivotBarRenderer *)renderer { + NSMutableArray *items = [renderer itemsArray]; + + NSUInteger index = [items indexOfObjectPassingTest:^BOOL(YTIPivotBarSupportedRenderers *renderers, NSUInteger idx, BOOL *stop) { + return [[[renderers pivotBarItemRenderer] pivotIdentifier] isEqualToString:@"com.miro.uyou"]; + }]; + if (index != NSNotFound) { + [items removeObjectAtIndex:index]; + } + + %orig; +} +- (void)layoutSubviews { + %orig; + + NSMutableArray *items = [[self renderer] itemsArray]; + + NSUInteger index = [items indexOfObjectPassingTest:^BOOL(YTIPivotBarSupportedRenderers *renderers, NSUInteger idx, BOOL *stop) { + return [[[renderers pivotBarItemRenderer] pivotIdentifier] isEqualToString:@"com.miro.uyou"]; + }]; + if (index != NSNotFound) { + YTIPivotBarSupportedRenderers *renderers = [items objectAtIndex:index]; + [renderers setHidden:YES]; + } +} +%end +%end + # pragma mark - Hide Notification Button && SponsorBlock Button %hook YTRightNavigationButtons - (void)layoutSubviews { @@ -1452,6 +1482,9 @@ UIColor* raisedColor = [UIColor blackColor]; if (IsEnabled(@"hideHeatwaves_enabled")) { %init(gHideHeatwaves); } + if (IsEnabled(@"hideuYouTab_enabled")) { + %init(gHideuYouTab); + } if (IsEnabled(@"ytNoModernUI_enabled")) { %init(gYTNoModernUI); }