Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@
"default_locale": "Default Locale",
"default_locale_description": "Format dates and numbers based on your browser locale",
"delete": "Delete",
"delete_action_confirmation_message": "Are you sure you want to delete this asset? This action will move the asset to the server's trash and will prompt if you want to delete it locally",
"delete_action_confirmation_message": "This will move the item to Trash and remove any local copies from your device.",
"delete_action_prompt": "{count} deleted",
"delete_album": "Delete album",
"delete_api_key_prompt": "Are you sure you want to delete this API key?",
Expand All @@ -867,6 +867,7 @@
"delete_local_dialog_ok_force": "Delete Anyway",
"delete_others": "Delete others",
"delete_permanently": "Delete permanently",
"delete_permanently_action_confirmation_message": "Are you sure you want to permanently delete this asset? This action cannot be undone.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not permanently_delete_assets_prompt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad.

Copy link
Contributor Author

@ByteSizedMarius ByteSizedMarius Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

permanently_delete_assets_prompt contains <b> for multiple assets, which is not rendered in flutter dialogs. How should this be handled? Has this usecase happened before?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pass the total number of assets as the count and the translation will be resolved accordingly to the singular or multiple variant

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I didnt put <b> in inline code. What I was trying to communicate is, that the strings contain html that I do not see the mobile app currently being able to resolve or render. I understood how the singular/plural string resolving works.

"delete_permanently_action_prompt": "{count} deleted permanently",
"delete_shared_link": "Delete shared link",
"delete_shared_link_dialog_title": "Delete Shared Link",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class DeleteActionButton extends ConsumerWidget {
const DeleteActionButton({
super.key,
required this.source,
this.showConfirmation = false,
this.showConfirmation = true,
this.iconOnly = false,
this.menuItem = false,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/constants/enums.dart';
import 'package:immich_mobile/domain/models/events.model.dart';
import 'package:immich_mobile/domain/utils/event_stream.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/extensions/translate_extensions.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/base_action_button.widget.dart';
import 'package:immich_mobile/providers/infrastructure/action.provider.dart';
Expand All @@ -15,16 +16,49 @@ import 'package:immich_mobile/widgets/common/immich_toast.dart';
/// - Prompt to delete the asset locally
class DeletePermanentActionButton extends ConsumerWidget {
final ActionSource source;
final bool showConfirmation;
final bool iconOnly;
final bool menuItem;

const DeletePermanentActionButton({super.key, required this.source, this.iconOnly = false, this.menuItem = false});
const DeletePermanentActionButton({
super.key,
required this.source,
this.showConfirmation = true,
this.iconOnly = false,
this.menuItem = false,
});

void _onTap(BuildContext context, WidgetRef ref) async {
if (!context.mounted) {
return;
}

if (showConfirmation) {
final confirm = await showDialog<bool>(
context: context,
builder: (context) => AlertDialog(
title: Text('delete_permanently'.t(context: context)),
content: Text(
'delete_permanently_action_confirmation_message'.t(context: context),
),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(false),
child: Text('cancel'.t(context: context)),
),
TextButton(
onPressed: () => Navigator.of(context).pop(true),
child: Text(
'confirm'.t(context: context),
style: TextStyle(color: context.colorScheme.error),
),
),
],
),
);
if (confirm != true) return;
}

final result = await ref.read(actionProvider.notifier).deleteRemoteAndLocal(source);
ref.read(multiSelectProvider.notifier).reset();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ViewerBottomBar extends ConsumerWidget {
if (isOwner) ...[
asset.isLocalOnly
? const DeleteLocalActionButton(source: ActionSource.viewer)
: const DeleteActionButton(source: ActionSource.viewer, showConfirmation: true),
: const DeleteActionButton(source: ActionSource.viewer),
],
],
];
Expand Down
Loading