Skip to content

Commit

Permalink
[PM-14526] Add JsonNames annotation to SyncResponseJson (#4247)
Browse files Browse the repository at this point in the history
  • Loading branch information
david-livefront authored and SaintPatrck committed Nov 11, 2024
1 parent 2c40a7f commit 015832e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.filterNotNull
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.merge
Expand Down Expand Up @@ -125,7 +124,6 @@ class VaultDiskSourceImpl(
override fun getDomains(userId: String): Flow<SyncResponseJson.Domains?> =
domainsDao
.getDomains(userId)
.filterNotNull()
.map { entity ->
withContext(dispatcherManager.default) {
entity?.domainsJson?.let { json.decodeFromString<SyncResponseJson.Domains>(it) }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.x8bit.bitwarden.data.vault.datasource.network.model

import kotlinx.serialization.Contextual
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.JsonNames
import kotlinx.serialization.json.JsonObject
import java.time.ZonedDateTime

Expand All @@ -21,6 +23,7 @@ private const val DEFAULT_FIDO_2_KEY_CURVE = "P-256"
* @property domains A domains object associated with the vault data.
* @property sends A list of send objects associated with the vault data (nullable).
*/
@OptIn(ExperimentalSerializationApi::class)
@Serializable
data class SyncResponseJson(
@SerialName("folders")
Expand All @@ -30,6 +33,7 @@ data class SyncResponseJson(
val collections: List<Collection>?,

@SerialName("profile")
@JsonNames("Profile")
val profile: Profile,

@SerialName("ciphers")
Expand All @@ -39,6 +43,7 @@ data class SyncResponseJson(
val policies: List<Policy>?,

@SerialName("domains")
@JsonNames("Domains")
val domains: Domains?,

@SerialName("sends")
Expand Down

0 comments on commit 015832e

Please sign in to comment.