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

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