mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
fix(mobile): handle asset trash, restore and delete ws events (#4482)
* server: add ASSET_RESTORE ws event * mobile: handle ASSET_TRASH, ASSET_RESTORE and ASSET_DELETE ws events --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
parent
634169235a
commit
a78e08bac1
7 changed files with 88 additions and 27 deletions
|
|
@ -153,7 +153,7 @@ class SyncService {
|
|||
if (toUpsert == null || toDelete == null) return null;
|
||||
try {
|
||||
if (toDelete.isNotEmpty) {
|
||||
await _handleRemoteAssetRemoval(toDelete);
|
||||
await handleRemoteAssetRemoval(toDelete);
|
||||
}
|
||||
if (toUpsert.isNotEmpty) {
|
||||
final (_, updated) = await _linkWithExistingFromDb(toUpsert);
|
||||
|
|
@ -171,7 +171,7 @@ class SyncService {
|
|||
}
|
||||
|
||||
/// Deletes remote-only assets, updates merged assets to be local-only
|
||||
Future<void> _handleRemoteAssetRemoval(List<String> idsToDelete) {
|
||||
Future<void> handleRemoteAssetRemoval(List<String> idsToDelete) {
|
||||
return _db.writeTxn(() async {
|
||||
await _db.assets.remote(idsToDelete).filter().localIdIsNull().deleteAll();
|
||||
final onlyLocal = await _db.assets.remote(idsToDelete).findAll();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue