feat(YouTube): add Player Flyout Menu patch (#416)

Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
Co-authored-by: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com>
This commit is contained in:
johnconner122 2023-07-30 14:51:16 +05:00 committed by GitHub
parent ac8de0a3b7
commit b2085aeebf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 75 additions and 10 deletions

View File

@ -1,9 +0,0 @@
package app.revanced.integrations.patches;
import app.revanced.integrations.settings.SettingsEnum;
public class HideWatchInVRPatch {
public static boolean hideWatchInVR() {
return SettingsEnum.HIDE_WATCH_IN_VR.getBoolean();
}
}

View File

@ -0,0 +1,63 @@
package app.revanced.integrations.patches.components;
import android.os.Build;
import androidx.annotation.RequiresApi;
import app.revanced.integrations.settings.SettingsEnum;
public class PlayerFlyoutMenuItemsFilter extends Filter {
@RequiresApi(api = Build.VERSION_CODES.N)
public PlayerFlyoutMenuItemsFilter() {
protobufBufferFilterGroups.addAll(
new ByteArrayAsStringFilterGroup(
SettingsEnum.HIDE_QUALITY_MENU,
"yt_outline_gear"
),
new ByteArrayAsStringFilterGroup(
SettingsEnum.HIDE_CAPTIONS_MENU,
"closed_caption"
),
new ByteArrayAsStringFilterGroup(
SettingsEnum.HIDE_LOOP_VIDEO_MENU,
"yt_outline_arrow_repeat_1_"
),
new ByteArrayAsStringFilterGroup(
SettingsEnum.HIDE_AMBIENT_MODE_MENU,
"yt_outline_screen_light"
),
new ByteArrayAsStringFilterGroup(
SettingsEnum.HIDE_REPORT_MENU,
"yt_outline_flag"
),
new ByteArrayAsStringFilterGroup(
SettingsEnum.HIDE_HELP_MENU,
"yt_outline_question_circle"
),
new ByteArrayAsStringFilterGroup(
SettingsEnum.HIDE_MORE_INFO_MENU,
"yt_outline_info_circle"
),
new ByteArrayAsStringFilterGroup(
SettingsEnum.HIDE_SPEED_MENU,
"yt_outline_play_arrow_half_circle"
),
new ByteArrayAsStringFilterGroup(
SettingsEnum.HIDE_AUDIO_TRACK_MENU,
"yt_outline_person_radar"
),
new ByteArrayAsStringFilterGroup(
SettingsEnum.HIDE_WATCH_IN_VR_MENU,
"yt_outline_vr"
)
);
}
@Override
boolean isFiltered(String path, String identifier, byte[] _protobufBufferArray) {
if (identifier != null && identifier.startsWith("overflow_menu_item.eml|"))
return super.isFiltered(path, identifier, _protobufBufferArray);
return false;
}
}

View File

@ -124,7 +124,6 @@ public enum SettingsEnum {
HIDE_SUBSCRIPTIONS_BUTTON("revanced_hide_subscriptions_button", BOOLEAN, FALSE, true), HIDE_SUBSCRIPTIONS_BUTTON("revanced_hide_subscriptions_button", BOOLEAN, FALSE, true),
HIDE_TIMESTAMP("revanced_hide_timestamp", BOOLEAN, FALSE), HIDE_TIMESTAMP("revanced_hide_timestamp", BOOLEAN, FALSE),
HIDE_VIDEO_WATERMARK("revanced_hide_video_watermark", BOOLEAN, TRUE), HIDE_VIDEO_WATERMARK("revanced_hide_video_watermark", BOOLEAN, TRUE),
HIDE_WATCH_IN_VR("revanced_hide_watch_in_vr", BOOLEAN, FALSE, true),
PLAYER_POPUP_PANELS("revanced_hide_player_popup_panels", BOOLEAN, FALSE), PLAYER_POPUP_PANELS("revanced_hide_player_popup_panels", BOOLEAN, FALSE),
SWITCH_CREATE_WITH_NOTIFICATIONS_BUTTON("revanced_switch_create_with_notifications_button", BOOLEAN, TRUE, true), SWITCH_CREATE_WITH_NOTIFICATIONS_BUTTON("revanced_switch_create_with_notifications_button", BOOLEAN, TRUE, true),
SPOOF_APP_VERSION("revanced_spoof_app_version", BOOLEAN, FALSE, true, "revanced_spoof_app_version_user_dialog_message"), SPOOF_APP_VERSION("revanced_spoof_app_version", BOOLEAN, FALSE, true, "revanced_spoof_app_version_user_dialog_message"),
@ -150,6 +149,18 @@ public enum SettingsEnum {
HIDE_SHORTS_NAVIGATION_BAR("revanced_hide_shorts_navigation_bar", BOOLEAN, TRUE, true), HIDE_SHORTS_NAVIGATION_BAR("revanced_hide_shorts_navigation_bar", BOOLEAN, TRUE, true),
HIDE_SHORTS("revanced_hide_shorts", BOOLEAN, FALSE, true), HIDE_SHORTS("revanced_hide_shorts", BOOLEAN, FALSE, true),
//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_LOOP_VIDEO_MENU("revanced_hide_player_flyout_loop_video", 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_HELP_MENU("revanced_hide_player_flyout_help", BOOLEAN, TRUE),
HIDE_SPEED_MENU("revanced_hide_player_flyout_speed", BOOLEAN, FALSE),
HIDE_MORE_INFO_MENU("revanced_hide_player_flyout_more_info", BOOLEAN, TRUE),
HIDE_AUDIO_TRACK_MENU("revanced_hide_player_flyout_audio_track", BOOLEAN, TRUE),
HIDE_WATCH_IN_VR_MENU("revanced_hide_player_flyout_watch_in_vr", BOOLEAN, TRUE),
// Misc // Misc
AUTO_CAPTIONS("revanced_auto_captions", BOOLEAN, FALSE), AUTO_CAPTIONS("revanced_auto_captions", BOOLEAN, FALSE),
DISABLE_ZOOM_HAPTICS("revanced_disable_zoom_haptics", BOOLEAN, TRUE), DISABLE_ZOOM_HAPTICS("revanced_disable_zoom_haptics", BOOLEAN, TRUE),