feat(YouTube): change patch name Disable shorts on startup to Disable resuming shorts on startup

This commit is contained in:
inotia00 2024-03-25 06:16:05 +09:00
parent eed9d58da8
commit dec9ae8f7d
3 changed files with 14 additions and 13 deletions

View File

@ -19,7 +19,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
@Patch( @Patch(
name = "Disable shorts on startup", name = "Disable resuming shorts on startup",
description = "Adds an option to disable the Shorts player from resuming on app startup when Shorts were last being watched.", description = "Adds an option to disable the Shorts player from resuming on app startup when Shorts were last being watched.",
dependencies = [SettingsPatch::class], dependencies = [SettingsPatch::class],
compatiblePackages = [ compatiblePackages = [
@ -53,7 +53,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
] ]
) )
@Suppress("unused") @Suppress("unused")
object DisableShortsOnStartupPatch : BytecodePatch( object DisableResumingShortsOnStartupPatch : BytecodePatch(
setOf(UserWasInShortsFingerprint) setOf(UserWasInShortsFingerprint)
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
@ -72,11 +72,11 @@ object DisableShortsOnStartupPatch : BytecodePatch(
addInstructionsWithLabels( addInstructionsWithLabels(
targetIndex + 1, targetIndex + 1,
""" """
invoke-static { }, $SHORTS->disableStartupShortsPlayer()Z invoke-static {}, $SHORTS->disableResumingStartupShortsPlayer()Z
move-result v${replaceInstruction.registerA} move-result v${replaceInstruction.registerA}
if-eqz v${replaceInstruction.registerA}, :show_startup_shorts_player if-eqz v${replaceInstruction.registerA}, :show
return-void return-void
:show_startup_shorts_player :show
iget-object v${replaceInstruction.registerA}, v${replaceInstruction.registerB}, $replaceReference iget-object v${replaceInstruction.registerA}, v${replaceInstruction.registerB}, $replaceReference
""" """
) )
@ -91,11 +91,11 @@ object DisableShortsOnStartupPatch : BytecodePatch(
arrayOf( arrayOf(
"PREFERENCE: SHORTS_SETTINGS", "PREFERENCE: SHORTS_SETTINGS",
"SETTINGS: SHORTS_PLAYER_PARENT", "SETTINGS: SHORTS_PLAYER_PARENT",
"SETTINGS: DISABLE_STARTUP_SHORTS_PLAYER" "SETTINGS: DISABLE_RESUMING_SHORTS_PLAYER"
) )
) )
SettingsPatch.updatePatchStatus("Disable shorts on startup") SettingsPatch.updatePatchStatus("Disable resuming shorts on startup")
} }
} }

View File

@ -139,13 +139,14 @@ Note: This feature hasn't been tested."</string>
<string name="revanced_disable_landscape_mode_title">Disable landscape mode</string> <string name="revanced_disable_landscape_mode_title">Disable landscape mode</string>
<string name="revanced_disable_quic_protocol_summary">"Disable CronetEngine's QUIC protocol."</string> <string name="revanced_disable_quic_protocol_summary">"Disable CronetEngine's QUIC protocol."</string>
<string name="revanced_disable_quic_protocol_title">Disable QUIC protocol</string> <string name="revanced_disable_quic_protocol_title">Disable QUIC protocol</string>
<string name="revanced_disable_resuming_shorts_player_summary_off">Shorts player will resume on app startup</string>
<string name="revanced_disable_resuming_shorts_player_summary_on">Shorts player will not resume on app startup</string>
<string name="revanced_disable_resuming_shorts_player_title">Disable resuming Shorts player</string>
<string name="revanced_disable_speed_overlay_summary">"Disable 'Playing at 2x speed' while holding down. <string name="revanced_disable_speed_overlay_summary">"Disable 'Playing at 2x speed' while holding down.
Note: Disabling the speed overlay restores the 'Slide to seek' behavior of the old layout."</string> Note: Disabling the speed overlay restores the 'Slide to seek' behavior of the old layout."</string>
<string name="revanced_disable_speed_overlay_title">Disable speed overlay</string> <string name="revanced_disable_speed_overlay_title">Disable speed overlay</string>
<string name="revanced_disable_startup_shorts_player_summary_off">Shorts player is enabled at app startup.</string>
<string name="revanced_disable_startup_shorts_player_summary_on">Shorts player is disabled at app startup.</string>
<string name="revanced_disable_startup_shorts_player_title">Disable shorts player at app startup</string>
<string name="revanced_disable_update_screen_summary">Disables the \"Update your app\" screen that appears when using an outdated client.</string> <string name="revanced_disable_update_screen_summary">Disables the \"Update your app\" screen that appears when using an outdated client.</string>
<string name="revanced_disable_update_screen_title">Disable update screen</string> <string name="revanced_disable_update_screen_title">Disable update screen</string>
<string name="revanced_double_back_timeout_summary">The amount of seconds the double press back to exit.</string> <string name="revanced_double_back_timeout_summary">The amount of seconds the double press back to exit.</string>

