mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 15:15:34 +03:00
Make the sync response profile nonnull (#400)
This commit is contained in:
parent
191602a867
commit
1b7e01ea89
3 changed files with 5 additions and 5 deletions
|
@ -16,7 +16,7 @@ import com.x8bit.bitwarden.ui.platform.base.util.toHexColorRepresentation
|
||||||
fun UserStateJson.toUpdatedUserStateJson(
|
fun UserStateJson.toUpdatedUserStateJson(
|
||||||
syncResponse: SyncResponseJson,
|
syncResponse: SyncResponseJson,
|
||||||
): UserStateJson {
|
): UserStateJson {
|
||||||
val userId = syncResponse.profile?.id ?: return this
|
val userId = syncResponse.profile.id
|
||||||
val account = this.accounts[userId] ?: return this
|
val account = this.accounts[userId] ?: return this
|
||||||
val profile = account.profile
|
val profile = account.profile
|
||||||
// TODO: Update additional missing UserStateJson properties (BIT-916)
|
// TODO: Update additional missing UserStateJson properties (BIT-916)
|
||||||
|
|
|
@ -10,7 +10,7 @@ import java.time.LocalDateTime
|
||||||
*
|
*
|
||||||
* @property folders A list of folders associated with the vault data (nullable).
|
* @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 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 ciphers A list of ciphers associated with the vault data (nullable).
|
||||||
* @property policies A list of policies 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.
|
* @property domains A domains object associated with the vault data.
|
||||||
|
@ -25,7 +25,7 @@ data class SyncResponseJson(
|
||||||
val collections: List<Collection>?,
|
val collections: List<Collection>?,
|
||||||
|
|
||||||
@SerialName("profile")
|
@SerialName("profile")
|
||||||
val profile: Profile?,
|
val profile: Profile,
|
||||||
|
|
||||||
@SerialName("ciphers")
|
@SerialName("ciphers")
|
||||||
val ciphers: List<Cipher>?,
|
val ciphers: List<Cipher>?,
|
||||||
|
|
|
@ -312,7 +312,7 @@ class VaultRepositoryImpl constructor(
|
||||||
private fun storeKeys(
|
private fun storeKeys(
|
||||||
syncResponse: SyncResponseJson,
|
syncResponse: SyncResponseJson,
|
||||||
) {
|
) {
|
||||||
val profile = syncResponse.profile ?: return
|
val profile = syncResponse.profile
|
||||||
val userId = profile.id
|
val userId = profile.id
|
||||||
val userKey = profile.key
|
val userKey = profile.key
|
||||||
val privateKey = profile.privateKey
|
val privateKey = profile.privateKey
|
||||||
|
@ -338,7 +338,7 @@ class VaultRepositoryImpl constructor(
|
||||||
private suspend fun unlockVaultForOrganizationsIfNecessary(
|
private suspend fun unlockVaultForOrganizationsIfNecessary(
|
||||||
syncResponse: SyncResponseJson,
|
syncResponse: SyncResponseJson,
|
||||||
) {
|
) {
|
||||||
val profile = syncResponse.profile ?: return
|
val profile = syncResponse.profile
|
||||||
val organizationKeys = profile.organizations
|
val organizationKeys = profile.organizations
|
||||||
.orEmpty()
|
.orEmpty()
|
||||||
.filter { it.key != null }
|
.filter { it.key != null }
|
||||||
|
|
Loading…
Reference in a new issue