Skip to content

armgit / ente

Public Imported from GitHub
0

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

update referal to offline mode redirects

AmanRajSinghMourya900079a554ac
diff --git a/mobile/apps/photos/lib/l10n/intl_en.arb b/mobile/apps/photos/lib/l10n/intl_en.arb
index 30c8fd35b9..710d390258 100644
--- a/mobile/apps/photos/lib/l10n/intl_en.arb
+++ b/mobile/apps/photos/lib/l10n/intl_en.arb
@@ -2813,6 +2813,7 @@
"offlineSettingsBannerTitle": "We can't see your photos. Ever.",
"offlineSettingsBannerDesc": "Zero-knowledge encryption means your memories stay yours.",
"alreadyHaveAnAccount": "Already have an account?",
+ "dontHaveAnAccount": "Don't have an account?",
"loginToEnte": "Login to Ente",
"searchAndDiscover": "Search and Discover",
"searchAndDiscoverDesc": "Search photos and discover memories with on-device machine learning",
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 5ca29f63ed..8223be9939 100644
--- a/mobile/apps/photos/lib/ui/account/email_entry_page.dart
+++ b/mobile/apps/photos/lib/ui/account/email_entry_page.dart
@@ -17,7 +17,14 @@ import "package:photos/ui/components/text_input_widget_v2.dart";
import "package:styled_text/styled_text.dart";
class EmailEntryPage extends StatefulWidget {
- const EmailEntryPage({super.key});
+ const EmailEntryPage({
+ super.key,
+ this.showReferralSourceField = true,
+ this.referralSource,
+ });
+
+ final bool showReferralSourceField;
+ final String? referralSource;
@override
State<EmailEntryPage> createState() => _EmailEntryPageState();
@@ -51,6 +58,7 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
@override
void initState() {
super.initState();
+ _referralSource = widget.referralSource?.trim() ?? '';
final storedEmail = _config.getEmail();
if (storedEmail != null && storedEmail.isNotEmpty) {
_email = storedEmail;
@@ -245,14 +253,16 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
);
},
),
- const SizedBox(height: 24),
- TextInputWidgetV2(
- label: AppLocalizations.of(context).hearUsWhereTitle,
- autoCorrect: false,
- onChange: (value) {
- _referralSource = value.trim();
- },
- ),
+ if (widget.showReferralSourceField) ...[
+ const SizedBox(height: 24),
+ TextInputWidgetV2(
+ label: AppLocalizations.of(context).hearUsWhereTitle,
+ autoCorrect: false,
+ onChange: (value) {
+ _referralSource = value.trim();
+ },
+ ),
+ ],
const SizedBox(height: 16),
_getTOSAgreement(colorScheme, textTheme),
const SizedBox(height: 80),
diff --git a/mobile/apps/photos/lib/ui/account/login_page.dart b/mobile/apps/photos/lib/ui/account/login_page.dart
index 15fa562547..83951d351f 100644
--- a/mobile/apps/photos/lib/ui/account/login_page.dart
+++ b/mobile/apps/photos/lib/ui/account/login_page.dart
@@ -12,6 +12,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/email_entry_page.dart";
import "package:photos/ui/account/login_pwd_verification_page.dart";
import "package:photos/ui/components/buttons/button_widget_v2.dart";
import "package:photos/ui/components/models/text_input_type_v2.dart";
@@ -61,6 +62,7 @@ class _LoginPageState extends State<LoginPage> {
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,
@@ -76,7 +78,7 @@ class _LoginPageState extends State<LoginPage> {
},
),
title: Text(
- AppLocalizations.of(context).logInLabel,
+ AppLocalizations.of(context).loginToEnte,
style: textTheme.largeBold,
),
centerTitle: true,
@@ -92,6 +94,8 @@ class _LoginPageState extends State<LoginPage> {
onTap: _emailIsValid ? _onLoginPressed : null,
),
),
+ bottomNavigationBar:
+ isKeyboardOpen ? null : _getSignUpPrompt(colorScheme, textTheme),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
);
}
@@ -127,6 +131,34 @@ class _LoginPageState extends State<LoginPage> {
);
}
+ Widget _getSignUpPrompt(
+ EnteColorScheme colorScheme,
+ EnteTextTheme textTheme,
+ ) {
+ return SafeArea(
+ top: false,
+ child: Padding(
+ padding: const EdgeInsets.only(bottom: 8),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ Text(
+ "Don't have an account?",
+ style: textTheme.bodyMuted,
+ ),
+ ButtonWidgetV2(
+ buttonType: ButtonTypeV2.link,
+ labelText: AppLocalizations.of(context).signUp,
+ buttonSize: ButtonSizeV2.small,
+ shouldSurfaceExecutionStates: false,
+ onTap: _goToSignUpPage,
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+
void _onEmailChanged(String value) {
_validationTimer?.cancel();
@@ -184,4 +216,13 @@ class _LoginPageState extends State<LoginPage> {
}
FocusScope.of(context).unfocus();
}
+
+ Future<void> _goToSignUpPage() async {
+ FocusScope.of(context).unfocus();
+ await Navigator.of(context).push(
+ MaterialPageRoute(
+ builder: (_) => const EmailEntryPage(),
+ ),
+ );
+ }
}
diff --git a/mobile/apps/photos/lib/ui/components/banners/get_started_banner.dart b/mobile/apps/photos/lib/ui/components/banners/get_started_banner.dart
index 770f027fb0..6d01e29960 100644
--- a/mobile/apps/photos/lib/ui/components/banners/get_started_banner.dart
+++ b/mobile/apps/photos/lib/ui/components/banners/get_started_banner.dart
@@ -138,7 +138,10 @@ class _GetStartedBannerState extends State<GetStartedBanner> {
Future<void> _onGetStarted() async {
await Navigator.of(context).push(
MaterialPageRoute(
- builder: (_) => const EmailEntryPage(),
+ builder: (_) => const EmailEntryPage(
+ showReferralSourceField: false,
+ referralSource: "Offline",
+ ),
),
);
}
diff --git a/mobile/apps/photos/lib/ui/components/banners/name_face_banner.dart b/mobile/apps/photos/lib/ui/components/banners/name_face_banner.dart
index b022627353..1f83f93982 100644
--- a/mobile/apps/photos/lib/ui/components/banners/name_face_banner.dart
+++ b/mobile/apps/photos/lib/ui/components/banners/name_face_banner.dart
@@ -8,8 +8,8 @@ import "package:photos/events/app_mode_changed_event.dart";
import "package:photos/generated/intl/app_localizations.dart";
import "package:photos/service_locator.dart";
import "package:photos/theme/ente_theme.dart";
+import "package:photos/ui/account/email_entry_page.dart";
import "package:photos/ui/components/banners/banner_action_button.dart";
-import "package:photos/ui/home/landing_page_widget.dart";
class NameFaceBanner extends StatefulWidget {
const NameFaceBanner({super.key});
@@ -119,7 +119,10 @@ class _NameFaceBannerState extends State<NameFaceBanner> {
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
- builder: (_) => const LandingPageWidget(),
+ builder: (_) => const EmailEntryPage(
+ showReferralSourceField: false,
+ referralSource: "Offline",
+ ),
),
);
},
diff --git a/mobile/apps/photos/lib/ui/components/banners/save_faces_banner.dart b/mobile/apps/photos/lib/ui/components/banners/save_faces_banner.dart
index 07145034dc..b3db5a84f5 100644
--- a/mobile/apps/photos/lib/ui/components/banners/save_faces_banner.dart
+++ b/mobile/apps/photos/lib/ui/components/banners/save_faces_banner.dart
@@ -119,7 +119,10 @@ class _SaveFacesBannerState extends State<SaveFacesBanner> {
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
- builder: (_) => const EmailEntryPage(),
+ builder: (_) => const EmailEntryPage(
+ showReferralSourceField: false,
+ referralSource: "Offline",
+ ),
),
);
},
diff --git a/mobile/apps/photos/lib/ui/components/banners/shared_empty_offline_state_widget.dart b/mobile/apps/photos/lib/ui/components/banners/shared_empty_offline_state_widget.dart
index edd736d3ec..55f1da1739 100644
--- a/mobile/apps/photos/lib/ui/components/banners/shared_empty_offline_state_widget.dart
+++ b/mobile/apps/photos/lib/ui/components/banners/shared_empty_offline_state_widget.dart
@@ -52,7 +52,10 @@ class SharedEmptyOfflineStateWidget extends StatelessWidget {
onTap: () async {
await Navigator.of(context).push(
MaterialPageRoute(
- builder: (_) => const EmailEntryPage(),
+ builder: (_) => const EmailEntryPage(
+ showReferralSourceField: false,
+ referralSource: "Offline",
+ ),
),
);
},
diff --git a/mobile/apps/photos/lib/ui/offline/empty/on_ente_empty_state.dart b/mobile/apps/photos/lib/ui/offline/empty/on_ente_empty_state.dart
index 9d1799ef07..2d26f1115a 100644
--- a/mobile/apps/photos/lib/ui/offline/empty/on_ente_empty_state.dart
+++ b/mobile/apps/photos/lib/ui/offline/empty/on_ente_empty_state.dart
@@ -63,7 +63,10 @@ class EmptyOnEnteSection extends StatelessWidget {
onTap: () async {
await Navigator.of(context).push(
MaterialPageRoute(
- builder: (_) => const EmailEntryPage(),
+ builder: (_) => const EmailEntryPage(
+ showReferralSourceField: false,
+ referralSource: "Offline",
+ ),
),
);
},
diff --git a/mobile/apps/photos/lib/ui/settings_page.dart b/mobile/apps/photos/lib/ui/settings_page.dart
index 5de2697c24..e73f9f4384 100644
--- a/mobile/apps/photos/lib/ui/settings_page.dart
+++ b/mobile/apps/photos/lib/ui/settings_page.dart
@@ -12,6 +12,7 @@ import "package:photos/services/local_authentication_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/email_entry_page.dart";
import "package:photos/ui/account/login_page.dart";
import "package:photos/ui/components/banners/offline_settings_banner.dart";
import "package:photos/ui/components/menu_item_widget/menu_item_widget_new.dart";
@@ -19,7 +20,6 @@ import "package:photos/ui/components/settings/settings_grouped_card.dart";
import "package:photos/ui/components/settings/social_icons_row.dart";
import "package:photos/ui/components/toggle_switch_widget.dart";
import "package:photos/ui/growth/referral_screen.dart";
-import "package:photos/ui/home/landing_page_widget.dart";
import "package:photos/ui/notification/toast.dart";
import "package:photos/ui/settings/about/about_us_page.dart";
import "package:photos/ui/settings/account/account_settings_page.dart";
@@ -96,7 +96,10 @@ class _SettingsBody extends StatelessWidget {
onGetStarted: () {
Navigator.of(context).push(
MaterialPageRoute(
- builder: (_) => const LandingPageWidget(),
+ builder: (_) => const EmailEntryPage(
+ showReferralSourceField: false,
+ referralSource: "Offline",
+ ),
),
);
},