fix: stealth mode (#156)
* fix: stealth mod --------- Co-authored-by: RevealedSoulEven <anshumaurya000@gmail.com>
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,4 +25,4 @@ class PreventReadReceipts : Feature("PreventReadReceipts", loadParams = FeatureL
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user