diff --git a/CHANGELOG.md b/CHANGELOG.md index 204cc08143..59a66d2217 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,29 @@ +# [1.14.0-dev.11](https://github.com/ReVanced/revanced-integrations/compare/v1.14.0-dev.10...v1.14.0-dev.11) (2024-09-17) + + +### Features + +* **YouTube - Hide Shorts components:** Hide 'Use this sound' button ([#691](https://github.com/ReVanced/revanced-integrations/issues/691)) ([6f3d2ff](https://github.com/ReVanced/revanced-integrations/commit/6f3d2ffb0d65ec819038050dfabe1432f87ce360)) + +# [1.14.0-dev.10](https://github.com/ReVanced/revanced-integrations/compare/v1.14.0-dev.9...v1.14.0-dev.10) (2024-09-11) + + +### Bug Fixes + +* **YouTube - Return YouTube Dislike:** Show correct value when swiping back to prior Short and disliking ([2eb5e3a](https://github.com/ReVanced/revanced-integrations/commit/2eb5e3afebe374a86e9da521d6441402130f0fd0)) + +# [1.14.0-dev.9](https://github.com/ReVanced/revanced-integrations/compare/v1.14.0-dev.8...v1.14.0-dev.9) (2024-09-09) + + +### Bug Fixes + +* **YouTube - SponsorBlock:** Add summary text to 'view my segments' button ([0f5dfb4](https://github.com/ReVanced/revanced-integrations/commit/0f5dfb4e76337da7e086a08b59aed7881de56a31)) + + +### Features + +* **YouTube:** Add donation link to settings about screen ([#688](https://github.com/ReVanced/revanced-integrations/issues/688)) ([b816c45](https://github.com/ReVanced/revanced-integrations/commit/b816c45838769c6b3df7147d091696cb3ee9789e)) + # [1.14.0-dev.8](https://github.com/ReVanced/revanced-integrations/compare/v1.14.0-dev.7...v1.14.0-dev.8) (2024-09-06) diff --git a/app/src/main/java/app/revanced/integrations/shared/settings/preference/ReVancedAboutPreference.java b/app/src/main/java/app/revanced/integrations/shared/settings/preference/ReVancedAboutPreference.java index f5911a0179..a39b24dbc1 100644 --- a/app/src/main/java/app/revanced/integrations/shared/settings/preference/ReVancedAboutPreference.java +++ b/app/src/main/java/app/revanced/integrations/shared/settings/preference/ReVancedAboutPreference.java @@ -1,5 +1,6 @@ package app.revanced.integrations.shared.settings.preference; +import static app.revanced.integrations.shared.StringRef.sf; import static app.revanced.integrations.shared.StringRef.str; import static app.revanced.integrations.youtube.requests.Route.Method.GET; @@ -71,7 +72,7 @@ protected int getDarkColor() { return Color.BLACK; } - private String createDialogHtml(ReVancedSocialLink[] socialLinks) { + private String createDialogHtml(WebLink[] socialLinks) { final boolean isNetworkConnected = Utils.isNetworkConnected(); StringBuilder builder = new StringBuilder(); @@ -122,7 +123,7 @@ private String createDialogHtml(ReVancedSocialLink[] socialLinks) { .append(""); builder.append("
"); - for (ReVancedSocialLink social : socialLinks) { + for (WebLink social : socialLinks) { builder.append("
"); builder.append(String.format("%s", social.url, social.name)); builder.append("
"); @@ -151,7 +152,7 @@ private String createDialogHtml(ReVancedSocialLink[] socialLinks) { } private void fetchLinksAndShowDialog(@Nullable ProgressDialog progress) { - ReVancedSocialLink[] socialLinks = SocialLinksRoutes.fetchSocialLinks(); + WebLink[] socialLinks = SocialLinksRoutes.fetchSocialLinks(); String htmlDialog = createDialogHtml(socialLinks); Utils.runOnMainThreadNowOrLater(() -> { @@ -221,19 +222,19 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) { } } -class ReVancedSocialLink { +class WebLink { final boolean preferred; final String name; final String url; - ReVancedSocialLink(JSONObject json) throws JSONException { + WebLink(JSONObject json) throws JSONException { this(json.getBoolean("preferred"), json.getString("name"), json.getString("url") ); } - ReVancedSocialLink(boolean preferred, String name, String url) { + WebLink(boolean preferred, String name, String url) { this.preferred = preferred; this.name = name; this.url = url; @@ -251,24 +252,33 @@ public String toString() { } class SocialLinksRoutes { + /** + * Simple link to the website donate page, + * rather than fetching and parsing the donation links using the API. + */ + public static final WebLink DONATE_LINK = new WebLink(true, + sf("revanced_settings_about_links_donate").toString(), + "https://revanced.app/donate"); + /** * Links to use if fetch links api call fails. */ - private static final ReVancedSocialLink[] NO_CONNECTION_STATIC_LINKS = { - new ReVancedSocialLink(true, "ReVanced.app", "https://revanced.app") + private static final WebLink[] NO_CONNECTION_STATIC_LINKS = { + new WebLink(true, "ReVanced.app", "https://revanced.app"), + DONATE_LINK, }; private static final String SOCIAL_LINKS_PROVIDER = "https://api.revanced.app/v2"; private static final Route.CompiledRoute GET_SOCIAL = new Route(GET, "/socials").compile(); @Nullable - private static volatile ReVancedSocialLink[] fetchedLinks; + private static volatile WebLink[] fetchedLinks; static boolean hasFetchedLinks() { return fetchedLinks != null; } - static ReVancedSocialLink[] fetchSocialLinks() { + static WebLink[] fetchSocialLinks() { try { if (hasFetchedLinks()) return fetchedLinks; @@ -290,14 +300,17 @@ static ReVancedSocialLink[] fetchSocialLinks() { JSONObject json = Requester.parseJSONObjectAndDisconnect(connection); JSONArray socials = json.getJSONArray("socials"); - List links = new ArrayList<>(); + List links = new ArrayList<>(); + + links.add(DONATE_LINK); // Show donate link first. for (int i = 0, length = socials.length(); i < length; i++) { - ReVancedSocialLink link = new ReVancedSocialLink(socials.getJSONObject(i)); + WebLink link = new WebLink(socials.getJSONObject(i)); links.add(link); } + Logger.printDebug(() -> "links: " + links); - return fetchedLinks = links.toArray(new ReVancedSocialLink[0]); + return fetchedLinks = links.toArray(new WebLink[0]); } catch (SocketTimeoutException ex) { Logger.printInfo(() -> "Could not fetch social links", ex); // No toast. diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/ReturnYouTubeDislikePatch.java b/app/src/main/java/app/revanced/integrations/youtube/patches/ReturnYouTubeDislikePatch.java index 8aa2c5ca5a..ec52ef076f 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/patches/ReturnYouTubeDislikePatch.java +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/ReturnYouTubeDislikePatch.java @@ -664,6 +664,7 @@ public static void setLastLithoShortsVideoId(@Nullable String videoId) { if (videoIdIsSame(lastLithoShortsVideoData, videoId)) { return; } + if (videoId == null) { // Litho filter did not detect the video id. App is in incognito mode, // or the proto buffer structure was changed and the video id is no longer present. diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/components/ReturnYouTubeDislikeFilterPatch.java b/app/src/main/java/app/revanced/integrations/youtube/patches/components/ReturnYouTubeDislikeFilterPatch.java index 11bffcc54e..8df0d1903e 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/patches/components/ReturnYouTubeDislikeFilterPatch.java +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/components/ReturnYouTubeDislikeFilterPatch.java @@ -68,18 +68,23 @@ public static void newPlayerResponseVideoId(String videoId, boolean isShortAndOp private final ByteArrayFilterGroupList videoIdFilterGroup = new ByteArrayFilterGroupList(); public ReturnYouTubeDislikeFilterPatch() { - // Likes always seems to load before the dislikes, but if this - // ever changes then both likes and dislikes need callbacks. + // When a new Short is opened, the like buttons always seem to load before the dislike. + // But if swiping back to a previous video and liking/disliking, then only that single button reloads. + // So must check for both buttons. addPathCallbacks( - new StringFilterGroup(null, "|shorts_like_button.eml") + new StringFilterGroup(null, "|shorts_like_button.eml"), + new StringFilterGroup(null, "|shorts_dislike_button.eml") ); // After the likes icon name is some binary data and then the video id for that specific short. videoIdFilterGroup.addAll( - // Video was previously liked before video was opened. + // on_shadowed = Video was previously like/disliked before opening. + // off_shadowed = Video was not previously liked/disliked before opening. new ByteArrayFilterGroup(null, "ic_right_like_on_shadowed"), - // Video was not already liked. - new ByteArrayFilterGroup(null, "ic_right_like_off_shadowed") + new ByteArrayFilterGroup(null, "ic_right_like_off_shadowed"), + + new ByteArrayFilterGroup(null, "ic_right_dislike_on_shadowed"), + new ByteArrayFilterGroup(null, "ic_right_dislike_off_shadowed") ); } @@ -111,6 +116,7 @@ private String findVideoId(byte[] protobufBufferArray) { return videoId; } } + return null; } } @@ -132,6 +138,7 @@ private static boolean byteArrayContainsString(@NonNull byte[] array, @NonNull S return true; } } + return false; } } \ No newline at end of file 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 8ba6c46b3c..a7935f71c3 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 @@ -202,6 +202,10 @@ public ShortsFilter() { 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_" ) ); } 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 57286b42e7..85bc6c8e7c 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 @@ -221,6 +221,7 @@ public class Settings extends BaseSettings { public static final BooleanSetting HIDE_SHORTS_LOCATION_LABEL = new BooleanSetting("revanced_hide_shorts_location_label", FALSE); // Save sound to playlist and Search suggestions may have been A/B tests that were abandoned by YT, and it's not clear if these are still used. public static final BooleanSetting HIDE_SHORTS_SAVE_SOUND_BUTTON = new BooleanSetting("revanced_hide_shorts_save_sound_button", FALSE); + 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_SEARCH_SUGGESTIONS = new BooleanSetting("revanced_hide_shorts_search_suggestions", FALSE); public static final BooleanSetting HIDE_SHORTS_SUPER_THANKS_BUTTON = new BooleanSetting("revanced_hide_shorts_super_thanks_button", TRUE); public static final BooleanSetting HIDE_SHORTS_LIKE_BUTTON = new BooleanSetting("revanced_hide_shorts_like_button", FALSE); diff --git a/app/src/main/java/app/revanced/integrations/youtube/settings/preference/SponsorBlockPreferenceFragment.java b/app/src/main/java/app/revanced/integrations/youtube/settings/preference/SponsorBlockPreferenceFragment.java index 05e0dbaf9b..2de654a2ba 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/settings/preference/SponsorBlockPreferenceFragment.java +++ b/app/src/main/java/app/revanced/integrations/youtube/settings/preference/SponsorBlockPreferenceFragment.java @@ -519,6 +519,7 @@ private void addUserStats(@NonNull Preference loadingPlaceholder, @Nullable User statsCategory.addPreference(preference); String formatted = SponsorBlockUtils.getNumberOfSkipsString(stats.segmentCount); preference.setTitle(fromHtml(str("revanced_sb_stats_submissions", formatted))); + preference.setSummary(str("revanced_sb_stats_submissions_sum")); if (stats.totalSegmentCountIncludingIgnored == 0) { preference.setSelectable(false); } else { diff --git a/gradle.properties b/gradle.properties index 7d69789c2f..f5df7333b7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true android.useAndroidX = true -version = 1.14.0-dev.8 +version = 1.14.0-dev.11