mirror of
https://github.com/revanced/revanced-integrations.git
synced 2025-01-23 18:27:32 +01:00
fix(YouTube - Player flyout menu): Restore functionality (#502)
This commit is contained in:
parent
1b29b7e11d
commit
c048527dc0
@ -6,26 +6,38 @@ import androidx.annotation.Nullable;
|
|||||||
import androidx.annotation.RequiresApi;
|
import androidx.annotation.RequiresApi;
|
||||||
|
|
||||||
import app.revanced.integrations.settings.SettingsEnum;
|
import app.revanced.integrations.settings.SettingsEnum;
|
||||||
|
import app.revanced.integrations.shared.PlayerType;
|
||||||
|
|
||||||
public class PlayerFlyoutMenuItemsFilter extends Filter {
|
public class PlayerFlyoutMenuItemsFilter extends Filter {
|
||||||
|
|
||||||
// Search the buffer only if the flyout menu identifier is found.
|
// Search the buffer only if the flyout menu path is found.
|
||||||
// Handle the searching in this class instead of adding to the global filter group (which searches all the time)
|
// Handle the searching in this class instead of adding to the global filter group (which searches all the time)
|
||||||
private final ByteArrayFilterGroupList flyoutFilterGroupList = new ByteArrayFilterGroupList();
|
private final ByteArrayFilterGroupList flyoutFilterGroupList = new ByteArrayFilterGroupList();
|
||||||
|
|
||||||
|
private final ByteArrayFilterGroup exception;
|
||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||||
public PlayerFlyoutMenuItemsFilter() {
|
public PlayerFlyoutMenuItemsFilter() {
|
||||||
identifierFilterGroupList.addAll(new StringFilterGroup(null, "overflow_menu_item.eml|"));
|
exception = new ByteArrayAsStringFilterGroup(
|
||||||
|
// Whitelist Quality menu item when "Hide Additional settings menu" is enabled
|
||||||
|
SettingsEnum.HIDE_ADDITIONAL_SETTINGS_MENU,
|
||||||
|
"quality_sheet"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Using pathFilterGroupList due to new flyout panel(A/B)
|
||||||
|
pathFilterGroupList.addAll(
|
||||||
|
new StringFilterGroup(null, "overflow_menu_item.eml|")
|
||||||
|
);
|
||||||
|
|
||||||
flyoutFilterGroupList.addAll(
|
flyoutFilterGroupList.addAll(
|
||||||
new ByteArrayAsStringFilterGroup(
|
|
||||||
SettingsEnum.HIDE_QUALITY_MENU,
|
|
||||||
"yt_outline_gear"
|
|
||||||
),
|
|
||||||
new ByteArrayAsStringFilterGroup(
|
new ByteArrayAsStringFilterGroup(
|
||||||
SettingsEnum.HIDE_CAPTIONS_MENU,
|
SettingsEnum.HIDE_CAPTIONS_MENU,
|
||||||
"closed_caption"
|
"closed_caption"
|
||||||
),
|
),
|
||||||
|
new ByteArrayAsStringFilterGroup(
|
||||||
|
SettingsEnum.HIDE_ADDITIONAL_SETTINGS_MENU,
|
||||||
|
"yt_outline_gear"
|
||||||
|
),
|
||||||
new ByteArrayAsStringFilterGroup(
|
new ByteArrayAsStringFilterGroup(
|
||||||
SettingsEnum.HIDE_LOOP_VIDEO_MENU,
|
SettingsEnum.HIDE_LOOP_VIDEO_MENU,
|
||||||
"yt_outline_arrow_repeat_1_"
|
"yt_outline_arrow_repeat_1_"
|
||||||
@ -64,6 +76,10 @@ public class PlayerFlyoutMenuItemsFilter extends Filter {
|
|||||||
@Override
|
@Override
|
||||||
boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBufferArray,
|
boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBufferArray,
|
||||||
FilterGroupList matchedList, FilterGroup matchedGroup, int matchedIndex) {
|
FilterGroupList matchedList, FilterGroup matchedGroup, int matchedIndex) {
|
||||||
|
// Shorts also use this player flyout panel
|
||||||
|
if (PlayerType.getCurrent().isNoneOrHidden() || exception.check(protobufBufferArray).isFiltered())
|
||||||
|
return false;
|
||||||
|
|
||||||
// Only 1 group is added to the parent class, so the matched group must be the overflow menu.
|
// Only 1 group is added to the parent class, so the matched group must be the overflow menu.
|
||||||
if (matchedIndex == 0 && flyoutFilterGroupList.check(protobufBufferArray).isFiltered()) {
|
if (matchedIndex == 0 && flyoutFilterGroupList.check(protobufBufferArray).isFiltered()) {
|
||||||
// Super class handles logging.
|
// Super class handles logging.
|
||||||
|
@ -155,8 +155,8 @@ public enum SettingsEnum {
|
|||||||
ALT_THUMBNAIL_FAST_QUALITY("revanced_alt_thumbnail_fast_quality", BOOLEAN, FALSE, parents(ALT_THUMBNAIL)),
|
ALT_THUMBNAIL_FAST_QUALITY("revanced_alt_thumbnail_fast_quality", BOOLEAN, FALSE, parents(ALT_THUMBNAIL)),
|
||||||
|
|
||||||
//Player flyout menu items
|
//Player flyout menu items
|
||||||
HIDE_QUALITY_MENU("revanced_hide_player_flyout_quality", BOOLEAN, FALSE),
|
|
||||||
HIDE_CAPTIONS_MENU("revanced_hide_player_flyout_captions", BOOLEAN, FALSE),
|
HIDE_CAPTIONS_MENU("revanced_hide_player_flyout_captions", BOOLEAN, FALSE),
|
||||||
|
HIDE_ADDITIONAL_SETTINGS_MENU("revanced_hide_player_flyout_additional_settings", BOOLEAN, FALSE),
|
||||||
HIDE_LOOP_VIDEO_MENU("revanced_hide_player_flyout_loop_video", BOOLEAN, FALSE),
|
HIDE_LOOP_VIDEO_MENU("revanced_hide_player_flyout_loop_video", BOOLEAN, FALSE),
|
||||||
HIDE_AMBIENT_MODE_MENU("revanced_hide_player_flyout_ambient_mode", BOOLEAN, FALSE),
|
HIDE_AMBIENT_MODE_MENU("revanced_hide_player_flyout_ambient_mode", BOOLEAN, FALSE),
|
||||||
HIDE_REPORT_MENU("revanced_hide_player_flyout_report", BOOLEAN, TRUE),
|
HIDE_REPORT_MENU("revanced_hide_player_flyout_report", BOOLEAN, TRUE),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user