generated from ReVanced/revanced-patches-template
-
-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Amazon): Add
Always allow deep-linking
patch (#3000)
- Loading branch information
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/main/kotlin/app/revanced/patches/amazon/deeplinking/DeepLinkingFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") | ||
) |
28 changes: 28 additions & 0 deletions
28
src/main/kotlin/app/revanced/patches/amazon/deeplinking/DeepLinkingPatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} |