diff --git a/api/revanced-patches.api b/api/revanced-patches.api index e07e2e7a0d..e885e2eb48 100644 --- a/api/revanced-patches.api +++ b/api/revanced-patches.api @@ -152,6 +152,12 @@ public final class app/revanced/patches/all/telephony/sim/spoof/SpoofSimCountryP public fun transform (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;Lkotlin/Pair;)V } +public final class app/revanced/patches/amazon/deeplinking/DeepLinkingPatch : app/revanced/patcher/patch/BytecodePatch { + public static final field INSTANCE Lapp/revanced/patches/amazon/deeplinking/DeepLinkingPatch; + public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V + public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V +} + public final class app/revanced/patches/backdrops/misc/pro/ProUnlockPatch : app/revanced/patcher/patch/BytecodePatch { public static final field INSTANCE Lapp/revanced/patches/backdrops/misc/pro/ProUnlockPatch; public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V diff --git a/src/main/kotlin/app/revanced/patches/amazon/deeplinking/DeepLinkingFingerprint.kt b/src/main/kotlin/app/revanced/patches/amazon/deeplinking/DeepLinkingFingerprint.kt new file mode 100644 index 0000000000..8caa3ece4e --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/amazon/deeplinking/DeepLinkingFingerprint.kt @@ -0,0 +1,11 @@ +package app.revanced.patches.amazon.deeplinking + +import app.revanced.patcher.fingerprint.MethodFingerprint +import com.android.tools.smali.dexlib2.AccessFlags + +internal object DeepLinkingFingerprint : MethodFingerprint( + "Z", + parameters = listOf("L"), + accessFlags = AccessFlags.PRIVATE.value, + strings = listOf("https://www.", "android.intent.action.VIEW") +) diff --git a/src/main/kotlin/app/revanced/patches/amazon/deeplinking/DeepLinkingPatch.kt b/src/main/kotlin/app/revanced/patches/amazon/deeplinking/DeepLinkingPatch.kt new file mode 100644 index 0000000000..96cf445459 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/amazon/deeplinking/DeepLinkingPatch.kt @@ -0,0 +1,28 @@ +package app.revanced.patches.amazon.deeplinking + +import app.revanced.patcher.data.BytecodeContext +import app.revanced.patcher.extensions.InstructionExtensions.addInstructions +import app.revanced.patcher.patch.BytecodePatch +import app.revanced.patcher.patch.annotation.CompatiblePackage +import app.revanced.patcher.patch.annotation.Patch +import app.revanced.util.exception + +@Patch( + name = "Always allow deep-linking", + description = "Open Amazon links, even if the app is not set to handle Amazon links.", + compatiblePackages = [CompatiblePackage("com.amazon.mShop.android.shopping")] +) +@Suppress("unused") +object DeepLinkingPatch : BytecodePatch( + setOf(DeepLinkingFingerprint) +) { + override fun execute(context: BytecodeContext) { + DeepLinkingFingerprint.result?.mutableMethod?.addInstructions( + 0, + """ + const/4 v0, 0x1 + return v0 + """ + ) ?: throw DeepLinkingFingerprint.exception + } +}