feat(kakaotalk): enhance version info patch to include build timestamp
This commit is contained in:
@ -10,6 +10,7 @@ import com.android.tools.smali.dexlib2.Opcode
|
|||||||
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction21c
|
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction21c
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
||||||
import com.android.tools.smali.dexlib2.immutable.reference.ImmutableStringReference
|
import com.android.tools.smali.dexlib2.immutable.reference.ImmutableStringReference
|
||||||
|
import java.time.format.DateTimeFormatter
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val versionInfoPatch = bytecodePatch(
|
val versionInfoPatch = bytecodePatch(
|
||||||
@ -19,8 +20,8 @@ val versionInfoPatch = bytecodePatch(
|
|||||||
compatibleWith("com.kakao.talk"("25.4.2"))
|
compatibleWith("com.kakao.talk"("25.4.2"))
|
||||||
|
|
||||||
execute {
|
execute {
|
||||||
val runPatch: (Fingerprint) -> Unit = {
|
val runPatch: (Fingerprint, Boolean) -> Unit = { fp, inDetail ->
|
||||||
val versionInfo = it.method.instructions
|
val versionInfo = fp.method.instructions
|
||||||
.filterIsInstance<BuilderInstruction21c>()
|
.filterIsInstance<BuilderInstruction21c>()
|
||||||
.first { inst ->
|
.first { inst ->
|
||||||
inst.opcode == Opcode.CONST_STRING
|
inst.opcode == Opcode.CONST_STRING
|
||||||
@ -28,20 +29,29 @@ val versionInfoPatch = bytecodePatch(
|
|||||||
|
|
||||||
val versionString = (versionInfo.reference as StringReference).string
|
val versionString = (versionInfo.reference as StringReference).string
|
||||||
|
|
||||||
it.method
|
fp.method
|
||||||
.replaceInstruction(
|
.replaceInstruction(
|
||||||
versionInfo.location.index,
|
versionInfo.location.index,
|
||||||
BuilderInstruction21c(
|
BuilderInstruction21c(
|
||||||
Opcode.CONST_STRING,
|
Opcode.CONST_STRING,
|
||||||
versionInfo.registerA,
|
versionInfo.registerA,
|
||||||
ImmutableStringReference(
|
ImmutableStringReference(
|
||||||
"$versionString (ReVanced)"
|
if (inDetail) {
|
||||||
|
val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
|
||||||
|
"$versionString (ReVanced)\nBuild at: ${
|
||||||
|
formatter.format(
|
||||||
|
java.time.LocalDateTime.now()
|
||||||
|
)
|
||||||
|
}"
|
||||||
|
} else {
|
||||||
|
"$versionString (ReVanced)"
|
||||||
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
runPatch(versionInfoFingerprint)
|
runPatch(versionInfoFingerprint, true)
|
||||||
runPatch(versionInfoPreviewFingerprint)
|
runPatch(versionInfoPreviewFingerprint, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user