From c52b282cd8f5f60c3f8426ef38aa3490b0eb8d76 Mon Sep 17 00:00:00 2001 From: Aaron Veil <70171475+anddea@users.noreply.github.com> Date: Wed, 23 Oct 2024 17:48:39 +0300 Subject: [PATCH] fix(YouTube - Hide feed components): `Hide carousel shelf` setting hides the library shelf --- .../patches/components/CarouselShelfFilter.java | 10 ++++++---- .../revanced/integrations/youtube/shared/PlayerType.kt | 6 +++--- .../revanced/integrations/youtube/shared/RootView.java | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/components/CarouselShelfFilter.java b/app/src/main/java/app/revanced/integrations/youtube/patches/components/CarouselShelfFilter.java index e9b3fa18..7618f269 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/patches/components/CarouselShelfFilter.java +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/components/CarouselShelfFilter.java @@ -5,10 +5,8 @@ import java.util.function.Supplier; import java.util.stream.Stream; -import app.revanced.integrations.shared.patches.components.ByteArrayFilterGroup; import app.revanced.integrations.shared.patches.components.Filter; import app.revanced.integrations.shared.patches.components.StringFilterGroup; -import app.revanced.integrations.shared.utils.Logger; import app.revanced.integrations.youtube.settings.Settings; import app.revanced.integrations.youtube.shared.NavigationBar.NavigationButton; import app.revanced.integrations.youtube.shared.RootView; @@ -18,7 +16,7 @@ public final class CarouselShelfFilter extends Filter { private static final String BROWSE_ID_HOME = "FEwhat_to_watch"; private static final String BROWSE_ID_LIBRARY = "FElibrary"; private static final String BROWSE_ID_NOTIFICATION = "FEactivity"; - private static final String BROWSE_ID_NOTIFICATION_INBOX = "FEsubscriptions_inbox"; + private static final String BROWSE_ID_NOTIFICATION_INBOX = "FEnotifications_inbox"; private static final String BROWSE_ID_PLAYLIST = "VLPL"; private static final String BROWSE_ID_SUBSCRIPTION = "FEsubscriptions"; @@ -56,7 +54,11 @@ public CarouselShelfFilter() { } private static boolean hideShelves() { - // If the search is active while library is selected, then filter. + // Must check player type first, as search bar can be active behind the player. + if (RootView.isPlayerActive()) { + return true; + } + // Must check second, as search can be from any tab. if (RootView.isSearchBarActive()) { return true; } diff --git a/app/src/main/java/app/revanced/integrations/youtube/shared/PlayerType.kt b/app/src/main/java/app/revanced/integrations/youtube/shared/PlayerType.kt index d9bb921d..85f2d4f9 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/shared/PlayerType.kt +++ b/app/src/main/java/app/revanced/integrations/youtube/shared/PlayerType.kt @@ -129,12 +129,12 @@ enum class PlayerType { /** * Check if the current player type is - * [WATCH_WHILE_MAXIMIZED], [WATCH_WHILE_FULLSCREEN], [WATCH_WHILE_SLIDING_MINIMIZED_MAXIMIZED], [WATCH_WHILE_SLIDING_MAXIMIZED_FULLSCREEN]. + * [WATCH_WHILE_MAXIMIZED], [WATCH_WHILE_FULLSCREEN], [WATCH_WHILE_SLIDING_MAXIMIZED_FULLSCREEN]. * * Useful to check if a regular video is being played. */ - fun isMaximizedOrFullscreenOrSliding(): Boolean { - return this == WATCH_WHILE_MAXIMIZED || this == WATCH_WHILE_FULLSCREEN || this == WATCH_WHILE_SLIDING_MINIMIZED_MAXIMIZED || this == WATCH_WHILE_SLIDING_MAXIMIZED_FULLSCREEN + fun isMaximizedOrFullscreen(): Boolean { + return this == WATCH_WHILE_MAXIMIZED || this == WATCH_WHILE_FULLSCREEN || this == WATCH_WHILE_SLIDING_MAXIMIZED_FULLSCREEN } /** diff --git a/app/src/main/java/app/revanced/integrations/youtube/shared/RootView.java b/app/src/main/java/app/revanced/integrations/youtube/shared/RootView.java index 06a2fc73..41e19f3e 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/shared/RootView.java +++ b/app/src/main/java/app/revanced/integrations/youtube/shared/RootView.java @@ -26,7 +26,7 @@ public static boolean isSearchBarActive() { } public static boolean isPlayerActive() { - return PlayerType.getCurrent().isMaximizedOrFullscreenOrSliding(); + return PlayerType.getCurrent().isMaximizedOrFullscreen(); } /**