mirror of
https://github.com/revanced/revanced-integrations.git
synced 2025-01-19 08:17:33 +01:00
feat(YouTube - Hide Shorts components): Hide Shop
, Location
and Save sound to playlist
buttons (#614)
This commit is contained in:
parent
4bd805e54d
commit
acfa3c9886
@ -33,11 +33,16 @@ public final class ShortsFilter extends Filter {
|
|||||||
private final StringFilterGroup joinButton;
|
private final StringFilterGroup joinButton;
|
||||||
private final StringFilterGroup shelfHeader;
|
private final StringFilterGroup shelfHeader;
|
||||||
|
|
||||||
|
private final StringFilterGroup suggestedActionPath;
|
||||||
|
private final ByteArrayFilterGroupList suggestedActions = new ByteArrayFilterGroupList();
|
||||||
|
|
||||||
private final StringFilterGroup actionBar;
|
private final StringFilterGroup actionBar;
|
||||||
private final ByteArrayFilterGroupList videoActionButtonGroupList = new ByteArrayFilterGroupList();
|
private final ByteArrayFilterGroupList videoActionButtonGroupList = new ByteArrayFilterGroupList();
|
||||||
|
|
||||||
public ShortsFilter() {
|
public ShortsFilter() {
|
||||||
|
//
|
||||||
// Identifier components.
|
// Identifier components.
|
||||||
|
//
|
||||||
|
|
||||||
var shorts = new StringFilterGroup(
|
var shorts = new StringFilterGroup(
|
||||||
null, // Setting is based on navigation state.
|
null, // Setting is based on navigation state.
|
||||||
@ -55,14 +60,17 @@ public final class ShortsFilter extends Filter {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Home / subscription feed components.
|
// Home / subscription feed components.
|
||||||
var thanksButton = new StringFilterGroup(
|
|
||||||
|
var thanksButton = new StringFilterGroup( // Edit: Does this item show up anymore?
|
||||||
Settings.HIDE_SHORTS_THANKS_BUTTON,
|
Settings.HIDE_SHORTS_THANKS_BUTTON,
|
||||||
"suggested_action"
|
"suggested_action"
|
||||||
);
|
);
|
||||||
|
|
||||||
addIdentifierCallbacks(shorts, shelfHeader, thanksButton);
|
addIdentifierCallbacks(shorts, shelfHeader, thanksButton);
|
||||||
|
|
||||||
|
//
|
||||||
// Path components.
|
// Path components.
|
||||||
|
//
|
||||||
|
|
||||||
// Shorts that appear in the feed/search when the device is using tablet layout.
|
// Shorts that appear in the feed/search when the device is using tablet layout.
|
||||||
shortsCompactFeedVideoPath = new StringFilterGroup(null, "compact_video.eml");
|
shortsCompactFeedVideoPath = new StringFilterGroup(null, "compact_video.eml");
|
||||||
@ -122,13 +130,21 @@ public final class ShortsFilter extends Filter {
|
|||||||
"shorts_action_bar"
|
"shorts_action_bar"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
suggestedActionPath = new StringFilterGroup(
|
||||||
|
null,
|
||||||
|
"suggested_action.eml"
|
||||||
|
);
|
||||||
|
|
||||||
addPathCallbacks(
|
addPathCallbacks(
|
||||||
shortsCompactFeedVideoPath,
|
shortsCompactFeedVideoPath,
|
||||||
joinButton, subscribeButton, subscribeButtonPaused,
|
joinButton, subscribeButton, subscribeButtonPaused, suggestedActionPath,
|
||||||
channelBar, fullVideoLinkLabel, videoTitle, reelSoundMetadata,
|
channelBar, fullVideoLinkLabel, videoTitle, reelSoundMetadata,
|
||||||
soundButton, infoPanel, actionBar
|
soundButton, infoPanel, actionBar
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Action buttons
|
||||||
|
//
|
||||||
var shortsLikeButton = new ByteArrayFilterGroup(
|
var shortsLikeButton = new ByteArrayFilterGroup(
|
||||||
Settings.HIDE_SHORTS_LIKE_BUTTON,
|
Settings.HIDE_SHORTS_LIKE_BUTTON,
|
||||||
"shorts_like_button"
|
"shorts_like_button"
|
||||||
@ -161,6 +177,24 @@ public final class ShortsFilter extends Filter {
|
|||||||
shortsShareButton,
|
shortsShareButton,
|
||||||
shortsRemixButton
|
shortsRemixButton
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Suggested actions.
|
||||||
|
//
|
||||||
|
suggestedActions.addAll(
|
||||||
|
new ByteArrayFilterGroup(
|
||||||
|
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_"
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -185,6 +219,14 @@ public final class ShortsFilter extends Filter {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (matchedGroup == subscribeButton || matchedGroup == joinButton) {
|
||||||
|
// Filter only when reelChannelBar is visible to avoid false positives.
|
||||||
|
if (path.startsWith(REEL_CHANNEL_BAR_PATH)) return super.isFiltered(
|
||||||
|
identifier, path, protobufBufferArray, matchedGroup, contentType, contentIndex
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Video action buttons (like, dislike, comment, share, remix) have the same path.
|
// Video action buttons (like, dislike, comment, share, remix) have the same path.
|
||||||
if (matchedGroup == actionBar) {
|
if (matchedGroup == actionBar) {
|
||||||
if (videoActionButtonGroupList.check(protobufBufferArray).isFiltered()) return super.isFiltered(
|
if (videoActionButtonGroupList.check(protobufBufferArray).isFiltered()) return super.isFiltered(
|
||||||
@ -193,14 +235,11 @@ public final class ShortsFilter extends Filter {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter other path groups from pathFilterGroupList, only when reelChannelBar is visible
|
if (matchedGroup == suggestedActionPath) {
|
||||||
// to avoid false positives.
|
if (contentIndex == 0 && suggestedActions.check(protobufBufferArray).isFiltered()) return super.isFiltered(
|
||||||
if (matchedGroup == subscribeButton ||
|
|
||||||
matchedGroup == joinButton
|
|
||||||
) {
|
|
||||||
if (path.startsWith(REEL_CHANNEL_BAR_PATH)) return super.isFiltered(
|
|
||||||
identifier, path, protobufBufferArray, matchedGroup, contentType, contentIndex
|
identifier, path, protobufBufferArray, matchedGroup, contentType, contentIndex
|
||||||
); // else, return false.
|
);
|
||||||
|
// else, return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -160,6 +160,9 @@ public class Settings extends BaseSettings {
|
|||||||
public static final BooleanSetting HIDE_SHORTS_SUBSCRIBE_BUTTON = new BooleanSetting("revanced_hide_shorts_subscribe_button", TRUE);
|
public static final BooleanSetting HIDE_SHORTS_SUBSCRIBE_BUTTON = new BooleanSetting("revanced_hide_shorts_subscribe_button", TRUE);
|
||||||
public static final BooleanSetting HIDE_SHORTS_SUBSCRIBE_BUTTON_PAUSED = new BooleanSetting("revanced_hide_shorts_subscribe_button_paused", FALSE);
|
public static final BooleanSetting HIDE_SHORTS_SUBSCRIBE_BUTTON_PAUSED = new BooleanSetting("revanced_hide_shorts_subscribe_button_paused", FALSE);
|
||||||
public static final BooleanSetting HIDE_SHORTS_THANKS_BUTTON = new BooleanSetting("revanced_hide_shorts_thanks_button", TRUE);
|
public static final BooleanSetting HIDE_SHORTS_THANKS_BUTTON = new BooleanSetting("revanced_hide_shorts_thanks_button", TRUE);
|
||||||
|
public static final BooleanSetting HIDE_SHORTS_SHOP_BUTTON = new BooleanSetting("revanced_hide_shorts_shop_button", TRUE);
|
||||||
|
public static final BooleanSetting HIDE_SHORTS_LOCATION_BUTTON = new BooleanSetting("revanced_hide_shorts_location_button", FALSE);
|
||||||
|
public static final BooleanSetting HIDE_SHORTS_SAVE_SOUND_BUTTON = new BooleanSetting("revanced_hide_shorts_save_sound_button", FALSE);
|
||||||
public static final BooleanSetting HIDE_SHORTS_LIKE_BUTTON = new BooleanSetting("revanced_hide_shorts_like_button", FALSE);
|
public static final BooleanSetting HIDE_SHORTS_LIKE_BUTTON = new BooleanSetting("revanced_hide_shorts_like_button", FALSE);
|
||||||
public static final BooleanSetting HIDE_SHORTS_DISLIKE_BUTTON = new BooleanSetting("revanced_hide_shorts_dislike_button", FALSE);
|
public static final BooleanSetting HIDE_SHORTS_DISLIKE_BUTTON = new BooleanSetting("revanced_hide_shorts_dislike_button", FALSE);
|
||||||
public static final BooleanSetting HIDE_SHORTS_COMMENTS_BUTTON = new BooleanSetting("revanced_hide_shorts_comments_button", FALSE);
|
public static final BooleanSetting HIDE_SHORTS_COMMENTS_BUTTON = new BooleanSetting("revanced_hide_shorts_comments_button", FALSE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user