mirror of
https://github.com/bitwarden/android.git
synced 2026-10-23 03:23:53 -05:00
Fix create id
This commit is contained in:
3 files changed
+6
-4
No files matched your search
+3
-2
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -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(),
|
||||
|
||||
Reference in new issue
Block a user