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.iface.reference.StringReference
|
||||
import com.android.tools.smali.dexlib2.immutable.reference.ImmutableStringReference
|
||||
import java.time.format.DateTimeFormatter
|
||||
|
||||
@Suppress("unused")
|
||||
val versionInfoPatch = bytecodePatch(
|
||||
@ -19,8 +20,8 @@ val versionInfoPatch = bytecodePatch(
|
||||
compatibleWith("com.kakao.talk"("25.4.2"))
|
||||
|
||||
execute {
|
||||
val runPatch: (Fingerprint) -> Unit = {
|
||||
val versionInfo = it.method.instructions
|
||||
val runPatch: (Fingerprint, Boolean) -> Unit = { fp, inDetail ->
|
||||
val versionInfo = fp.method.instructions
|
||||
.filterIsInstance<BuilderInstruction21c>()
|
||||
.first { inst ->
|
||||
inst.opcode == Opcode.CONST_STRING
|
||||
@ -28,20 +29,29 @@ val versionInfoPatch = bytecodePatch(
|
||||
|
||||
val versionString = (versionInfo.reference as StringReference).string
|
||||
|
||||
it.method
|
||||
fp.method
|
||||
.replaceInstruction(
|
||||
versionInfo.location.index,
|
||||
BuilderInstruction21c(
|
||||
Opcode.CONST_STRING,
|
||||
versionInfo.registerA,
|
||||
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(versionInfoPreviewFingerprint)
|
||||
runPatch(versionInfoFingerprint, true)
|
||||
runPatch(versionInfoPreviewFingerprint, false)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user