Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

Commit

Permalink
feat(YouTube - Shorts components): Clarify the description of some se…
Browse files Browse the repository at this point in the history
…ttings
  • Loading branch information
inotia00 authored and Francesco146 committed Sep 1, 2024
1 parent a5c3015 commit 7ee5630
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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() {
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -148,44 +148,54 @@ 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.
// Instead, use a unique identifier found in the buffer.
"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(
Settings.HIDE_SHORTS_SAVE_SOUND_BUTTON,
"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);
Expand Down Expand Up @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7ee5630

Please sign in to comment.