From a859d4825b1c33575eaca54137f8c5791b7a67e6 Mon Sep 17 00:00:00 2001 From: C R E S T <217463890+imCrest@users.noreply.github.com> Date: Tue, 14 Apr 2026 16:09:00 +0530 Subject: [PATCH] Implement long click listener for chat button Add long click listener to handle app termination based on user settings. --- .../core/ui/menu/impl/SettingsMenu.kt | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/core/src/main/kotlin/me/eternal/purrfectsnap/core/ui/menu/impl/SettingsMenu.kt b/core/src/main/kotlin/me/eternal/purrfectsnap/core/ui/menu/impl/SettingsMenu.kt index f9052bf0..bb74b4e0 100644 --- a/core/src/main/kotlin/me/eternal/purrfectsnap/core/ui/menu/impl/SettingsMenu.kt +++ b/core/src/main/kotlin/me/eternal/purrfectsnap/core/ui/menu/impl/SettingsMenu.kt @@ -22,6 +22,29 @@ class SettingsMenu : AbstractMenu() { view.setOnClickListener { context.bridgeClient.openOverlay(OverlayType.SETTINGS) } + view.setOnLongClickListener { + val holdKillConfig = context.config.userInterface.chatButtonHoldKill + if (!holdKillConfig.enabled.get()) { + return@setOnLongClickListener false + } + + val targetApps = holdKillConfig.targetApps.get() + val shouldKillModule = targetApps.contains("kill_purrfectsnap") + val shouldKillSnapchat = targetApps.contains("kill_snapchat") + + if (shouldKillModule) { + runCatching { + context.bridgeClient.terminateModuleProcess() + }.onFailure { + context.log.error("Failed to terminate PurrfectSnap module process", it, "SettingsMenu") + } + } + if (shouldKillSnapchat) { + context.forceCloseApp() + } + + shouldKillModule || shouldKillSnapchat + } } } }