-
Notifications
You must be signed in to change notification settings - Fork 16
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
55f76ae
commit af6f6ee
Showing
4 changed files
with
40 additions
and
2 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
24 changes: 24 additions & 0 deletions
24
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,24 @@ | ||
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 localRecievedShares = await _receivedShareRepository | ||
.getAllReceivedShareOfflineByRecipient(recipient); | ||
|
||
for (final localReceived in localRecievedShares) { | ||
final receivedShare = receivedShares.firstWhereOrNull( | ||
(received) => received.shareId == localReceived.shareId); | ||
if (receivedShare == null) { | ||
await _receivedShareRepository.disableOffline( | ||
localReceived.shareId, localReceived.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