feat: Hide typing indicator blacklist/whitelist

This commit is contained in:
ΞTΞRNAL
2025-10-09 14:01:04 +05:30
parent 471099142c
commit a25b66a385
6 changed files with 33 additions and 14 deletions

View File

@@ -263,6 +263,14 @@
"whitelist": "Stealth mode"
}
},
"hide_typing_indicator": {
"name": "Hide Typing Indicator",
"description": "Prevents anyone from knowing you're typing",
"options": {
"blacklist": "Exclude from Hide Typing Indicator",
"whitelist": "Hide Typing Indicator"
}
},
"auto_save": {
"name": "Auto Save",
"description": "Saves Chat Messages when viewing them",
@@ -598,10 +606,6 @@
"name": "Hide Bitmoji Presence",
"description": "Prevents your Bitmoji from popping up while in Chat"
},
"hide_typing_notifications": {
"name": "Hide Typing Notifications",
"description": "Prevents anyone from knowing you're typing a message"
},
"unlimited_snap_view_time": {
"name": "Unlimited Snap View Time",
"description": "Removes the Time Limit for viewing Snaps"

View File

@@ -60,7 +60,6 @@ class MessagingTweaks : ConfigContainer() {
val preventStoryRewatchIndicator = boolean("prevent_story_rewatch_indicator") { requireRestart() }
val hidePeekAPeek = boolean("hide_peek_a_peek")
val hideBitmojiPresence = boolean("hide_bitmoji_presence")
val hideTypingNotifications = boolean("hide_typing_notifications")
val unlimitedSnapViewTime = boolean("unlimited_snap_view_time")
val autoMarkAsRead = multiple("auto_mark_as_read", "snap_reply", "conversation_read", "save_snap_in_chat") { requireRestart() }
val markSnapAsSeenButton = boolean("mark_snap_as_seen_button") { requireRestart() }

View File

@@ -48,6 +48,7 @@ enum class MessagingRuleType(
val configNotices: Array<FeatureNotice> = emptyArray()
) {
STEALTH("stealth", true, Icons.Outlined.TrackChanges),
HIDE_TYPING_INDICATOR("hide_typing_indicator", true, Icons.Outlined.KeyboardHide, defaultValue = "whitelist"),
AUTO_DOWNLOAD("auto_download", true, Icons.Outlined.DownloadForOffline),
AUTO_SAVE("auto_save", true, Icons.Outlined.Save, defaultValue = "blacklist"),
AUTO_OPEN_SNAPS("auto_open_snaps", true, Icons.Outlined.OpenInFull, configNotices = arrayOf(FeatureNotice.BAN_RISK, FeatureNotice.UNSTABLE), defaultValue = null),

View File

@@ -81,6 +81,7 @@ class FeatureManager(
PreventMessageSending(),
Notifications(),
AutoSave(),
HideTypingIndicator(),
UITweaks(),
ConfigurationOverride(),
COFOverride(),

View File

@@ -0,0 +1,18 @@
package me.rhunk.snapenhance.core.features.impl.messaging
import me.rhunk.snapenhance.common.data.MessagingRuleType
import me.rhunk.snapenhance.core.features.MessagingRuleFeature
import me.rhunk.snapenhance.core.util.hook.HookStage
import me.rhunk.snapenhance.core.util.hook.hook
class HideTypingIndicator : MessagingRuleFeature("Hide Typing Indicator", MessagingRuleType.HIDE_TYPING_INDICATOR) {
private val messaging: Messaging by lazy { context.feature(Messaging::class) }
override fun init() {
context.classCache.presenceSession.hook("processTypingActivity", HookStage.BEFORE, {
messaging.openedConversationUUID?.toString()?.let { canUseRule(it) } ?: false
}) {
it.setResult(null)
}
}
}

View File

@@ -98,16 +98,18 @@ class Messaging : Feature("Messaging") {
}
defer {
arrayOf("activate", "deactivate", "processTypingActivity").forEach { hook ->
arrayOf("activate", "deactivate").forEach { hook ->
context.classCache.presenceSession.hook(hook, HookStage.BEFORE, {
context.config.messaging.hideBitmojiPresence.get() || stealthMode.canUseRule(openedConversationUUID.toString())
val conversationId = openedConversationUUID?.toString() ?: return@hook false
context.config.messaging.hideBitmojiPresence.get() || stealthMode.canUseRule(conversationId)
}) {
it.setResult(null)
}
}
context.classCache.presenceSession.hook("startPeeking", HookStage.BEFORE, {
context.config.messaging.hidePeekAPeek.get() || stealthMode.canUseRule(openedConversationUUID.toString())
val conversationId = openedConversationUUID?.toString() ?: return@hook false
context.config.messaging.hidePeekAPeek.get() || stealthMode.canUseRule(conversationId)
}) { it.setResult(null) }
//get last opened snap for media downloader
@@ -122,12 +124,6 @@ class Messaging : Feature("Messaging") {
lastFocusedMessageId = param.arg(1)
}
}
context.classCache.conversationManager.hook("sendTypingNotification", HookStage.BEFORE, {
context.config.messaging.hideTypingNotifications.get() || stealthMode.canUseRule(openedConversationUUID.toString())
}) {
it.setResult(null)
}
}
onNextActivityCreate {