π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Add error handling for map enable failures
anandbaburajan26c1e716111e
diff --git a/mobile/apps/photos/lib/ui/settings/advanced_settings_screen.dart b/mobile/apps/photos/lib/ui/settings/advanced_settings_screen.dartindex bf5df948d8..2b53680867 100644--- a/mobile/apps/photos/lib/ui/settings/advanced_settings_screen.dart+++ b/mobile/apps/photos/lib/ui/settings/advanced_settings_screen.dart@@ -10,6 +10,7 @@ import 'package:photos/ui/components/menu_section_description_widget.dart';import 'package:photos/ui/components/title_bar_title_widget.dart';import 'package:photos/ui/components/title_bar_widget.dart';import "package:photos/ui/components/toggle_switch_widget.dart";+import 'package:photos/ui/notification/toast.dart';import "package:photos/ui/settings/app_icon_selection_screen.dart";import "package:photos/ui/settings/ml/machine_learning_settings_page.dart";import "package:photos/ui/settings/streaming/video_streaming_settings_page.dart";@@ -104,7 +105,15 @@ class AdvancedSettingsScreen extends StatelessWidget {value: () => flagService.mapEnabled,onChanged: () async {final isEnabled = flagService.mapEnabled;- await flagService.setMapEnabled(!isEnabled);+ try {+ await flagService.setMapEnabled(!isEnabled);+ } catch (e) {+ showShortToast(+ context,+ AppLocalizations.of(context).somethingWentWrong,+ );+ rethrow;+ }},),),diff --git a/mobile/apps/photos/lib/ui/viewer/file_details/location_tags_widget.dart b/mobile/apps/photos/lib/ui/viewer/file_details/location_tags_widget.dartindex 574aa11d04..bea345816d 100644--- a/mobile/apps/photos/lib/ui/viewer/file_details/location_tags_widget.dart+++ b/mobile/apps/photos/lib/ui/viewer/file_details/location_tags_widget.dart@@ -19,6 +19,7 @@ import "package:photos/ui/map/image_marker.dart";import "package:photos/ui/map/map_screen.dart";import "package:photos/ui/map/map_view.dart";import "package:photos/ui/map/tile/layers.dart";+import 'package:photos/ui/notification/toast.dart';import 'package:photos/ui/viewer/location/add_location_sheet.dart';import "package:photos/ui/viewer/location/location_screen.dart";import "package:photos/utils/navigation_util.dart";@@ -298,10 +299,18 @@ class _InfoMapState extends State<InfoMap> {GestureDetector(behavior: HitTestBehavior.opaque,onTap: () async {- await flagService.setMapEnabled(true);- setState(() {- _hasEnabledMap = true;- });+ try {+ await flagService.setMapEnabled(true);+ setState(() {+ _hasEnabledMap = true;+ });+ } catch (e) {+ showShortToast(+ context,+ AppLocalizations.of(context)+ .somethingWentWrong,+ );+ }},child: Center(child: Text(diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dartindex 2c726deed8..aecbf4ab3f 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart@@ -788,7 +788,13 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {Future<void> showOnMap() async {if (!flagService.mapEnabled) {- await flagService.setMapEnabled(true);+ try {+ await flagService.setMapEnabled(true);+ } catch (e) {+ showShortToast(+ context, AppLocalizations.of(context).somethingWentWrong,);+ return;+ }}unawaited(Navigator.of(context).push(diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/go_to_map_widget.dart b/mobile/apps/photos/lib/ui/viewer/search/result/go_to_map_widget.dartindex 3a05755ac0..a09a4901d5 100644--- a/mobile/apps/photos/lib/ui/viewer/search/result/go_to_map_widget.dart+++ b/mobile/apps/photos/lib/ui/viewer/search/result/go_to_map_widget.dart@@ -4,6 +4,7 @@ import "package:photos/service_locator.dart";import "package:photos/services/search_service.dart";import "package:photos/theme/ente_theme.dart";import "package:photos/ui/map/map_screen.dart";+import 'package:photos/ui/notification/toast.dart';//Used for empty state of location sectionclass GoToMap extends StatelessWidget {@@ -14,7 +15,15 @@ class GoToMap extends StatelessWidget {return GestureDetector(onTap: () async {if (!flagService.mapEnabled) {- await flagService.setMapEnabled(true);+ try {+ await flagService.setMapEnabled(true);+ } catch (e) {+ showShortToast(+ context,+ AppLocalizations.of(context).somethingWentWrong,+ );+ return;+ }}// ignore: unawaited_futuresNavigator.of(context).push(diff --git a/mobile/apps/photos/lib/ui/viewer/search_tab/locations_section.dart b/mobile/apps/photos/lib/ui/viewer/search_tab/locations_section.dartindex ddcd3e8f42..1f8db52ba2 100644--- a/mobile/apps/photos/lib/ui/viewer/search_tab/locations_section.dart+++ b/mobile/apps/photos/lib/ui/viewer/search_tab/locations_section.dart@@ -16,6 +16,7 @@ import "package:photos/services/search_service.dart";import "package:photos/theme/colors.dart";import "package:photos/theme/ente_theme.dart";import "package:photos/ui/map/map_screen.dart";+import 'package:photos/ui/notification/toast.dart';import "package:photos/ui/viewer/file/no_thumbnail_widget.dart";import "package:photos/ui/viewer/file/thumbnail_widget.dart";import "package:photos/ui/viewer/search/result/go_to_map_widget.dart";@@ -380,7 +381,15 @@ class GoToMapWithBG extends StatelessWidget {child: GestureDetector(onTap: () async {if (!flagService.mapEnabled) {- await flagService.setMapEnabled(true);+ try {+ await flagService.setMapEnabled(true);+ } catch (e) {+ showShortToast(+ context,+ AppLocalizations.of(context).somethingWentWrong,+ );+ return;+ }}// ignore: unawaited_futuresNavigator.of(context).push(