From f2363bc954567c42bfa0712e922492684d09c8a0 Mon Sep 17 00:00:00 2001
From: inotia00 <108592928+inotia00@users.noreply.github.com>
Date: Sun, 8 Dec 2024 18:10:57 +0900
Subject: [PATCH] feat(YouTube - Shorts components): Add `Hide in watch
history` setting
---
.../youtube/patches/components/ShortsShelfFilter.java | 7 ++++---
.../app/revanced/extension/youtube/settings/Settings.java | 2 +-
.../main/resources/youtube/settings/xml/revanced_prefs.xml | 1 +
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/extensions/shared/src/main/java/app/revanced/extension/youtube/patches/components/ShortsShelfFilter.java b/extensions/shared/src/main/java/app/revanced/extension/youtube/patches/components/ShortsShelfFilter.java
index 261c64621..113b07ec9 100644
--- a/extensions/shared/src/main/java/app/revanced/extension/youtube/patches/components/ShortsShelfFilter.java
+++ b/extensions/shared/src/main/java/app/revanced/extension/youtube/patches/components/ShortsShelfFilter.java
@@ -140,8 +140,9 @@ public final class ShortsShelfFilter extends Filter {
final boolean hideHomeAndRelatedVideos = Settings.HIDE_SHORTS_SHELF_HOME_RELATED_VIDEOS.get();
final boolean hideSubscriptions = Settings.HIDE_SHORTS_SHELF_SUBSCRIPTIONS.get();
final boolean hideSearch = Settings.HIDE_SHORTS_SHELF_SEARCH.get();
+ final boolean hideHistory = Settings.HIDE_SHORTS_SHELF_HISTORY.get();
- if (hideHomeAndRelatedVideos && hideSubscriptions && hideSearch) {
+ if (hideHomeAndRelatedVideos && hideSubscriptions && hideSearch && hideHistory) {
// Shorts suggestions can load in the background if a video is opened and
// then immediately minimized before any suggestions are loaded.
// In this state the player type will show minimized, which makes it not possible to
@@ -165,7 +166,7 @@ public final class ShortsShelfFilter extends Filter {
}
// Avoid checking navigation button status if all other Shorts should show.
- if (!hideHomeAndRelatedVideos && !hideSubscriptions) {
+ if (!hideHomeAndRelatedVideos && !hideSubscriptions && !hideHistory) {
return false;
}
@@ -175,7 +176,7 @@ public final class ShortsShelfFilter extends Filter {
switch (browseId) {
case BROWSE_ID_HISTORY, BROWSE_ID_LIBRARY, BROWSE_ID_NOTIFICATION_INBOX -> {
- return false;
+ return hideHistory;
}
case BROWSE_ID_SUBSCRIPTIONS -> {
return hideSubscriptions;
diff --git a/extensions/shared/src/main/java/app/revanced/extension/youtube/settings/Settings.java b/extensions/shared/src/main/java/app/revanced/extension/youtube/settings/Settings.java
index bdb78aaa5..8494aeb64 100644
--- a/extensions/shared/src/main/java/app/revanced/extension/youtube/settings/Settings.java
+++ b/extensions/shared/src/main/java/app/revanced/extension/youtube/settings/Settings.java
@@ -420,7 +420,7 @@ public class Settings extends BaseSettings {
public static final BooleanSetting HIDE_SHORTS_SHELF_HOME_RELATED_VIDEOS = new BooleanSetting("revanced_hide_shorts_shelf_home_related_videos", TRUE);
public static final BooleanSetting HIDE_SHORTS_SHELF_SUBSCRIPTIONS = new BooleanSetting("revanced_hide_shorts_shelf_subscriptions", TRUE);
public static final BooleanSetting HIDE_SHORTS_SHELF_SEARCH = new BooleanSetting("revanced_hide_shorts_shelf_search", TRUE);
- public static final BooleanSetting HIDE_SHORTS_SHELF_HISTORY = new BooleanSetting("revanced_hide_shorts_shelf_history", FALSE);
+ public static final BooleanSetting HIDE_SHORTS_SHELF_HISTORY = new BooleanSetting("revanced_hide_shorts_shelf_history", TRUE);
public static final IntegerSetting CHANGE_SHORTS_REPEAT_STATE = new IntegerSetting("revanced_change_shorts_repeat_state", 0);
// PreferenceScreen: Shorts - Shorts player components
diff --git a/patches/src/main/resources/youtube/settings/xml/revanced_prefs.xml b/patches/src/main/resources/youtube/settings/xml/revanced_prefs.xml
index 46657daca..c5fdf74e5 100644
--- a/patches/src/main/resources/youtube/settings/xml/revanced_prefs.xml
+++ b/patches/src/main/resources/youtube/settings/xml/revanced_prefs.xml
@@ -585,6 +585,7 @@
+
SETTINGS: SHORTS_COMPONENTS -->