diff --git a/lib/locale/l10n/app_de.arb b/lib/locale/l10n/app_de.arb index 9717615..fb63158 100644 --- a/lib/locale/l10n/app_de.arb +++ b/lib/locale/l10n/app_de.arb @@ -6,6 +6,7 @@ "generalContinueButtonLabel": "Weiter", "generalUnderstoodButtonLabel": "OK", "generalLoadingLabel": "Wird geladen...", + "generalSwipeForMore": "Wische hoch für mehr", "welcomeScreenDescription": "Finde heraus was du den ganzen Tag gemacht hast und erlebe Erinnerungen wieder, die du komplett vergessen hast!", "welcomeScreenSubtitle": "Was hab ich heute gemacht?", @@ -41,6 +42,9 @@ "loginScreenFormPasswordLabel": "Passwort", "loginScreenFormSubmitButton": "Anmelden", "loginScreenLoginFailed": "E-Mail oder Passwort inkorrekt", + "loginScreenSignUpDialogTitle": "Registrieren", + "loginScreenSignUpDialogExplanation": "Wir haben deinen Account nicht gefunden. Möchtest du dich jetzt registrieren?", + "loginScreenSignUpDialogAffirmationLabel": "Jetzt registrieren", "grantPermissionScreenTitle": "Berechtigungen erteilen", @@ -71,7 +75,6 @@ "memoryMapScreenTitle": "Standort", - "memoryMapScreenExpandForMoreDescription": "Erweitere für mehr Details", "memoryMapScreenOpenNavigation": "Navigation öffnen", "memoryMapScreenValuesAddressLabel": "Geschätzte Adresse", "memoryMapScreenValuesAddressIsUnavailable": "Address nicht verfügbar", diff --git a/lib/locale/l10n/app_en.arb b/lib/locale/l10n/app_en.arb index 7864e7a..0620154 100644 --- a/lib/locale/l10n/app_en.arb +++ b/lib/locale/l10n/app_en.arb @@ -7,6 +7,7 @@ "generalSaveButtonLabel": "Save", "generalUnderstoodButtonLabel": "OK", "generalLoadingLabel": "Loading...", + "generalSwipeForMore": "Swipe up for more", "welcomeScreenDescription": "Find out what you did all the days and unlock moments you completely forgot!", "welcomeScreenSubtitle": "What did I do today?", @@ -66,6 +67,9 @@ "loginScreenFormPasswordLabel": "Password", "loginScreenFormSubmitButton": "Login", "loginScreenLoginFailed": "Email or password incorrect", + "loginScreenSignUpDialogTitle": "Sign up", + "loginScreenSignUpDialogExplanation": "We didn't find your account. Do you want to sign up now?", + "loginScreenSignUpDialogAffirmationLabel": "Sign me up now", "grantPermissionScreenTitle": "Grant Permissions", @@ -105,7 +109,6 @@ "memoryMapScreenTitle": "Location", - "memoryMapScreenExpandForMoreDescription": "Expand for more details", "memoryMapScreenOpenNavigation": "Open Navigation", "memoryMapScreenValuesAddressLabel": "Estimated Address", "memoryMapScreenValuesAddressIsUnavailable": "Address not available", diff --git a/lib/screens/login_screen.dart b/lib/screens/login_screen.dart index e22f3c1..fd9fe6d 100644 --- a/lib/screens/login_screen.dart +++ b/lib/screens/login_screen.dart @@ -72,23 +72,47 @@ class _LoginScreenState extends AuthState with Loadable { } } + Future _askWhetherToSignUp() { + final localizations = AppLocalizations.of(context)!; + + return showPlatformDialog( + context: context, + builder: (_) => PlatformAlertDialog( + title: Text(localizations.loginScreenSignUpDialogTitle), + content: Text(localizations.loginScreenSignUpDialogExplanation), + actions: [ + PlatformDialogAction( + child: Text(localizations.generalCancelButtonLabel), + onPressed: () => Navigator.pop(context, false), + ), + PlatformDialogAction( + child: Text(localizations.loginScreenSignUpDialogAffirmationLabel), + onPressed: () => Navigator.pop(context, true), + ), + ], + ), + ) as Future; + } + Future signIn() async { final localizations = AppLocalizations.of(context)!; try { await _signIn(); } catch (error) { - try { - await _signUp(); - } catch (error) { - if (mounted) { - context.showLongErrorSnackBar( - message: localizations.loginScreenLoginFailed, - ); + if (await _askWhetherToSignUp()) { + try { + await _signUp(); + } catch (error) { + if (mounted) { + context.showLongErrorSnackBar( + message: localizations.loginScreenLoginFailed, + ); - passwordController.clear(); + passwordController.clear(); + } + return; } - return; } } diff --git a/lib/screens/main_screen.dart b/lib/screens/main_screen.dart index c6508bc..7185ad3 100644 --- a/lib/screens/main_screen.dart +++ b/lib/screens/main_screen.dart @@ -158,7 +158,10 @@ class _MainScreenState extends AuthRequiredState with Loadable { settings.resolution, imageFormatGroup: ImageFormatGroup.jpeg, ); - cameraController.setFlashMode(FlashMode.off); + + try { + cameraController.setFlashMode(FlashMode.off); + } catch (error) {} await previousCameraController?.dispose(); diff --git a/lib/screens/memory_map_screen.dart b/lib/screens/memory_map_screen.dart index a8e352f..614091c 100644 --- a/lib/screens/memory_map_screen.dart +++ b/lib/screens/memory_map_screen.dart @@ -98,7 +98,7 @@ class _MemoryMapScreenState extends State with Loadable { const SheetIndicator(), const SizedBox(height: MEDIUM_SPACE), Text( - localizations.memoryMapScreenExpandForMoreDescription, + localizations.generalSwipeForMore, style: getBodyTextTextStyle(context), ), ], diff --git a/lib/screens/timeline_screen/memory_sheet.dart b/lib/screens/timeline_screen/memory_sheet.dart index 66f028a..437c7a1 100644 --- a/lib/screens/timeline_screen/memory_sheet.dart +++ b/lib/screens/timeline_screen/memory_sheet.dart @@ -237,6 +237,13 @@ class _MemorySheetState extends State with Loadable { ), ], ), + if (widget.memory.location != null) ...[ + const SizedBox(height: SMALL_SPACE), + Text( + localizations.generalSwipeForMore, + style: getBodyTextTextStyle(context), + ), + ], ], ), ), diff --git a/lib/screens/welcome_screen/photo_switching.dart b/lib/screens/welcome_screen/photo_switching.dart index 1459b25..e7d3b17 100644 --- a/lib/screens/welcome_screen/photo_switching.dart +++ b/lib/screens/welcome_screen/photo_switching.dart @@ -67,9 +67,7 @@ class _PhotoSwitchingState extends State { final nextImage = NetworkImage(nextPhotoURL); precacheImage(nextImage, context); - setState(() { - images.add(nextImage); - }); + images.add(nextImage); } Future getNextPhoto() async { diff --git a/lib/widgets/help_sheet.dart b/lib/widgets/help_sheet.dart index cf8165d..e4cc2d2 100644 --- a/lib/widgets/help_sheet.dart +++ b/lib/widgets/help_sheet.dart @@ -108,7 +108,7 @@ class _HelpSheetState extends State { }); } - if (dontShowSheetAgain) { + if (dontShowSheetAgain == true) { await UserHelpSheetsManager.setAsShown(widget.helpID); } }); diff --git a/lib/widgets/help_sheet/help_sheet_form.dart b/lib/widgets/help_sheet/help_sheet_form.dart index b0cb004..3c4e817 100644 --- a/lib/widgets/help_sheet/help_sheet_form.dart +++ b/lib/widgets/help_sheet/help_sheet_form.dart @@ -27,47 +27,45 @@ class _HelpSheetFormState extends State { final localizations = AppLocalizations.of(context)!; return ModalSheet( - child: SingleChildScrollView( - child: Column( - children: [ - Text( - widget.title, - textAlign: TextAlign.center, - style: getTitleTextStyle(context), - ), - const SizedBox(height: MEDIUM_SPACE), - widget.helpContent, - const SizedBox(height: LARGE_SPACE), - PlatformElevatedButton( - child: Text(localizations.generalUnderstoodButtonLabel), - onPressed: () => Navigator.pop(context, dontShowSheetAgain), - ), - const SizedBox(height: SMALL_SPACE), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - PlatformSwitch( - value: dontShowSheetAgain, - activeColor: platformThemeData( - context, - material: (data) => data.colorScheme.primary, - cupertino: (data) => data.primaryColor, - ), - onChanged: (value) { - setState(() { - dontShowSheetAgain = value; - }); - }, + child: Column( + children: [ + Text( + widget.title, + textAlign: TextAlign.center, + style: getTitleTextStyle(context), + ), + const SizedBox(height: MEDIUM_SPACE), + widget.helpContent, + const SizedBox(height: LARGE_SPACE), + PlatformElevatedButton( + child: Text(localizations.generalUnderstoodButtonLabel), + onPressed: () => Navigator.pop(context, dontShowSheetAgain), + ), + const SizedBox(height: SMALL_SPACE), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + PlatformSwitch( + value: dontShowSheetAgain, + activeColor: platformThemeData( + context, + material: (data) => data.colorScheme.primary, + cupertino: (data) => data.primaryColor, ), - const SizedBox(width: SMALL_SPACE), - Text( - localizations.helpSheetDontShowAgain, - style: getBodyTextTextStyle(context), - ) - ], - ), - ], - ), + onChanged: (value) { + setState(() { + dontShowSheetAgain = value; + }); + }, + ), + const SizedBox(width: SMALL_SPACE), + Text( + localizations.helpSheetDontShowAgain, + style: getBodyTextTextStyle(context), + ) + ], + ), + ], ), ); } diff --git a/lib/widgets/modal_sheet.dart b/lib/widgets/modal_sheet.dart index 8a9d03f..76270ff 100644 --- a/lib/widgets/modal_sheet.dart +++ b/lib/widgets/modal_sheet.dart @@ -14,38 +14,36 @@ class ModalSheet extends StatelessWidget { @override Widget build(BuildContext context) { - final innerChild = Padding( - padding: const EdgeInsets.symmetric(horizontal: MEDIUM_SPACE), - child: child, - ); - - return Column( - mainAxisSize: MainAxisSize.min, - children: [ - PlatformWidget( - material: (_, __) => Container( - decoration: BoxDecoration( - borderRadius: const BorderRadius.only( - topLeft: Radius.circular(LARGE_SPACE), - topRight: Radius.circular(LARGE_SPACE), + return SingleChildScrollView( + padding: const EdgeInsets.symmetric(vertical: MEDIUM_SPACE), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + PlatformWidget( + material: (_, __) => Container( + decoration: BoxDecoration( + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(LARGE_SPACE), + topRight: Radius.circular(LARGE_SPACE), + ), + color: getSheetColor(context), ), - color: getSheetColor(context), + padding: const EdgeInsets.symmetric(vertical: LARGE_SPACE), + child: child, ), - padding: const EdgeInsets.symmetric(vertical: LARGE_SPACE), - child: innerChild, - ), - cupertino: (_, __) => CupertinoPopupSurface( - isSurfacePainted: false, - child: Container( - color: Colors.white, - child: Padding( - padding: const EdgeInsets.symmetric(vertical: LARGE_SPACE), - child: innerChild, + cupertino: (_, __) => CupertinoPopupSurface( + isSurfacePainted: false, + child: Container( + color: Colors.white, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: LARGE_SPACE), + child: child, + ), ), ), - ), - ) - ], + ) + ], + ), ); } }