Template
mirror of
https://github.com/MorpheApp/morphe-patches-template.git
synced 2026-11-30 23:09:34 +00:00
chore: Update example patch
This commit is contained in:
1 parent
f15bee4d35
commit
8c4fa72ae6
3 files changed
+34
-6
No files matched your search
@@ -2,15 +2,17 @@ package app.template.patches.example
|
||||
|
||||
import app.morphe.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.morphe.patcher.patch.bytecodePatch
|
||||
import app.template.patches.shared.Constants.COMPATIBILITY_EXAMPLE
|
||||
|
||||
private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/template/extension/ExamplePatch;"
|
||||
|
||||
@Suppress("unused")
|
||||
val examplePatch = bytecodePatch(
|
||||
name = "Example Patch",
|
||||
description = "Example patch to start with."
|
||||
description = "Example patch to start with.",
|
||||
default = true
|
||||
) {
|
||||
compatibleWith("com.example.app"("1.0.0"))
|
||||
compatibleWith(COMPATIBILITY_EXAMPLE)
|
||||
|
||||
extendWith("extensions/extension.mpp")
|
||||
|
||||
|
||||
@@ -2,11 +2,13 @@ package app.template.patches.example
|
||||
|
||||
import app.morphe.patcher.Fingerprint
|
||||
import app.morphe.patcher.InstructionLocation.*
|
||||
import app.morphe.patcher.StringComparisonType
|
||||
import app.morphe.patcher.fieldAccess
|
||||
import app.morphe.patcher.literal
|
||||
import app.morphe.patcher.methodCall
|
||||
import app.morphe.patcher.opcode
|
||||
import app.morphe.patcher.string
|
||||
import app.template.patches.example.AdLoaderFingerprint.classDef
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
@@ -15,11 +17,11 @@ import com.android.tools.smali.dexlib2.Opcode
|
||||
object AdLoaderFingerprint : Fingerprint(
|
||||
// Exact access flags
|
||||
accessFlags = listOf(AccessFlags.PUBLIC, AccessFlags.FINAL),
|
||||
// Return type is matched using String.startsWith()
|
||||
// Return type is matched using implicit coparison depending on how the type is declared.
|
||||
// See StringComparisonType for more.
|
||||
returnType = "Z",
|
||||
// Declared parameters are matched using String.startsWith()
|
||||
// Non obfuscated classes should be declared using the full class name.
|
||||
// While obfuscated class names must be declared only using the object type
|
||||
// Declared parameters are matched using StringComparisonType implicit comparison.
|
||||
// Obfuscated class names must be declared only using the object type
|
||||
// Since obfuscated names change between releases.
|
||||
// Last parameter is simply `L` since it's an obfuscated class object.
|
||||
parameters = listOf("Ljava/lang/String;", "I", "L"),
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package app.template.patches.shared
|
||||
|
||||
import app.morphe.patcher.patch.ApkFileType
|
||||
import app.morphe.patcher.patch.AppTarget
|
||||
import app.morphe.patcher.patch.Compatibility
|
||||
|
||||
object Constants {
|
||||
val COMPATIBILITY_EXAMPLE = Compatibility(
|
||||
name = "XYZ app",
|
||||
packageName = "com.example.app",
|
||||
apkFileType = ApkFileType.APK,
|
||||
appIconColor = 0xFF0045, // Icon color in Morphe Manager
|
||||
targets = listOf(
|
||||
// "version = null" means the patch works with the latest app target
|
||||
// and is expected to work with all future app targets
|
||||
AppTarget(
|
||||
version = "2.0.0"
|
||||
),
|
||||
AppTarget(
|
||||
version = "1.0.2",
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user