Skip to content

armgit / ente

Public Imported from GitHub
0

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

feat: add login prompt and navigation to login page in email entry

AmanRajSinghMouryae5ebb20ee3f6
diff --git a/mobile/apps/photos/lib/l10n/intl_en.arb b/mobile/apps/photos/lib/l10n/intl_en.arb
index e986eae065..d88c6d43af 100644
--- a/mobile/apps/photos/lib/l10n/intl_en.arb
+++ b/mobile/apps/photos/lib/l10n/intl_en.arb
@@ -32,6 +32,7 @@
"entePhotosPerm": "Ente <i>needs permission to</i> preserve your photos",
"ok": "Ok",
"createAccount": "Create account",
+ "createAccountTitle": "Create an account",
"createNewAccount": "Create new account",
"password": "Password",
"confirmPassword": "Confirm password",
diff --git a/mobile/apps/photos/lib/ui/account/email_entry_page.dart b/mobile/apps/photos/lib/ui/account/email_entry_page.dart
index 0aa082eb94..5ca29f63ed 100644
--- a/mobile/apps/photos/lib/ui/account/email_entry_page.dart
+++ b/mobile/apps/photos/lib/ui/account/email_entry_page.dart
@@ -9,6 +9,7 @@ import 'package:photos/services/account/user_service.dart';
import "package:photos/theme/colors.dart";
import "package:photos/theme/ente_theme.dart";
import "package:photos/theme/text_style.dart";
+import "package:photos/ui/account/login_page.dart";
import 'package:photos/ui/common/web_page.dart';
import "package:photos/ui/components/buttons/button_widget_v2.dart";
import "package:photos/ui/components/models/text_input_type_v2.dart";
@@ -73,6 +74,7 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
Widget build(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
+ final isKeyboardOpen = MediaQuery.of(context).viewInsets.bottom > 0;
return Scaffold(
resizeToAvoidBottomInset: true,
backgroundColor: colorScheme.backgroundColour,
@@ -88,7 +90,7 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
},
),
title: Text(
- AppLocalizations.of(context).createAccount,
+ AppLocalizations.of(context).createAccountTitle,
style: textTheme.largeBold,
),
centerTitle: true,
@@ -99,7 +101,7 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
child: ButtonWidgetV2(
key: const ValueKey("createAccountButton"),
buttonType: ButtonTypeV2.primary,
- labelText: AppLocalizations.of(context).createAccount,
+ labelText: AppLocalizations.of(context).createAccountTitle,
isDisabled: !_isFormValid(),
onTap: _isFormValid()
? () async {
@@ -117,6 +119,8 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
: null,
),
),
+ bottomNavigationBar:
+ isKeyboardOpen ? null : _getLoginPrompt(colorScheme, textTheme),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
);
}
@@ -257,6 +261,34 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
);
}
+ Widget _getLoginPrompt(
+ EnteColorScheme colorScheme,
+ EnteTextTheme textTheme,
+ ) {
+ return SafeArea(
+ top: false,
+ child: Padding(
+ padding: const EdgeInsets.only(bottom: 8),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ Text(
+ AppLocalizations.of(context).alreadyHaveAnAccount,
+ style: textTheme.bodyMuted,
+ ),
+ ButtonWidgetV2(
+ buttonType: ButtonTypeV2.link,
+ labelText: AppLocalizations.of(context).logInLabel,
+ buttonSize: ButtonSizeV2.small,
+ shouldSurfaceExecutionStates: false,
+ onTap: _goToLoginPage,
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+
void _onEmailChanged(String value) {
_emailValidationTimer?.cancel();
@@ -366,4 +398,13 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
_hasAgreedToTOS &&
_passwordIsValid;
}
+
+ Future<void> _goToLoginPage() async {
+ FocusScope.of(context).unfocus();
+ await Navigator.of(context).push(
+ MaterialPageRoute(
+ builder: (_) => const LoginPage(),
+ ),
+ );
+ }
}