From fe8d6c7b2c10be5cca0717b6a03cfa1bef10e2c0 Mon Sep 17 00:00:00 2001 From: OxrxL <108184954+OxrxL@users.noreply.github.com> Date: Tue, 1 Nov 2022 00:06:42 +0100 Subject: [PATCH] fix(youtube/theme-patch): respect app specific theme (#946) --- .../bytecode/fingerprints/ThemeSetterAppFingerprint.kt | 6 +++--- .../youtube/misc/settings/bytecode/patch/SettingsPatch.kt | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/bytecode/fingerprints/ThemeSetterAppFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/bytecode/fingerprints/ThemeSetterAppFingerprint.kt index 7c612a70b..15616788c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/bytecode/fingerprints/ThemeSetterAppFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/bytecode/fingerprints/ThemeSetterAppFingerprint.kt @@ -24,9 +24,9 @@ object ThemeSetterAppFingerprint : MethodFingerprint( Opcode.MOVE_RESULT_OBJECT, Opcode.SGET_OBJECT, Opcode.IF_NE, - Opcode.CONST, + Opcode.CONST, //target reference Opcode.GOTO, - Opcode.CONST, + Opcode.CONST, //target reference Opcode.INVOKE_DIRECT, Opcode.RETURN_OBJECT, Opcode.NEW_INSTANCE, @@ -34,6 +34,6 @@ object ThemeSetterAppFingerprint : MethodFingerprint( Opcode.MOVE_RESULT_OBJECT, Opcode.SGET_OBJECT, Opcode.IF_NE, - Opcode.CONST, + Opcode.CONST, //target reference ) ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/bytecode/patch/SettingsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/bytecode/patch/SettingsPatch.kt index a5751d2e8..82cff22b4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/bytecode/patch/SettingsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/bytecode/patch/SettingsPatch.kt @@ -75,7 +75,15 @@ class SettingsPatch : BytecodePatch( scanResult.patternScanResult!!.endIndex + 1, buildInstructionsString(1) ) + addInstructions( + scanResult.patternScanResult!!.endIndex - 7, + buildInstructionsString(0) + ) + addInstructions( + scanResult.patternScanResult!!.endIndex - 9, + buildInstructionsString(1) + ) addInstructions( mutableMethod.implementation!!.instructions.size - 2, buildInstructionsString(0)