diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 9075392e..5e007284 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -6,10 +6,72 @@ body: - type: markdown attributes: value: | +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Continuing the legacy of Vanced
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Continuing the legacy of Vanced
+
* Used exclusively by {@link RememberPlaybackSpeedPatch} */ public static void overridePlaybackSpeed(float speedOverride) { @@ -124,24 +125,33 @@ public final class VideoInformation { /** * Seek on the current video. * Does not function for playback of Shorts. - * + *
* Caution: If called from a videoTimeHook() callback, * this will cause a recursive call into the same videoTimeHook() callback. * * @param millisecond The millisecond to seek the video to. - * @return if the seek was successful + * @return true if the seek was successful. */ public static boolean seekTo(final long millisecond) { + final long videoLength = getVideoLength(); + + // Don't seek more than the video length to prevent issues such as + // Play pause button or autoplay not working. + // TODO: These are arbitrarily chosen values and should be subject to be adjusted. + final long seekToMilliseconds = millisecond <= videoLength - 500 ? millisecond : millisecond - 100; + ReVancedUtils.verifyOnMainThread(); try { - LogHelper.printDebug(() -> "Seeking to " + millisecond); - return (Boolean) seekMethod.invoke(playerControllerRef.get(), millisecond); + LogHelper.printDebug(() -> "Seeking to " + seekToMilliseconds); + //noinspection DataFlowIssue + return (Boolean) seekMethod.invoke(playerControllerRef.get(), seekToMilliseconds); } catch (Exception ex) { LogHelper.printException(() -> "Failed to seek", ex); return false; } } + /** @noinspection UnusedReturnValue*/ public static boolean seekToRelative(long millisecondsRelative) { return seekTo(videoTime + millisecondsRelative); } @@ -159,10 +169,10 @@ public final class VideoInformation { /** * Differs from {@link #videoId} as this is the video id for the * last player response received, which may not be the current video playing. - * + *
* If Shorts are loading the background, this commonly will be * different from the Short that is currently on screen. - * + *
* For most use cases, you should instead use {@link #getVideoId()}. * * @return The id of the last video loaded. Empty string if not set yet. @@ -192,9 +202,9 @@ public final class VideoInformation { /** * Playback time of the current video playing. Includes Shorts. - * + *
* Value will lag behind the actual playback time by a variable amount based on the playback speed. - * + *
* If playback speed is 2.0x, this value may be up to 2000ms behind the actual playback time. * If playback speed is 1.0x, this value may be up to 1000ms behind the actual playback time. * If playback speed is 0.5x, this value may be up to 500ms behind the actual playback time. @@ -208,12 +218,12 @@ public final class VideoInformation { /** * @return If the playback is at the end of the video. - * + *
* If video is playing in the background with no video visible, * this always returns false (even if the video is actually at the end). - * + *
* This is equivalent to checking for {@link VideoState#ENDED}, - * but can give a more up to date result for code calling from some hooks. + * but can give a more up-to-date result for code calling from some hooks. * * @see VideoState */ diff --git a/app/src/main/java/app/revanced/integrations/patches/components/AdsFilter.java b/app/src/main/java/app/revanced/integrations/patches/components/AdsFilter.java index 40192d0d..5868596d 100644 --- a/app/src/main/java/app/revanced/integrations/patches/components/AdsFilter.java +++ b/app/src/main/java/app/revanced/integrations/patches/components/AdsFilter.java @@ -12,6 +12,7 @@ import app.revanced.integrations.utils.StringTrieSearch; public final class AdsFilter extends Filter { private final StringTrieSearch exceptions = new StringTrieSearch(); + private final StringFilterGroup shoppingLinks; public AdsFilter() { exceptions.addPatterns( @@ -71,6 +72,11 @@ public final class AdsFilter extends Filter { "products_in_video" ); + shoppingLinks = new StringFilterGroup( + SettingsEnum.HIDE_SHOPPING_LINKS, + "expandable_list" + ); + final var webLinkPanel = new StringFilterGroup( SettingsEnum.HIDE_WEB_SEARCH_RESULTS, "web_link_panel" @@ -93,6 +99,7 @@ public final class AdsFilter extends Filter { viewProducts, selfSponsor, webLinkPanel, + shoppingLinks, movieAds ); this.identifierFilterGroupList.addAll(carouselAd); @@ -104,6 +111,10 @@ public final class AdsFilter extends Filter { if (exceptions.matches(path)) return false; + // Check for the index because of likelihood of false positives. + if (matchedGroup == shoppingLinks && matchedIndex != 0) + return false; + return super.isFiltered(identifier, path, protobufBufferArray, matchedList, matchedGroup, matchedIndex); } diff --git a/app/src/main/java/app/revanced/integrations/patches/components/LayoutComponentsFilter.java b/app/src/main/java/app/revanced/integrations/patches/components/LayoutComponentsFilter.java index 278bfc2e..f11f43b8 100644 --- a/app/src/main/java/app/revanced/integrations/patches/components/LayoutComponentsFilter.java +++ b/app/src/main/java/app/revanced/integrations/patches/components/LayoutComponentsFilter.java @@ -192,6 +192,11 @@ public final class LayoutComponentsFilter extends Filter { "featured_channel_watermark_overlay" ); + final var forYouShelf = new StringFilterGroup( + SettingsEnum.HIDE_FOR_YOU_SHELF, + "mixed_content_shelf" + ); + this.pathFilterGroupList.addAll( channelBar, communityPosts, @@ -216,6 +221,7 @@ public final class LayoutComponentsFilter extends Filter { timedReactions, imageShelf, channelMemberShelf, + forYouShelf, custom ); diff --git a/app/src/main/java/app/revanced/integrations/patches/playback/speed/CustomPlaybackSpeedPatch.java b/app/src/main/java/app/revanced/integrations/patches/playback/speed/CustomPlaybackSpeedPatch.java index 30f79e64..3c281722 100644 --- a/app/src/main/java/app/revanced/integrations/patches/playback/speed/CustomPlaybackSpeedPatch.java +++ b/app/src/main/java/app/revanced/integrations/patches/playback/speed/CustomPlaybackSpeedPatch.java @@ -15,15 +15,23 @@ import java.util.Arrays; public class CustomPlaybackSpeedPatch { /** * Maximum playback speed, exclusive value. Custom speeds must be less than this value. - * Limit is required otherwise double digit speeds show up out of order in the UI selector. + * + * Going over 8x does not increase the actual playback speed any higher, + * and the UI selector starts flickering and acting weird. + * Over 10x and the speeds show up out of order in the UI selector. */ - public static final float MAXIMUM_PLAYBACK_SPEED = 10; + public static final float MAXIMUM_PLAYBACK_SPEED = 8; /** * Custom playback speeds. */ public static float[] customPlaybackSpeeds; + /** + * The last time the old playback menu was forcefully called. + */ + private static long lastTimeOldPlaybackMenuInvoked; + /** * PreferenceList entries and values, of all available playback speeds. */ @@ -101,36 +109,48 @@ public class CustomPlaybackSpeedPatch { // For some reason, the custom playback speed flyout panel is activated when the user opens the share panel. (A/B tests) // Check the child count of playback speed flyout panel to prevent this issue. // Child count of playback speed flyout panel is always 8. - if (PlaybackSpeedMenuFilterPatch.isPlaybackSpeedMenuVisible - && ((ViewGroup) recyclerView.getChildAt(0)).getChildCount() == 8) { - PlaybackSpeedMenuFilterPatch.isPlaybackSpeedMenuVisible = false; - ViewGroup parentView3rd = (ViewGroup) recyclerView.getParent().getParent().getParent(); - ViewGroup parentView4th = (ViewGroup) parentView3rd.getParent(); - - // Dismiss View [R.id.touch_outside] is the 1st ChildView of the 4th ParentView. - // This only shows in phone layout. - - final var touchInsidedView = parentView4th.getChildAt(0); - touchInsidedView.setSoundEffectsEnabled(false); - touchInsidedView.performClick(); - - // In tablet layout there is no Dismiss View, instead we just hide all two parent views. - parentView3rd.setVisibility(View.GONE); - parentView4th.setVisibility(View.GONE); - - // This works without issues for both tablet and phone layouts, - // So no code is needed to check whether the current device is a tablet or phone. - - // Close the new Playback speed menu and show the old one. - showOldPlaybackSpeedMenu(); + if (!PlaybackSpeedMenuFilterPatch.isPlaybackSpeedMenuVisible || recyclerView.getChildCount() == 0) { + return; } + ViewGroup PlaybackSpeedParentView = (ViewGroup) recyclerView.getChildAt(0); + if (PlaybackSpeedParentView == null || PlaybackSpeedParentView.getChildCount() != 8) { + return; + } + + PlaybackSpeedMenuFilterPatch.isPlaybackSpeedMenuVisible = false; + ViewGroup parentView3rd = (ViewGroup) recyclerView.getParent().getParent().getParent(); + ViewGroup parentView4th = (ViewGroup) parentView3rd.getParent(); + + // Dismiss View [R.id.touch_outside] is the 1st ChildView of the 4th ParentView. + // This only shows in phone layout. + final var touchInsidedView = parentView4th.getChildAt(0); + touchInsidedView.setSoundEffectsEnabled(false); + touchInsidedView.performClick(); + + // In tablet layout there is no Dismiss View, instead we just hide all two parent views. + parentView3rd.setVisibility(View.GONE); + parentView4th.setVisibility(View.GONE); + + // This works without issues for both tablet and phone layouts, + // So no code is needed to check whether the current device is a tablet or phone. + + // Close the new Playback speed menu and show the old one. + showOldPlaybackSpeedMenu(); } catch (Exception ex) { LogHelper.printException(() -> "onFlyoutMenuCreate failure", ex); } }); } - public static void showOldPlaybackSpeedMenu() { + private static void showOldPlaybackSpeedMenu() { + // This method is sometimes used multiple times. + // To prevent this, ignore method reuse within 1 second. + final long now = System.currentTimeMillis(); + if (now - lastTimeOldPlaybackMenuInvoked < 1000) { + LogHelper.printDebug(() -> "Ignoring call to showOldPlaybackSpeedMenu"); + return; + } + lastTimeOldPlaybackMenuInvoked = now; LogHelper.printDebug(() -> "Old video quality menu shown"); // Rest of the implementation added by patch. diff --git a/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java b/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java index 99f62421..e4b9550a 100644 --- a/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java +++ b/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java @@ -50,6 +50,7 @@ public enum SettingsEnum { HIDE_MERCHANDISE_BANNERS("revanced_hide_merchandise_banners", BOOLEAN, TRUE), HIDE_PAID_CONTENT("revanced_hide_paid_content_ads", BOOLEAN, TRUE), HIDE_PRODUCTS_BANNER("revanced_hide_products_banner", BOOLEAN, TRUE), + HIDE_SHOPPING_LINKS("revanced_hide_shopping_links", BOOLEAN, TRUE), HIDE_SELF_SPONSOR("revanced_hide_self_sponsor_ads", BOOLEAN, TRUE), HIDE_VIDEO_ADS("revanced_hide_video_ads", BOOLEAN, TRUE, true), HIDE_WEB_SEARCH_RESULTS("revanced_hide_web_search_results", BOOLEAN, TRUE), @@ -114,6 +115,7 @@ public enum SettingsEnum { HIDE_TIMESTAMP("revanced_hide_timestamp", BOOLEAN, FALSE), @Deprecated HIDE_VIDEO_WATERMARK("revanced_hide_video_watermark", BOOLEAN, TRUE), HIDE_VIDEO_CHANNEL_WATERMARK("revanced_hide_channel_watermark", BOOLEAN, TRUE), + HIDE_FOR_YOU_SHELF("revanced_hide_for_you_shelf", BOOLEAN, TRUE), HIDE_VIDEO_QUALITY_MENU_FOOTER("revanced_hide_video_quality_menu_footer", BOOLEAN, TRUE), PLAYER_OVERLAY_OPACITY("revanced_player_overlay_opacity", INTEGER, 100, true), PLAYER_POPUP_PANELS("revanced_hide_player_popup_panels", BOOLEAN, FALSE), diff --git a/assets/revanced-headline/revanced-headline-vertical-dark.svg b/assets/revanced-headline/revanced-headline-vertical-dark.svg new file mode 100644 index 00000000..a59bfb50 --- /dev/null +++ b/assets/revanced-headline/revanced-headline-vertical-dark.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/revanced-headline/revanced-headline-vertical-light.svg b/assets/revanced-headline/revanced-headline-vertical-light.svg new file mode 100644 index 00000000..3c5eeccc --- /dev/null +++ b/assets/revanced-headline/revanced-headline-vertical-light.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/revanced-logo/revanced-logo.svg b/assets/revanced-logo/revanced-logo.svg new file mode 100644 index 00000000..901e1914 --- /dev/null +++ b/assets/revanced-logo/revanced-logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 2291ead8..69ed5db8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true android.useAndroidX = true -version = 0.123.0 +version = 0.124.0-dev.1