Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Show toast on failure

laurenspriem5670631db151
diff --git a/mobile/apps/photos/lib/ui/viewer/actions/people_selection_action_widget.dart b/mobile/apps/photos/lib/ui/viewer/actions/people_selection_action_widget.dart
index 5415ea33b7..3442c1590d 100644
--- a/mobile/apps/photos/lib/ui/viewer/actions/people_selection_action_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/actions/people_selection_action_widget.dart
@@ -65,9 +65,9 @@ class _PeopleSelectionActionWidgetState
.toList();
}
- List<String> _getSelectedClusterIds(Map<String, PersonEntity> personMap) {
+ List<String> _getSelectedClusterIds() {
return widget.selectedPeople.personIds
- .where((id) => id.startsWith('cluster_') || !personMap.containsKey(id))
+ .where((id) => id.startsWith('cluster_'))
.toList();
}
@@ -101,7 +101,7 @@ class _PeopleSelectionActionWidgetState
final personMap = snapshot.data!;
final List<SelectionActionButton> items = [];
final selectedPersonIds = _getSelectedPersonIds(personMap);
- final selectedClusterIds = _getSelectedClusterIds(personMap);
+ final selectedClusterIds = _getSelectedClusterIds();
final onlyOnePerson =
selectedPersonIds.length == 1 && selectedClusterIds.isEmpty;
final onlyPersonSelected =
@@ -418,7 +418,7 @@ class _PeopleSelectionActionWidgetState
Future<void> _onIgnore() async {
final personMap = await personEntitiesMapFuture;
final selectedPersonIds = _getSelectedPersonIds(personMap);
- final selectedClusterIds = _getSelectedClusterIds(personMap);
+ final selectedClusterIds = _getSelectedClusterIds();
if (selectedPersonIds.isEmpty && selectedClusterIds.isEmpty) return;
final multiple = (selectedPersonIds.length + selectedClusterIds.length) > 1;
@@ -574,7 +574,7 @@ class _PeopleSelectionActionWidgetState
Future<void> _onMerge() async {
final personMap = await personEntitiesMapFuture;
final selectedPersonIds = _getSelectedPersonIds(personMap);
- final selectedClusterIds = _getSelectedClusterIds(personMap);
+ final selectedClusterIds = _getSelectedClusterIds();
if (selectedClusterIds.isEmpty) return;
if (!mounted) return;
diff --git a/mobile/apps/photos/lib/ui/viewer/people/people_app_bar.dart b/mobile/apps/photos/lib/ui/viewer/people/people_app_bar.dart
index 8b92859964..c6659d1db7 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/people_app_bar.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/people_app_bar.dart
@@ -17,6 +17,8 @@ import 'package:photos/services/collections_service.dart';
import "package:photos/services/machine_learning/face_ml/person/person_service.dart";
import "package:photos/theme/ente_theme.dart";
import 'package:photos/ui/actions/collection/collection_sharing_actions.dart';
+import "package:photos/ui/components/buttons/button_widget.dart";
+import "package:photos/ui/notification/toast.dart";
import "package:photos/ui/viewer/gallery/hooks/pick_person_avatar.dart";
import "package:photos/ui/viewer/gallery/state/inherited_search_filter_data.dart";
import "package:photos/ui/viewer/hierarchicial_search/applied_filters_for_appbar.dart";
@@ -566,7 +568,7 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
}
Future<void> _ignorePerson(BuildContext context) async {
- await showChoiceDialog(
+ final result = await showChoiceDialog(
context,
title: AppLocalizations.of(context).areYouSureYouWantToIgnoreThisPerson,
body: AppLocalizations.of(context).thePersonWillNotBeDisplayed,
@@ -587,12 +589,19 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
person: updatedPerson,
),
);
- Navigator.of(context).pop();
} catch (e, s) {
_logger.severe('Ignoring/showing person failed', e, s);
+ rethrow;
}
},
);
+ if (!mounted || result?.action != ButtonAction.error) {
+ return;
+ }
+ showShortToast(
+ context,
+ AppLocalizations.of(context).somethingWentWrongPleaseTryAgain,
+ );
}
Future<void> _showPerson(BuildContext context) async {