MS-1433 Persist data for MFID analytics events across activity recreation#1669
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds SavedStateHandle-backed persistence for MFID external credential analytics timestamps/IDs so analytics events can survive ViewModel recreation.
Changes:
- Injects
SavedStateHandleintoExternalCredentialViewModel. - Restores and persists selection start time, selection event ID, and capture start time.
- Adds unit tests covering persistence/restoration paths.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
feature/external-credential/src/main/java/com/simprints/feature/externalcredential/screens/controller/ExternalCredentialViewModel.kt |
Adds SavedStateHandle persistence for analytics-related fields. |
feature/external-credential/src/test/java/com/simprints/feature/externalcredential/screens/controller/ExternalCredentialViewModelTest.kt |
Adds tests for saved/restored analytics state. |
| selectionEventId = eventsTracker.saveSelectionEvent(selectionStartTime, selectionEndTime, selectedType) | ||
| savedStateHandle[KEY_SELECTION_EVENT_ID] = selectionEventId | ||
| captureStartTime = timeHelper.now() | ||
| savedStateHandle[KEY_CAPTURE_START_TIME] = captureStartTime |
There was a problem hiding this comment.
Should the savedStateHandle be updated in an onStop() callback instead of being scattered throughout the VM?
There was a problem hiding this comment.
I think this is simpler and safer, since the onStop() could be called before "captureStartTime" is initialised and we would need to have extra error handling.
96f8680 to
bb87640
Compare
|



JIRA ticket
Will be released in: 2026.2.0
Root cause analysis (for bugfixes only)
First known affected version: 2026.1.0
Notable changes
Testing guidance
Additional work checklist