generated from ReVanced/revanced-patches-template
-
-
Notifications
You must be signed in to change notification settings - Fork 312
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
133 changed files
with
1,857 additions
and
747 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ name: Pull strings | |
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: 0 * 1 * * | ||
- cron: 0 0 1 * * | ||
|
||
jobs: | ||
pull: | ||
|
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
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
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
org.gradle.parallel = true | ||
org.gradle.caching = true | ||
kotlin.code.style = official | ||
version = 4.6.0 | ||
version = 4.7.0-dev.16 |
55 changes: 55 additions & 0 deletions
55
src/main/kotlin/app/revanced/patches/all/misc/hex/HexPatch.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,55 @@ | ||
package app.revanced.patches.all.misc.hex | ||
|
||
import app.revanced.patcher.patch.PatchException | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.registerNewPatchOption | ||
import app.revanced.patches.shared.misc.hex.BaseHexPatch | ||
import app.revanced.util.Utils.trimIndentMultiline | ||
import app.revanced.patcher.patch.Patch as PatchClass | ||
|
||
@Patch( | ||
name = "Hex", | ||
description = "Replaces a hexadecimal patterns of bytes of files in an APK.", | ||
use = false, | ||
) | ||
@Suppress("unused") | ||
class HexPatch : BaseHexPatch() { | ||
// TODO: Instead of stringArrayOption, use a custom option type to work around | ||
// https://github.com/ReVanced/revanced-library/issues/48. | ||
// Replace the custom option type with a stringArrayOption once the issue is resolved. | ||
private val replacementsOption by registerNewPatchOption<PatchClass<*>, List<String>>( | ||
key = "replacements", | ||
title = "replacements", | ||
description = """ | ||
Hexadecimal patterns to search for and replace with another in a target file. | ||
A pattern is a sequence of case insensitive strings, each representing hexadecimal bytes, separated by spaces. | ||
An example pattern is 'aa 01 02 FF'. | ||
Every pattern must be followed by a pipe ('|'), the replacement pattern, | ||
another pipe ('|'), and the path to the file to make the changes in relative to the APK root. | ||
The replacement pattern must have the same length as the original pattern. | ||
Full example of a valid input: | ||
'aa 01 02 FF|00 00 00 00|path/to/file' | ||
""".trimIndentMultiline(), | ||
required = true, | ||
valueType = "StringArray", | ||
) | ||
|
||
override val replacements | ||
get() = replacementsOption!!.map { from -> | ||
val (pattern, replacementPattern, targetFilePath) = try { | ||
from.split("|", limit = 3) | ||
} catch (e: Exception) { | ||
throw PatchException( | ||
"Invalid input: $from.\n" + | ||
"Every pattern must be followed by a pipe ('|'), " + | ||
"the replacement pattern, another pipe ('|'), " + | ||
"and the path to the file to make the changes in relative to the APK root. ", | ||
) | ||
} | ||
|
||
Replacement(pattern, replacementPattern, targetFilePath) | ||
} | ||
} |
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 | ||
} | ||
} |
Oops, something went wrong.