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'); } } }