View File

@ -508,7 +508,7 @@
<Preference android:title="Hide time stamp" android:summary="@string/revanced_patches_excluded" android:selectable="false"/> <Preference android:title="Hide time stamp" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_shorts" /> <Preference android:title=" " android:selectable="false" android:summary="@string/revanced_shorts" />
<Preference android:title="Disable shorts on startup" android:summary="@string/revanced_patches_excluded" android:selectable="false"/> <Preference android:title="Disable resuming shorts on startup" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Hide shorts components" android:summary="@string/revanced_patches_excluded" android:selectable="false"/> <Preference android:title="Hide shorts components" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Shorts outline button" android:summary="@string/revanced_patches_excluded" android:selectable="false"/> <Preference android:title="Shorts outline button" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
@ -686,8 +686,8 @@
<!-- SETTINGS: SHORTS_PLAYER_PARENT <!-- SETTINGS: SHORTS_PLAYER_PARENT
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_shorts_player_title" />SETTINGS: SHORTS_PLAYER_PARENT --> <Preference android:title=" " android:selectable="false" android:summary="@string/revanced_shorts_player_title" />SETTINGS: SHORTS_PLAYER_PARENT -->
<!-- SETTINGS: DISABLE_STARTUP_SHORTS_PLAYER <!-- SETTINGS: DISABLE_RESUMING_SHORTS_PLAYER
<SwitchPreference android:title="@string/revanced_disable_startup_shorts_player_title" android:key="revanced_disable_startup_shorts_player" android:defaultValue="true" android:summaryOn="@string/revanced_disable_startup_shorts_player_summary_on" android:summaryOff="@string/revanced_disable_startup_shorts_player_summary_off" />SETTINGS: DISABLE_STARTUP_SHORTS_PLAYER --> <SwitchPreference android:title="@string/revanced_disable_resuming_shorts_player_title" android:key="revanced_disable_resuming_shorts_player" android:defaultValue="true" android:summaryOn="@string/revanced_disable_resuming_shorts_player_summary_on" android:summaryOff="@string/revanced_disable_resuming_shorts_player_summary_off" />SETTINGS: DISABLE_RESUMING_SHORTS_PLAYER -->
<!-- SETTINGS: HIDE_SHORTS_COMPONENTS <!-- SETTINGS: HIDE_SHORTS_COMPONENTS
<SwitchPreference android:title="@string/revanced_hide_shorts_player_comments_button_title" android:key="revanced_hide_shorts_player_comments_button" android:defaultValue="false" android:summaryOn="@string/revanced_hide_shorts_player_comments_button_summary_on" android:summaryOff="@string/revanced_hide_shorts_player_comments_button_summary_off" /> <SwitchPreference android:title="@string/revanced_hide_shorts_player_comments_button_title" android:key="revanced_hide_shorts_player_comments_button" android:defaultValue="false" android:summaryOn="@string/revanced_hide_shorts_player_comments_button_summary_on" android:summaryOff="@string/revanced_hide_shorts_player_comments_button_summary_off" />