commit f3465a69d03c8018436e7e4c8f5182b92aaf4a36
parent bf5d92a2c4e4ebb9cb53fbd480e394e590a79a1b
Author: rhunk <101876869+rhunk@users.noreply.github.com>
Date:   Tue, 26 Aug 2025 11:39:45 +0200

feat(core): prevent forced keyboard

Signed-off-by: rhunk <101876869+rhunk@users.noreply.github.com>

Diffstat:
Mcommon/src/main/assets/lang/en_US.json | 4++++
Mcommon/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/UserInterfaceTweaks.kt | 1+
Mcore/src/main/kotlin/me/rhunk/snapenhance/core/features/FeatureManager.kt | 1+
Acore/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/tweaks/PreventForcedKeyboard.kt | 20++++++++++++++++++++
4 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/common/src/main/assets/lang/en_US.json b/common/src/main/assets/lang/en_US.json @@ -540,6 +540,10 @@ "edit_text_override": { "name": "Edit Text Override", "description": "Overrides text field behavior" + }, + "prevent_forced_keyboard": { + "name": "Prevent Forced Keyboard", + "description": "Prevents Snapchat from automatically popping up the keyboard when you open a conversation" } } }, diff --git a/common/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/UserInterfaceTweaks.kt b/common/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/UserInterfaceTweaks.kt @@ -57,4 +57,5 @@ class UserInterfaceTweaks : ConfigContainer() { val editTextOverride = multiple("edit_text_override", "multi_line_chat_input", "bypass_text_input_limit") { requireRestart(); addNotices(FeatureNotice.BAN_RISK, FeatureNotice.INTERNAL_BEHAVIOR) } + val preventForcedKeyboard = boolean("prevent_forced_keyboard") { requireRestart() } } diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/FeatureManager.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/FeatureManager.kt @@ -143,6 +143,7 @@ class FeatureManager( DoubleTapChatAction(), SnapScoreChanges(), DisableSnapModeRestrictions(), + PreventForcedKeyboard(), ) features.values.toList().forEach { feature -> diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/tweaks/PreventForcedKeyboard.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/tweaks/PreventForcedKeyboard.kt @@ -0,0 +1,19 @@ +package me.rhunk.snapenhance.core.features.impl.tweaks + +import android.view.View +import android.view.inputmethod.InputMethodManager +import me.rhunk.snapenhance.core.features.Feature +import me.rhunk.snapenhance.core.util.hook.HookStage +import me.rhunk.snapenhance.core.util.hook.hook + +class PreventForcedKeyboard : Feature("Prevent Forced Keyboard") { + override fun init() { + if (!context.config.userInterface.preventForcedKeyboard.get()) return + + InputMethodManager::class.java.hook("showSoftInput", HookStage.BEFORE) { param -> + if (param.argNullable<View>(0)?.javaClass?.name?.endsWith("InputBarEditText") == true && param.args().getOrNull(1) is Int) { + param.setResult(false) + } + } + } +}+ \ No newline at end of file