diff --git a/common/src/main/assets/lang/en_US.json b/common/src/main/assets/lang/en_US.json index ca5e5a56..de871a4b 100644 --- a/common/src/main/assets/lang/en_US.json +++ b/common/src/main/assets/lang/en_US.json @@ -324,6 +324,10 @@ "name": "Anonymous Story Viewing", "description": "Prevents anyone from knowing you've seen their story" }, + "hide_peek_a_peek": { + "name": "Hide Peek-a-Peek", + "description": "Prevents notification from being sent when you half swipe into a chat" + }, "hide_bitmoji_presence": { "name": "Hide Bitmoji Presence", "description": "Prevents your Bitmoji from popping up while in Chat" diff --git a/common/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/MessagingTweaks.kt b/common/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/MessagingTweaks.kt index 82634c7b..1e2b5325 100644 --- a/common/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/MessagingTweaks.kt +++ b/common/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/MessagingTweaks.kt @@ -7,6 +7,7 @@ import me.rhunk.snapenhance.common.data.NotificationType class MessagingTweaks : ConfigContainer() { val bypassScreenshotDetection = boolean("bypass_screenshot_detection") { requireRestart() } val anonymousStoryViewing = boolean("anonymous_story_viewing") + 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") diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/messaging/Messaging.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/messaging/Messaging.kt index 8ee08cd2..30210324 100644 --- a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/messaging/Messaging.kt +++ b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/messaging/Messaging.kt @@ -98,17 +98,18 @@ class Messaging : Feature("Messaging", loadParams = FeatureLoadParams.ACTIVITY_C override fun asyncInit() { val stealthMode = context.feature(StealthMode::class) - val hideBitmojiPresence by context.config.messaging.hideBitmojiPresence - val hideTypingNotification by context.config.messaging.hideTypingNotifications - arrayOf("activate", "deactivate", "processTypingActivity").forEach { hook -> Hooker.hook(context.classCache.presenceSession, hook, HookStage.BEFORE, { - hideBitmojiPresence || stealthMode.canUseRule(openedConversationUUID.toString()) + context.config.messaging.hideBitmojiPresence.get() || stealthMode.canUseRule(openedConversationUUID.toString()) }) { it.setResult(null) } } + context.classCache.presenceSession.hook("startPeeking", HookStage.BEFORE, { + context.config.messaging.hidePeekAPeek.get() || stealthMode.canUseRule(openedConversationUUID.toString()) + }) { it.setResult(null) } + //get last opened snap for media downloader context.event.subscribe(OnSnapInteractionEvent::class) { event -> openedConversationUUID = event.conversationId @@ -121,7 +122,7 @@ class Messaging : Feature("Messaging", loadParams = FeatureLoadParams.ACTIVITY_C } context.classCache.conversationManager.hook("sendTypingNotification", HookStage.BEFORE, { - hideTypingNotification || stealthMode.canUseRule(openedConversationUUID.toString()) + context.config.messaging.hideTypingNotifications.get() || stealthMode.canUseRule(openedConversationUUID.toString()) }) { it.setResult(null) }