mirror of
https://github.com/bitwarden/android.git
synced 2025-01-08 09:17: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>>()
|
private val forceSendFlow = bufferedMutableSharedFlow<List<SyncResponseJson.Send>>()
|
||||||
|
|
||||||
override suspend fun saveOfflineCipher(userId: String, cipher: Cipher) {
|
override suspend fun saveOfflineCipher(userId: String, cipher: Cipher) {
|
||||||
|
val id = cipher.id ?: "create_${UUID.randomUUID()}"
|
||||||
offlineCiphersDao.insertCiphers(
|
offlineCiphersDao.insertCiphers(
|
||||||
ciphers = listOf(
|
ciphers = listOf(
|
||||||
OfflineCipherEntity(
|
OfflineCipherEntity(
|
||||||
id = cipher.id ?: "create_${UUID.randomUUID()}",
|
id = id,
|
||||||
userId = userId,
|
userId = userId,
|
||||||
cipherType = json.encodeToString(cipher.type),
|
cipherType = json.encodeToString(cipher.type),
|
||||||
cipherJson = json.encodeToString(
|
cipherJson = json.encodeToString(
|
||||||
cipher.toOfflineCipher().toOfflineCipherJson()
|
cipher.toOfflineCipher().toOfflineCipherJson(id)
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -109,6 +109,7 @@ class CipherManagerImpl(
|
||||||
// TODO: Why are we doing this?
|
// TODO: Why are we doing this?
|
||||||
cipher = response.cipher.copy(collectionIds = cipher.collectionIds),
|
cipher = response.cipher.copy(collectionIds = cipher.collectionIds),
|
||||||
)
|
)
|
||||||
|
vaultDiskSource.deleteOfflineCipher(userId = userId, cipherId = c.id)
|
||||||
UpdateCipherResult.Success
|
UpdateCipherResult.Success
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,9 +96,9 @@ fun Cipher.toOfflineCipher(): OfflineCipher =
|
||||||
mergeConflict = false,
|
mergeConflict = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
fun OfflineCipher.toOfflineCipherJson(): OfflineCipherJson =
|
fun OfflineCipher.toOfflineCipherJson(id: String): OfflineCipherJson =
|
||||||
OfflineCipherJson(
|
OfflineCipherJson(
|
||||||
id = id ?: "create_${UUID.randomUUID()}",
|
id = id,
|
||||||
organizationId = organizationId,
|
organizationId = organizationId,
|
||||||
folderId = folderId,
|
folderId = folderId,
|
||||||
collectionIds = collectionIds.orEmpty(),
|
collectionIds = collectionIds.orEmpty(),
|
||||||
|
|
Loading…
Reference in a new issue