diff --git a/README.md b/README.md index b63a87fd8..d5ed67a11 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,6 @@ LeanType is available in two purpose-built flavors designed to match your exact - **🔐 Granular Backup & Encrypted API Key Export**: Export preferences, layouts, custom wordlists, typing history, and text expander shortcuts separately, with optional AES-256 encrypted export for third-party AI and media API keys. - **💾 Selective Category Backup & Restore**: Export and restore your data modularly with independent category checkboxes (**Layouts**, **Theme & Custom Backgrounds**, **Dictionaries & Typing History**, **Clipboard History**, and **General Settings**) without all-or-nothing overwrites. - **🔎 In-Palette Emoji Search**: Search emojis instantly by name or keyword directly within the emoji palette view, powered by locale-aware emoji dictionaries. -- **✉️ Privacy-First OTP Auto-Fill**: Notification-based OTP verification code detection without sensitive SMS permissions, with customizable messaging app selection. - **📚 Smart Learning & Session Boost**: Adaptive personal dictionary learning threshold (1 to 5 times) and dynamic session word boosting. - **🚫 Blacklist & Regex Filtering**: Filter offensive words or unwanted suggestions with custom regex pattern support. - **🔄 Google Dictionary Import**: Seamlessly import personal dictionary words exported from Gboard. diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 72aaaff8b..194c5bce1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -73,18 +73,6 @@ SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only - - - (b.root.parent as? ViewGroup)?.removeView(b.root) b.root.isGone = false - } ?: OtpSuggestionBinding.inflate(LayoutInflater.from(latinIME), parent, false).also { + } ?: InlineSuggestionBinding.inflate(LayoutInflater.from(latinIME), parent, false).also { cachedBinding = it } - val textView = binding.otpSuggestionText + val textView = binding.inlineSuggestionText latinIME.mSettings.getCustomTypeface()?.let { textView.typeface = it } textView.text = match.resultFormatted @@ -57,7 +57,7 @@ class MathSuggestionManager(private val latinIME: LatinIME) { lastDismissedExpression = match.expression } - val closeButton = binding.otpSuggestionClose + val closeButton = binding.inlineSuggestionClose closeButton.setImageDrawable(latinIME.mKeyboardSwitcher.keyboard?.mIconsSet?.getIconDrawable(ToolbarKey.CLOSE_HISTORY.name.lowercase())) closeButton.setOnClickListener { AudioAndHapticFeedbackManager.getInstance().performHapticAndAudioFeedback(KeyCode.NOT_SPECIFIED, it, HapticEvent.KEY_PRESS) diff --git a/app/src/main/java/helium314/keyboard/latin/OtpNotificationListenerService.kt b/app/src/main/java/helium314/keyboard/latin/OtpNotificationListenerService.kt deleted file mode 100644 index c8d69d2fd..000000000 --- a/app/src/main/java/helium314/keyboard/latin/OtpNotificationListenerService.kt +++ /dev/null @@ -1,170 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-only - -package helium314.keyboard.latin - -import android.app.Notification -import android.content.SharedPreferences -import android.os.Bundle -import android.service.notification.NotificationListenerService -import android.service.notification.StatusBarNotification -import androidx.core.app.NotificationCompat -import helium314.keyboard.latin.settings.Settings -import helium314.keyboard.latin.utils.Log -import helium314.keyboard.latin.utils.SmsPackageProvider -import helium314.keyboard.latin.utils.prefs - -/** - * Service that reads incoming OTPs strictly from SMS notifications of allowed SMS messaging apps. - * Requires zero SMS reading permissions in AndroidManifest.xml. - */ -class OtpNotificationListenerService : NotificationListenerService() { - - @Volatile private var isAutoReadEnabled = false - @Volatile private var cachedDefaultSmsPackage: String? = null - - private val prefChangeListener = SharedPreferences.OnSharedPreferenceChangeListener { _, key -> - if (key == Settings.PREF_AUTO_READ_OTP) { - refreshCachedPreferences() - } - } - - private fun refreshCachedPreferences() { - try { - val p = prefs() - isAutoReadEnabled = p.getBoolean(Settings.PREF_AUTO_READ_OTP, false) - cachedDefaultSmsPackage = SmsPackageProvider.getDefaultSmsPackage(this) - } catch (e: Exception) { - Log.w(TAG, "Failed to refresh cached preferences", e) - } - } - - private fun isAllowedPackage(pkg: String): Boolean { - val defaultSms = cachedDefaultSmsPackage ?: SmsPackageProvider.getDefaultSmsPackage(this) - return !defaultSms.isNullOrBlank() && pkg == defaultSms - } - - override fun onNotificationPosted(sbn: StatusBarNotification?) { - processNotification(sbn) - } - - fun checkActiveNotifications() { - refreshCachedPreferences() - if (!isAutoReadEnabled) return - try { - val notifications = activeNotifications ?: return - Log.d(TAG, "checkActiveNotifications: scanning ${notifications.size} active notifications") - for (sbn in notifications) { - processNotification(sbn) - } - } catch (e: Exception) { - Log.w(TAG, "Failed to inspect active notifications", e) - } - } - - private fun processNotification(sbn: StatusBarNotification?) { - val sbnNonNull = sbn ?: return - val pkg = sbnNonNull.packageName ?: return - - // 1. Strict package filter: only accept notifications from the device's default SMS app - if (!isAllowedPackage(pkg)) return - - // 2. In-memory check if feature is enabled - if (!isAutoReadEnabled) return - - Log.d(TAG, "Processing notification from package: $pkg") - - // 4. Extract notification text safely from all possible notification components - val textPieces = mutableListOf() - - sbnNonNull.notification?.tickerText?.let { textPieces.add(it.toString()) } - - try { - val messagingStyle = NotificationCompat.MessagingStyle.extractMessagingStyleFromNotification(sbnNonNull.notification) - messagingStyle?.messages?.forEach { message -> - message.text?.let { textPieces.add(it.toString()) } - } - } catch (e: Exception) { - Log.w(TAG, "Failed to parse MessagingStyle", e) - } - - val extras = sbnNonNull.notification?.extras - if (extras != null) { - extras.getCharSequence(Notification.EXTRA_TITLE)?.let { textPieces.add(it.toString()) } - extras.getCharSequence(Notification.EXTRA_TEXT)?.let { textPieces.add(it.toString()) } - extras.getCharSequence(Notification.EXTRA_BIG_TEXT)?.let { textPieces.add(it.toString()) } - extras.getCharSequence(Notification.EXTRA_SUB_TEXT)?.let { textPieces.add(it.toString()) } - extras.getCharSequenceArray(Notification.EXTRA_TEXT_LINES)?.forEach { textPieces.add(it.toString()) } - - val messages = extras.getParcelableArray(Notification.EXTRA_MESSAGES) - ?: (extras.get(Notification.EXTRA_MESSAGES) as? Array<*>) - if (messages != null) { - for (msg in messages) { - if (msg is Bundle) { - msg.getCharSequence("text")?.let { textPieces.add(it.toString()) } - } - } - } - } - - if (textPieces.isEmpty()) return - val fullText = textPieces.joinToString("\n") - - val otp = OtpSuggestionManager.extractOtp(fullText) ?: return - Log.i(TAG, "OTP detected from notification (pkg=$pkg): $otp") - OtpSuggestionManager.onOtpReceived(otp) - } - - override fun onListenerConnected() { - super.onListenerConnected() - instance = this - refreshCachedPreferences() - try { - prefs().registerOnSharedPreferenceChangeListener(prefChangeListener) - } catch (e: Exception) { - Log.w(TAG, "Failed to register prefChangeListener", e) - } - Log.i(TAG, "Notification listener connected") - try { - prefs().edit().putBoolean(PREF_NLS_DISCONNECTED, false).apply() - checkActiveNotifications() - } catch (e: Exception) { - Log.w(TAG, "Failed to update NLS connected state", e) - } - } - - override fun onListenerDisconnected() { - super.onListenerDisconnected() - if (instance === this) { - instance = null - } - try { - prefs().unregisterOnSharedPreferenceChangeListener(prefChangeListener) - } catch (e: Exception) { - Log.w(TAG, "Failed to unregister prefChangeListener", e) - } - Log.i(TAG, "Notification listener disconnected") - try { - prefs().edit().putBoolean(PREF_NLS_DISCONNECTED, true).apply() - } catch (e: Exception) { - Log.w(TAG, "Failed to update NLS disconnected state", e) - } - } - - override fun onDestroy() { - super.onDestroy() - if (instance === this) { - instance = null - } - try { - prefs().unregisterOnSharedPreferenceChangeListener(prefChangeListener) - } catch (e: Exception) { - // ignore - } - } - - companion object { - private const val TAG = "OtpNotificationListener" - const val PREF_NLS_DISCONNECTED = "nls_disconnected" - @Volatile var instance: OtpNotificationListenerService? = null - } -} diff --git a/app/src/main/java/helium314/keyboard/latin/OtpSuggestionManager.kt b/app/src/main/java/helium314/keyboard/latin/OtpSuggestionManager.kt deleted file mode 100644 index 6fbe0ba71..000000000 --- a/app/src/main/java/helium314/keyboard/latin/OtpSuggestionManager.kt +++ /dev/null @@ -1,186 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-only - -package helium314.keyboard.latin - -import android.os.Handler -import android.os.Looper -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import androidx.core.view.isGone -import helium314.keyboard.event.HapticEvent -import helium314.keyboard.keyboard.internal.keyboard_parser.floris.KeyCode -import helium314.keyboard.latin.common.ColorType -import helium314.keyboard.latin.databinding.OtpSuggestionBinding -import helium314.keyboard.latin.utils.Log -import helium314.keyboard.latin.utils.ToolbarKey - -/** - * Optional, opt-in helper that surfaces one-time passcodes (OTPs) from incoming SMS as a - * suggestion-strip chip the user can tap to insert (similar to the clipboard/screenshot - * suggestions, see [ClipboardHistoryManager.getClipboardSuggestionView]). - * - * Privacy: OTPs are extracted strictly from SMS app notifications via [OtpNotificationListenerService] - * when enabled in Settings. No SMS reading permissions are required. - */ -class OtpSuggestionManager(private val latinIME: LatinIME) { - - private val mainHandler = Handler(Looper.getMainLooper()) - private var otpSuggestionView: View? = null - - fun start() { - activeInstance = this - if (latestOtp == null && latinIME.mSettings.current.mAutoReadOtp) { - OtpNotificationListenerService.instance?.checkActiveNotifications() - } - } - - fun stop() { - if (activeInstance === this) { - activeInstance = null - } - } - - /** - * Build the OTP suggestion chip if a recent code is available, else null. - * Called from [LatinIME.tryShowOtpSuggestion]. - */ - fun getOtpSuggestionView(parent: ViewGroup?): View? { - otpSuggestionView = null - if (parent == null) return null - if (!latinIME.mSettings.current.mAutoReadOtp) return null - if (latestOtp == null) { - OtpNotificationListenerService.instance?.checkActiveNotifications() - } - val otp = latestOtp ?: return null - if (otp == dismissedOtp) return null - if (System.currentTimeMillis() - latestOtpTimestamp > RECENT_OTP_MILLIS) return null - - val binding = OtpSuggestionBinding.inflate(LayoutInflater.from(latinIME), parent, false) - val textView = binding.otpSuggestionText - latinIME.mSettings.getCustomTypeface()?.let { textView.typeface = it } - textView.text = otp - val icon = latinIME.mKeyboardSwitcher.keyboard?.mIconsSet?.getIconDrawable(ToolbarKey.NUMPAD.name.lowercase()) - textView.setCompoundDrawablesRelativeWithIntrinsicBounds(icon, null, null, null) - textView.setOnClickListener { - dismissedOtp = otp - latinIME.onTextInput(otp) - AudioAndHapticFeedbackManager.getInstance().performHapticAndAudioFeedback(KeyCode.NOT_SPECIFIED, it, HapticEvent.KEY_PRESS) - binding.root.isGone = true - } - val closeButton = binding.otpSuggestionClose - closeButton.setImageDrawable(latinIME.mKeyboardSwitcher.keyboard?.mIconsSet?.getIconDrawable(ToolbarKey.CLOSE_HISTORY.name.lowercase())) - closeButton.setOnClickListener { - AudioAndHapticFeedbackManager.getInstance().performHapticAndAudioFeedback(KeyCode.NOT_SPECIFIED, it, HapticEvent.KEY_PRESS) - binding.root.isGone = true - removeOtpSuggestion() - } - - val colors = latinIME.mSettings.current.mColors - textView.setTextColor(colors.get(ColorType.KEY_TEXT)) - icon?.let { colors.setColor(it, ColorType.KEY_ICON) } - colors.setColor(closeButton, ColorType.REMOVE_SUGGESTION_ICON) - colors.setBackground(binding.root, ColorType.CLIPBOARD_SUGGESTION_BACKGROUND) - - otpSuggestionView = binding.root - return otpSuggestionView - } - - private fun removeOtpSuggestion() { - dismissedOtp = latestOtp - otpSuggestionView?.isGone = true - otpSuggestionView = null - latinIME.removeExternalSuggestions() - } - - companion object { - private const val TAG = "OtpSuggestionManager" - private const val RECENT_OTP_MILLIS = 10 * 60 * 1000L // 10 minutes - - private val webOtpRegex = Regex("""(?:^|\s)@[\w.-]+\s+#(\d{4,8})\b""") - private val keywordPrefixOtpRegex = Regex( - """(?i)\b(?:is|otp|code|passcode|password|pin|verification|verify|2fa|auth)\b[\s:=-]+(\d{4,8})\b""" - ) - private val reverseOtpRegex = Regex( - """(?i)\b(\d{4,8})\b[\s:=-]+(?:is\s+)?(?:[a-z0-9_-]{1,15}\s+){0,5}(?:otp|code|passcode|password|pin|verification|verify|2fa|auth)\b""" - ) - private val hashtagOtpRegex = Regex("""(?i)#(\d{4,8})\b""") - private val codeRegex = Regex("""(? - return match.groupValues[1] - } - - // 2. Keyword prefix: "OTP: 123456", "code is 482910", "is 789012" - keywordPrefixOtpRegex.find(body)?.let { match -> - return match.groupValues[1] - } - - // 3. Reverse pattern: "123456 is your code", "789101 is your OTP" - reverseOtpRegex.find(body)?.let { match -> - return match.groupValues[1] - } - - // 4. Hashtag format with OTP keyword: "#123456" - if (otpKeywordRegex.containsMatchIn(body)) { - hashtagOtpRegex.find(body)?.let { match -> - return match.groupValues[1] - } - } - - // 5. Fallback: if message mentions an OTP keyword, find candidate numbers (excluding decimal amounts) - if (otpKeywordRegex.containsMatchIn(body)) { - val matches = codeRegex.findAll(body).map { it.value }.toList() - if (matches.isNotEmpty()) { - // Filter out likely 4-digit years (2020..2035) if multiple candidates exist - val filtered = if (matches.size > 1) { - matches.filterNot { it.length == 4 && it.toIntOrNull() in 2020..2035 } - } else matches - if (filtered.isNotEmpty()) { - return filtered.last() // The OTP is almost always at the end after the context/metadata - } - } - } - - // 6. Single candidate number in the entire message - val allGroups = codeRegex.findAll(body).map { it.value }.toList() - if (allGroups.size == 1) { - return allGroups.first() - } - - return null - } - } -} diff --git a/app/src/main/java/helium314/keyboard/latin/permissions/PermissionsUtil.kt b/app/src/main/java/helium314/keyboard/latin/permissions/PermissionsUtil.kt index 5f88e3d10..75948be47 100644 --- a/app/src/main/java/helium314/keyboard/latin/permissions/PermissionsUtil.kt +++ b/app/src/main/java/helium314/keyboard/latin/permissions/PermissionsUtil.kt @@ -6,23 +6,15 @@ package helium314.keyboard.latin.permissions -import android.content.ComponentName import android.content.Context -import android.content.Intent import android.content.pm.PackageManager import android.os.Build -import android.service.notification.NotificationListenerService -import androidx.core.app.NotificationManagerCompat import androidx.core.content.ContextCompat -import helium314.keyboard.latin.OtpNotificationListenerService -import helium314.keyboard.latin.utils.Log /** * Utility class for permissions. */ object PermissionsUtil { - private const val TAG = "PermissionsUtil" - /** * Queries if al the permissions are granted for the given permission strings. */ @@ -41,88 +33,4 @@ object PermissionsUtil { } return true } - - fun isNotificationListenerEnabled(context: Context?): Boolean { - if (context == null) return false - val pkg = context.packageName - if (NotificationManagerCompat.getEnabledListenerPackages(context).contains(pkg)) { - return true - } - val component = ComponentName(context, OtpNotificationListenerService::class.java) - val requiredComponent = component.flattenToString() - val shortComponent = component.flattenToShortString() - - val enabledListeners = android.provider.Settings.Secure.getString( - context.contentResolver, "enabled_notification_listeners" - ) ?: return false - - for (listener in enabledListeners.split(":")) { - val trimmed = listener.trim() - if (trimmed == requiredComponent || trimmed == shortComponent) { - return true - } - } - return false - } - - fun openNotificationListenerSettings(context: Context) { - val component = ComponentName(context, OtpNotificationListenerService::class.java) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { - try { - val detailIntent = Intent(android.provider.Settings.ACTION_NOTIFICATION_LISTENER_DETAIL_SETTINGS).apply { - putExtra(android.provider.Settings.EXTRA_NOTIFICATION_LISTENER_COMPONENT_NAME, component.flattenToString()) - addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) - } - context.startActivity(detailIntent) - return - } catch (e: Exception) { - Log.w(TAG, "Could not open detail settings, falling back to general listener settings", e) - } - } - try { - val generalIntent = Intent(android.provider.Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS).apply { - addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) - } - context.startActivity(generalIntent) - } catch (e: Exception) { - Log.e(TAG, "Could not open notification listener settings", e) - } - } - - fun updateNotificationListenerComponent(context: Context, enabled: Boolean) { - val component = ComponentName(context, OtpNotificationListenerService::class.java) - val pm = context.packageManager - val targetState = if (enabled) { - PackageManager.COMPONENT_ENABLED_STATE_ENABLED - } else { - PackageManager.COMPONENT_ENABLED_STATE_DISABLED - } - try { - if (pm.getComponentEnabledSetting(component) != targetState) { - pm.setComponentEnabledSetting(component, targetState, PackageManager.DONT_KILL_APP) - } - } catch (e: Exception) { - Log.w(TAG, "Failed to update notification listener component state", e) - } - - if (!enabled) { - OtpNotificationListenerService.instance?.let { service -> - try { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - service.requestUnbind() - } - } catch (e: Exception) { - Log.w(TAG, "Failed to unbind notification listener service", e) - } - } - } else { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && isNotificationListenerEnabled(context)) { - try { - NotificationListenerService.requestRebind(component) - } catch (e: Exception) { - Log.w(TAG, "Failed to rebind notification listener service", e) - } - } - } - } } diff --git a/app/src/main/java/helium314/keyboard/latin/settings/Defaults.kt b/app/src/main/java/helium314/keyboard/latin/settings/Defaults.kt index eec3e5bde..66ee902b5 100644 --- a/app/src/main/java/helium314/keyboard/latin/settings/Defaults.kt +++ b/app/src/main/java/helium314/keyboard/latin/settings/Defaults.kt @@ -56,7 +56,6 @@ object Defaults { const val PREF_ENABLE_SPELL_CHECKER_SERVICE = true const val PREF_ENABLE_CLIPBOARD_LISTENER = true - const val PREF_ENABLE_SMS_OTP_RECEIVER = false const val PREF_ENABLE_APP_SYNC_LISTENER = false @@ -175,7 +174,6 @@ object Defaults { const val PREF_SUGGESTIONS_COUNT_IN_STRIP = 3 const val PREF_SUGGEST_SCREENSHOTS = false const val PREF_COMPRESS_SCREENSHOTS = true - const val PREF_AUTO_READ_OTP = false const val PREF_INLINE_MATH_CALCULATION = true const val PREF_GESTURE_INPUT = true // ponytail: gesture method default value diff --git a/app/src/main/java/helium314/keyboard/latin/settings/Settings.kt b/app/src/main/java/helium314/keyboard/latin/settings/Settings.kt index 4cff8d47c..366d45368 100644 --- a/app/src/main/java/helium314/keyboard/latin/settings/Settings.kt +++ b/app/src/main/java/helium314/keyboard/latin/settings/Settings.kt @@ -387,7 +387,6 @@ class Settings private constructor() : SharedPreferences.OnSharedPreferenceChang const val PREF_ENABLE_SPELL_CHECKER_SERVICE = "enable_spell_checker_service" const val PREF_ENABLE_CLIPBOARD_LISTENER = "enable_clipboard_listener" - const val PREF_ENABLE_SMS_OTP_RECEIVER = "enable_sms_otp_receiver" const val PREF_ENABLE_APP_SYNC_LISTENER = "enable_app_sync_listener" const val PREF_GIF_PROVIDER = "pref_gif_provider" const val PREF_GIF_PROVIDER_ENABLED_PREFIX = "pref_gif_provider_enabled_" @@ -534,7 +533,6 @@ class Settings private constructor() : SharedPreferences.OnSharedPreferenceChang const val PREF_ENABLE_CLIPBOARD_HISTORY = "enable_clipboard_history" const val PREF_SUGGEST_SCREENSHOTS = "suggest_screenshots" const val PREF_COMPRESS_SCREENSHOTS = "compress_screenshots" - const val PREF_AUTO_READ_OTP = "auto_read_otp" const val PREF_INLINE_MATH_CALCULATION = "pref_inline_calculator_suggestions" const val PREF_CLIPBOARD_HISTORY_RETENTION_TIME = "clipboard_history_retention_time" const val PREF_CLIPBOARD_HISTORY_PINNED_FIRST = "clipboard_history_pinned_first" diff --git a/app/src/main/java/helium314/keyboard/latin/settings/SettingsValues.kt b/app/src/main/java/helium314/keyboard/latin/settings/SettingsValues.kt index 5fd38529d..951c251eb 100644 --- a/app/src/main/java/helium314/keyboard/latin/settings/SettingsValues.kt +++ b/app/src/main/java/helium314/keyboard/latin/settings/SettingsValues.kt @@ -160,7 +160,6 @@ open class SettingsValues( val mUseAppsDictionary: Boolean val mEnableSpellCheckerService: Boolean val mEnableClipboardListener: Boolean - val mEnableSmsOtpReceiver: Boolean val mEnableAppSyncListener: Boolean val mCustomNavBarColor: Boolean val mKeyboardHeightScale: Float @@ -236,7 +235,6 @@ open class SettingsValues( private val mOverrideShowingSuggestions: Boolean val mSuggestClipboardContent: Boolean val mSuggestScreenshots: Boolean - val mAutoReadOtp: Boolean val mInlineMathCalculation: Boolean val mCompressScreenshots: Boolean val mSettingsValuesForSuggestion: SettingsValuesForSuggestion @@ -338,7 +336,6 @@ open class SettingsValues( mUsePersonalizedDicts = prefs.getBoolean(Settings.PREF_KEY_USE_PERSONALIZED_DICTS, Defaults.PREF_KEY_USE_PERSONALIZED_DICTS) mEnableSpellCheckerService = prefs.getBoolean(Settings.PREF_ENABLE_SPELL_CHECKER_SERVICE, Defaults.PREF_ENABLE_SPELL_CHECKER_SERVICE) mEnableClipboardListener = prefs.getBoolean(Settings.PREF_ENABLE_CLIPBOARD_LISTENER, Defaults.PREF_ENABLE_CLIPBOARD_LISTENER) - mEnableSmsOtpReceiver = prefs.getBoolean(Settings.PREF_ENABLE_SMS_OTP_RECEIVER, Defaults.PREF_ENABLE_SMS_OTP_RECEIVER) mEnableAppSyncListener = prefs.getBoolean(Settings.PREF_ENABLE_APP_SYNC_LISTENER, Defaults.PREF_ENABLE_APP_SYNC_LISTENER) mUseDoubleSpacePeriod = prefs.getBoolean(Settings.PREF_KEY_USE_DOUBLE_SPACE_PERIOD, Defaults.PREF_KEY_USE_DOUBLE_SPACE_PERIOD) && mInputAttributes.mIsGeneralTextInput mBlockPotentiallyOffensive = prefs.getBoolean(Settings.PREF_BLOCK_POTENTIALLY_OFFENSIVE, Defaults.PREF_BLOCK_POTENTIALLY_OFFENSIVE) @@ -382,7 +379,6 @@ open class SettingsValues( mSuggestPunctuation = prefs.getBoolean(Settings.PREF_SUGGEST_PUNCTUATION, Defaults.PREF_SUGGEST_PUNCTUATION) mSuggestClipboardContent = prefs.getBoolean(Settings.PREF_SUGGEST_CLIPBOARD_CONTENT, Defaults.PREF_SUGGEST_CLIPBOARD_CONTENT) mSuggestScreenshots = prefs.getBoolean(Settings.PREF_SUGGEST_SCREENSHOTS, Defaults.PREF_SUGGEST_SCREENSHOTS) - mAutoReadOtp = prefs.getBoolean(Settings.PREF_AUTO_READ_OTP, Defaults.PREF_AUTO_READ_OTP) mInlineMathCalculation = prefs.getBoolean(Settings.PREF_INLINE_MATH_CALCULATION, Defaults.PREF_INLINE_MATH_CALCULATION) mCompressScreenshots = prefs.getBoolean(Settings.PREF_COMPRESS_SCREENSHOTS, Defaults.PREF_COMPRESS_SCREENSHOTS) mDoubleSpacePeriodTimeout = 1100L diff --git a/app/src/main/java/helium314/keyboard/latin/suggestions/SuggestionStripView.kt b/app/src/main/java/helium314/keyboard/latin/suggestions/SuggestionStripView.kt index 0f7b83102..414481447 100644 --- a/app/src/main/java/helium314/keyboard/latin/suggestions/SuggestionStripView.kt +++ b/app/src/main/java/helium314/keyboard/latin/suggestions/SuggestionStripView.kt @@ -554,7 +554,7 @@ class SuggestionStripView(context: Context, attrs: AttributeSet?, defStyle: Int) } if (isShowingEmojiSuggestions) return if (isExternalSuggestionVisible && (suggestions.isEmpty || suggestions.isPunctuationSuggestions || suggestions.isPrediction || suggestions.mInputStyle == SuggestedWords.INPUT_STYLE_RECORRECTION || suggestions.mInputStyle == SuggestedWords.INPUT_STYLE_NONE)) { - // Keep external suggestion (clipboard/screenshot/OTP) if new suggestions are empty, punctuation, or passive predictions/recorrections + // Keep external suggestion (clipboard/screenshot/calculator) if new suggestions are empty, punctuation, or passive predictions/recorrections return } clear() diff --git a/app/src/main/java/helium314/keyboard/latin/utils/SmsPackageProvider.kt b/app/src/main/java/helium314/keyboard/latin/utils/SmsPackageProvider.kt deleted file mode 100644 index 5f6497c64..000000000 --- a/app/src/main/java/helium314/keyboard/latin/utils/SmsPackageProvider.kt +++ /dev/null @@ -1,36 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-only - -package helium314.keyboard.latin.utils - -import android.content.Context -import android.content.Intent -import android.net.Uri -import android.provider.Telephony - -/** - * Utility helper for detecting the system default SMS messaging app. - */ -object SmsPackageProvider { - - /** - * Resolves the package name of the active default SMS application. - */ - fun getDefaultSmsPackage(context: Context): String? { - val telephonyDefault = try { - Telephony.Sms.getDefaultSmsPackage(context) - } catch (e: Exception) { - null - } - if (!telephonyDefault.isNullOrBlank()) { - return telephonyDefault - } - return try { - val intent = Intent(Intent.ACTION_SENDTO, Uri.parse("smsto:")) - val resolveInfo = context.packageManager.resolveActivity(intent, 0) - val pkg = resolveInfo?.activityInfo?.packageName - if (pkg != null && pkg != "android") pkg else null - } catch (e: Exception) { - null - } - } -} diff --git a/app/src/main/java/helium314/keyboard/settings/screens/SuggestionsScreen.kt b/app/src/main/java/helium314/keyboard/settings/screens/SuggestionsScreen.kt index 674211adc..ba2743174 100644 --- a/app/src/main/java/helium314/keyboard/settings/screens/SuggestionsScreen.kt +++ b/app/src/main/java/helium314/keyboard/settings/screens/SuggestionsScreen.kt @@ -23,15 +23,11 @@ import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.draw.rotate -import androidx.compose.runtime.DisposableEffect import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.core.content.edit -import androidx.lifecycle.Lifecycle -import androidx.lifecycle.LifecycleEventObserver -import androidx.lifecycle.compose.LocalLifecycleOwner import helium314.keyboard.dictionarypack.DictionaryPackConstants import helium314.keyboard.keyboard.KeyboardSwitcher import helium314.keyboard.latin.R @@ -105,7 +101,6 @@ fun SuggestionsScreen( Settings.PREF_SUGGEST_SCREENSHOTS, if (prefs.getBoolean(Settings.PREF_SUGGEST_SCREENSHOTS, Defaults.PREF_SUGGEST_SCREENSHOTS)) Settings.PREF_COMPRESS_SCREENSHOTS else null, - // Settings.PREF_AUTO_READ_OTP, Settings.PREF_INLINE_MATH_CALCULATION, Settings.PREF_USE_APPS, ) @@ -290,68 +285,6 @@ fun createSuggestionsSettings(context: Context) = listOf( ) { SwitchPreference(it, Defaults.PREF_COMPRESS_SCREENSHOTS) }, - /* - Setting(context, Settings.PREF_AUTO_READ_OTP, - R.string.auto_read_otp, R.string.auto_read_otp_summary - ) { setting -> - val activity = LocalContext.current.getActivity() as? SettingsActivity ?: return@Setting - var granted by remember { mutableStateOf(PermissionsUtil.isNotificationListenerEnabled(activity)) } - var pendingOtpEnable by rememberSaveable { mutableStateOf(false) } - - val lifecycleOwner = LocalLifecycleOwner.current - DisposableEffect(lifecycleOwner) { - val observer = LifecycleEventObserver { _, event -> - if (event == Lifecycle.Event.ON_RESUME) { - val currentGranted = PermissionsUtil.isNotificationListenerEnabled(activity) - granted = currentGranted - if (pendingOtpEnable && currentGranted) { - activity.prefs().edit { putBoolean(Settings.PREF_AUTO_READ_OTP, true) } - PermissionsUtil.updateNotificationListenerComponent(activity, true) - pendingOtpEnable = false - } else if (!currentGranted && activity.prefs().getBoolean(Settings.PREF_AUTO_READ_OTP, false)) { - activity.prefs().edit { putBoolean(Settings.PREF_AUTO_READ_OTP, false) } - PermissionsUtil.updateNotificationListenerComponent(activity, false) - } - activity.prefChanged() - } - } - lifecycleOwner.lifecycle.addObserver(observer) - onDispose { - lifecycleOwner.lifecycle.removeObserver(observer) - } - } - - val description = if (!granted && activity.prefs().getBoolean(Settings.PREF_AUTO_READ_OTP, false)) { - "${setting.description}\n\n⚠ Notification access required. Tap to grant permission." - } else { - setting.description - } - - SwitchPreference( - name = setting.title, - key = setting.key, - default = Defaults.PREF_AUTO_READ_OTP, - description = description, - allowCheckedChange = { enable -> - if (enable) { - PermissionsUtil.updateNotificationListenerComponent(activity, true) - if (!PermissionsUtil.isNotificationListenerEnabled(activity)) { - pendingOtpEnable = true - PermissionsUtil.openNotificationListenerSettings(activity) - false - } else true - } else { - PermissionsUtil.updateNotificationListenerComponent(activity, false) - true - } - }, - onCheckedChange = { - PermissionsUtil.updateNotificationListenerComponent(activity, it) - activity.prefChanged() - } - ) - }, - */ Setting(context, Settings.PREF_INLINE_MATH_CALCULATION, R.string.pref_inline_calculator_suggestions, R.string.pref_inline_calculator_suggestions_summary ) { diff --git a/app/src/main/res/layout/otp_suggestion.xml b/app/src/main/res/layout/inline_suggestion.xml similarity index 88% rename from app/src/main/res/layout/otp_suggestion.xml rename to app/src/main/res/layout/inline_suggestion.xml index 6cae76219..6bfd6651d 100644 --- a/app/src/main/res/layout/otp_suggestion.xml +++ b/app/src/main/res/layout/inline_suggestion.xml @@ -11,7 +11,7 @@ SPDX-License-Identifier: GPL-3.0-only android:layout_height="match_parent" tools:ignore="RtlSymmetry"> إدراج مسافة فورًا عند اختيار اقتراح لمنع التأخير في كتابة الحرف التالي اقتراح لقطات الشاشة الحديثة عرض لقطات الشاشة التي تم التقاطها مؤخرًا كاقتراح - قراءة OTP تلقائيًا من الرسائل القصيرة - عرض الرمز من رسالة نصية واردة كاقتراح يمكنك النقر عليه لإدراجه - تجاهل اقتراح OTP ضغط اقتراحات لقطات الشاشة تقليل جودة وحجم اقتراحات لقطات الشاشة لتوفير المساحة طي العناصر المثبتة افتراضيًا diff --git a/app/src/main/res/values-be/strings.xml b/app/src/main/res/values-be/strings.xml index 9b9d3c00c..c560f2162 100644 --- a/app/src/main/res/values-be/strings.xml +++ b/app/src/main/res/values-be/strings.xml @@ -457,9 +457,6 @@ Паказваць знакі пунктуацыі, калі іншых прапаноў няма Прапаноўваць нядаўнія здымкі экрана Паказваць нядаўна зробленыя здымкі экрана ў якасці прапановы - Аўтаматычнае чытанне OTP з SMS - Паказваць код з уваходнага SMS у якасці прапановы, якую можна націснуць для ўстаўкі - Адхіліць прапанову OTP Сціскаць прапановы здымкаў экрана Зніжаць якасць і памер прапаноў здымкаў экрана для эканоміі месца Паказваць замацаваныя элементы зверху diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index c81f8ccd8..8106aecf2 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -511,9 +511,6 @@ Незабавно потвърждаване на интервал при избор на предложение, за да се предотврати забавяне при следващата въведена буква Предлагане на скорошни екранни снимки Показване на наскоро направени екранни снимки като предложение - Автоматично четене на OTP от SMS - Показване на кода от входящ SMS като предложение, което можете да докоснете за вмъкване - Отхвърляне на OTP предложение Компресиране на предложенията за екранни снимки Намаляване на качеството и размера на предложенията за екранни снимки за спестяване на място Сгъване на фиксираните елементи по подразбиране diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 8fc7a18ac..5a97e0e99 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -476,9 +476,6 @@ Při výběru návrhu okamžitě vložit mezeru, aby se předešlo zpoždění při dalším psaném písmenu Navrhovat nedávné snímky obrazovky Zobrazit nedávno pořízené snímky obrazovky jako návrh - Automaticky číst OTP z SMS - Zobrazit kód z příchozí SMS jako návrh, který můžete klepnutím vložit - Zavřít návrh OTP Komprimovat návrhy snímků obrazovky Snížit kvalitu a velikost návrhů snímků obrazovky pro úsporu místa Ve výchozím nastavení sbalit připnuté položky diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index e1a99b3f1..fda3714be 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -460,9 +460,6 @@ Bei Auswahl eines Vorschlags sofort ein Leerzeichen einfügen, um Verzögerung beim nächsten getippten Buchstaben zu vermeiden Aktuelle Screenshots vorschlagen Kürzlich aufgenommene Screenshots als Vorschlag anzeigen - OTP automatisch aus SMS lesen - Den Code aus einer eingehenden SMS als Vorschlag anzeigen, den Sie zum Einfügen antippen können - OTP-Vorschlag verwerfen Screenshot-Vorschläge komprimieren Qualität und Größe der Screenshot-Vorschläge reduzieren, um Speicherplatz zu sparen Angeheftete Einträge standardmäßig einklappen diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 9b033b684..19e543227 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -191,9 +191,6 @@ Εμφάνιση πρόσφατα αντιγραμμένου περιεχομένου προχείρου ως πρόταση Πρόταση πρόσφατων στιγμιότυπων οθόνης Εμφάνιση πρόσφατα ληφθέντων στιγμιότυπων οθόνης ως πρόταση - Αυτόματη ανάγνωση OTP από SMS - Εμφάνιση του κωδικού από εισερχόμενο SMS ως πρόταση που μπορείτε να πατήσετε για εισαγωγή - Απόρριψη πρότασης OTP Συμπίεση προτάσεων στιγμιότυπων Μείωση ποιότητας και μεγέθους προτάσεων στιγμιότυπων για εξοικονόμηση χώρου Αιωρούμενη προεπισκόπηση diff --git a/app/src/main/res/values-es-rUS/strings.xml b/app/src/main/res/values-es-rUS/strings.xml index 5c1a9d694..66abfb34b 100644 --- a/app/src/main/res/values-es-rUS/strings.xml +++ b/app/src/main/res/values-es-rUS/strings.xml @@ -401,9 +401,6 @@ Mostrar puntuación cuando no hay otras sugerencias disponibles Sugerir capturas de pantalla recientes Mostrar capturas de pantalla tomadas recientemente como sugerencia - Leer automáticamente OTP de SMS - Mostrar el código de un SMS entrante como sugerencia que puedes tocar para insertar - Descartar sugerencia OTP Comprimir sugerencias de capturas Reducir calidad y tamaño de las sugerencias de capturas para ahorrar espacio Mostrar elementos fijados primero diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index cc2256a4e..b7dc23679 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -713,9 +713,6 @@ Insertar espacio instantáneamente al elegir una sugerencia para evitar retraso en la siguiente letra escrita Sugerir capturas de pantalla recientes Mostrar capturas de pantalla tomadas recientemente como sugerencia - Leer automáticamente OTP de SMS - Mostrar el código de un SMS entrante como sugerencia que puedes tocar para insertar - Descartar sugerencia OTP Comprimir sugerencias de capturas Reducir calidad y tamaño de las sugerencias de capturas para ahorrar espacio Plegar elementos fijados por defecto diff --git a/app/src/main/res/values-et/strings.xml b/app/src/main/res/values-et/strings.xml index 46ec07d63..631a6ae0f 100644 --- a/app/src/main/res/values-et/strings.xml +++ b/app/src/main/res/values-et/strings.xml @@ -511,9 +511,6 @@ Kinnita tühik kohe soovituse valimisel, et vältida viivitust järgmise tippitava tähe juures Soovita hiljutisi ekraanipilte Näita hiljuti tehtud ekraanipilte soovitusena - Loe SMS-ist OTP automaatselt - Näita sissetuleva SMS-i koodi soovitusena, mida saate puudutades sisestada - Lükka OTP soovitus tagasi Tihenda ekraanipiltide soovitusi Vähenda ekraanipiltide soovituste kvaliteeti ja suurust ruumi säästmiseks Voldi kinnitatud üksused vaikimisi kokku diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index f36377f30..7ed5277b1 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -462,9 +462,6 @@ Nouveau dictionnaire: Insérer un espace instantanément lors de la sélection d\'une suggestion pour éviter un délai sur la prochaine lettre tapée Suggérer des captures d\'écran récentes Afficher les captures d\'écran récentes comme suggestion - Lecture automatique des OTP depuis les SMS - Afficher le code d\'un SMS entrant comme suggestion que vous pouvez toucher pour insérer - Rejeter la suggestion OTP Compresser les suggestions de captures d\'écran Réduire la qualité et la taille des suggestions de captures pour économiser de l\'espace Plier les éléments épinglés par défaut diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xml index 1a73a7b47..4670fef36 100644 --- a/app/src/main/res/values-hi/strings.xml +++ b/app/src/main/res/values-hi/strings.xml @@ -848,9 +848,6 @@ हाल ही में कॉपी की गई क्लिपबोर्ड सामग्री को सुझाव के रूप में दिखाएं हाल के स्क्रीनशॉट सुझाएं सुझाव के रूप में हाल ही में लिए गए स्क्रीनशॉट दिखाएं - एसएमएस से ऑटो-रीड ओटीपी - आने वाले एसएमएस से कोड को एक सुझाव के रूप में दिखाएं जिसे आप सम्मिलित करने के लिए टैप कर सकते हैं - ओटीपी सुझाव खारिज करें स्क्रीनशॉट सुझावों को संपीड़ित करें स्थान बचाने के लिए स्क्रीनशॉट सुझावों की गुणवत्ता और आकार कम करें फ़्लोटिंग पूर्वावलोकन diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index f74351bcf..aac4925ae 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -474,9 +474,6 @@ Trenutno potvrdite razmak prilikom odabira prijedloga kako biste spriječili odgodu na sljedećem upisanom slovu Predloži nedavne snimke zaslona Prikažite nedavno napravljene snimke zaslona kao prijedlog - Automatsko čitanje OTP-a iz SMS-a - Prikažite kod iz dolaznog SMS-a kao prijedlog koji možete dodirnuti za umetanje - Odbaci prijedlog OTP-a Komprimiraj prijedloge snimki zaslona Smanjite kvalitetu i veličinu prijedloga snimki zaslona kako biste uštedjeli prostor Zadano sklopi prikvačene stavke diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 6632c2e05..4cbd4b9ff 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -474,9 +474,6 @@ Szóköz azonnali beszúrása javaslat kiválasztásakor, hogy elkerüljük a késést a következő begépelt betűnél Legutóbbi képernyőképek javasolása Nemrég készített képernyőképek megjelenítése javaslatként - OTP automatikus olvasása SMS-ből - A beérkező SMS kódjának megjelenítése javaslatként, amelyre koppintva beilleszthető - OTP javaslat elvetése Képernyőkép-javaslatok tömörítése A képernyőkép-javaslatok minőségének és méretének csökkentése a helymegtakarítás érdekében Rögzített elemek alapértelmezett összecsukása diff --git a/app/src/main/res/values-in/strings.xml b/app/src/main/res/values-in/strings.xml index 0cfb65163..33e497975 100644 --- a/app/src/main/res/values-in/strings.xml +++ b/app/src/main/res/values-in/strings.xml @@ -463,9 +463,6 @@ Tampilkan tanda baca ketika tidak ada saran lain yang tersedia Sarankan tangkapan layar terbaru Tampilkan tangkapan layar yang baru diambil sebagai saran - Baca OTP otomatis dari SMS - Tampilkan kode dari SMS masuk sebagai saran yang dapat Anda ketuk untuk disisipkan - Tutup saran OTP Kompres saran tangkapan layar Kurangi kualitas dan ukuran saran tangkapan layar untuk menghemat ruang Tampilkan item yang disematkan di atas diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 89df4e084..6edc373b3 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -464,9 +464,6 @@ Inserisci subito uno spazio quando scegli un suggerimento per evitare ritardi nella prossima lettera digitata Suggerisci screenshot recenti Mostra gli screenshot scattati di recente come suggerimento - Leggi automaticamente OTP da SMS - Mostra il codice da un SMS in arrivo come suggerimento che puoi toccare per inserire - Ignora suggerimento OTP Comprimi suggerimenti screenshot Riduci qualità e dimensioni dei suggerimenti screenshot per risparmiare spazio Riduci gli elementi fissati per impostazione predefinita diff --git a/app/src/main/res/values-iw/strings.xml b/app/src/main/res/values-iw/strings.xml index ece415477..7f0fe463d 100644 --- a/app/src/main/res/values-iw/strings.xml +++ b/app/src/main/res/values-iw/strings.xml @@ -482,9 +482,6 @@ בצע רווח באופן מיידי בעת בחירת הצעה כדי למנוע עיכוב באות הבאה שמוקלדת הצע צילומי מסך אחרונים הצג צילומי מסך שצולמו לאחרונה כהצעה - קרא OTP אוטומטית מ-SMS - הצג את הקוד מ-SMS נכנס כהצעה שתוכל להקיש עליה כדי להוסיף - דחה הצעת OTP דחוס הצעות צילום מסך הפחת את האיכות והגודל של הצעות צילום מסך כדי לחסוך מקום קפל פריטים מוצמדים כברירת מחדל diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index 283ee7e6e..c33b2f9b3 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -469,9 +469,6 @@ Iš karto įterpti tarpą pasirinkus pasiūlymą, kad būtų išvengta delsos rašant kitą raidę Siūlyti naujausias ekrano kopijas Rodyti neseniai padarytas ekrano kopijas kaip pasiūlymą - Automatiškai nuskaityti OTP iš SMS - Rodyti kodą iš gaunamos SMS kaip pasiūlymą, kurį galite paspausti, kad įterptumėte - Atmesti OTP pasiūlymą Suspausti ekrano kopijų pasiūlymus Sumažinti ekrano kopijų pasiūlymų kokybę ir dydį, kad sutaupytumėte vietos Suskleisti prisegtus elementus pagal numatytuosius nustatymus diff --git a/app/src/main/res/values-ml/strings.xml b/app/src/main/res/values-ml/strings.xml index 0b1565ed4..d4d90130d 100644 --- a/app/src/main/res/values-ml/strings.xml +++ b/app/src/main/res/values-ml/strings.xml @@ -190,9 +190,6 @@ അടുത്തിടെ പകർത്തിയ ക്ലിപ്പ്ബോർഡ് ഉള്ളടക്കം ഒരു നിർദ്ദേശമായി കാണിക്കുക അടുത്തിടെ എടുത്ത സ്ക്രീൻഷോട്ടുകൾ നിർദ്ദേശിക്കുക അടുത്തിടെ എടുത്ത സ്ക്രീൻഷോട്ടുകൾ ഒരു നിർദ്ദേശമായി കാണിക്കുക - SMS-ൽ നിന്ന് OTP സ്വയം വായിക്കുക - വരുന്ന SMS-ൽ നിന്നുള്ള കോഡ് ടാപ്പുചെയ്ത് ചേർക്കാവുന്ന ഒരു നിർദ്ദേശമായി കാണിക്കുക - OTP നിർദ്ദേശം ഒഴിവാക്കുക സ്ക്രീൻഷോട്ട് നിർദ്ദേശങ്ങൾ കംപ്രസ്സ് ചെയ്യുക ഇടം ലാഭിക്കാൻ സ്ക്രീൻഷോട്ട് നിർദ്ദേശങ്ങളുടെ ഗുണനിലവാരവും വലുപ്പവും കുറയ്ക്കുക ഫ്ലോട്ടിംഗ് പ്രിവ്യൂ diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 9d7269dde..6de67101e 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -496,9 +496,6 @@ Spatie direct invoegen bij het kiezen van een suggestie om vertraging bij de volgende getypte letter te voorkomen Recente screenshots voorstellen Recent gemaakte screenshots tonen als suggestie - OTP automatisch lezen uit sms - Toon de code van een inkomende sms als een suggestie die u kunt aantikken om in te voegen - OTP-suggestie negeren Screenshot-suggesties comprimeren Verminder kwaliteit en grootte van screenshot-suggesties om ruimte te besparen Vastgezette items standaard samenvouwen diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 139b61c45..0b7e7ff3a 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -518,9 +518,6 @@ Wstawiaj spację natychmiast po wybraniu sugestii, aby zapobiec opóźnieniu przy następnej literze Sugeruj ostatnie zrzuty ekranu Pokazuj ostatnio zrobione zrzuty ekranu jako sugestię - Automatyczne odczytywanie OTP z SMS - Pokazuj kod z przychodzącego SMS-a jako sugestię do wstawienia - Odrzuć sugestię OTP Kompresuj sugestie zrzutów ekranu Zmniejsz jakość i rozmiar sugestii zrzutów ekranu, aby zaoszczędzić miejsce Domyślnie zwijaj przypięte elementy diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 53293f031..dcc847454 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -722,9 +722,6 @@ Inserir espaço instantaneamente ao escolher uma sugestão para evitar atraso na próxima letra digitada Sugerir capturas de ecrã recentes Mostrar capturas de ecrã tiradas recentemente como sugestão - Ler OTP automaticamente de SMS - Mostrar o código de uma SMS recebida como sugestão que pode tocar para inserir - Dispensar sugestão de OTP Comprimir sugestões de captura de ecrã Reduzir a qualidade e o tamanho das sugestões de captura de ecrã para poupar espaço Dobrar itens fixados por defeito diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index 398f8dffd..835080767 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -712,9 +712,6 @@ Inserir espaço instantaneamente ao escolher uma sugestão para evitar atraso na próxima letra digitada Sugerir capturas de ecrã recentes Mostrar capturas de ecrã tiradas recentemente como sugestão - Ler OTP automaticamente de SMS - Mostrar o código de uma SMS recebida como sugestão que pode tocar para inserir - Dispensar sugestão de OTP Comprimir sugestões de captura de ecrã Reduzir a qualidade e o tamanho das sugestões de captura de ecrã para poupar espaço Dobrar itens fixados por defeito diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index bef722f4c..9380223c1 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -456,9 +456,6 @@ Inserir espaço instantaneamente ao escolher uma sugestão para evitar atraso na próxima letra digitada Sugerir capturas de ecrã recentes Mostrar capturas de ecrã tiradas recentemente como sugestão - Ler OTP automaticamente de SMS - Mostrar o código de uma SMS recebida como sugestão que pode tocar para inserir - Dispensar sugestão de OTP Comprimir sugestões de captura de ecrã Reduzir a qualidade e o tamanho das sugestões de captura de ecrã para poupar espaço Dobrar itens fixados por defeito diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index 97b604a78..899ad980a 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -463,9 +463,6 @@ Confirmă spațiul instantaneu la alegerea unei sugestii pentru a preveni întârzierea la următoarea literă tastată Sugerează capturi de ecran recente Afișează capturile de ecran făcute recent ca sugestie - Citește automat OTP din SMS - Afișează codul dintr-un SMS primit ca sugestie pe care o poți atinge pentru a o introduce - Respinge sugestia OTP Comprimă sugestiile de capturi de ecran Reduc calitatea și dimensiunea sugestiilor de capturi de ecran pentru a economisi spațiu Afișează elementele fixate în partea de sus diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 951c1839b..a87697c59 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -552,9 +552,6 @@ Предлагать выученные слова только тогда, когда контекст предыдущего слова совпадает Мгновенный автопробел Вставлять пробел мгновенно при выборе подсказки, чтобы предотвратить задержку при вводе следующей буквы - Авто-чтение OTP из SMS - Показывать код из входящего SMS как подсказку, которую можно нажать для вставки - Отклонить подсказку OTP Сжимать подсказки скриншотов Уменьшать качество и размер подсказок скриншотов для экономии места Иконка очистки буфера обмена diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 99bee0a36..85feeed5b 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -453,9 +453,6 @@ Bir sonraki harf yazıldığında gecikmeyi önlemek için bir öneri seçildiğinde boşluğu anında ekle Son ekran görüntülerini öner Yakın zamanda çekilen ekran görüntülerini öneri olarak göster - SMS\'ten OTP\'yi otomatik oku - Gelen SMS\'teki kodu, eklemek için dokunabileceğin bir öneri olarak göster - OTP önerisini kapat Ekran görüntüsü önerilerini sıkıştır Yerden tasarruf etmek için ekran görüntüsü önerilerinin kalitesini ve boyutunu düşür Sabitlenmiş öğeleri varsayılan olarak daralt diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 918bf2317..4835fb295 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -469,9 +469,6 @@ Миттєво вставляти пробіл під час вибору пропозиції, щоб запобігти затримці при введенні наступної літери Пропонувати недавні скріншоти Показувати нещодавно зроблені скріншоти як пропозицію - Автоматичне читання OTP з SMS - Показувати код із вхідного SMS як пропозицію, яку можна натиснути для вставки - Відхилити пропозицію OTP Стискати пропозиції скріншотів Зменшити якість і розмір пропозицій скріншотів для економії місця Згортати закріплені елементи за замовчуванням diff --git a/app/src/main/res/values-ur/strings.xml b/app/src/main/res/values-ur/strings.xml index e753315eb..f1a95c622 100644 --- a/app/src/main/res/values-ur/strings.xml +++ b/app/src/main/res/values-ur/strings.xml @@ -169,9 +169,6 @@ حال ہی میں کاپی کردہ کلپ بورڈ مواد کو بطور تجویز دکھائیں حالیہ اسکرین شاٹس تجویز کریں حال ہی میں لیے گئے اسکرین شاٹس کو بطور تجویز دکھائیں - SMS سے OTP خودکار پڑھیں - آنے والی SMS سے کوڈ کو بطور تجویز دکھائیں جسے تھپتھپا کر داخل کیا جا سکتا ہے - OTP تجویز مسترد کریں اسکرین شاٹ تجاویز کو کمپریس کریں جگہ بچانے کے لیے اسکرین شاٹ تجاویز کے معیار اور سائز کو کم کریں تیرتا پیش منظر diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index bfda58c34..abf5bfd24 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -479,9 +479,6 @@ 选择建议时立即提交空格,以防止输入下一个字母时出现延迟 建议最近的截图 将最近截取的屏幕截图显示为建议 - 自动读取短信中的 OTP - 将传入短信中的验证码显示为建议,点击即可插入 - 关闭 OTP 建议 压缩截图建议 降低截图建议的质量和大小以节省空间 默认折叠固定项目 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a3793db30..1489b4220 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -288,12 +288,6 @@ Suggest recent screenshots Show recently taken screenshots as a suggestion - - Auto-read OTP from SMS - - Show the code from an incoming SMS as a suggestion you can tap to insert - - Dismiss OTP suggestion Compress screenshot suggestions diff --git a/app/src/test/java/helium314/keyboard/latin/OtpSuggestionManagerTest.kt b/app/src/test/java/helium314/keyboard/latin/OtpSuggestionManagerTest.kt deleted file mode 100644 index ceffcc2d9..000000000 --- a/app/src/test/java/helium314/keyboard/latin/OtpSuggestionManagerTest.kt +++ /dev/null @@ -1,56 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-only -package helium314.keyboard.latin - -import kotlin.test.Test -import kotlin.test.assertEquals -import kotlin.test.assertNull - -class OtpSuggestionManagerTest { - - @Test - fun testExplicitOtpPatterns() { - assertEquals("123456", OtpSuggestionManager.extractOtp("Your OTP is 123456.")) - assertEquals("482910", OtpSuggestionManager.extractOtp("Your verification code: 482910")) - assertEquals("847291", OtpSuggestionManager.extractOtp("Login passcode: 847291")) - assertEquals("314159", OtpSuggestionManager.extractOtp("Use OTP 314159 to confirm transaction.")) - assertEquals("654321", OtpSuggestionManager.extractOtp("Your one-time password is 654321.")) - assertEquals("9988", OtpSuggestionManager.extractOtp("Your 2FA pin is: 9988")) - } - - @Test - fun testReverseOtpPatterns() { - assertEquals("482910", OtpSuggestionManager.extractOtp("482910 is your Google verification code.")) - assertEquals("789101", OtpSuggestionManager.extractOtp("789101 is your OTP.")) - assertEquals("123456", OtpSuggestionManager.extractOtp("123456 is your security code.")) - assertEquals("297053", OtpSuggestionManager.extractOtp("297053 is your One time password (OTP) to sign-in to your account on www.jio.com. Please enter the OTP to proceed. @www.jio.com #297053")) - assertEquals("864627", OtpSuggestionManager.extractOtp("864627 is your One time password (OTP) to sign-in to your account on www.jio.com.\nPlease enter the OTP to proceed.\n@www.jio.com #864627")) - } - - @Test - fun testWebOtpAndHashtagPatterns() { - assertEquals("492810", OtpSuggestionManager.extractOtp("@example.com #492810")) - assertEquals("654321", OtpSuggestionManager.extractOtp("Verify your account with OTP. @login.site.com #654321")) - assertEquals("981245", OtpSuggestionManager.extractOtp("Your authentication passcode is #981245.")) - } - - @Test - fun testMessagesWithYearsDatesAndAmounts() { - assertEquals("492015", OtpSuggestionManager.extractOtp("Account accessed on 2026-09-28. Verification code: 492015.")) - assertEquals("314159", OtpSuggestionManager.extractOtp("Order #982345: Use OTP 314159 to confirm delivery.")) - assertEquals("789012", OtpSuggestionManager.extractOtp("Dear user, OTP for INR 2500.00 at Store is 789012.")) - } - - @Test - fun testSingleNumberWithoutKeyword() { - assertEquals("582914", OtpSuggestionManager.extractOtp("582914")) - assertEquals("1234", OtpSuggestionManager.extractOtp("Your number is 1234")) - } - - @Test - fun testIrrelevantMessages() { - assertNull(OtpSuggestionManager.extractOtp("")) - assertNull(OtpSuggestionManager.extractOtp(" ")) - assertNull(OtpSuggestionManager.extractOtp("Hello! How are you doing today?")) - assertNull(OtpSuggestionManager.extractOtp("See you tomorrow at 5pm.")) - } -} diff --git a/docs/FEATURES.md b/docs/FEATURES.md index b39bd52dc..45af076ba 100644 --- a/docs/FEATURES.md +++ b/docs/FEATURES.md @@ -25,7 +25,6 @@ LeanType combines a lightweight, privacy-focused keyboard foundation with cuttin | 📸 **[Screenshot Suggestions & Capture](#14-screenshot-suggestions--capture)** | Recent screenshot suggestion strip and clipboard storage | | 🔎 **[Emoji Search](#15-emoji-search)** | Search for emojis by keyword with an Emoji Dictionary | | 🚫 **[Blocked Words & Regex Blacklist](#16-blocked-words--regex-blacklist)** | Filter out offensive or unwanted words using custom regex patterns | -| ✉️ **[Privacy-First OTP Auto-Fill](#17-privacy-first-otp-auto-fill)** | Notification-based OTP extraction from messaging apps without SMS permissions | | 📚 **[Adaptive Personal Dictionary Learning](#18-adaptive-personal-dictionary-learning)** | Customizable repeat learning thresholds & session word boosting | | 👆 **[Gesture / Glide Typing](#19-gesture--glide-typing)** | Smooth swipe typing powered by native C++ library | | ⌨️ **[Direct Switch Target IME](#20-direct-switch-target-ime)** | Switch directly to a specific target keyboard with keycode `-10076` | @@ -94,7 +93,6 @@ LeanType combines a lightweight, privacy-focused keyboard foundation with cuttin | **Screenshot Suggestions** | Instant 1-tap sharing of recently taken screenshots via the suggestion strip. | `Text correction > Suggest recent screenshots` | | **Emoji Search** | Search emojis by name/keyword directly from the emoji palette. | `Emoji Key > Search Icon` | | **Blocked Words Blacklist** | Prevent unwanted words from being suggested with regex pattern matching. | `Text correction > Blocked words blacklist` | -| **Privacy-First OTP Auto-Fill** | Extracts OTP verification codes from incoming notifications with app package selector. | `Text correction > OTP Auto-Fill` | | **Smart Learning & Boost** | Adjustable personal dictionary learning threshold (1-5 times) and temporary session word boost. | `Text correction > Dictionary learning threshold` | | **Gesture Typing** | Swipe typing powered by native C++ spatial scoring engine. | `Gesture typing > Enable gesture typing` | | **Direct Switch Target IME** | Fast 1-tap switching to another configured IME using custom keycode `-10076`. | `Preferences > Direct Switch Target IME` | @@ -498,15 +496,6 @@ Prevent offensive, sensitive, or unwanted words from ever appearing in the sugge --- -## 17. Privacy-First OTP Auto-Fill - -- **Zero SMS Permissions (`RECEIVE_SMS`)**: Uses Android's secure `NotificationListenerService` to parse verification codes directly from incoming notifications without accessing private SMS message stores. -- **Dynamic Messaging App Selector**: Choose which specific messaging apps (Google Messages, Signal, WhatsApp, Telegram, etc.) LeanType should monitor for OTP codes. -- **1-Tap Insertion**: Automatically detects OTP codes and offers them in the suggestion strip for instant 1-tap pasting. -- Manage via **Settings → Text correction → OTP Auto-Fill**. - ---- - ## 18. Adaptive Personal Dictionary Learning & Suggestion Engine Tuning LeanType learns your vocabulary organically as you type while providing deep granular control over the suggestion scoring pipeline: