mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-06-13 05:37:48 +02:00
fix(mapper): streaks expiration
Signed-off-by: rhunk <101876869+rhunk@users.noreply.github.com>
This commit is contained in:
@ -6,13 +6,16 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction22c
|
||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
||||
import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
||||
|
||||
fun MethodImplementation.findConstString(string: String, contains: Boolean = false): Boolean = instructions.filterIsInstance(Instruction21c::class.java).any {
|
||||
fun MethodImplementation.findConstString(
|
||||
string: String,
|
||||
contains: Boolean = false,
|
||||
startsWith: Boolean = false,
|
||||
ignoreCase: Boolean = false
|
||||
): Boolean = instructions.filterIsInstance<Instruction21c>().any {
|
||||
(it.reference as? StringReference)?.string?.let { str ->
|
||||
if (contains) {
|
||||
str.contains(string)
|
||||
} else {
|
||||
str == string
|
||||
}
|
||||
if (contains && str.contains(string, ignoreCase = ignoreCase)) return@any true
|
||||
if (startsWith && str.startsWith(string, ignoreCase = ignoreCase)) return@any true
|
||||
str == string
|
||||
} == true
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ class StreaksExpirationMapper: AbstractClassMapper("StreaksExpirationMapper") {
|
||||
var streaksResultClass: String? = null
|
||||
for (clazz in classes) {
|
||||
val toStringMethod = clazz.methods.firstOrNull { it.name == "toString" } ?: continue
|
||||
if (toStringMethod.implementation?.findConstString("StreaksResult(", contains = true) != true) continue
|
||||
if (toStringMethod.implementation?.findConstString("StreaksResult(", startsWith = true) != true) continue
|
||||
streaksResultClass = clazz.type
|
||||
break
|
||||
}
|
||||
|
Reference in New Issue
Block a user