feat(core/ui_tweaks): hide unread chat hint

This commit is contained in:
rhunk
2023-12-04 22:26:13 +01:00
parent c9526931e8
commit d762040937
4 changed files with 10 additions and 4 deletions

View File

@ -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",

View File

@ -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() }

View File

@ -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 ->

View File

@ -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
}
}
}
}