MobBridge.kt.eex: MobTextField honours secure: true - #6
Closed
C-Sinclair wants to merge 1 commit into
Closed
Conversation
Apply Compose's `PasswordVisualTransformation()` and switch `keyboardType` to `KeyboardType.Password` when the BEAM-side `text_field` carries `secure: true`. Mirrors the iOS-side `SecureField`-vs-`TextField` swap landing in mob 0.6.x. Cleartext still reaches the BEAM via `on_change` so apps hash/store the value as normal — the transformation is purely visual. `secure: true` overrides any explicit `keyboard:` choice. Numeric PIN-style masking on a Number keyboard isn't a single-prop combo; apps that need it can layer their own masking, or we can revisit the override rule based on real demand. Verified: - `MobNew.Templates.Lint.check_kotlin/1` clean on regenerated MobBridge.kt (balanced braces/parens/brackets, no EEx leaks, no duplicate imports) - `mix test` — same 230/266 pass baseline; the 36 pre-existing failures (LiveView path missing phx_new locally, clang/NDK test) unchanged - `mix format`, `mix credo --strict`, `mix compile --warnings-as-errors` all clean
Owner
|
Thanks @C-Sinclair — landed as 4a41f47 in mob_new 0.3.8 with your authorship preserved. Paired with mob#12 (iOS SecureField) in mob 0.6.15 so the CHANGELOG entry merged into the [0.3.8] [Unreleased]-renamed section alongside the project_swift_sources hook landing in the same release. Closing since the commit is on master. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Companion to GenericJam/mob#12 (mob iOS
secure: truefortext_field). Wires the Android Compose side sotext_field secure={true}actually masks input on both platforms.In
MobBridge.kt.eex'sMobTextFieldcomposable:secure: Booleanfrom the prop bag.PasswordVisualTransformation()when set,VisualTransformation.Noneotherwise.secure: true, overridekeyboardTypetoKeyboardType.Password(autocorrect off, no suggestions strip). The override rule documented inline — apps wanting numeric-PIN masking on a Number keyboard can layer their own masking; we can revisit based on real demand.Cleartext still reaches the BEAM via
on_change— the transformation is purely visual. Existing apps generated from prior templates are unaffected; the prop becomes a no-op there. Regenerating or hand-portingMobBridge.ktenables masking.CHANGELOG / version
Under
## [Unreleased]. Nomix.exsbump — follows the repo's ride-along bump pattern (e.g.2e566d9 Bump to 0.3.5 — fix three template regressions + add tier-1/3 lint suiterolling up three prior feature commits).Test plan
MobNew.Templates.Lint.check_kotlin/1on the regeneratedMobBridge.kt— returns[]. All 8 structural checks pass (balanced braces/parens/brackets, no EEx leaks, no duplicate Kotlin imports, etc.).mix test— 230/266 pass (same baseline as master; the 36 pre-existing failures are LiveView-path tests requiringmix archive.install hex phx_new, plus the:requires_android_ndk-tagged clang test).mix format --check-formatted— cleanmix credo --strict— clean (129 mods/funs, 0 issues)mix compile --warnings-as-errors— cleansecure: truefield, type "hunter2" — Compose renders 7 dots, BEAM-side:passwordassign holds"hunter2", on-screen length label updates live. Same contract as the iOS verification in text_field: secure: true for masked password input mob#12.Files
priv/templates/mob.new/android/app/src/main/java/MobBridge.kt.eex— two new imports (PasswordVisualTransformation,VisualTransformation);isSecureflag inMobTextField;visualTransformationparameter; keyboard-type overrideCHANGELOG.md— entry under## [Unreleased]