Skip to content

Commit

Permalink
Merge pull request #582 from bhackel/feature/hide-home-tab
Browse files Browse the repository at this point in the history
Feature/hide home tab
  • Loading branch information
arichornlover authored May 2, 2024
2 parents 348ad8e + a752c59 commit 9716499
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 1 deletion.
1 change: 0 additions & 1 deletion Sources/YTReExplore.x
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#import <YouTubeHeader/YTIPivotBarRenderer.h>
#import <YouTubeHeader/YTIGuideResponse.h>
#import <YouTubeHeader/YTIGuideResponseSupportedRenderers.h>
#import <YouTubeHeader/YTIBrowseRequest.h>
Expand Down
8 changes: 8 additions & 0 deletions Sources/uYouPlus.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#import <YouTubeHeader/GPBMessage.h>
#import <YouTubeHeader/YTIStringRun.h>
#import <YouTubeHeader/YTWatchViewController.h>
#import <YouTubeHeader/YTIPivotBarRenderer.h>

// Hide buttons under the video player by @PoomSmart
#import <YouTubeHeader/ASCollectionElement.h>
Expand Down Expand Up @@ -61,6 +62,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;
Expand Down
35 changes: 35 additions & 0 deletions Sources/uYouPlus.xm
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,38 @@ static BOOL findCell(ASNodeController *nodeController, NSArray <NSString *> *ide
%end

// Miscellaneous

// Hide Home Tab - @bhackel
%group gHideHomeTab
%hook YTPivotBarView
- (void)setRenderer:(YTIPivotBarRenderer *)renderer {
// Iterate over each renderer item
NSLog(@"bhackel: setting renderer");
NSUInteger indexToRemove = -1;
NSMutableArray <YTIPivotBarSupportedRenderers *> *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

// YT startup animation
%hook YTColdConfig
- (BOOL)mainAppCoreClientIosEnableStartupAnimation {
Expand Down Expand Up @@ -1490,6 +1522,9 @@ static BOOL findCell(ASNodeController *nodeController, NSArray <NSString *> *ide
if (IS_ENABLED(@"uYouAdBlockingWorkaround_enabled")) {
%init(uYouAdBlockingWorkaround);
}
if (IS_ENABLED(@"hideHomeTab_enabled")) {
%init(gHideHomeTab);
}

// YTNoModernUI - @arichorn
BOOL ytNoModernUIEnabled = IS_ENABLED(@"ytNoModernUI_enabled");
Expand Down
2 changes: 2 additions & 0 deletions Sources/uYouPlusSettings.xm
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down

0 comments on commit 9716499

Please sign in to comment.