Template
mirror of
https://github.com/MorpheApp/morphe-patches-template.git
synced 2026-12-01 00:19:34 +00:00
chore: Merge branch dev to main (#25)
This commit is contained in:
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.extensions.InstructionExtensions.addInstructions
|
||||||
import app.morphe.patcher.patch.bytecodePatch
|
import app.morphe.patcher.patch.bytecodePatch
|
||||||
|
import app.template.patches.shared.Constants.COMPATIBILITY_EXAMPLE
|
||||||
|
|
||||||
private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/template/extension/ExamplePatch;"
|
private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/template/extension/ExamplePatch;"
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val examplePatch = bytecodePatch(
|
val examplePatch = bytecodePatch(
|
||||||
name = "Example Patch",
|
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")
|
extendWith("extensions/extension.mpp")
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,13 @@ package app.template.patches.example
|
|||||||
|
|
||||||
import app.morphe.patcher.Fingerprint
|
import app.morphe.patcher.Fingerprint
|
||||||
import app.morphe.patcher.InstructionLocation.*
|
import app.morphe.patcher.InstructionLocation.*
|
||||||
|
import app.morphe.patcher.StringComparisonType
|
||||||
import app.morphe.patcher.fieldAccess
|
import app.morphe.patcher.fieldAccess
|
||||||
import app.morphe.patcher.literal
|
import app.morphe.patcher.literal
|
||||||
import app.morphe.patcher.methodCall
|
import app.morphe.patcher.methodCall
|
||||||
import app.morphe.patcher.opcode
|
import app.morphe.patcher.opcode
|
||||||
import app.morphe.patcher.string
|
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.AccessFlags
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
@@ -15,11 +17,11 @@ import com.android.tools.smali.dexlib2.Opcode
|
|||||||
object AdLoaderFingerprint : Fingerprint(
|
object AdLoaderFingerprint : Fingerprint(
|
||||||
// Exact access flags
|
// Exact access flags
|
||||||
accessFlags = listOf(AccessFlags.PUBLIC, AccessFlags.FINAL),
|
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",
|
returnType = "Z",
|
||||||
// Declared parameters are matched using String.startsWith()
|
// Declared parameters are matched using StringComparisonType implicit comparison.
|
||||||
// Non obfuscated classes should be declared using the full class name.
|
// Obfuscated class names must be declared only using the object type
|
||||||
// While obfuscated class names must be declared only using the object type
|
|
||||||
// Since obfuscated names change between releases.
|
// Since obfuscated names change between releases.
|
||||||
// Last parameter is simply `L` since it's an obfuscated class object.
|
// Last parameter is simply `L` since it's an obfuscated class object.
|
||||||
parameters = listOf("Ljava/lang/String;", "I", "L"),
|
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