Skip to content

Commit

Permalink
fix(YouTube - Hide feed components): Hide carousel shelf setting hi…
Browse files Browse the repository at this point in the history
…des the library shelf
  • Loading branch information
anddea committed Oct 23, 2024
1 parent 91d8c3c commit c52b282
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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";

Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static boolean isSearchBarActive() {
}

public static boolean isPlayerActive() {
return PlayerType.getCurrent().isMaximizedOrFullscreenOrSliding();
return PlayerType.getCurrent().isMaximizedOrFullscreen();
}

/**
Expand Down

0 comments on commit c52b282

Please sign in to comment.