mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-06-13 05:37:48 +02:00
fix(core): hide streak restore
This commit is contained in:
@ -4,16 +4,14 @@ import me.rhunk.snapenhance.core.features.Feature
|
|||||||
import me.rhunk.snapenhance.core.features.FeatureLoadParams
|
import me.rhunk.snapenhance.core.features.FeatureLoadParams
|
||||||
import me.rhunk.snapenhance.core.util.hook.HookStage
|
import me.rhunk.snapenhance.core.util.hook.HookStage
|
||||||
import me.rhunk.snapenhance.core.util.hook.hookConstructor
|
import me.rhunk.snapenhance.core.util.hook.hookConstructor
|
||||||
import me.rhunk.snapenhance.core.util.ktx.getObjectField
|
|
||||||
import me.rhunk.snapenhance.core.util.ktx.setObjectField
|
import me.rhunk.snapenhance.core.util.ktx.setObjectField
|
||||||
|
|
||||||
class HideStreakRestore : Feature("HideStreakRestore", loadParams = FeatureLoadParams.ACTIVITY_CREATE_SYNC) {
|
class HideStreakRestore : Feature("HideStreakRestore", loadParams = FeatureLoadParams.ACTIVITY_CREATE_SYNC) {
|
||||||
override fun onActivityCreate() {
|
override fun onActivityCreate() {
|
||||||
if (!context.config.userInterface.hideStreakRestore.get()) return
|
if (!context.config.userInterface.hideStreakRestore.get()) return
|
||||||
|
|
||||||
context.classCache.feedEntry.hookConstructor(HookStage.AFTER) { param ->
|
findClass("com.snapchat.client.messaging.ExpiredStreakMetadata").hookConstructor(HookStage.AFTER) { param ->
|
||||||
val streakMetadata = param.thisObject<Any>().getObjectField("mStreakMetadata") ?: return@hookConstructor
|
param.thisObject<Any>().setObjectField("mIsRestorable", false)
|
||||||
streakMetadata.setObjectField("mExpiredStreak", null)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user