fix(youtube/disable-startup-shorts-player): don't affect functionality of navigation bar (#716)

This commit is contained in:
OxrxL 2022-10-04 07:43:01 +02:00 committed by GitHub
parent 37f48e2b99
commit e938ba99b5
2 changed files with 20 additions and 5 deletions

View File

@ -3,6 +3,7 @@ package app.revanced.patches.youtube.layout.startupshortsreset.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.startupshortsreset.annotations.StartupShortsResetCompatibility import app.revanced.patches.youtube.layout.startupshortsreset.annotations.StartupShortsResetCompatibility
@ -11,9 +12,20 @@ import org.jf.dexlib2.Opcode
@Name("user-was-in-shorts-fingerprint") @Name("user-was-in-shorts-fingerprint")
@MatchingMethod("Lkzb;", "e") @MatchingMethod("Lkzb;", "e")
@FuzzyPatternScanMethod(3)
@StartupShortsResetCompatibility @StartupShortsResetCompatibility
@Version("0.0.1") @Version("0.0.1")
object UserWasInShortsFingerprint : MethodFingerprint( object UserWasInShortsFingerprint : MethodFingerprint(
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("L"), "V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("L"),
opcodes = listOf(
Opcode.IGET_OBJECT,
Opcode.INVOKE_INTERFACE,
Opcode.MOVE_RESULT_OBJECT,
Opcode.CHECK_CAST,
Opcode.INVOKE_INTERFACE,
Opcode.MOVE_RESULT,
Opcode.INVOKE_INTERFACE,
Opcode.MOVE_RESULT,
),
strings = listOf("Failed to read user_was_in_shorts proto after successful warmup"), strings = listOf("Failed to read user_was_in_shorts proto after successful warmup"),
) )

View File

@ -16,6 +16,7 @@ import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Patch @Patch
@DependsOn([IntegrationsPatch::class, SettingsPatch::class]) @DependsOn([IntegrationsPatch::class, SettingsPatch::class])
@ -39,15 +40,17 @@ class DisableShortsOnStartupPatch : BytecodePatch(
) )
) )
val userWasInShortsMethod = UserWasInShortsFingerprint.result!!.mutableMethod val userWasInShortsResult = UserWasInShortsFingerprint.result!!
val userWasInShortsMethod = userWasInShortsResult.mutableMethod
val moveResultIndex = userWasInShortsResult.scanResult.patternScanResult!!.endIndex
userWasInShortsMethod.addInstructions( userWasInShortsMethod.addInstructions(
0, """ moveResultIndex + 1, """
invoke-static { }, Lapp/revanced/integrations/patches/DisableStartupShortsPlayerPatch;->disableStartupShortsPlayer()Z invoke-static { }, Lapp/revanced/integrations/patches/DisableStartupShortsPlayerPatch;->disableStartupShortsPlayer()Z
move-result v0 move-result v5
if-eqz v0, :cond_startup_shorts_reset if-eqz v5, :disable_shorts_player
return-void return-void
:cond_startup_shorts_reset :disable_shorts_player
nop nop
""" """
) )