From f39cd5daf0094aca3a28eb7b4947c899afe43e0e Mon Sep 17 00:00:00 2001 From: arichornlover <78001398+arichornlover@users.noreply.github.com> Date: Thu, 16 May 2024 21:41:20 -0500 Subject: [PATCH] New Option & Auto-Start Certain Tab Added a new Option called `Auto-Hide Home Indicator`. Added a way to auto-start to a certain tab. Closes #145 --- YTLitePlus.xm | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/YTLitePlus.xm b/YTLitePlus.xm index e385615..cc8669c 100644 --- a/YTLitePlus.xm +++ b/YTLitePlus.xm @@ -535,6 +535,45 @@ static NSData *cellDividerData = nil; %end // Miscellaneous +%group gAutoHideHomeBar // Auto-Hide Home Bar - @arichornlover +%hook UIViewController +- (BOOL)prefersHomeIndicatorAutoHidden { + return YES; +} +%end +%end + +BOOL selectedTabIndex = NO; + +%hook YTPivotBarViewController // https://github.com/LillieH001/YouTube-Reborn +- (void)viewDidAppear:(BOOL)animated { + %orig(); + if ([[NSUserDefaults standardUserDefaults] integerForKey:@"kStartupPageIntVTwo"]) { + int selectedTab = [[NSUserDefaults standardUserDefaults] integerForKey:@"kStartupPageIntVTwo"]; + if (selectedTab == 0 && !selectedTabIndex) { + [self selectItemWithPivotIdentifier:@"FEwhat_to_watch"]; + selectedTabIndex = YES; + } + if (selectedTab == 1 && !selectedTabIndex) { + [self selectItemWithPivotIdentifier:@"FEexplore"]; + selectedTabIndex = YES; + } + if (selectedTab == 2 && !selectedTabIndex) { + [self selectItemWithPivotIdentifier:@"FEshorts"]; + selectedTabIndex = YES; + } + if (selectedTab == 3 && !selectedTabIndex) { + [self selectItemWithPivotIdentifier:@"FEsubscriptions"]; + selectedTabIndex = YES; + } + if (selectedTab == 4 && !selectedTabIndex) { + [self selectItemWithPivotIdentifier:@"FElibrary"]; + selectedTabIndex = YES; + } + } +} +%end + %group giPadLayout // https://github.com/LillieH001/YouTube-Reborn %hook UIDevice - (long long)userInterfaceIdiom {