mirror of
https://github.com/immich-app/immich.git
synced 2025-07-21 22:44:23 +02:00
fix(mobile): do not removed not backup asset when selecting the correspond options (#13256)
* fixed the local ids selecting issue
* code: updated impl inside deleteLocalOnlyAssets
* fix: used png instead of jpg to maintain picture quality
* Revert "fix: used png instead of jpg to maintain picture quality"
This reverts commit 04f2ed54e4
.
* fix: update logic from code-review perspective
* refractor (mobile) : Dart fix applied
* fix (mobile) : Updated multi grid as per requirement
---------
Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
parent
b9096f3e99
commit
b95bc32310
2 changed files with 31 additions and 5 deletions
mobile/lib/widgets/asset_grid
|
@ -203,18 +203,30 @@ class MultiselectGrid extends HookConsumerWidget {
|
|||
void onDeleteLocal(bool onlyBackedUp) async {
|
||||
processing.value = true;
|
||||
try {
|
||||
// Select only the local assets from the selection
|
||||
final localIds = selection.value.where((a) => a.isLocal).toList();
|
||||
|
||||
// Delete only the backed-up assets if 'onlyBackedUp' is true
|
||||
final isDeleted = await ref
|
||||
.read(assetProvider.notifier)
|
||||
.deleteLocalOnlyAssets(localIds, onlyBackedUp: onlyBackedUp);
|
||||
|
||||
if (isDeleted) {
|
||||
// Show a toast with the correct number of deleted assets
|
||||
final deletedCount = localIds
|
||||
.where(
|
||||
(e) => !onlyBackedUp || e.isRemote,
|
||||
) // Only count backed-up assets
|
||||
.length;
|
||||
|
||||
ImmichToast.show(
|
||||
context: context,
|
||||
msg: 'assets_removed_permanently_from_device'
|
||||
.tr(args: ["${localIds.length}"]),
|
||||
.tr(args: ["$deletedCount"]),
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
);
|
||||
|
||||
// Reset the selection
|
||||
selectionEnabledHook.value = false;
|
||||
}
|
||||
} finally {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue