From b2fe105199d4a5958676cbc8f9c701541e8ff24a Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Thu, 4 Apr 2024 10:46:54 +0400 Subject: [PATCH] fix(YouTube - Player flyout menu): Add hide Lock screen menu (#609) --- .../components/PlayerFlyoutMenuItemsFilter.java | 16 +++++++++++++--- .../integrations/youtube/settings/Settings.java | 3 ++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/components/PlayerFlyoutMenuItemsFilter.java b/app/src/main/java/app/revanced/integrations/youtube/patches/components/PlayerFlyoutMenuItemsFilter.java index 19ccfac5ce..7099bf2f5e 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/patches/components/PlayerFlyoutMenuItemsFilter.java +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/components/PlayerFlyoutMenuItemsFilter.java @@ -57,6 +57,10 @@ public PlayerFlyoutMenuItemsFilter() { Settings.HIDE_MORE_INFO_MENU, "yt_outline_info_circle" ), + new ByteArrayFilterGroup( + Settings.HIDE_LOCK_SCREEN_MENU, + "yt_outline_lock" + ), new ByteArrayFilterGroup( Settings.HIDE_SPEED_MENU, "yt_outline_play_arrow_half_circle" @@ -75,15 +79,21 @@ public PlayerFlyoutMenuItemsFilter() { @Override boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBufferArray, StringFilterGroup matchedGroup, FilterContentType contentType, int contentIndex) { + // Only 1 path callback was added, so the matched group must be the overflow menu. + if (contentIndex != 0) { + return false; // Overflow menu is always the start of the path. + } + // Shorts also use this player flyout panel - if (PlayerType.getCurrent().isNoneOrHidden() || exception.check(protobufBufferArray).isFiltered()) + if (PlayerType.getCurrent().isNoneOrHidden() || exception.check(protobufBufferArray).isFiltered()) { return false; + } - // Only 1 path callback was added, so the matched group must be the overflow menu. - if (contentIndex == 0 && flyoutFilterGroupList.check(protobufBufferArray).isFiltered()) { + if (flyoutFilterGroupList.check(protobufBufferArray).isFiltered()) { // Super class handles logging. return super.isFiltered(identifier, path, protobufBufferArray, matchedGroup, contentType, contentIndex); } + return false; } } diff --git a/app/src/main/java/app/revanced/integrations/youtube/settings/Settings.java b/app/src/main/java/app/revanced/integrations/youtube/settings/Settings.java index 1297d96589..75b03d51a7 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/settings/Settings.java +++ b/app/src/main/java/app/revanced/integrations/youtube/settings/Settings.java @@ -198,6 +198,7 @@ public class Settings extends BaseSettings { public static final BooleanSetting HIDE_HELP_MENU = new BooleanSetting("revanced_hide_player_flyout_help", TRUE); public static final BooleanSetting HIDE_SPEED_MENU = new BooleanSetting("revanced_hide_player_flyout_speed", FALSE); public static final BooleanSetting HIDE_MORE_INFO_MENU = new BooleanSetting("revanced_hide_player_flyout_more_info", TRUE); + public static final BooleanSetting HIDE_LOCK_SCREEN_MENU = new BooleanSetting("revanced_hide_player_flyout_lock_screen", FALSE); public static final BooleanSetting HIDE_AUDIO_TRACK_MENU = new BooleanSetting("revanced_hide_player_flyout_audio_track", FALSE); public static final BooleanSetting HIDE_WATCH_IN_VR_MENU = new BooleanSetting("revanced_hide_player_flyout_watch_in_vr", TRUE); @@ -218,7 +219,7 @@ public class Settings extends BaseSettings { public static final BooleanSetting SPOOF_DEVICE_DIMENSIONS = new BooleanSetting("revanced_spoof_device_dimensions", FALSE, true); public static final BooleanSetting BYPASS_URL_REDIRECTS = new BooleanSetting("revanced_bypass_url_redirects", TRUE); public static final BooleanSetting ANNOUNCEMENTS = new BooleanSetting("revanced_announcements", TRUE); - @Deprecated + @Deprecated public static final StringSetting DEPRECATED_ANNOUNCEMENT_LAST_HASH = new StringSetting("revanced_announcement_last_hash", ""); public static final IntegerSetting ANNOUNCEMENT_LAST_ID = new IntegerSetting("revanced_announcement_last_id", -1); public static final BooleanSetting REMOVE_TRACKING_QUERY_PARAMETER = new BooleanSetting("revanced_remove_tracking_query_parameter", TRUE);