From 4651a4521645d5231311d1c2b0be43b651425815 Mon Sep 17 00:00:00 2001 From: Artem Chepurnoy Date: Sat, 9 Mar 2024 08:50:39 +0200 Subject: [PATCH] improvement: If decodign a cipher fails, prefer the last local copy over a remote one --- .../keyguard/provider/bitwarden/api/SyncEngine.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/provider/bitwarden/api/SyncEngine.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/provider/bitwarden/api/SyncEngine.kt index 083cc1a1..f59ab4f3 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/provider/bitwarden/api/SyncEngine.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/provider/bitwarden/api/SyncEngine.kt @@ -317,7 +317,7 @@ class SyncEngine( deleted = false, version = BitwardenService.VERSION, ) - val model = BitwardenFolder( + val model = localOrNull?.copy(service = service) ?: BitwardenFolder( accountId = user.id, folderId = localId, revisionDate = remote.revisionDate, @@ -543,7 +543,7 @@ class SyncEngine( deleted = false, version = BitwardenService.VERSION, ) - val model = BitwardenCipher( + val model = localOrNull?.copy(service = service) ?: BitwardenCipher( accountId = user.id, cipherId = localId, folderId = folderId, @@ -768,7 +768,7 @@ class SyncEngine( deleted = false, version = BitwardenService.VERSION, ) - val model = BitwardenCollection( + val model = localOrNull?.copy(service = service) ?: BitwardenCollection( accountId = user.id, collectionId = remote.id, externalId = remote.externalId, @@ -883,7 +883,7 @@ class SyncEngine( deleted = false, version = BitwardenService.VERSION, ) - val model = BitwardenOrganization( + val model = localOrNull?.copy(service = service) ?: BitwardenOrganization( accountId = user.id, organizationId = remote.id, revisionDate = now, @@ -1001,7 +1001,7 @@ class SyncEngine( deleted = false, version = BitwardenService.VERSION, ) - val model = BitwardenSend( + val model = localOrNull?.copy(service = service) ?: BitwardenSend( accountId = user.id, sendId = localOrNull?.sendId ?: cryptoGenerator.uuid(), revisionDate = now,