From 471099142c4647898a910c319674a75557fe4e09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=9ET=CE=9ERNAL?= Date: Thu, 9 Oct 2025 13:56:03 +0530 Subject: [PATCH] feat: message logger blacklist/whitelist --- .../rhunk/snapenhance/common/data/MessagingCoreObjects.kt | 2 +- .../snapenhance/core/features/impl/spying/MessageLogger.kt | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/common/src/main/kotlin/me/rhunk/snapenhance/common/data/MessagingCoreObjects.kt b/common/src/main/kotlin/me/rhunk/snapenhance/common/data/MessagingCoreObjects.kt index a5597e2a..6e03a646 100644 --- a/common/src/main/kotlin/me/rhunk/snapenhance/common/data/MessagingCoreObjects.kt +++ b/common/src/main/kotlin/me/rhunk/snapenhance/common/data/MessagingCoreObjects.kt @@ -55,7 +55,7 @@ enum class MessagingRuleType( HIDE_FRIEND_FEED("hide_friend_feed", false, Icons.Outlined.VisibilityOff, showInFriendMenu = false), E2E_ENCRYPTION("e2e_encryption", false, Icons.Outlined.Lock), PIN_CONVERSATION("pin_conversation", false, Icons.Outlined.PushPin, showInFriendMenu = false), - EXCLUDE_MESSAGE_LOGGER("exclude_message_logger", false, Icons.AutoMirrored.Filled.Message, showInFriendMenu = false); + MESSAGE_LOGGER("message_logger", true, Icons.AutoMirrored.Filled.Message, showInFriendMenu = true); fun translateOptionKey(optionKey: String): String { return if (listMode) "rules.properties.$key.options.$optionKey" else "rules.properties.$key.name" diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/spying/MessageLogger.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/spying/MessageLogger.kt index a3eec645..7b165265 100644 --- a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/spying/MessageLogger.kt +++ b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/spying/MessageLogger.kt @@ -27,7 +27,7 @@ import me.rhunk.snapenhance.core.util.EvictingMap import java.util.concurrent.Executors import kotlin.system.measureTimeMillis -class MessageLogger : MessagingRuleFeature("MessageLogger", MessagingRuleType.EXCLUDE_MESSAGE_LOGGER) { +class MessageLogger : MessagingRuleFeature("MessageLogger", MessagingRuleType.MESSAGE_LOGGER) { companion object { const val PREFETCH_MESSAGE_COUNT = 20 const val PREFETCH_FEED_COUNT = 20 @@ -130,8 +130,7 @@ class MessageLogger : MessagingRuleFeature("MessageLogger", MessagingRuleType.EX } threadPool.execute { - // ignore excluded conversations - if (getState(conversationId)) { + if (!canUseRule(conversationId)) { return@execute } @@ -200,6 +199,4 @@ class MessageLogger : MessagingRuleFeature("MessageLogger", MessagingRuleType.EX } } } - - override fun getRuleState() = RuleState.WHITELIST } \ No newline at end of file