commit 4e8dff949f1c67eb4bdd122198c869206b02e9a9 parent ce9833f2c38831852b3a196922c237520d0485f4 Author: rhunk <101876869+rhunk@users.noreply.github.com> Date: Thu, 27 Jul 2023 15:57:18 +0200 fix: stealth mode (#156) * fix: stealth mod --------- Co-authored-by: RevealedSoulEven <anshumaurya000@gmail.com> Diffstat:
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/Messaging.kt b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/Messaging.kt @@ -1,6 +1,5 @@ package me.rhunk.snapenhance.features.impl -import me.rhunk.snapenhance.Logger import me.rhunk.snapenhance.config.ConfigProperty import me.rhunk.snapenhance.data.wrapper.impl.SnapUUID import me.rhunk.snapenhance.features.Feature @@ -9,6 +8,7 @@ import me.rhunk.snapenhance.hook.HookStage import me.rhunk.snapenhance.hook.Hooker import me.rhunk.snapenhance.hook.hook import me.rhunk.snapenhance.util.getObjectField +import me.rhunk.snapenhance.features.impl.spying.StealthMode; class Messaging : Feature("Messaging", loadParams = FeatureLoadParams.ACTIVITY_CREATE_SYNC or FeatureLoadParams.INIT_ASYNC or FeatureLoadParams.INIT_SYNC) { lateinit var conversationManager: Any @@ -59,8 +59,12 @@ class Messaging : Feature("Messaging", loadParams = FeatureLoadParams.ACTIVITY_C } override fun asyncInit() { + val stealthMode = context.feature(StealthMode::class) + arrayOf("activate", "deactivate", "processTypingActivity").forEach { hook -> - Hooker.hook(context.classCache.presenceSession, hook, HookStage.BEFORE, { context.config.bool(ConfigProperty.HIDE_BITMOJI_PRESENCE) }) { + Hooker.hook(context.classCache.presenceSession, hook, HookStage.BEFORE, { + context.config.bool(ConfigProperty.HIDE_BITMOJI_PRESENCE) || stealthMode.isStealth(openedConversationUUID.toString()) + }) { it.setResult(null) } } @@ -76,8 +80,9 @@ class Messaging : Feature("Messaging", loadParams = FeatureLoadParams.ACTIVITY_C lastFocusedMessageId = param.arg(1) } - Hooker.hook(context.classCache.conversationManager, "sendTypingNotification", HookStage.BEFORE, - {context.config.bool(ConfigProperty.HIDE_TYPING_NOTIFICATION)}) { + Hooker.hook(context.classCache.conversationManager, "sendTypingNotification", HookStage.BEFORE, { + context.config.bool(ConfigProperty.HIDE_TYPING_NOTIFICATION) || stealthMode.isStealth(openedConversationUUID.toString()) + }) { it.setResult(null) } } diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spying/PreventReadReceipts.kt b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spying/PreventReadReceipts.kt @@ -25,4 +25,4 @@ class PreventReadReceipts : Feature("PreventReadReceipts", loadParams = FeatureL } } } -} +}+ \ No newline at end of file diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spying/StealthMode.kt b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spying/StealthMode.kt @@ -4,7 +4,6 @@ import me.rhunk.snapenhance.bridge.types.BridgeFileType import me.rhunk.snapenhance.features.BridgeFileFeature import me.rhunk.snapenhance.features.FeatureLoadParams - class StealthMode : BridgeFileFeature("StealthMode", BridgeFileType.STEALTH, loadParams = FeatureLoadParams.ACTIVITY_CREATE_SYNC) { override fun onActivityCreate() { readFile()