From 7ee5630e5edfb5dc3908626167c49b2c812a8244 Mon Sep 17 00:00:00 2001 From: inotia00 <108592928+inotia00@users.noreply.github.com> Date: Sun, 1 Sep 2024 22:07:40 +0900 Subject: [PATCH] feat(YouTube - Shorts components): Clarify the description of some settings --- .../components/ShortsButtonFilter.java | 46 +++++++++++-------- .../youtube/settings/Settings.java | 5 +- 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/components/ShortsButtonFilter.java b/app/src/main/java/app/revanced/integrations/youtube/patches/components/ShortsButtonFilter.java index e1f9f1e351..73913bf270 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/patches/components/ShortsButtonFilter.java +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/components/ShortsButtonFilter.java @@ -29,8 +29,8 @@ public final class ShortsButtonFilter extends Filter { private final StringFilterGroup subscribeButton; private final StringFilterGroup joinButton; - private final StringFilterGroup paidPromotionButton; private final StringFilterGroup pausedOverlayButtons; + private final ByteArrayFilterGroupList pausedOverlayButtonsGroupList = new ByteArrayFilterGroupList(); private final ByteArrayFilterGroup shortsCommentDisabled; @@ -40,9 +40,9 @@ public final class ShortsButtonFilter extends Filter { private final StringFilterGroup actionBar; private final ByteArrayFilterGroupList videoActionButtonGroupList = new ByteArrayFilterGroupList(); - private final ByteArrayFilterGroup shopButton = new ByteArrayFilterGroup( - Settings.HIDE_SHORTS_SHOP_BUTTON, - "yt_outline_bag_" + private final ByteArrayFilterGroup useThisSoundButton = new ByteArrayFilterGroup( + Settings.HIDE_SHORTS_USE_THIS_SOUND_BUTTON, + "yt_outline_camera" ); public ShortsButtonFilter() { @@ -81,6 +81,11 @@ public ShortsButtonFilter() { "immersive_live_header" ); + StringFilterGroup paidPromotionButton = new StringFilterGroup( + Settings.HIDE_SHORTS_PAID_PROMOTION_LABEL, + "reel_player_disclosure.eml" + ); + joinButton = new StringFilterGroup( Settings.HIDE_SHORTS_JOIN_BUTTON, "sponsor_button" @@ -91,11 +96,6 @@ public ShortsButtonFilter() { "subscribe_button" ); - paidPromotionButton = new StringFilterGroup( - Settings.HIDE_SHORTS_PAID_PROMOTION_LABEL, - "reel_player_disclosure.eml" - ); - actionBar = new StringFilterGroup( null, "shorts_action_bar" @@ -148,11 +148,20 @@ public ShortsButtonFilter() { ) ); + // + // Paused overlay buttons. + // + pausedOverlayButtonsGroupList.addAll( + new ByteArrayFilterGroup( + Settings.HIDE_SHORTS_SHOPPING_BUTTON, + "yt_outline_bag_" + ) + ); + // // Suggested actions. // suggestedActionsGroupList.addAll( - shopButton, new ByteArrayFilterGroup( Settings.HIDE_SHORTS_TAGGED_PRODUCTS, // Product buttons show pictures of the products, and does not have any unique icons to identify. @@ -160,7 +169,11 @@ public ShortsButtonFilter() { "PAproduct_listZ" ), new ByteArrayFilterGroup( - Settings.HIDE_SHORTS_LOCATION_LABEL, + Settings.HIDE_SHORTS_SHOP_BUTTON, + "yt_outline_bag_" + ), + new ByteArrayFilterGroup( + Settings.HIDE_SHORTS_LOCATION_BUTTON, "yt_outline_location_point_" ), new ByteArrayFilterGroup( @@ -168,24 +181,21 @@ public ShortsButtonFilter() { "yt_outline_list_add_" ), new ByteArrayFilterGroup( - Settings.HIDE_SHORTS_SEARCH_SUGGESTIONS, + Settings.HIDE_SHORTS_SEARCH_SUGGESTIONS_BUTTON, "yt_outline_search_" ), new ByteArrayFilterGroup( Settings.HIDE_SHORTS_SUPER_THANKS_BUTTON, "yt_outline_dollar_sign_heart_" ), - new ByteArrayFilterGroup( - Settings.HIDE_SHORTS_USE_THIS_SOUND_BUTTON, - "yt_outline_camera" - ) + useThisSoundButton ); } @Override public boolean isFiltered(String path, @Nullable String identifier, String allValue, byte[] protobufBufferArray, StringFilterGroup matchedGroup, FilterContentType contentType, int contentIndex) { - if (matchedGroup == subscribeButton || matchedGroup == joinButton || matchedGroup == paidPromotionButton) { + if (matchedGroup == subscribeButton || matchedGroup == joinButton) { // Selectively filter to avoid false positive filtering of other subscribe/join buttons. if (StringUtils.startsWithAny(path, REEL_CHANNEL_BAR_PATH, REEL_LIVE_HEADER_PATH, REEL_METAPANEL_PATH)) { return super.isFiltered(path, identifier, allValue, protobufBufferArray, matchedGroup, contentType, contentIndex); @@ -220,7 +230,7 @@ public boolean isFiltered(String path, @Nullable String identifier, String allVa if (Settings.HIDE_SHORTS_PAUSED_OVERLAY_BUTTONS.get()) { return super.isFiltered(path, identifier, allValue, protobufBufferArray, matchedGroup, contentType, contentIndex); } else if (StringUtils.contains(path, SHORTS_PAUSED_STATE_BUTTON_PATH)) { - if (shopButton.check(protobufBufferArray).isFiltered()) { + if (pausedOverlayButtonsGroupList.check(protobufBufferArray).isFiltered()) { return super.isFiltered(path, identifier, allValue, protobufBufferArray, matchedGroup, contentType, contentIndex); } } 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 2affd171fb..dbddbbf4d5 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 @@ -371,11 +371,12 @@ public class Settings extends BaseSettings { public static final BooleanSetting HIDE_SHORTS_PAUSED_HEADER = new BooleanSetting("revanced_hide_shorts_paused_header", FALSE, true); public static final BooleanSetting HIDE_SHORTS_PAUSED_OVERLAY_BUTTONS = new BooleanSetting("revanced_hide_shorts_paused_overlay_buttons", FALSE); public static final BooleanSetting HIDE_SHORTS_PAID_PROMOTION_LABEL = new BooleanSetting("revanced_hide_shorts_paid_promotion_label", TRUE, true); + public static final BooleanSetting HIDE_SHORTS_SHOPPING_BUTTON = new BooleanSetting("revanced_hide_shorts_shopping_button", TRUE); public static final BooleanSetting HIDE_SHORTS_SHOP_BUTTON = new BooleanSetting("revanced_hide_shorts_shop_button", TRUE); public static final BooleanSetting HIDE_SHORTS_TAGGED_PRODUCTS = new BooleanSetting("revanced_hide_shorts_tagged_products", TRUE); - public static final BooleanSetting HIDE_SHORTS_LOCATION_LABEL = new BooleanSetting("revanced_hide_shorts_location_label", TRUE); + public static final BooleanSetting HIDE_SHORTS_LOCATION_BUTTON = new BooleanSetting("revanced_hide_shorts_location_button", TRUE); public static final BooleanSetting HIDE_SHORTS_SAVE_SOUND_BUTTON = new BooleanSetting("revanced_hide_shorts_save_sound_button", TRUE); - public static final BooleanSetting HIDE_SHORTS_SEARCH_SUGGESTIONS = new BooleanSetting("revanced_hide_shorts_search_suggestions", TRUE); + public static final BooleanSetting HIDE_SHORTS_SEARCH_SUGGESTIONS_BUTTON = new BooleanSetting("revanced_hide_shorts_search_suggestions_button", TRUE); public static final BooleanSetting HIDE_SHORTS_SUPER_THANKS_BUTTON = new BooleanSetting("revanced_hide_shorts_super_thanks_button", TRUE); public static final BooleanSetting HIDE_SHORTS_USE_THIS_SOUND_BUTTON = new BooleanSetting("revanced_hide_shorts_use_this_sound_button", TRUE); public static final BooleanSetting HIDE_SHORTS_INFO_PANEL = new BooleanSetting("revanced_hide_shorts_info_panel", TRUE);