revanced-patches/src/main/kotlin/app/revanced/patches/lightroom/misc/login/DisableMandatoryLoginPatch.kt
2024-03-31 23:43:13 +04:00

27 lines
1021 B
Kotlin

package app.revanced.patches.lightroom.misc.login
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.lightroom.misc.login.fingerprints.IsLoggedInFingerprint
import app.revanced.util.exception
@Patch(
name = "Disable mandatory login",
compatiblePackages = [CompatiblePackage("com.adobe.lrmobile")]
)
@Suppress("unused")
object DisableMandatoryLoginPatch : BytecodePatch(
setOf(IsLoggedInFingerprint)
) {
override fun execute(context: BytecodeContext) {
IsLoggedInFingerprint.result?.mutableMethod?.apply {
val index = implementation!!.instructions.lastIndex - 1
// Set isLoggedIn = true.
replaceInstruction(index, "const/4 v0, 0x1")
} ?: throw IsLoggedInFingerprint.exception
}
}