From 4ec955fd0133643826e47be7089fbfa07fd9a089 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Mon, 25 Mar 2024 20:13:06 +0400 Subject: [PATCH 01/11] fix(YouTube - Hide ads): Prevent app crash if hiding fullscreen ads is not possible (#590) --- .../youtube/patches/components/AdsFilter.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/components/AdsFilter.java b/app/src/main/java/app/revanced/integrations/youtube/patches/components/AdsFilter.java index c122cd914e..0c2233a46b 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/patches/components/AdsFilter.java +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/components/AdsFilter.java @@ -1,5 +1,7 @@ package app.revanced.integrations.youtube.patches.components; +import static app.revanced.integrations.shared.StringRef.str; + import android.app.Instrumentation; import android.view.KeyEvent; import android.view.View; @@ -170,7 +172,24 @@ private static void closeFullscreenAd() { Utils.runOnMainThreadDelayed(() -> { // Must run off main thread (Odd, but whatever). - Utils.runOnBackgroundThread(() -> instrumentation.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK)); + Utils.runOnBackgroundThread(() -> { + try { + instrumentation.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK); + } catch (Exception ex) { + // Injecting user events on Android 10+ requires the manifest to include + // INJECT_EVENTS, and it's usage is heavily restricted + // and requires the user to manually approve the permission in the device settings. + // + // And no matter what, permissions cannot be added for root installations + // as manifest changes are ignored for mount installations. + // + // Instead, catch the SecurityException and turn off hide full screen ads + // since this functionality does not work for these devices. + Logger.printInfo(() -> "Could not inject back button event", ex); + Settings.HIDE_FULLSCREEN_ADS.save(false); + Utils.showToastLong(str("revanced_hide_fullscreen_ads_feature_not_available_toast")); + } + }); }, 1000); } } From 32a14efe6f107c10b72e01a1342849c607293624 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 25 Mar 2024 16:16:13 +0000 Subject: [PATCH 02/11] chore(release): 1.5.0-dev.8 [skip ci] # [1.5.0-dev.8](https://github.com/ReVanced/revanced-integrations/compare/v1.5.0-dev.7...v1.5.0-dev.8) (2024-03-25) ### Bug Fixes * **YouTube - Hide ads:** Prevent app crash if hiding fullscreen ads is not possible ([#590](https://github.com/ReVanced/revanced-integrations/issues/590)) ([4ec955f](https://github.com/ReVanced/revanced-integrations/commit/4ec955fd0133643826e47be7089fbfa07fd9a089)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff243e6fa1..7abded656c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [1.5.0-dev.8](https://github.com/ReVanced/revanced-integrations/compare/v1.5.0-dev.7...v1.5.0-dev.8) (2024-03-25) + + +### Bug Fixes + +* **YouTube - Hide ads:** Prevent app crash if hiding fullscreen ads is not possible ([#590](https://github.com/ReVanced/revanced-integrations/issues/590)) ([4ec955f](https://github.com/ReVanced/revanced-integrations/commit/4ec955fd0133643826e47be7089fbfa07fd9a089)) + # [1.5.0-dev.7](https://github.com/ReVanced/revanced-integrations/compare/v1.5.0-dev.6...v1.5.0-dev.7) (2024-03-18) diff --git a/gradle.properties b/gradle.properties index 55e7f1ae9a..582b936ebb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true android.useAndroidX = true -version = 1.5.0-dev.7 +version = 1.5.0-dev.8 From bed8f9f640daadb83406d53a1418c118850d62ef Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Mon, 25 Mar 2024 21:11:36 +0100 Subject: [PATCH 03/11] chore: Remove unnecessary consumer parameter (#591) The query parameter was introduced for future use. It turns out that it is unnecessary and can be removed therefor. --- .../patches/announcements/AnnouncementsPatch.java | 14 +------------- .../requests/AnnouncementsRoutes.java | 2 +- .../integrations/youtube/settings/Settings.java | 5 ++++- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/announcements/AnnouncementsPatch.java b/app/src/main/java/app/revanced/integrations/youtube/patches/announcements/AnnouncementsPatch.java index 8de878a7fa..865b13cf10 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/patches/announcements/AnnouncementsPatch.java +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/announcements/AnnouncementsPatch.java @@ -18,7 +18,6 @@ import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.util.Locale; -import java.util.UUID; import static android.text.Html.FROM_HTML_MODE_COMPACT; import static app.revanced.integrations.shared.StringRef.str; @@ -26,8 +25,6 @@ @SuppressWarnings("unused") public final class AnnouncementsPatch { - private final static String CONSUMER = getOrSetConsumer(); - private AnnouncementsPatch() { } @@ -41,7 +38,7 @@ public static void showAnnouncement(final Activity context) { Utils.runOnBackgroundThread(() -> { try { HttpURLConnection connection = AnnouncementsRoutes.getAnnouncementsConnectionFromRoute( - GET_LATEST_ANNOUNCEMENT, CONSUMER, Locale.getDefault().toLanguageTag()); + GET_LATEST_ANNOUNCEMENT, Locale.getDefault().toLanguageTag()); Logger.printDebug(() -> "Get latest announcement route connection url: " + connection.getURL()); @@ -139,15 +136,6 @@ public static void showAnnouncement(final Activity context) { }); } - private static String getOrSetConsumer() { - final var consumer = Settings.ANNOUNCEMENT_CONSUMER.get(); - if (!consumer.isEmpty()) return consumer; - - final var uuid = UUID.randomUUID().toString(); - Settings.ANNOUNCEMENT_CONSUMER.save(uuid); - return uuid; - } - // TODO: Use better icons. private enum Level { INFO(android.R.drawable.ic_dialog_info), diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/announcements/requests/AnnouncementsRoutes.java b/app/src/main/java/app/revanced/integrations/youtube/patches/announcements/requests/AnnouncementsRoutes.java index 6fca530c2b..59273c2bc3 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/patches/announcements/requests/AnnouncementsRoutes.java +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/announcements/requests/AnnouncementsRoutes.java @@ -14,7 +14,7 @@ public class AnnouncementsRoutes { /** * 'language' parameter is IETF format (for USA it would be 'en-us'). */ - public static final Route GET_LATEST_ANNOUNCEMENT = new Route(GET, "/announcements/youtube/latest?consumer={consumer}&language={language}"); + public static final Route GET_LATEST_ANNOUNCEMENT = new Route(GET, "/announcements/youtube/latest?language={language}"); private AnnouncementsRoutes() { } 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 928af8c255..8d1b83dd5e 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 @@ -196,7 +196,6 @@ public class Settings extends BaseSettings { public static final BooleanSetting SPOOF_DEVICE_DIMENSIONS = new BooleanSetting("revanced_spoof_device_dimensions", FALSE, true); public static final BooleanSetting BYPASS_URL_REDIRECTS = new BooleanSetting("revanced_bypass_url_redirects", TRUE); public static final BooleanSetting ANNOUNCEMENTS = new BooleanSetting("revanced_announcements", TRUE); - public static final StringSetting ANNOUNCEMENT_CONSUMER = new StringSetting("revanced_announcement_consumer", "", false, false); @Deprecated public static final StringSetting DEPRECATED_ANNOUNCEMENT_LAST_HASH = new StringSetting("revanced_announcement_last_hash", ""); public static final IntegerSetting ANNOUNCEMENT_LAST_ID = new IntegerSetting("revanced_announcement_last_id", -1); @@ -346,6 +345,10 @@ public class Settings extends BaseSettings { } + // Remove any previously saved announcement consumer (a random generated string). + Setting.preferences.saveString("revanced_announcement_consumer", null); + + // endregion } } From b945e2f44b1a62326e6d45345c1467668d803f53 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Tue, 26 Mar 2024 01:36:13 +0100 Subject: [PATCH 04/11] fix(YouTube - Hide layout components): Correctly hide Join button --- .../components/LayoutComponentsFilter.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/components/LayoutComponentsFilter.java b/app/src/main/java/app/revanced/integrations/youtube/patches/components/LayoutComponentsFilter.java index a260c04e3a..def0c6d4d1 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/patches/components/LayoutComponentsFilter.java +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/components/LayoutComponentsFilter.java @@ -29,6 +29,8 @@ public final class LayoutComponentsFilter extends Filter { private final StringFilterGroup expandableMetadata; private final ByteArrayFilterGroup searchResultRecommendations; private final StringFilterGroup searchResultVideo; + private final StringFilterGroup compactChannelBarInner; + private final ByteArrayFilterGroup joinMembership; static { mixPlaylistsExceptions.addPatterns( @@ -194,9 +196,14 @@ public LayoutComponentsFilter() { "set_reminder_button" ); - final var joinMembership = new StringFilterGroup( + compactChannelBarInner = new StringFilterGroup( Settings.HIDE_JOIN_MEMBERSHIP_BUTTON, - "compact_sponsor_button" + "compact_channel_bar_inner" + ); + + joinMembership = new ByteArrayFilterGroup( + Settings.HIDE_JOIN_MEMBERSHIP_BUTTON, + "Join this channel" ); final var channelWatermark = new StringFilterGroup( @@ -233,7 +240,7 @@ public LayoutComponentsFilter() { quickActions, relatedVideos, compactBanner, - joinMembership, + compactChannelBarInner, medicalPanel, videoQualityMenuFooter, infoPanel, @@ -258,6 +265,12 @@ public boolean isFiltered(@Nullable String identifier, String path, byte[] proto } } + if (matchedGroup == compactChannelBarInner) { + if (joinMembership.check(protobufBufferArray).isFiltered()){ + return super.isFiltered(identifier, path, protobufBufferArray, matchedGroup, contentType, contentIndex); + } + } + // The groups are excluded from the filter due to the exceptions list below. // Filter them separately here. if (matchedGroup == notifyMe || matchedGroup == inFeedSurvey || matchedGroup == expandableMetadata) From 2a08e5a98e9e9a00bb306313ff487d67c042a92e Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Tue, 26 Mar 2024 01:50:40 +0100 Subject: [PATCH 05/11] feat(YouTube - Hide Shorts components): Hide like and dislike buttons --- .../patches/components/ShortsFilter.java | 30 ++++++++++++++----- .../youtube/settings/Settings.java | 2 ++ 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/components/ShortsFilter.java b/app/src/main/java/app/revanced/integrations/youtube/patches/components/ShortsFilter.java index c0c8d8c519..c3f4c77e5f 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/patches/components/ShortsFilter.java +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/components/ShortsFilter.java @@ -27,7 +27,7 @@ public final class ShortsFilter extends Filter { private final StringFilterGroup infoPanel; private final StringFilterGroup shelfHeader; - private final StringFilterGroup videoActionButton; + private final StringFilterGroup actionBar; private final ByteArrayFilterGroupList videoActionButtonGroupList = new ByteArrayFilterGroupList(); public ShortsFilter() { @@ -94,15 +94,25 @@ public ShortsFilter() { "shorts_info_panel_overview" ); - videoActionButton = new StringFilterGroup( + actionBar = new StringFilterGroup( null, - "ContainerType|shorts_video_action_button" + "shorts_action_bar" ); addPathCallbacks( shortsCompactFeedVideoPath, joinButton, subscribeButton, subscribeButtonPaused, - channelBar, soundButton, infoPanel, videoActionButton + channelBar, soundButton, infoPanel, actionBar + ); + + var shortsLikeButton = new ByteArrayFilterGroup( + Settings.HIDE_SHORTS_LIKE_BUTTON, + "shorts_like_button" + ); + + var shortsDislikeButton = new ByteArrayFilterGroup( + Settings.HIDE_SHORTS_DISLIKE_BUTTON, + "shorts_dislike_button" ); var shortsCommentButton = new ByteArrayFilterGroup( @@ -120,7 +130,13 @@ public ShortsFilter() { "reel_remix_button" ); - videoActionButtonGroupList.addAll(shortsCommentButton, shortsShareButton, shortsRemixButton); + videoActionButtonGroupList.addAll( + shortsLikeButton, + shortsDislikeButton, + shortsCommentButton, + shortsShareButton, + shortsRemixButton + ); } @Override @@ -141,8 +157,8 @@ boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBuff return false; } - // Video action buttons (comment, share, remix) have the same path. - if (matchedGroup == videoActionButton) { + // Video action buttons (like, dislike, comment, share, remix) have the same path. + if (matchedGroup == actionBar) { if (videoActionButtonGroupList.check(protobufBufferArray).isFiltered()) return super.isFiltered( identifier, path, 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 8d1b83dd5e..b19ccd4cf0 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 @@ -141,6 +141,8 @@ 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_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_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_COMMENTS_BUTTON = new BooleanSetting("revanced_hide_shorts_comments_button", FALSE); public static final BooleanSetting HIDE_SHORTS_REMIX_BUTTON = new BooleanSetting("revanced_hide_shorts_remix_button", TRUE); public static final BooleanSetting HIDE_SHORTS_SHARE_BUTTON = new BooleanSetting("revanced_hide_shorts_share_button", FALSE); From 59165de801a5481fa4055dcf1797fe84dce235c0 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Tue, 26 Mar 2024 01:51:26 +0100 Subject: [PATCH 06/11] feat(YouTube - Hide Shorts components): Hide title and full video link label --- .../patches/components/ShortsFilter.java | 17 ++++++++++++++++- .../integrations/youtube/settings/Settings.java | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/components/ShortsFilter.java b/app/src/main/java/app/revanced/integrations/youtube/patches/components/ShortsFilter.java index c3f4c77e5f..27f880c4b4 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/patches/components/ShortsFilter.java +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/components/ShortsFilter.java @@ -21,6 +21,8 @@ public final class ShortsFilter extends Filter { private final ByteArrayFilterGroup shortsCompactFeedVideoBuffer; private final StringFilterGroup channelBar; + private final StringFilterGroup fullVideoLinkLabel; + private final StringFilterGroup videoTitle; private final StringFilterGroup subscribeButton; private final StringFilterGroup subscribeButtonPaused; private final StringFilterGroup soundButton; @@ -84,6 +86,16 @@ public ShortsFilter() { REEL_CHANNEL_BAR_PATH ); + fullVideoLinkLabel = new StringFilterGroup( + Settings.HIDE_SHORTS_FULL_VIDEO_LINK_LABEL, + "reel_multi_format_link" + ); + + videoTitle = new StringFilterGroup( + Settings.HIDE_SHORTS_VIDEO_TITLE, + "shorts_video_title_item" + ); + soundButton = new StringFilterGroup( Settings.HIDE_SHORTS_SOUND_BUTTON, "reel_pivot_button" @@ -102,7 +114,8 @@ public ShortsFilter() { addPathCallbacks( shortsCompactFeedVideoPath, joinButton, subscribeButton, subscribeButtonPaused, - channelBar, soundButton, infoPanel, actionBar + channelBar, fullVideoLinkLabel, videoTitle, soundButton, + infoPanel, actionBar ); var shortsLikeButton = new ByteArrayFilterGroup( @@ -147,6 +160,8 @@ boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBuff if (matchedGroup == soundButton || matchedGroup == infoPanel || matchedGroup == channelBar || + matchedGroup == fullVideoLinkLabel || + matchedGroup == videoTitle || matchedGroup == subscribeButtonPaused ) return super.isFiltered(identifier, path, 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 b19ccd4cf0..50e4235874 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 @@ -149,6 +149,8 @@ public class Settings extends BaseSettings { public static final BooleanSetting HIDE_SHORTS_INFO_PANEL = new BooleanSetting("revanced_hide_shorts_info_panel", TRUE); public static final BooleanSetting HIDE_SHORTS_SOUND_BUTTON = new BooleanSetting("revanced_hide_shorts_sound_button", FALSE); public static final BooleanSetting HIDE_SHORTS_CHANNEL_BAR = new BooleanSetting("revanced_hide_shorts_channel_bar", FALSE); + public static final BooleanSetting HIDE_SHORTS_VIDEO_TITLE = new BooleanSetting("revanced_hide_shorts_video_title", FALSE); + public static final BooleanSetting HIDE_SHORTS_FULL_VIDEO_LINK_LABEL = new BooleanSetting("revanced_hide_shorts_full_video_link_label", FALSE); public static final BooleanSetting HIDE_SHORTS_NAVIGATION_BAR = new BooleanSetting("revanced_hide_shorts_navigation_bar", TRUE, true); // Seekbar From b7a8995f798e386ee1d9ab5bbd857c1736cc5a29 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Tue, 26 Mar 2024 01:52:41 +0100 Subject: [PATCH 07/11] fix(YouTube - Hide Shorts components): Correctly hide join button --- .../components/LayoutComponentsFilter.java | 33 +++++++++++++------ .../patches/components/ShortsFilter.java | 7 ++-- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/components/LayoutComponentsFilter.java b/app/src/main/java/app/revanced/integrations/youtube/patches/components/LayoutComponentsFilter.java index def0c6d4d1..fb1cd0fbfd 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/patches/components/LayoutComponentsFilter.java +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/components/LayoutComponentsFilter.java @@ -30,7 +30,8 @@ public final class LayoutComponentsFilter extends Filter { private final ByteArrayFilterGroup searchResultRecommendations; private final StringFilterGroup searchResultVideo; private final StringFilterGroup compactChannelBarInner; - private final ByteArrayFilterGroup joinMembership; + private final StringFilterGroup compactChannelBarInnerButton; + private final ByteArrayFilterGroup joinMembershipButton; static { mixPlaylistsExceptions.addPatterns( @@ -39,6 +40,7 @@ public final class LayoutComponentsFilter extends Filter { ); } + @RequiresApi(api = Build.VERSION_CODES.N) public LayoutComponentsFilter() { exceptions.addPatterns( @@ -201,9 +203,14 @@ public LayoutComponentsFilter() { "compact_channel_bar_inner" ); - joinMembership = new ByteArrayFilterGroup( - Settings.HIDE_JOIN_MEMBERSHIP_BUTTON, - "Join this channel" + compactChannelBarInnerButton = new StringFilterGroup( + null, + "|button.eml|" + ); + + joinMembershipButton = new ByteArrayFilterGroup( + null, + "sponsorships" ); final var channelWatermark = new StringFilterGroup( @@ -265,12 +272,6 @@ public boolean isFiltered(@Nullable String identifier, String path, byte[] proto } } - if (matchedGroup == compactChannelBarInner) { - if (joinMembership.check(protobufBufferArray).isFiltered()){ - return super.isFiltered(identifier, path, protobufBufferArray, matchedGroup, contentType, contentIndex); - } - } - // The groups are excluded from the filter due to the exceptions list below. // Filter them separately here. if (matchedGroup == notifyMe || matchedGroup == inFeedSurvey || matchedGroup == expandableMetadata) @@ -278,6 +279,18 @@ public boolean isFiltered(@Nullable String identifier, String path, byte[] proto if (exceptions.matches(path)) return false; // Exceptions are not filtered. + if (matchedGroup == compactChannelBarInner) { + if (compactChannelBarInnerButton.check(path).isFiltered()) { + // The filter may be broad, but in the context of a compactChannelBarInnerButton, + // it's safe to assume that the button is the only thing that should be hidden. + if (joinMembershipButton.check(protobufBufferArray).isFiltered()) { + return super.isFiltered(identifier, path, protobufBufferArray, matchedGroup, contentType, contentIndex); + } + } + + return false; + } + // TODO: This also hides the feed Shorts shelf header if (matchedGroup == searchResultShelfHeader && contentIndex != 0) return false; diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/components/ShortsFilter.java b/app/src/main/java/app/revanced/integrations/youtube/patches/components/ShortsFilter.java index 27f880c4b4..0f42564161 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/patches/components/ShortsFilter.java +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/components/ShortsFilter.java @@ -27,6 +27,7 @@ public final class ShortsFilter extends Filter { private final StringFilterGroup subscribeButtonPaused; private final StringFilterGroup soundButton; private final StringFilterGroup infoPanel; + private final StringFilterGroup joinButton; private final StringFilterGroup shelfHeader; private final StringFilterGroup actionBar; @@ -66,7 +67,7 @@ public ShortsFilter() { "/frame0.jpg"); // Shorts player components. - var joinButton = new StringFilterGroup( + joinButton = new StringFilterGroup( Settings.HIDE_SHORTS_JOIN_BUTTON, "sponsor_button" ); @@ -182,7 +183,9 @@ boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBuff // Filter other path groups from pathFilterGroupList, only when reelChannelBar is visible // to avoid false positives. - if (matchedGroup == subscribeButton) { + if (matchedGroup == subscribeButton || + matchedGroup == joinButton + ) { if (path.startsWith(REEL_CHANNEL_BAR_PATH)) return super.isFiltered( identifier, path, protobufBufferArray, matchedGroup, contentType, contentIndex ); From 46d8ef6f88bd4c912a45357541291af38b5fc81f Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Tue, 26 Mar 2024 02:17:42 +0100 Subject: [PATCH 08/11] feat(YouTube - Hide Shorts components): Hide sound metadata label --- .../youtube/patches/components/ShortsFilter.java | 11 +++++++++-- .../integrations/youtube/settings/Settings.java | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/components/ShortsFilter.java b/app/src/main/java/app/revanced/integrations/youtube/patches/components/ShortsFilter.java index 0f42564161..8bbcae7fa0 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/patches/components/ShortsFilter.java +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/components/ShortsFilter.java @@ -23,6 +23,7 @@ public final class ShortsFilter extends Filter { private final StringFilterGroup channelBar; private final StringFilterGroup fullVideoLinkLabel; private final StringFilterGroup videoTitle; + private final StringFilterGroup reelSoundMetadata; private final StringFilterGroup subscribeButton; private final StringFilterGroup subscribeButtonPaused; private final StringFilterGroup soundButton; @@ -97,6 +98,11 @@ public ShortsFilter() { "shorts_video_title_item" ); + reelSoundMetadata = new StringFilterGroup( + Settings.HIDE_SHORTS_SOUND_METADATA_LABEL, + "reel_sound_metadata" + ); + soundButton = new StringFilterGroup( Settings.HIDE_SHORTS_SOUND_BUTTON, "reel_pivot_button" @@ -115,8 +121,8 @@ public ShortsFilter() { addPathCallbacks( shortsCompactFeedVideoPath, joinButton, subscribeButton, subscribeButtonPaused, - channelBar, fullVideoLinkLabel, videoTitle, soundButton, - infoPanel, actionBar + channelBar, fullVideoLinkLabel, videoTitle, reelSoundMetadata, + soundButton, infoPanel, actionBar ); var shortsLikeButton = new ByteArrayFilterGroup( @@ -163,6 +169,7 @@ boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBuff matchedGroup == channelBar || matchedGroup == fullVideoLinkLabel || matchedGroup == videoTitle || + matchedGroup == reelSoundMetadata || matchedGroup == subscribeButtonPaused ) return super.isFiltered(identifier, path, 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 50e4235874..19da334d16 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 @@ -150,6 +150,7 @@ public class Settings extends BaseSettings { public static final BooleanSetting HIDE_SHORTS_SOUND_BUTTON = new BooleanSetting("revanced_hide_shorts_sound_button", FALSE); public static final BooleanSetting HIDE_SHORTS_CHANNEL_BAR = new BooleanSetting("revanced_hide_shorts_channel_bar", FALSE); public static final BooleanSetting HIDE_SHORTS_VIDEO_TITLE = new BooleanSetting("revanced_hide_shorts_video_title", FALSE); + public static final BooleanSetting HIDE_SHORTS_SOUND_METADATA_LABEL = new BooleanSetting("revanced_hide_shorts_sound_metadata_label", FALSE); public static final BooleanSetting HIDE_SHORTS_FULL_VIDEO_LINK_LABEL = new BooleanSetting("revanced_hide_shorts_full_video_link_label", FALSE); public static final BooleanSetting HIDE_SHORTS_NAVIGATION_BAR = new BooleanSetting("revanced_hide_shorts_navigation_bar", TRUE, true); From 3329285e5cc5e85a9d4064a4b962cb18624bd8f0 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 26 Mar 2024 01:21:50 +0000 Subject: [PATCH 09/11] chore(release): 1.5.0-dev.9 [skip ci] # [1.5.0-dev.9](https://github.com/ReVanced/revanced-integrations/compare/v1.5.0-dev.8...v1.5.0-dev.9) (2024-03-26) ### Bug Fixes * **YouTube - Hide layout components:** Correctly hide Join button ([b945e2f](https://github.com/ReVanced/revanced-integrations/commit/b945e2f44b1a62326e6d45345c1467668d803f53)) * **YouTube - Hide Shorts components:** Correctly hide join button ([0ab9c70](https://github.com/ReVanced/revanced-integrations/commit/0ab9c701376ba700abb573fcd7dd3a06be65e52e)) ### Features * **YouTube - Hide Shorts components:** Hide like and dislike buttons ([2a08e5a](https://github.com/ReVanced/revanced-integrations/commit/2a08e5a98e9e9a00bb306313ff487d67c042a92e)) * **YouTube - Hide Shorts components:** Hide sound metadata label ([827beff](https://github.com/ReVanced/revanced-integrations/commit/827beffde0c7c6b27a3ac4bbec727f51d17dd3cd)) * **YouTube - Hide Shorts components:** Hide title and full video link label ([59165de](https://github.com/ReVanced/revanced-integrations/commit/59165de801a5481fa4055dcf1797fe84dce235c0)) --- CHANGELOG.md | 15 +++++++++++++++ gradle.properties | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7abded656c..a7388d2d2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ +# [1.5.0-dev.9](https://github.com/ReVanced/revanced-integrations/compare/v1.5.0-dev.8...v1.5.0-dev.9) (2024-03-26) + + +### Bug Fixes + +* **YouTube - Hide layout components:** Correctly hide Join button ([b945e2f](https://github.com/ReVanced/revanced-integrations/commit/b945e2f44b1a62326e6d45345c1467668d803f53)) +* **YouTube - Hide Shorts components:** Correctly hide join button ([0ab9c70](https://github.com/ReVanced/revanced-integrations/commit/0ab9c701376ba700abb573fcd7dd3a06be65e52e)) + + +### Features + +* **YouTube - Hide Shorts components:** Hide like and dislike buttons ([2a08e5a](https://github.com/ReVanced/revanced-integrations/commit/2a08e5a98e9e9a00bb306313ff487d67c042a92e)) +* **YouTube - Hide Shorts components:** Hide sound metadata label ([827beff](https://github.com/ReVanced/revanced-integrations/commit/827beffde0c7c6b27a3ac4bbec727f51d17dd3cd)) +* **YouTube - Hide Shorts components:** Hide title and full video link label ([59165de](https://github.com/ReVanced/revanced-integrations/commit/59165de801a5481fa4055dcf1797fe84dce235c0)) + # [1.5.0-dev.8](https://github.com/ReVanced/revanced-integrations/compare/v1.5.0-dev.7...v1.5.0-dev.8) (2024-03-25) diff --git a/gradle.properties b/gradle.properties index 582b936ebb..66bc2777ef 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true android.useAndroidX = true -version = 1.5.0-dev.8 +version = 1.5.0-dev.9 From e3ba343d890bf3cf79642b1b196c96934a4c0007 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Tue, 26 Mar 2024 04:47:21 +0100 Subject: [PATCH 10/11] fix: Check index of pattern in string instead of the other way around --- .../youtube/patches/components/LithoFilterPatch.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/components/LithoFilterPatch.java b/app/src/main/java/app/revanced/integrations/youtube/patches/components/LithoFilterPatch.java index f77a9ac59e..51c36493f9 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/patches/components/LithoFilterPatch.java +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/components/LithoFilterPatch.java @@ -1,7 +1,6 @@ package app.revanced.integrations.youtube.patches.components; import android.os.Build; - import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.RequiresApi; @@ -15,7 +14,6 @@ import java.util.function.Consumer; import app.revanced.integrations.shared.Logger; -import app.revanced.integrations.shared.Utils; import app.revanced.integrations.shared.settings.BooleanSetting; import app.revanced.integrations.shared.settings.BaseSettings; import app.revanced.integrations.youtube.ByteTrieSearch; @@ -124,7 +122,7 @@ public FilterGroupResult check(final String string) { if (isEnabled()) { for (String pattern : filters) { if (!string.isEmpty()) { - final int indexOf = pattern.indexOf(string); + final int indexOf = string.indexOf(pattern); if (indexOf >= 0) { matchedIndex = indexOf; matchedLength = pattern.length(); From 47895c785a37199ed2a20c87262f34cc91e31ab7 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 26 Mar 2024 03:50:31 +0000 Subject: [PATCH 11/11] chore(release): 1.5.0-dev.9 [skip ci] # [1.5.0-dev.9](https://github.com/ReVanced/revanced-integrations/compare/v1.5.0-dev.8...v1.5.0-dev.9) (2024-03-26) ### Bug Fixes * Check index of pattern in string instead of the other way around ([e3ba343](https://github.com/ReVanced/revanced-integrations/commit/e3ba343d890bf3cf79642b1b196c96934a4c0007)) * **YouTube - Hide layout components:** Correctly hide Join button ([b945e2f](https://github.com/ReVanced/revanced-integrations/commit/b945e2f44b1a62326e6d45345c1467668d803f53)) * **YouTube - Hide Shorts components:** Correctly hide join button ([b7a8995](https://github.com/ReVanced/revanced-integrations/commit/b7a8995f798e386ee1d9ab5bbd857c1736cc5a29)) ### Features * **YouTube - Hide Shorts components:** Hide like and dislike buttons ([2a08e5a](https://github.com/ReVanced/revanced-integrations/commit/2a08e5a98e9e9a00bb306313ff487d67c042a92e)) * **YouTube - Hide Shorts components:** Hide sound metadata label ([46d8ef6](https://github.com/ReVanced/revanced-integrations/commit/46d8ef6f88bd4c912a45357541291af38b5fc81f)) * **YouTube - Hide Shorts components:** Hide title and full video link label ([59165de](https://github.com/ReVanced/revanced-integrations/commit/59165de801a5481fa4055dcf1797fe84dce235c0)) --- CHANGELOG.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7388d2d2f..410e32117a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,22 @@ # [1.5.0-dev.9](https://github.com/ReVanced/revanced-integrations/compare/v1.5.0-dev.8...v1.5.0-dev.9) (2024-03-26) +### Bug Fixes + +* Check index of pattern in string instead of the other way around ([e3ba343](https://github.com/ReVanced/revanced-integrations/commit/e3ba343d890bf3cf79642b1b196c96934a4c0007)) +* **YouTube - Hide layout components:** Correctly hide Join button ([b945e2f](https://github.com/ReVanced/revanced-integrations/commit/b945e2f44b1a62326e6d45345c1467668d803f53)) +* **YouTube - Hide Shorts components:** Correctly hide join button ([b7a8995](https://github.com/ReVanced/revanced-integrations/commit/b7a8995f798e386ee1d9ab5bbd857c1736cc5a29)) + + +### Features + +* **YouTube - Hide Shorts components:** Hide like and dislike buttons ([2a08e5a](https://github.com/ReVanced/revanced-integrations/commit/2a08e5a98e9e9a00bb306313ff487d67c042a92e)) +* **YouTube - Hide Shorts components:** Hide sound metadata label ([46d8ef6](https://github.com/ReVanced/revanced-integrations/commit/46d8ef6f88bd4c912a45357541291af38b5fc81f)) +* **YouTube - Hide Shorts components:** Hide title and full video link label ([59165de](https://github.com/ReVanced/revanced-integrations/commit/59165de801a5481fa4055dcf1797fe84dce235c0)) + +# [1.5.0-dev.9](https://github.com/ReVanced/revanced-integrations/compare/v1.5.0-dev.8...v1.5.0-dev.9) (2024-03-26) + + ### Bug Fixes * **YouTube - Hide layout components:** Correctly hide Join button ([b945e2f](https://github.com/ReVanced/revanced-integrations/commit/b945e2f44b1a62326e6d45345c1467668d803f53))