mobile: update toast asset count
This commit is contained in:
parent
1679973caf
commit
3d7c13b30f
3 changed files with 16 additions and 11 deletions
|
@ -143,7 +143,7 @@
|
|||
"daily_title_text_date_year": "E, MMM dd, yyyy",
|
||||
"date_format": "E, LLL d, y • h:mm a",
|
||||
"delete_dialog_alert": "These items will be permanently deleted from Immich and from your device",
|
||||
"delete_dialog_alert_local": "These items will be permanently deleted from your device",
|
||||
"delete_dialog_alert_local": "These items will be permanently removed from your device",
|
||||
"delete_dialog_cancel": "Cancel",
|
||||
"delete_dialog_ok": "Delete",
|
||||
"delete_dialog_title": "Delete Permanently",
|
||||
|
|
|
@ -15,7 +15,8 @@ class ControlBottomAppBar extends ConsumerWidget {
|
|||
final void Function() onShare;
|
||||
final void Function() onFavorite;
|
||||
final void Function() onArchive;
|
||||
final void Function(bool localOnly) onDelete;
|
||||
final void Function() onDelete;
|
||||
final void Function() onDeleteLocal;
|
||||
final Function(Album album) onAddToAlbum;
|
||||
final void Function() onCreateNewAlbum;
|
||||
final void Function() onUpload;
|
||||
|
@ -31,6 +32,7 @@ class ControlBottomAppBar extends ConsumerWidget {
|
|||
required this.onFavorite,
|
||||
required this.onArchive,
|
||||
required this.onDelete,
|
||||
required this.onDeleteLocal,
|
||||
required this.sharedAlbums,
|
||||
required this.albums,
|
||||
required this.onAddToAlbum,
|
||||
|
@ -80,12 +82,12 @@ class ControlBottomAppBar extends ConsumerWidget {
|
|||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return DeleteDialog(
|
||||
onDelete: () => onDelete(false),
|
||||
onDelete: onDelete,
|
||||
);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
onDelete(false);
|
||||
onDelete();
|
||||
}
|
||||
}
|
||||
: null,
|
||||
|
@ -103,7 +105,7 @@ class ControlBottomAppBar extends ConsumerWidget {
|
|||
builder: (BuildContext context) {
|
||||
return DeleteDialog(
|
||||
content: 'delete_dialog_alert_local',
|
||||
onDelete: () => onDelete(true),
|
||||
onDelete: onDeleteLocal,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
|
|
@ -166,16 +166,19 @@ class HomePage extends HookConsumerWidget {
|
|||
void onDeleteLocal() async {
|
||||
processing.value = true;
|
||||
try {
|
||||
final mergedIds = selection.value
|
||||
.where((a) => a.storage == AssetState.merged)
|
||||
.toList();
|
||||
|
||||
final isDeleted = await ref
|
||||
.read(assetProvider.notifier)
|
||||
.deleteLocalAssets(selection.value);
|
||||
.deleteLocalAssets(mergedIds);
|
||||
if (isDeleted) {
|
||||
final assetOrAssets =
|
||||
selection.value.length > 1 ? 'assets' : 'asset';
|
||||
final assetOrAssets = mergedIds.length > 1 ? 'assets' : 'asset';
|
||||
ImmichToast.show(
|
||||
context: context,
|
||||
msg:
|
||||
'${selection.value.length} $assetOrAssets deleted permanently from your device',
|
||||
'${mergedIds.length} $assetOrAssets removed permanently from your device',
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
);
|
||||
}
|
||||
|
@ -354,8 +357,8 @@ class HomePage extends HookConsumerWidget {
|
|||
onShare: onShareAssets,
|
||||
onFavorite: onFavoriteAssets,
|
||||
onArchive: onArchiveAsset,
|
||||
onDelete: (bool localOnly) =>
|
||||
localOnly ? onDeleteLocal() : onDelete(),
|
||||
onDelete: onDelete,
|
||||
onDeleteLocal: onDeleteLocal,
|
||||
onAddToAlbum: onAddToAlbum,
|
||||
albums: albums,
|
||||
sharedAlbums: sharedAlbums,
|
||||
|
|
Loading…
Reference in a new issue