feat(YouTube/Player components): add setting toggle for Hide suggested video end screen https://github.com/inotia00/ReVanced_Extended/issues/2066

This commit is contained in:
inotia00
2024-05-27 20:43:42 +09:00
parent 2ce77b15da
commit b5038586a0
4 changed files with 12 additions and 10 deletions

View File

@ -4,7 +4,6 @@ import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
import app.revanced.patches.youtube.utils.fix.fullscreen.FullscreenButtonViewStubPatch
import app.revanced.patches.youtube.utils.fix.suggestedvideoendscreen.SuggestedVideoEndScreenPatch
import app.revanced.patches.youtube.utils.integrations.Constants.OVERLAY_BUTTONS_PATH
import app.revanced.patches.youtube.utils.playercontrols.PlayerControlsPatch
import app.revanced.patches.youtube.utils.settings.SettingsPatch
@ -30,7 +29,6 @@ object OverlayButtonsPatch : BaseResourcePatch(
FullscreenButtonViewStubPatch::class,
PlayerControlsPatch::class,
SettingsPatch::class,
SuggestedVideoEndScreenPatch::class,
OverlayButtonsBytecodePatch::class,
VideoInformationPatch::class
),

View File

@ -7,6 +7,7 @@ import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.youtube.utils.fix.suggestedvideoendscreen.fingerprints.RemoveOnLayoutChangeListenerFingerprint
import app.revanced.patches.youtube.utils.integrations.Constants.PLAYER_CLASS_DESCRIPTOR
import app.revanced.util.getTargetIndex
import app.revanced.util.getTargetIndexReversed
import app.revanced.util.getWalkerMethod
@ -43,6 +44,10 @@ object SuggestedVideoEndScreenPatch : BytecodePatch(
addInstructionsWithLabels(
0,
"""
invoke-static {}, $PLAYER_CLASS_DESCRIPTOR->hideSuggestedVideoEndScreen()Z
move-result v0
if-eqz v0, :show_suggested_video_end_screen
iget-object v0, p0, $iGetObjectReference
# This reference checks whether autoplay is turned on.

View File

@ -508,16 +508,15 @@ Note:
<string name="revanced_hide_suggested_actions_title">Hide suggested actions</string>
<string name="revanced_hide_suggested_actions_summary_on">Suggested actions hidden.</string>
<string name="revanced_hide_suggested_actions_summary_off">Suggested actions shown.</string>
<string name="revanced_hide_suggested_video_end_screen_title">Hide suggested video end screen</string>
<string name="revanced_hide_suggested_video_end_screen_summary">"This setting has been deprecated.
Instead, use the 'Settings → Autoplay → Autoplay next video' setting.
Note:
• If you have any issues with 'Suggested video end screen', try restarting the app."</string>
<string name="revanced_hide_timed_reactions_title">Hide timed reactions</string>
<string name="revanced_hide_timed_reactions_summary_on">Timed reactions are hidden.</string>
<string name="revanced_hide_timed_reactions_summary_off">Timed reactions are shown.</string>
<string name="revanced_hide_suggested_video_end_screen_title">Hide suggested video end screen</string>
<string name="revanced_hide_suggested_video_end_screen_summary_on">"Suggested video end screen is hidden when autoplay is turned off.
Autoplay can be changed in YouTube settings:
'Settings → Autoplay → Autoplay next video'"</string>
<string name="revanced_hide_suggested_video_end_screen_summary_off">Suggested video end screen is shown.</string>
<string name="revanced_skip_autoplay_countdown_title">Skip autoplay countdown</string>
<string name="revanced_skip_autoplay_countdown_summary_on">If autoplay is enabled, the next video will play immediately.</string>
<string name="revanced_skip_autoplay_countdown_summary_off">If autoplay is enabled, the next video will play after the countdown ends.</string>

View File

@ -407,8 +407,8 @@
<SwitchPreference android:title="@string/revanced_hide_seek_message_title" android:key="revanced_hide_seek_message" android:summaryOn="@string/revanced_hide_seek_message_summary_on" android:summaryOff="@string/revanced_hide_seek_message_summary_off" />
<SwitchPreference android:title="@string/revanced_hide_seek_undo_message_title" android:key="revanced_hide_seek_undo_message" android:summaryOn="@string/revanced_hide_seek_undo_message_summary_on" android:summaryOff="@string/revanced_hide_seek_undo_message_summary_off" />
<SwitchPreference android:title="@string/revanced_hide_suggested_actions_title" android:key="revanced_hide_suggested_actions" android:summaryOn="@string/revanced_hide_suggested_actions_summary_on" android:summaryOff="@string/revanced_hide_suggested_actions_summary_off" />
<Preference android:title="@string/revanced_hide_suggested_video_end_screen_title" android:key="revanced_hide_suggested_video_end_screen" android:summary="@string/revanced_hide_suggested_video_end_screen_summary" />
<SwitchPreference android:title="@string/revanced_hide_timed_reactions_title" android:key="revanced_hide_timed_reactions" android:summaryOn="@string/revanced_hide_timed_reactions_summary_on" android:summaryOff="@string/revanced_hide_timed_reactions_summary_off" />
<SwitchPreference android:title="@string/revanced_hide_suggested_video_end_screen_title" android:key="revanced_hide_suggested_video_end_screen" android:summaryOn="@string/revanced_hide_suggested_video_end_screen_summary_on" android:summaryOff="@string/revanced_hide_suggested_video_end_screen_summary_off" />
<SwitchPreference android:title="@string/revanced_skip_autoplay_countdown_title" android:key="revanced_skip_autoplay_countdown" android:summaryOn="@string/revanced_skip_autoplay_countdown_summary_on" android:summaryOff="@string/revanced_skip_autoplay_countdown_summary_off" />SETTINGS: PLAYER_COMPONENTS -->
<!-- PREFERENCE_SCREEN: PLAYER