[MS-1340] MFID: adding validation for manual credential entry#1584
Conversation
…manual-credential-entry
There was a problem hiding this comment.
Pull request overview
This PR adds validation for manual credential entry in the Multi-Factor ID (MFID) feature. It ensures that credentials can only be saved when they match the expected format for their type (Ghana ID Card, NHIS Card, or QR Code), and preserves the editing state across configuration changes like screen rotation.
Changes:
- Added format validation for manually entered credentials using dedicated use cases for Ghana ID Card and NHIS Card patterns
- Introduced
isEditingCredentialflag inSearchCredentialStateto track and persist editing state across configuration changes - Updated UI to enable/disable the edit/save icon based on credential format validity
- Continue button is now disabled while editing to prevent proceeding with unsaved changes
- Added color selector resource to visually indicate disabled state for the save icon
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| ExternalCredentialSearchViewModelTest.kt | Added mock dependencies for Ghana ID and NHIS card validation use cases |
| ic_done.xml | Changed hardcoded color to color resource reference to support disabled state |
| ic_edit_color.xml | New color selector defining colors for enabled and disabled states |
| SearchCredentialState.kt | Added isEditingCredential boolean field to preserve editing state |
| ExternalCredentialSearchViewModel.kt | Added validation method delegating to credential-specific use cases and state management for editing mode |
| ExternalCredentialSearchFragment.kt | Implemented UI logic for edit mode including validation-based icon enabling and text change listener |
| .editorconfig | Added ktlint rules for when-entry bracing, blank lines, backticked identifiers, and unused imports |
.../com/simprints/feature/externalcredential/screens/search/ExternalCredentialSearchFragment.kt
Outdated
Show resolved
Hide resolved
.../java/com/simprints/feature/externalcredential/screens/search/model/SearchCredentialState.kt
Show resolved
Hide resolved
...com/simprints/feature/externalcredential/screens/search/ExternalCredentialSearchViewModel.kt
Show resolved
Hide resolved
.../com/simprints/feature/externalcredential/screens/search/ExternalCredentialSearchFragment.kt
Show resolved
Hide resolved
...com/simprints/feature/externalcredential/screens/search/ExternalCredentialSearchViewModel.kt
Outdated
Show resolved
Hide resolved
...com/simprints/feature/externalcredential/screens/search/ExternalCredentialSearchViewModel.kt
Outdated
Show resolved
Hide resolved
.../com/simprints/feature/externalcredential/screens/search/ExternalCredentialSearchFragment.kt
Show resolved
Hide resolved
BurningAXE
left a comment
There was a problem hiding this comment.
From UX side - maybe the checkbox should be disabled, too, when the number is not valid. Otherwise it's weird to verify an invalid number. But then you have to reset it after every edit and you get into a rabbit hole :)
luhmirin-s
left a comment
There was a problem hiding this comment.
+1 to all of Milen's comments
|
Thanks for feedback! The checkbox is now disabled when the credential is being edited checkbox.mp4 |
|



JIRA ticket
Will be released in: 2025.4.1
Notable changes
Additional work checklist