-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LA-1352 sync deleted recieved shares with local db
- Loading branch information
1 parent
45aba5b
commit 49ca084
Showing
6 changed files
with
53 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
domain/lib/src/usecases/received/remove_deleted_received_share_from_local_database.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import 'package:domain/domain.dart'; | ||
import 'package:collection/collection.dart'; | ||
|
||
class RemoveDeletedReceivedShareFromLocalDatabaseInteractor { | ||
final ReceivedShareRepository _receivedShareRepository; | ||
|
||
RemoveDeletedReceivedShareFromLocalDatabaseInteractor( | ||
this._receivedShareRepository); | ||
|
||
Future<void> execute( | ||
List<ReceivedShare> 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 ?? ''); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters