Make the sync response profile nonnull (#400)

This commit is contained in:
David Perez
2023-12-15 11:53:52 -06:00
committed by GitHub
parent 6afa7ba23f
commit 1a3035bb2f
3 changed files with 5 additions and 5 deletions

View File

@@ -16,7 +16,7 @@ import com.x8bit.bitwarden.ui.platform.base.util.toHexColorRepresentation
fun UserStateJson.toUpdatedUserStateJson(
syncResponse: SyncResponseJson,
): UserStateJson {
val userId = syncResponse.profile?.id ?: return this
val userId = syncResponse.profile.id
val account = this.accounts[userId] ?: return this
val profile = account.profile
// TODO: Update additional missing UserStateJson properties (BIT-916)

View File

@@ -10,7 +10,7 @@ import java.time.LocalDateTime
*
* @property folders A list of folders associated with the vault data (nullable).
* @property collections A list of collections associated with the vault data (nullable).
* @property profile The profile associated with the vault data (nullable).
* @property profile The profile associated with the vault data.
* @property ciphers A list of ciphers associated with the vault data (nullable).
* @property policies A list of policies associated with the vault data (nullable).
* @property domains A domains object associated with the vault data.
@@ -25,7 +25,7 @@ data class SyncResponseJson(
val collections: List<Collection>?,
@SerialName("profile")
val profile: Profile?,
val profile: Profile,
@SerialName("ciphers")
val ciphers: List<Cipher>?,

View File

@@ -312,7 +312,7 @@ class VaultRepositoryImpl constructor(
private fun storeKeys(
syncResponse: SyncResponseJson,
) {
val profile = syncResponse.profile ?: return
val profile = syncResponse.profile
val userId = profile.id
val userKey = profile.key
val privateKey = profile.privateKey
@@ -338,7 +338,7 @@ class VaultRepositoryImpl constructor(
private suspend fun unlockVaultForOrganizationsIfNecessary(
syncResponse: SyncResponseJson,
) {
val profile = syncResponse.profile ?: return
val profile = syncResponse.profile
val organizationKeys = profile.organizations
.orEmpty()
.filter { it.key != null }