From e21286e4d76323adb24ca8112a4ce03bfab98d60 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sat, 11 Nov 2023 17:49:16 +0100 Subject: [PATCH] feat(YouTube - Navigation buttons): Support version `18.43.45` --- .../layout/buttons/navigation/NavigationButtonsPatch.kt | 9 +-------- .../fingerprints/PivotBarCreateButtonViewFingerprint.kt | 6 ++++-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/NavigationButtonsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/NavigationButtonsPatch.kt index 736b45755..882f09911 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/NavigationButtonsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/NavigationButtonsPatch.kt @@ -15,7 +15,6 @@ import app.revanced.patches.youtube.layout.buttons.navigation.utils.InjectionUti import app.revanced.patches.youtube.layout.buttons.navigation.utils.InjectionUtils.injectHook import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch import app.revanced.patches.youtube.misc.settings.SettingsPatch -import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @Patch( @@ -177,13 +176,7 @@ object NavigationButtonsPatch : BytecodePatch( } PivotBarCreateButtonViewFingerprint.result!!.apply { - val insertIndex = mutableMethod.implementation!!.instructions.let { - val scanStart = scanResult.patternScanResult!!.endIndex - - scanStart + it.subList(scanStart, it.size - 1).indexOfFirst { instruction -> - instruction.opcode == Opcode.INVOKE_STATIC - } - } + val insertIndex = scanResult.patternScanResult!!.endIndex /* * Inject hooks diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/PivotBarCreateButtonViewFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/PivotBarCreateButtonViewFingerprint.kt index 71eb4ae28..2b209b94f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/PivotBarCreateButtonViewFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/PivotBarCreateButtonViewFingerprint.kt @@ -5,7 +5,9 @@ import com.android.tools.smali.dexlib2.Opcode object PivotBarCreateButtonViewFingerprint : MethodFingerprint( opcodes = listOf( - Opcode.MOVE_OBJECT, - Opcode.INVOKE_DIRECT_RANGE, // unique instruction anchor + Opcode.INVOKE_DIRECT_RANGE, + Opcode.INVOKE_VIRTUAL, + Opcode.MOVE_RESULT_OBJECT, + Opcode.INVOKE_STATIC ) ) \ No newline at end of file