Skip to content

Commit 9716499

Browse files
Merge pull request #582 from bhackel/feature/hide-home-tab
Feature/hide home tab
2 parents 348ad8e + a752c59 commit 9716499

File tree

4 files changed

+45
-1
lines changed

4 files changed

+45
-1
lines changed

Sources/YTReExplore.x

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#import <YouTubeHeader/YTIPivotBarRenderer.h>
21
#import <YouTubeHeader/YTIGuideResponse.h>
32
#import <YouTubeHeader/YTIGuideResponseSupportedRenderers.h>
43
#import <YouTubeHeader/YTIBrowseRequest.h>

Sources/uYouPlus.h

+8
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#import <YouTubeHeader/GPBMessage.h>
3535
#import <YouTubeHeader/YTIStringRun.h>
3636
#import <YouTubeHeader/YTWatchViewController.h>
37+
#import <YouTubeHeader/YTIPivotBarRenderer.h>
3738

3839
// Hide buttons under the video player by @PoomSmart
3940
#import <YouTubeHeader/ASCollectionElement.h>
@@ -61,6 +62,13 @@
6162
@property (nonatomic, strong) UIView *scrimOverlay;
6263
@end
6364

65+
// Hide Home Tab - @bhackel
66+
@interface YTPivotBarItemViewAccessibilityControl : UIControl
67+
@end
68+
@interface YTPivotBarItemView (uYouEnhanced)
69+
@property (nonatomic, strong) YTPivotBarItemViewAccessibilityControl *hitTarget;
70+
@end
71+
6472
// YTTapToSeek - https://github.com/bhackel/YTTapToSeek
6573
@interface YTMainAppVideoPlayerOverlayViewController : UIViewController
6674
- (CGFloat)totalTime;

Sources/uYouPlus.xm

+35
Original file line numberDiff line numberDiff line change
@@ -1222,6 +1222,38 @@ static BOOL findCell(ASNodeController *nodeController, NSArray <NSString *> *ide
12221222
%end
12231223

12241224
// Miscellaneous
1225+
1226+
// Hide Home Tab - @bhackel
1227+
%group gHideHomeTab
1228+
%hook YTPivotBarView
1229+
- (void)setRenderer:(YTIPivotBarRenderer *)renderer {
1230+
// Iterate over each renderer item
1231+
NSLog(@"bhackel: setting renderer");
1232+
NSUInteger indexToRemove = -1;
1233+
NSMutableArray <YTIPivotBarSupportedRenderers *> *itemsArray = renderer.itemsArray;
1234+
NSLog(@"bhackel: starting loop");
1235+
for (NSUInteger i = 0; i < itemsArray.count; i++) {
1236+
NSLog(@"bhackel: iterating index %lu", (unsigned long)i);
1237+
YTIPivotBarSupportedRenderers *item = itemsArray[i];
1238+
// Check if this is the home tab button
1239+
NSLog(@"bhackel: checking identifier");
1240+
YTIPivotBarItemRenderer *pivotBarItemRenderer = item.pivotBarItemRenderer;
1241+
NSString *pivotIdentifier = pivotBarItemRenderer.pivotIdentifier;
1242+
if ([pivotIdentifier isEqualToString:@"FEwhat_to_watch"]) {
1243+
NSLog(@"bhackel: removing home tab button");
1244+
// Remove the home tab button
1245+
indexToRemove = i;
1246+
break;
1247+
}
1248+
}
1249+
if (indexToRemove != -1) {
1250+
[itemsArray removeObjectAtIndex:indexToRemove];
1251+
}
1252+
%orig;
1253+
}
1254+
%end
1255+
%end
1256+
12251257
// YT startup animation
12261258
%hook YTColdConfig
12271259
- (BOOL)mainAppCoreClientIosEnableStartupAnimation {
@@ -1490,6 +1522,9 @@ static BOOL findCell(ASNodeController *nodeController, NSArray <NSString *> *ide
14901522
if (IS_ENABLED(@"uYouAdBlockingWorkaround_enabled")) {
14911523
%init(uYouAdBlockingWorkaround);
14921524
}
1525+
if (IS_ENABLED(@"hideHomeTab_enabled")) {
1526+
%init(gHideHomeTab);
1527+
}
14931528

14941529
// YTNoModernUI - @arichorn
14951530
BOOL ytNoModernUIEnabled = IS_ENABLED(@"ytNoModernUI_enabled");

Sources/uYouPlusSettings.xm

+2
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,8 @@ extern NSBundle *uYouPlusBundle();
332332
# pragma mark - UI interface options
333333
SECTION_HEADER(LOC(@"UI Interface Options"));
334334

335+
SWITCH_ITEM2(LOC(@"Hide Home Tab"), LOC(@""), @"hideHomeTab_enabled");
336+
335337
YTSettingsSectionItem *lowContrastMode = [YTSettingsSectionItemClass
336338
switchItemWithTitle:LOC(@"Low Contrast Mode")
337339
titleDescription:LOC(@"This will lower the contrast of texts and buttons, similar to the old YouTube Interface. App restart is required.")

0 commit comments

Comments
 (0)