commit d7620409375dd089a3099475f6bf9e455daa6cca parent c9526931e8cc5cc8202cecb701dd6570931713a2 Author: rhunk <101876869+rhunk@users.noreply.github.com> Date: Mon, 4 Dec 2023 22:26:13 +0100 feat(core/ui_tweaks): hide unread chat hint Diffstat:
4 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/common/src/main/assets/lang/en_US.json b/common/src/main/assets/lang/en_US.json @@ -752,7 +752,8 @@ "hide_chat_call_buttons": "Remove Chat Call Buttons", "hide_live_location_share_button": "Remove Live Location Share Button", "hide_stickers_button": "Remove Stickers Button", - "hide_voice_record_button": "Remove Voice Record Button" + "hide_voice_record_button": "Remove Voice Record Button", + "hide_unread_chat_hint": "Remove Unread Chat Hint" }, "hide_story_sections": { "hide_friend_suggestions": "Hide friend suggestions", diff --git a/common/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/UserInterfaceTweaks.kt b/common/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/UserInterfaceTweaks.kt @@ -41,7 +41,8 @@ class UserInterfaceTweaks : ConfigContainer() { "hide_stickers_button", "hide_live_location_share_button", "hide_chat_call_buttons", - "hide_profile_call_buttons" + "hide_profile_call_buttons", + "hide_unread_chat_hint", ) { requireRestart() } val operaMediaQuickInfo = boolean("opera_media_quick_info") { requireRestart() } val oldBitmojiSelfie = unique("old_bitmoji_selfie", "2d", "3d") { requireCleanCache() } diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/Stories.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/Stories.kt @@ -9,8 +9,8 @@ import me.rhunk.snapenhance.core.features.FeatureLoadParams import java.nio.ByteBuffer import kotlin.coroutines.suspendCoroutine -class Stories : Feature("Stories", loadParams = FeatureLoadParams.ACTIVITY_CREATE_SYNC) { - override fun onActivityCreate() { +class Stories : Feature("Stories", loadParams = FeatureLoadParams.INIT_SYNC) { + override fun init() { val disablePublicStories by context.config.global.disablePublicStories context.event.subscribe(NetworkApiRequestEvent::class) { event -> diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/ui/UITweaks.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/ui/UITweaks.kt @@ -50,6 +50,7 @@ class UITweaks : Feature("UITweaks", loadParams = FeatureLoadParams.ACTIVITY_CRE val callButton2 = getId("friend_action_button4", "id") val chatNoteRecordButton = getId("chat_note_record_button", "id") + val unreadHintButton = getId("unread_hint_button", "id") View::class.java.hook("setVisibility", HookStage.BEFORE) { methodParam -> val viewId = (methodParam.thisObject() as View).id @@ -145,6 +146,9 @@ class UITweaks : Feature("UITweaks", loadParams = FeatureLoadParams.ACTIVITY_CRE } } } + if (viewId == unreadHintButton && hiddenElements.contains("hide_unread_chat_hint")) { + event.canceled = true + } } } } \ No newline at end of file