You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-06-23 04:38:12 +02: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:
@ -3,7 +3,6 @@ import 'package:immich_mobile/modules/home/ui/asset_grid/asset_grid_data_structu
|
||||
import 'package:immich_mobile/modules/trash/services/trash.service.dart';
|
||||
import 'package:immich_mobile/shared/models/asset.dart';
|
||||
import 'package:immich_mobile/shared/models/exif_info.dart';
|
||||
import 'package:immich_mobile/shared/providers/asset.provider.dart';
|
||||
import 'package:immich_mobile/shared/providers/db.provider.dart';
|
||||
import 'package:immich_mobile/shared/providers/user.provider.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
@ -42,12 +41,6 @@ class TrashNotifier extends StateNotifier<bool> {
|
||||
await _db.exifInfos.deleteAll(dbIds);
|
||||
await _db.assets.deleteAll(dbIds);
|
||||
});
|
||||
|
||||
// Refresh assets in background
|
||||
Future.delayed(
|
||||
const Duration(seconds: 4),
|
||||
() async => await _ref.read(assetProvider.notifier).getAllAsset(),
|
||||
);
|
||||
} catch (error, stack) {
|
||||
_log.severe("Cannot empty trash ${error.toString()}", error, stack);
|
||||
}
|
||||
@ -68,12 +61,6 @@ class TrashNotifier extends StateNotifier<bool> {
|
||||
await _db.writeTxn(() async {
|
||||
await _db.assets.putAll(updatedAssets);
|
||||
});
|
||||
|
||||
// Refresh assets in background
|
||||
Future.delayed(
|
||||
const Duration(seconds: 4),
|
||||
() async => await _ref.read(assetProvider.notifier).getAllAsset(),
|
||||
);
|
||||
return true;
|
||||
}
|
||||
} catch (error, stack) {
|
||||
@ -106,12 +93,6 @@ class TrashNotifier extends StateNotifier<bool> {
|
||||
await _db.writeTxn(() async {
|
||||
await _db.assets.putAll(updatedAssets);
|
||||
});
|
||||
|
||||
// Refresh assets in background
|
||||
Future.delayed(
|
||||
const Duration(seconds: 4),
|
||||
() async => await _ref.read(assetProvider.notifier).getAllAsset(),
|
||||
);
|
||||
} catch (error, stack) {
|
||||
_log.severe("Cannot restore trash ${error.toString()}", error, stack);
|
||||
}
|
||||
|
Reference in New Issue
Block a user