From 687d0e7d10741d9ce0b951bfde924d195c48bafb Mon Sep 17 00:00:00 2001 From: level3tjg Date: Tue, 5 Sep 2023 11:35:22 -0400 Subject: [PATCH] add toggle to hide play next in queue --- Settings.xm | 10 ++++++++++ lang/uYouPlus.bundle/en.lproj/Localizable.strings | 3 +++ .../uYouPlus.bundle/template.lproj/Localizable.strings | 3 +++ uYouPlus.xm | 5 ++++- 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Settings.xm b/Settings.xm index 7ff5dd9..0fa045d 100644 --- a/Settings.xm +++ b/Settings.xm @@ -365,6 +365,16 @@ extern NSBundle *uYouPlusBundle(); } settingItemId:0], + [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"HIDE_PLAY_NEXT_IN_QUEUE") + titleDescription:LOC(@"HIDE_PLAY_NEXT_IN_QUEUE_DESC") + accessibilityIdentifier:nil + switchOn:IsEnabled(@"hidePlayNextInQueue_enabled") + switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) { + [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"hidePlayNextInQueue_enabled"]; + return YES; + } + settingItemId:0], + [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"IPHONE_LAYOUT") titleDescription:LOC(@"IPHONE_LAYOUT_DESC") accessibilityIdentifier:nil diff --git a/lang/uYouPlus.bundle/en.lproj/Localizable.strings b/lang/uYouPlus.bundle/en.lproj/Localizable.strings index 83f0003..7e8984b 100644 --- a/lang/uYouPlus.bundle/en.lproj/Localizable.strings +++ b/lang/uYouPlus.bundle/en.lproj/Localizable.strings @@ -130,6 +130,9 @@ "HIDE_CHIP_BAR" = "Hide the Upper bar"; "HIDE_CHIP_BAR_DESC" = "Hide Upper bar in the Home feeds (Trends, Music, Gaming...) and Subscription feeds (All videos, Continue watching...)."; +"HIDE_PLAY_NEXT_IN_QUEUE" = "Hide \"Play next in queue\""; +"HIDE_PLAY_NEXT_IN_QUEUE_DESC" = "Hide the premium \"Play next in queue\" option in video context menus"; + "NEW_MINIPLAYER_STYLE" = "New mini player bar style (BigYTMiniPlayer)"; "NEW_MINIPLAYER_STYLE_DESC" = "App restart is required."; diff --git a/lang/uYouPlus.bundle/template.lproj/Localizable.strings b/lang/uYouPlus.bundle/template.lproj/Localizable.strings index e4cf7b6..0b3a1d9 100644 --- a/lang/uYouPlus.bundle/template.lproj/Localizable.strings +++ b/lang/uYouPlus.bundle/template.lproj/Localizable.strings @@ -145,6 +145,9 @@ https://github.com/PoomSmart/Return-YouTube-Dislikes/tree/main/layout/Library/Ap "HIDE_CHIP_BAR" = "Hide the Upper bar"; "HIDE_CHIP_BAR_DESC" = "Hide Upper bar in the Home feeds (Trends, Music, Gaming...) and Subscription feeds (All videos, Continue watching...)."; +"HIDE_PLAY_NEXT_IN_QUEUE" = "Hide \"Play next in queue\""; +"HIDE_PLAY_NEXT_IN_QUEUE_DESC" = "Hide the premium \"Play next in queue\" option in video context menus"; + "NEW_MINIPLAYER_STYLE" = "New mini player bar style (BigYTMiniPlayer)"; "NEW_MINIPLAYER_STYLE_DESC" = "App restart is required."; diff --git a/uYouPlus.xm b/uYouPlus.xm index fa9b3e2..cc78916 100644 --- a/uYouPlus.xm +++ b/uYouPlus.xm @@ -155,7 +155,7 @@ static BOOL oldDarkTheme() { // Remove “Play next in queue” from the menu (@PoomSmart) - qnblackcat/uYouPlus#1138 %hook YTMenuItemVisibilityHandler - (BOOL)shouldShowServiceItemRenderer:(YTIMenuConditionalServiceItemRenderer *)renderer { - return renderer.icon.iconType == 251 ? NO : %orig; + return IsEnabled(@"hidePlayNextInQueue_enabled") && renderer.icon.iconType == 251 ? NO : %orig; } %end @@ -1027,6 +1027,9 @@ UIColor* raisedColor = [UIColor colorWithRed:0.035 green:0.035 blue:0.035 alpha: // Change the default value of some options NSArray *allKeys = [[[NSUserDefaults standardUserDefaults] dictionaryRepresentation] allKeys]; + if (![allKeys containsObject:@"hidePlayNextInQueue_enabled"]) { + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"hidePlayNextInQueue_enabled"]; + } if (![allKeys containsObject:@"relatedVideosAtTheEndOfYTVideos"]) { [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"relatedVideosAtTheEndOfYTVideos"]; }