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