mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-05-24 10:32:15 +02:00
fix(sc_plus): mapping update
This commit is contained in:
parent
adc237e0d3
commit
017dd912f6
@ -137,7 +137,9 @@ afterEvaluate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1'
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
|
||||||
|
implementation 'org.jetbrains.kotlin:kotlin-reflect:1.8.10'
|
||||||
|
|
||||||
compileOnly files('libs/LSPosed-api-1.0-SNAPSHOT.jar')
|
compileOnly files('libs/LSPosed-api-1.0-SNAPSHOT.jar')
|
||||||
implementation 'com.google.code.gson:gson:2.10.1'
|
implementation 'com.google.code.gson:gson:2.10.1'
|
||||||
implementation 'com.arthenica:ffmpeg-kit-full-gpl:5.1.LTS'
|
implementation 'com.arthenica:ffmpeg-kit-full-gpl:5.1.LTS'
|
||||||
|
@ -10,19 +10,25 @@ class SnapchatPlus: Feature("SnapchatPlus", loadParams = FeatureLoadParams.ACTIV
|
|||||||
override fun asyncOnActivityCreate() {
|
override fun asyncOnActivityCreate() {
|
||||||
if (!context.config.bool(ConfigProperty.SNAPCHAT_PLUS)) return
|
if (!context.config.bool(ConfigProperty.SNAPCHAT_PLUS)) return
|
||||||
|
|
||||||
Hooker.hookConstructor(context.mappings.getMappedClass("SubscriptionInfoClass"), HookStage.BEFORE) { param ->
|
val subscriptionInfoMembers = context.mappings.getMappedMap("SubscriptionInfoClassMembers")
|
||||||
|
|
||||||
|
Hooker.hookConstructor(context.mappings.getMappedClass("SubscriptionInfoClass"), HookStage.AFTER) { param ->
|
||||||
|
val getField = { key: String -> param.thisObject<Any>().javaClass.declaredFields.first {it.name == (subscriptionInfoMembers[key] as String)}.also { it.isAccessible = true }}
|
||||||
|
|
||||||
|
val subscriptionStatusField = getField("status")
|
||||||
|
val isSubscribedField = getField("isSubscribed")
|
||||||
|
val startTimeMsField = getField("startTimeMs")
|
||||||
|
val expireTimeMsField = getField("expireTimeMs")
|
||||||
|
|
||||||
//check if the user is already premium
|
//check if the user is already premium
|
||||||
if (param.arg(0) as Int == 2) {
|
if ((subscriptionStatusField[param.thisObject()] as Double).toInt() == 2) {
|
||||||
return@hookConstructor
|
return@hookConstructor
|
||||||
}
|
}
|
||||||
//subscription info tier
|
|
||||||
param.setArg(0, 2)
|
isSubscribedField.set(param.thisObject(), true)
|
||||||
//subscription status
|
startTimeMsField.set(param.thisObject(), (System.currentTimeMillis() - 7776000000L).toDouble())
|
||||||
param.setArg(1, 2)
|
expireTimeMsField.set(param.thisObject(), (System.currentTimeMillis() + 15552000000L).toDouble())
|
||||||
//subscription time
|
subscriptionStatusField.set(param.thisObject(), 2.toDouble())
|
||||||
param.setArg(2, System.currentTimeMillis() - 7776000000L)
|
|
||||||
//expiration time
|
|
||||||
param.setArg(3, System.currentTimeMillis() + 15552000000L)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -20,11 +20,21 @@ class PlusSubscriptionMapper : Mapper() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
//get the first param of the method which is the PlusSubscriptionState class
|
//get the first param of the method which is the PlusSubscriptionState class
|
||||||
val plusSubscriptionStateClass = loadSubscriptionMethod.parameterTypes[0]
|
val plusSubscriptionStateClass = loadSubscriptionMethod.parameterTypes[0]
|
||||||
//get the first param of the constructor of PlusSubscriptionState which is the SubscriptionInfo class
|
//get the first param of the constructor of PlusSubscriptionState which is the SubscriptionInfo class
|
||||||
val subscriptionInfoClass = plusSubscriptionStateClass.constructors[0].parameterTypes[0]
|
val subscriptionInfoClass = plusSubscriptionStateClass.constructors[0].parameterTypes[0]
|
||||||
|
*/
|
||||||
|
mappings["SubscriptionInfoClass"] = loadSubscriptionMethod.returnType.name
|
||||||
|
|
||||||
mappings["SubscriptionInfoClass"] = subscriptionInfoClass.name
|
val members = mutableMapOf<String, Any>()
|
||||||
|
loadSubscriptionMethod.returnType.declaredFields.forEach { field ->
|
||||||
|
val serializedNameAnnotation = field.declaredAnnotations.first()
|
||||||
|
val propertyName = serializedNameAnnotation.annotationClass.members.first { it.name == "name" }.call(serializedNameAnnotation) as String
|
||||||
|
members[propertyName] = field.name
|
||||||
|
}
|
||||||
|
|
||||||
|
mappings["SubscriptionInfoClassMembers"] = members
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user