mirror of
https://github.com/bitwarden/android.git
synced 2025-01-07 08:47:36 +03:00
Fix create id
This commit is contained in:
parent
e44cfe16d5
commit
d7b935031e
3 changed files with 6 additions and 4 deletions
|
@ -55,14 +55,15 @@ class VaultDiskSourceImpl(
|
|||
private val forceSendFlow = bufferedMutableSharedFlow<List<SyncResponseJson.Send>>()
|
||||
|
||||
override suspend fun saveOfflineCipher(userId: String, cipher: Cipher) {
|
||||
val id = cipher.id ?: "create_${UUID.randomUUID()}"
|
||||
offlineCiphersDao.insertCiphers(
|
||||
ciphers = listOf(
|
||||
OfflineCipherEntity(
|
||||
id = cipher.id ?: "create_${UUID.randomUUID()}",
|
||||
id = id,
|
||||
userId = userId,
|
||||
cipherType = json.encodeToString(cipher.type),
|
||||
cipherJson = json.encodeToString(
|
||||
cipher.toOfflineCipher().toOfflineCipherJson()
|
||||
cipher.toOfflineCipher().toOfflineCipherJson(id)
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -109,6 +109,7 @@ class CipherManagerImpl(
|
|||
// TODO: Why are we doing this?
|
||||
cipher = response.cipher.copy(collectionIds = cipher.collectionIds),
|
||||
)
|
||||
vaultDiskSource.deleteOfflineCipher(userId = userId, cipherId = c.id)
|
||||
UpdateCipherResult.Success
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,9 +96,9 @@ fun Cipher.toOfflineCipher(): OfflineCipher =
|
|||
mergeConflict = false,
|
||||
)
|
||||
|
||||
fun OfflineCipher.toOfflineCipherJson(): OfflineCipherJson =
|
||||
fun OfflineCipher.toOfflineCipherJson(id: String): OfflineCipherJson =
|
||||
OfflineCipherJson(
|
||||
id = id ?: "create_${UUID.randomUUID()}",
|
||||
id = id,
|
||||
organizationId = organizationId,
|
||||
folderId = folderId,
|
||||
collectionIds = collectionIds.orEmpty(),
|
||||
|
|
Loading…
Reference in a new issue