From 98800cf46ef08a82c95ee0a67f001d7c9f8e0330 Mon Sep 17 00:00:00 2001 From: KhaledNjim Date: Tue, 12 Nov 2024 23:45:00 +0100 Subject: [PATCH] fixup! fixup! LA-1352 sync deleted recieved shares with local db --- ...ed_received_share_from_local_database.dart | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/domain/lib/src/usecases/received/remove_deleted_received_share_from_local_database.dart b/domain/lib/src/usecases/received/remove_deleted_received_share_from_local_database.dart index ebef0caa..837692e3 100644 --- a/domain/lib/src/usecases/received/remove_deleted_received_share_from_local_database.dart +++ b/domain/lib/src/usecases/received/remove_deleted_received_share_from_local_database.dart @@ -1,5 +1,5 @@ +import 'dart:developer'; import 'package:domain/domain.dart'; -import 'package:collection/collection.dart'; class RemoveDeletedReceivedShareFromLocalDatabaseInteractor { final ReceivedShareRepository _receivedShareRepository; @@ -9,13 +9,19 @@ class RemoveDeletedReceivedShareFromLocalDatabaseInteractor { Future execute( List receivedShares, String recipient) async { - var localReceivedShares = await _receivedShareRepository - .getAllReceivedShareOfflineByRecipient(recipient); - final receivedShareIds = receivedShares.map((received) => received.shareId).toSet(); - for (final local in localReceivedShares) { - if (!receivedShareIds.contains(local.shareId)) { - await _receivedShareRepository.disableOffline(local.shareId, local.localPath ?? ''); + try { + var localReceivedShares = await _receivedShareRepository + .getAllReceivedShareOfflineByRecipient(recipient); + final receivedShareIds = + receivedShares.map((received) => received.shareId).toSet(); + for (final local in localReceivedShares) { + if (!receivedShareIds.contains(local.shareId)) { + await _receivedShareRepository.disableOffline( + local.shareId, local.localPath ?? ''); + } } + } catch (exception) { + log('RemoveDeletedReceivedShareFromLocalDatabaseInteractor: $exception'); } } }