fix(YouTube - Disable resuming Shorts on startup): Adjust patch name (#3281)
This commit is contained in:
parent
554738d6fe
commit
c3329527db
|
@ -1,5 +1,6 @@
|
||||||
package app.revanced.patches.youtube.layout.startupshortsreset
|
package app.revanced.patches.youtube.layout.startupshortsreset
|
||||||
|
|
||||||
|
import app.revanced.extensions.exception
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
@ -12,8 +13,8 @@ import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||||
|
|
||||||
@Patch(
|
@Patch(
|
||||||
name = "Disable Shorts on startup",
|
name = "Disable resuming Shorts on startup",
|
||||||
description = "Disables playing YouTube Shorts when launching YouTube.",
|
description = "Disables resuming the Shorts player on app startup if a Short was last opened.",
|
||||||
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
|
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
|
||||||
compatiblePackages = [
|
compatiblePackages = [
|
||||||
CompatiblePackage(
|
CompatiblePackage(
|
||||||
|
@ -33,33 +34,37 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object DisableShortsOnStartupPatch : BytecodePatch(
|
object DisableResumingShortsOnStartupPatch : BytecodePatch(
|
||||||
setOf(UserWasInShortsFingerprint)
|
setOf(UserWasInShortsFingerprint)
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||||
|
"Lapp/revanced/integrations/patches/DisableResumingStartupShortsPlayerPatch;"
|
||||||
|
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||||
SwitchPreference(
|
SwitchPreference(
|
||||||
"revanced_disable_resuming_shorts_player",
|
"revanced_disable_resuming_shorts_player",
|
||||||
StringResource("revanced_disable_resuming_shorts_player_title", "Disable Shorts player at app startup"),
|
StringResource("revanced_disable_resuming_shorts_player_title", "Disable resuming Shorts player"),
|
||||||
StringResource("revanced_disable_resuming_shorts_player_summary_on", "Shorts player is disabled at app startup"),
|
StringResource("revanced_disable_resuming_shorts_player_summary_on", "Shorts player will not resume on app startup"),
|
||||||
StringResource("revanced_disable_resuming_shorts_player_summary_off", "Shorts player is enabled at app startup")
|
StringResource("revanced_disable_resuming_shorts_player_summary_off", "Shorts player will resume on app startup")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
val userWasInShortsResult = UserWasInShortsFingerprint.result!!
|
UserWasInShortsFingerprint.result?.apply {
|
||||||
val userWasInShortsMethod = userWasInShortsResult.mutableMethod
|
val moveResultIndex = scanResult.patternScanResult!!.endIndex
|
||||||
val moveResultIndex = userWasInShortsResult.scanResult.patternScanResult!!.endIndex
|
|
||||||
|
|
||||||
userWasInShortsMethod.addInstructionsWithLabels(
|
mutableMethod.addInstructionsWithLabels(
|
||||||
moveResultIndex + 1,
|
moveResultIndex + 1,
|
||||||
"""
|
"""
|
||||||
invoke-static { }, Lapp/revanced/integrations/patches/DisableStartupShortsPlayerPatch;->disableStartupShortsPlayer()Z
|
invoke-static { }, $INTEGRATIONS_CLASS_DESCRIPTOR->disableResumingStartupShortsPlayer()Z
|
||||||
move-result v5
|
move-result v5
|
||||||
if-eqz v5, :disable_shorts_player
|
if-eqz v5, :disable_shorts_player
|
||||||
return-void
|
return-void
|
||||||
:disable_shorts_player
|
:disable_shorts_player
|
||||||
nop
|
nop
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
} ?: throw UserWasInShortsFingerprint.exception
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue