mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-06-12 13:17:42 +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.util.hook.HookStage
|
||||
import me.rhunk.snapenhance.core.util.hook.hookConstructor
|
||||
import me.rhunk.snapenhance.core.util.ktx.getObjectField
|
||||
import me.rhunk.snapenhance.core.util.ktx.setObjectField
|
||||
|
||||
class HideStreakRestore : Feature("HideStreakRestore", loadParams = FeatureLoadParams.ACTIVITY_CREATE_SYNC) {
|
||||
override fun onActivityCreate() {
|
||||
if (!context.config.userInterface.hideStreakRestore.get()) return
|
||||
|
||||
context.classCache.feedEntry.hookConstructor(HookStage.AFTER) { param ->
|
||||
val streakMetadata = param.thisObject<Any>().getObjectField("mStreakMetadata") ?: return@hookConstructor
|
||||
streakMetadata.setObjectField("mExpiredStreak", null)
|
||||
findClass("com.snapchat.client.messaging.ExpiredStreakMetadata").hookConstructor(HookStage.AFTER) { param ->
|
||||
param.thisObject<Any>().setObjectField("mIsRestorable", false)
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user