fix(android): send chat with hardware Enter#101321
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7c6ca85e49
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ): Boolean { | ||
| val enterKey = event.key == Key.Enter || event.key == Key.NumPadEnter | ||
| val modified = event.isShiftPressed || event.isCtrlPressed || event.isAltPressed || event.isMetaPressed | ||
| if (event.type != KeyEventType.KeyDown || event.nativeKeyEvent.repeatCount != 0 || !enterKey || modified) return false |
There was a problem hiding this comment.
Consume repeated Enter keydowns after the first send
When a physical Enter key is held down, the first KeyDown sends and clears the draft, but subsequent auto-repeat KeyDowns hit this early return and are passed through to BasicTextField, which this helper is specifically trying to intercept before newline insertion. That leaves blank newline(s) in the composer after a long-press Enter send instead of making repeats a no-op; repeated unmodified Enter events should be consumed without calling onSend.
Useful? React with 👍 / 👎.
|
Land-ready review complete. What changed:
Proof:
Known proof gap: an isolated APK was installed and launched on an attached Pixel 10a / API 36, but the device required fingerprint unlock before interaction. The isolated package was removed and the existing OpenClaw app was not replaced. |
|
Merged via squash.
|
…eyTest Import-order/blank-line drift landed via the hardware-Enter changes (#101321 and follow-up) while this PR was open — the exact recurrence the new android-ktlint lane prevents. Generated with ktlintFormat; native i18n inventory resynced for the shifted line numbers.
* style(android): fix ktlint drift in ShellScreen.kt Formatting drift landed via #101161; :app:ktlintCheck fails on main without this. Generated with ./gradlew :app:ktlintFormat. * ci(android): add ktlint lane to the Android CI job Android formatting drift kept landing on main because CI never ran ktlintCheck (see the #100304 manual sweep). Adds an android-ktlint matrix lane mirroring pnpm android:lint. * chore(i18n): sync native inventory after ShellScreen.kt format The ktlint format fix shifted line numbers tracked in apps/.i18n/native-source.json; regenerated via pnpm native:i18n:sync. * style(android): fix new ktlint drift in NodeRuntime and ChatHardwareKeyTest Import-order/blank-line drift landed via the hardware-Enter changes (#101321 and follow-up) while this PR was open — the exact recurrence the new android-ktlint lane prevents. Generated with ktlintFormat; native i18n inventory resynced for the shifted line numbers.
* style(android): fix ktlint drift in ShellScreen.kt Formatting drift landed via openclaw#101161; :app:ktlintCheck fails on main without this. Generated with ./gradlew :app:ktlintFormat. * ci(android): add ktlint lane to the Android CI job Android formatting drift kept landing on main because CI never ran ktlintCheck (see the openclaw#100304 manual sweep). Adds an android-ktlint matrix lane mirroring pnpm android:lint. * chore(i18n): sync native inventory after ShellScreen.kt format The ktlint format fix shifted line numbers tracked in apps/.i18n/native-source.json; regenerated via pnpm native:i18n:sync. * style(android): fix new ktlint drift in NodeRuntime and ChatHardwareKeyTest Import-order/blank-line drift landed via the hardware-Enter changes (openclaw#101321 and follow-up) while this PR was open — the exact recurrence the new android-ktlint lane prevents. Generated with ktlintFormat; native i18n inventory resynced for the shifted line numbers.
* style(android): fix ktlint drift in ShellScreen.kt Formatting drift landed via openclaw#101161; :app:ktlintCheck fails on main without this. Generated with ./gradlew :app:ktlintFormat. * ci(android): add ktlint lane to the Android CI job Android formatting drift kept landing on main because CI never ran ktlintCheck (see the openclaw#100304 manual sweep). Adds an android-ktlint matrix lane mirroring pnpm android:lint. * chore(i18n): sync native inventory after ShellScreen.kt format The ktlint format fix shifted line numbers tracked in apps/.i18n/native-source.json; regenerated via pnpm native:i18n:sync. * style(android): fix new ktlint drift in NodeRuntime and ChatHardwareKeyTest Import-order/blank-line drift landed via the hardware-Enter changes (openclaw#101321 and follow-up) while this PR was open — the exact recurrence the new android-ktlint lane prevents. Generated with ktlintFormat; native i18n inventory resynced for the shifted line numbers.
* style(android): fix ktlint drift in ShellScreen.kt Formatting drift landed via openclaw#101161; :app:ktlintCheck fails on main without this. Generated with ./gradlew :app:ktlintFormat. * ci(android): add ktlint lane to the Android CI job Android formatting drift kept landing on main because CI never ran ktlintCheck (see the openclaw#100304 manual sweep). Adds an android-ktlint matrix lane mirroring pnpm android:lint. * chore(i18n): sync native inventory after ShellScreen.kt format The ktlint format fix shifted line numbers tracked in apps/.i18n/native-source.json; regenerated via pnpm native:i18n:sync. * style(android): fix new ktlint drift in NodeRuntime and ChatHardwareKeyTest Import-order/blank-line drift landed via the hardware-Enter changes (openclaw#101321 and follow-up) while this PR was open — the exact recurrence the new android-ktlint lane prevents. Generated with ktlintFormat; native i18n inventory resynced for the shifted line numbers.
Closes #101239
What Problem This Solves
Fixes an issue where Android users typing with a physical keyboard would insert a newline instead of sending when pressing Enter in chat.
Why This Change Was Made
The chat composer now intercepts an unmodified physical Enter key before
BasicTextFieldapplies its newline behavior and uses the same enablement and send action as the visible Send button. Shift+Enter and other modified Enter combinations remain text input; repeats and key-up events do not send.User Impact
Physical-keyboard users can press Enter to send messages. Modified Enter combinations continue to support multiline composition.
Evidence
tbx_01kwx6hpzsqm3t2jswgr0a6wgwpnpm native:i18n:checkChatHardwareKeyTest: Enter, numpad Enter, repeat, disabled-send, modifier, and key-up cases:app:assemblePlayDebug:app:lintPlayDebug