Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Request incognito keyboard for sensitive Android inputs#8539

Open
KingParmenides wants to merge 3 commits into
BlueWallet:masterfrom
KingParmenides:android-incognito-keyboard-sensitive-inputs
Open

Request incognito keyboard for sensitive Android inputs#8539
KingParmenides wants to merge 3 commits into
BlueWallet:masterfrom
KingParmenides:android-incognito-keyboard-sensitive-inputs

Conversation

@KingParmenides

Copy link
Copy Markdown

Summary

  • Adds an Android native bridge that applies EditorInfo.IME_FLAG_NO_PERSONALIZED_LEARNING to the currently focused text editor and restarts the IME.
  • Routes mnemonic/seed entry, password inputs, import-speed passphrases, and secure prompt dialogs through the incognito request path.
  • Keeps existing iOS behavior unchanged.

Fixes #2235.

Bounty payout address: BTC: 39Q34P8A7g375yqEr8buvNJkUbRgKfbKQZ

Test plan

  • npm run lint
  • ./node_modules/.bin/prettier --check --single-quote --print-width 140 --trailing-comma all --arrow-parens avoid BlueComponents.tsx blue_modules/SettingsModule.ts blue_modules/requestKeyboardIncognitoMode.ts codegen/NativeSettingsModule.ts components/IncognitoKeyboardTextInput.tsx components/PasswordInput.tsx helpers/prompt.ts screen/PromptPasswordConfirmationSheet.tsx screen/wallets/ImportSpeed.tsx
  • git diff --check

Not run: Android/Gradle build. This machine has no Java runtime installed (java -version fails before Gradle starts).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Android support for requesting an “incognito” IME mode on sensitive inputs by bridging to a native SettingsModule method that sets EditorInfo.IME_FLAG_NO_PERSONALIZED_LEARNING on the currently focused editor and restarts the IME.

Changes:

  • Introduces an Android TurboModule method requestKeyboardIncognitoMode() plus a JS helper wrapper to invoke it.
  • Adds IncognitoKeyboardTextInput and routes password / passphrase / mnemonic entry points through it (and updates the Android secure prompt flow).
  • Updates existing screens/components (import speed, password confirmation sheet, password input, mnemonic multi-input) to request incognito mode on focus.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
screen/wallets/ImportSpeed.tsx Uses IncognitoKeyboardTextInput for the import-speed passphrase field.
screen/PromptPasswordConfirmationSheet.tsx Replaces password/confirm password TextInput with incognito-enabled input.
helpers/prompt.ts Requests incognito mode for Android secure prompts after showing the prompt.
components/PasswordInput.tsx Swaps to IncognitoKeyboardTextInput for password entry.
components/IncognitoKeyboardTextInput.tsx New wrapper component that requests incognito mode on focus and adjusts text input defaults.
codegen/NativeSettingsModule.ts Extends TurboModule spec with requestKeyboardIncognitoMode().
BlueComponents.tsx Makes BlueFormMultiInput use IncognitoKeyboardTextInput (for mnemonic-style multiline inputs).
blue_modules/SettingsModule.ts Updates TS interface to include requestKeyboardIncognitoMode().
blue_modules/requestKeyboardIncognitoMode.ts New helper to invoke the native incognito request on Android.
android/app/src/main/java/io/bluewallet/bluewallet/SettingsModule.kt Implements the native Android method to set IME_FLAG_NO_PERSONALIZED_LEARNING and restart the IME.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

ref={ref}
autoCapitalize={incognitoKeyboard ? (autoCapitalize ?? 'none') : autoCapitalize}
autoCorrect={incognitoKeyboard ? (autoCorrect ?? false) : autoCorrect}
importantForAutofill={incognitoKeyboard ? (importantForAutofill ?? 'no') : importantForAutofill}
Comment thread helpers/prompt.ts
Comment on lines +56 to +59

if (Platform.OS === 'android' && type === 'secure-text') {
setTimeout(requestKeyboardIncognitoMode, 250);
}
@KingParmenides

Copy link
Copy Markdown
Author

Checked the current head f05c4bd against the Copilot review comments:

  • IncognitoKeyboardTextInput no longer implicitly sets importantForAutofill; callers can pass it explicitly if needed.
  • Android secure prompts now retry requestKeyboardIncognitoMode() until it applies or times out, and cancel pending retries when the prompt resolves/rejects.

The branch is already updated for those comments and the configured Socket/Snyk checks are green.

@KingParmenides

Copy link
Copy Markdown
Author

CI note after the latest run:

  • Tests (lint, unit, integration) are passing on the PR head.
  • BuildReleaseApk fails before building because release signing env vars are unavailable in this PR context (KEYSTORE_FILE_HEX, KEYSTORE_PASSWORD).
  • Build Release and Upload to TestFlight (iOS) fails in its branch setup step because the workflow fetches ${GITHUB_HEAD_REF} from origin, but this PR head branch lives on my fork, not the upstream repo.

I do not see a code failure in those release jobs; the remaining blocker is maintainer review / CI permissions.

Comment thread components/PasswordInput.tsx Outdated
<TextInput
<IncognitoKeyboardTextInput
ref={inputRef}
incognitoKeyboard

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property can be removed, so as autoCapitalize, autoCorrect and spellCheck

@KingParmenides

Copy link
Copy Markdown
Author

Updated in d43bb70 for the maintainer review item.

Changes:

  • IncognitoKeyboardTextInput now always requests incognito keyboard behavior, so callers no longer pass an incognitoKeyboard prop.
  • Removed the now-redundant autoCapitalize, autoCorrect, and spellCheck call-site props where the wrapper supplies those defaults.
  • Kept importantForAutofill passthrough-only from the prior Copilot feedback.

Re-ran locally:

  • ./node_modules/.bin/tsc --noEmit
  • ./node_modules/.bin/eslint BlueComponents.tsx blue_modules/requestKeyboardIncognitoMode.ts components/IncognitoKeyboardTextInput.tsx components/PasswordInput.tsx helpers/prompt.ts screen/PromptPasswordConfirmationSheet.tsx screen/wallets/ImportSpeed.tsx
  • ./node_modules/.bin/prettier --check --single-quote --print-width 140 --trailing-comma all --arrow-parens avoid BlueComponents.tsx blue_modules/requestKeyboardIncognitoMode.ts components/IncognitoKeyboardTextInput.tsx components/PasswordInput.tsx helpers/prompt.ts screen/PromptPasswordConfirmationSheet.tsx screen/wallets/ImportSpeed.tsx
  • git diff --check

@Overtorment

Copy link
Copy Markdown
Member

this PR is not following CONTRIBUTING.md guidelines

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

While typing seed words to import, application should request Incognito keyboard (android) (100k sat bounty)

4 participants