feat: hide streak restore

This commit is contained in:
rhunk 2023-10-09 21:46:17 +02:00
parent 1a40856ae7
commit 1d41aef8e0
4 changed files with 26 additions and 0 deletions

View File

@ -252,6 +252,10 @@
"name": "Show Streak Expiration Info",
"description": "Shows a Streak Expiration timer next to the Streaks counter"
},
"hide_streak_restore": {
"name": "Hide Streak Restore",
"description": "Hides the Restore button in the friend feed"
},
"hide_story_sections": {
"name": "Hide Story Section",
"description": "Hide certain UI Elements shown in the story section"

View File

@ -26,6 +26,7 @@ class UserInterfaceTweaks : ConfigContainer() {
val bootstrapOverride = container("bootstrap_override", BootstrapOverride()) { requireRestart() }
val mapFriendNameTags = boolean("map_friend_nametags") { requireRestart() }
val streakExpirationInfo = boolean("streak_expiration_info") { requireRestart() }
val hideStreakRestore = boolean("hide_streak_restore") { requireRestart() }
val hideStorySections = multiple("hide_story_sections",
"hide_friend_suggestions", "hide_friends", "hide_suggested", "hide_for_you") { requireRestart() }
val hideUiComponents = multiple("hide_ui_components",

View File

@ -0,0 +1,19 @@
package me.rhunk.snapenhance.features.impl.ui
import me.rhunk.snapenhance.core.util.ktx.getObjectField
import me.rhunk.snapenhance.core.util.ktx.setObjectField
import me.rhunk.snapenhance.features.Feature
import me.rhunk.snapenhance.features.FeatureLoadParams
import me.rhunk.snapenhance.hook.HookStage
import me.rhunk.snapenhance.hook.hookConstructor
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)
}
}
}

View File

@ -24,6 +24,7 @@ import me.rhunk.snapenhance.features.impl.spying.StealthMode
import me.rhunk.snapenhance.features.impl.tweaks.*
import me.rhunk.snapenhance.features.impl.ui.ClientBootstrapOverride
import me.rhunk.snapenhance.features.impl.ui.FriendFeedMessagePreview
import me.rhunk.snapenhance.features.impl.ui.HideStreakRestore
import me.rhunk.snapenhance.features.impl.ui.PinConversations
import me.rhunk.snapenhance.features.impl.ui.UITweaks
import me.rhunk.snapenhance.manager.Manager
@ -104,6 +105,7 @@ class FeatureManager(
OldBitmojiSelfie::class,
SnapToChatMedia::class,
FriendFeedMessagePreview::class,
HideStreakRestore::class,
)
initializeFeatures()