Skip to content

feat: Add securityScore and lastPasswordUpdate in AccountEntity#149

Open
tevincent wants to merge 4 commits intomainfrom
save-score-last-updated-password
Open

feat: Add securityScore and lastPasswordUpdate in AccountEntity#149
tevincent wants to merge 4 commits intomainfrom
save-score-last-updated-password

Conversation

@tevincent
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings April 30, 2026 06:32
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 securityScore and lastPasswordUpdate fields to AccountEntity and update persistence calls to populate them from UserProfile.preferences.security.
  • Add a new AuthenticatorFacade.refreshUserProfileFor(...) API and wire it through AuthenticatorFacadeImpl.
  • 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 with securityScore/lastPasswordUpdate, the subsequent dao.upsert(notConnectedAccount.copy(status = LoggedIn)) can overwrite those new columns with the (likely default) values from notConnectedAccount. Consider including the security fields in that final upsert, or avoid the second upsert if syncAccountWithUserProfile already 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.

Comment thread multiplatform-lib/src/commonMain/kotlin/internal/AuthenticatorFacadeImpl.kt Outdated
@tevincent tevincent force-pushed the save-score-last-updated-password branch 4 times, most recently from 814e241 to 7c3f061 Compare April 30, 2026 08:52
@tevincent tevincent marked this pull request as draft April 30, 2026 11:07
@tevincent tevincent marked this pull request as ready for review May 1, 2026 11:01
# Conflicts:
#	multiplatform-lib/src/commonMain/kotlin/internal/db/AccountsDao.kt

# Conflicts:
#	multiplatform-lib/src/commonMain/kotlin/models/migration/user/preferences/Preferences.kt
@tevincent tevincent force-pushed the save-score-last-updated-password branch from 46dad03 to ce5ebfb Compare May 1, 2026 11:02
…og when an Account's password has been updated
@tevincent tevincent force-pushed the save-score-last-updated-password branch from ce5ebfb to 7cb8a06 Compare May 1, 2026 11:03
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 1, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants