mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
rework trashed assets handling
- add new table trashed_local_asset - mirror trashed assets data in trashed_local_asset. - compute checksums for assets trashed out-of-app. - restore assets present in trashed_local_asset and non-trashed in remote_asset. - simplify moving-to-trash logic based on remote_asset events.
This commit is contained in:
parent
3d56a5ca9c
commit
f7e5288173
29 changed files with 2085 additions and 876 deletions
|
|
@ -24,6 +24,7 @@ class PlatformAsset {
|
|||
final int durationInSeconds;
|
||||
final int orientation;
|
||||
final bool isFavorite;
|
||||
final int? size;
|
||||
|
||||
const PlatformAsset({
|
||||
required this.id,
|
||||
|
|
@ -36,6 +37,7 @@ class PlatformAsset {
|
|||
this.durationInSeconds = 0,
|
||||
this.orientation = 0,
|
||||
this.isFavorite = false,
|
||||
this.size,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -71,6 +73,19 @@ class SyncDelta {
|
|||
});
|
||||
}
|
||||
|
||||
class TrashedAssetParams {
|
||||
final String id;
|
||||
// Follows AssetType enum from base_asset.model.dart
|
||||
final int type;
|
||||
final String? albumId;
|
||||
|
||||
const TrashedAssetParams({
|
||||
required this.id,
|
||||
required this.type,
|
||||
this.albumId,
|
||||
});
|
||||
}
|
||||
|
||||
@HostApi()
|
||||
abstract class NativeSyncApi {
|
||||
bool shouldFullSync();
|
||||
|
|
@ -96,4 +111,11 @@ abstract class NativeSyncApi {
|
|||
|
||||
@TaskQueue(type: TaskQueueType.serialBackgroundThread)
|
||||
List<Uint8List?> hashPaths(List<String> paths);
|
||||
|
||||
@TaskQueue(type: TaskQueueType.serialBackgroundThread)
|
||||
List<PlatformAsset> getTrashedAssetsForAlbum(String albumId, {int? updatedTimeCond});
|
||||
|
||||
@TaskQueue(type: TaskQueueType.serialBackgroundThread)
|
||||
List<Uint8List?> hashTrashedAssets(List<TrashedAssetParams> trashedAssets);
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue