High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
feat(mobile): prompt when deleting from trash (#26392)
Yarosa469d350be46
diff --git a/mobile/lib/presentation/widgets/action_buttons/delete_trash_action_button.widget.dart b/mobile/lib/presentation/widgets/action_buttons/delete_trash_action_button.widget.dartindex cb0e7091c8..0d9bc41734 100644--- a/mobile/lib/presentation/widgets/action_buttons/delete_trash_action_button.widget.dart+++ b/mobile/lib/presentation/widgets/action_buttons/delete_trash_action_button.widget.dart@@ -5,6 +5,7 @@ import 'package:immich_mobile/constants/enums.dart';import 'package:immich_mobile/extensions/translate_extensions.dart';import 'package:immich_mobile/providers/infrastructure/action.provider.dart';import 'package:immich_mobile/providers/timeline/multiselect.provider.dart';+import 'package:immich_mobile/widgets/asset_grid/trash_delete_dialog.dart';import 'package:immich_mobile/widgets/common/immich_toast.dart';/// This delete action has the following behavior:@@ -22,6 +23,18 @@ class DeleteTrashActionButton extends ConsumerWidget {return;}+ final selectCount = ref.watch(multiSelectProvider.select((s) => s.selectedAssets.length));++ final confirmDelete =+ await showDialog<bool>(+ context: context,+ builder: (context) => TrashDeleteDialog(count: selectCount),+ ) ??+ false;+ if (!confirmDelete) {+ return;+ }+final result = await ref.read(actionProvider.notifier).deleteRemoteAndLocal(source);ref.read(multiSelectProvider.notifier).reset();diff --git a/mobile/lib/widgets/asset_grid/trash_delete_dialog.dart b/mobile/lib/widgets/asset_grid/trash_delete_dialog.dartnew file mode 100644index 0000000000..2e0fae76a3--- /dev/null+++ b/mobile/lib/widgets/asset_grid/trash_delete_dialog.dart@@ -0,0 +1,47 @@+import 'package:flutter/material.dart';+import 'package:immich_mobile/extensions/build_context_extensions.dart';+import 'package:immich_mobile/generated/translations.g.dart';+import 'package:immich_ui/immich_ui.dart';++class TrashDeleteDialog extends StatelessWidget {+ const TrashDeleteDialog({super.key, required this.count});++ final int count;++ @override+ Widget build(BuildContext context) {+ return AlertDialog(+ shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(10))),+ title: Text(context.t.permanently_delete),+ content: ImmichHtmlText(context.t.permanently_delete_assets_prompt(count: count)),+ actions: [+ SizedBox(+ width: double.infinity,+ height: 48,+ child: FilledButton(+ onPressed: () => context.pop(false),+ style: FilledButton.styleFrom(+ backgroundColor: context.colorScheme.surfaceDim,+ foregroundColor: context.primaryColor,+ ),+ child: Text(context.t.cancel, style: const TextStyle(fontWeight: FontWeight.bold)),+ ),+ ),+ const SizedBox(height: 8),+ SizedBox(+ width: double.infinity,+ height: 48,++ child: FilledButton(+ onPressed: () => context.pop(true),+ style: FilledButton.styleFrom(+ backgroundColor: context.colorScheme.errorContainer,+ foregroundColor: context.colorScheme.onErrorContainer,+ ),+ child: Text(context.t.delete, style: const TextStyle(fontWeight: FontWeight.bold)),+ ),+ ),+ ],+ );+ }+}