feat: Add securityScore and lastPasswordUpdate in AccountEntity#149
Open
feat: Add securityScore and lastPasswordUpdate in AccountEntity#149
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the account persistence model to store security-related profile metadata (security score + last password update) and adds a refresh pathway to re-sync that metadata from the backend, including a UI-triggered refresh from the account list.
Changes:
- Add
securityScoreandlastPasswordUpdatefields toAccountEntityand update persistence calls to populate them fromUserProfile.preferences.security. - Add a new
AuthenticatorFacade.refreshUserProfileFor(...)API and wire it throughAuthenticatorFacadeImpl. - Add an account-list refresh hook to trigger user-profile syncing from the app UI.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| multiplatform-lib/src/commonMain/kotlin/models/migration/user/preferences/Preferences.kt | Makes Preferences.security non-null (now required) for profile parsing. |
| multiplatform-lib/src/commonMain/kotlin/internal/db/AccountsDao.kt | Makes getAccountsWith suspend and adds getAccount for one-shot reads. |
| multiplatform-lib/src/commonMain/kotlin/internal/db/AccountEntity.kt | Adds securityScore and lastPasswordUpdate columns to the entity. |
| multiplatform-lib/src/commonMain/kotlin/internal/AuthenticatorFacadeImpl.kt | Fetches/stores security fields from user profile; adds syncing helper and refresh entrypoint. |
| multiplatform-lib/src/commonMain/kotlin/DummyAuthenticatorFacade.kt | Adds stub implementation for the new facade method. |
| multiplatform-lib/src/commonMain/kotlin/AuthenticatorFacade.kt | Adds new abstract API refreshUserProfileFor(...). |
| multiplatform-lib/schemas/com.infomaniak.auth.lib.internal.db.AccountsDatabase/1.json | Updates exported Room schema to include new columns. |
| app/src/main/kotlin/com/infomaniak/auth/ui/screen/accountlist/AccountListViewModel.kt | Adds refreshUserProfiles() and nests AccountListUiState in the VM. |
| app/src/main/kotlin/com/infomaniak/auth/ui/screen/accountlist/AccountListScreen.kt | Wires pull-to-refresh to also refresh user profiles. |
Comments suppressed due to low confidence (1)
multiplatform-lib/src/commonMain/kotlin/internal/AuthenticatorFacadeImpl.kt:346
- After
syncAccountWithUserProfile(...)updates the account row withsecurityScore/lastPasswordUpdate, the subsequentdao.upsert(notConnectedAccount.copy(status = LoggedIn))can overwrite those new columns with the (likely default) values fromnotConnectedAccount. Consider including the security fields in that final upsert, or avoid the second upsert ifsyncAccountWithUserProfilealready persisted the needed updates.
val userProfile = syncAccountWithUserProfile(apiToken.accessToken, userId)
userProfile.apiToken = apiToken
authenticatorBridge.persistUserProfile(userProfile)
},
)
if (succeeded.not()) return false
dao.upsert(notConnectedAccount.copy(status = AccountEntity.Status.LoggedIn))
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
814e241 to
7c3f061
Compare
# Conflicts: # multiplatform-lib/src/commonMain/kotlin/internal/db/AccountsDao.kt # Conflicts: # multiplatform-lib/src/commonMain/kotlin/models/migration/user/preferences/Preferences.kt
46dad03 to
ce5ebfb
Compare
…og when an Account's password has been updated
ce5ebfb to
7cb8a06
Compare
|
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.

No description provided.