mirror of
https://github.com/immich-app/immich.git
synced 2025-02-11 01:18:24 -05:00
fixed the local ids selecting issue
This commit is contained in:
parent
94d213bbb9
commit
7085b19e91
1 changed files with 16 additions and 1 deletions
|
@ -204,11 +204,26 @@ class MultiselectGrid extends HookConsumerWidget {
|
||||||
void onDeleteLocal(bool onlyBackedUp) async {
|
void onDeleteLocal(bool onlyBackedUp) async {
|
||||||
processing.value = true;
|
processing.value = true;
|
||||||
try {
|
try {
|
||||||
final localIds = selection.value.where((a) => a.isLocal).toList();
|
// Filter local assets based on the backup status (`isRemote`).
|
||||||
|
// If `onlyBackedUp` is true, only select assets that are also present on the server (`isRemote`).
|
||||||
|
final localIds = selection.value
|
||||||
|
.where((a) => a.isLocal && (!onlyBackedUp || a.isRemote))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
if (localIds.isEmpty) {
|
||||||
|
ImmichToast.show(
|
||||||
|
context: context,
|
||||||
|
msg: 'No backed-up assets selected for deletion.',
|
||||||
|
gravity: ToastGravity.BOTTOM,
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Proceed with deletion of filtered assets
|
||||||
final isDeleted = await ref
|
final isDeleted = await ref
|
||||||
.read(assetProvider.notifier)
|
.read(assetProvider.notifier)
|
||||||
.deleteLocalOnlyAssets(localIds, onlyBackedUp: onlyBackedUp);
|
.deleteLocalOnlyAssets(localIds, onlyBackedUp: onlyBackedUp);
|
||||||
|
|
||||||
if (isDeleted) {
|
if (isDeleted) {
|
||||||
ImmichToast.show(
|
ImmichToast.show(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
Loading…
Add table
Reference in a new issue