Skip to content

armgit / ente

Public Imported from GitHub
0

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

add developer setting options on login and email entry page

AmanRajSinghMourya5552df53717e
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 8223be9939..0ef45ac8a6 100644
--- a/mobile/apps/photos/lib/ui/account/email_entry_page.dart
+++ b/mobile/apps/photos/lib/ui/account/email_entry_page.dart
@@ -14,6 +14,7 @@ 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";
import "package:photos/ui/components/text_input_widget_v2.dart";
+import "package:photos/ui/settings/developer_settings_tap_area.dart";
import "package:styled_text/styled_text.dart";
class EmailEntryPage extends StatefulWidget {
@@ -166,106 +167,129 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
}
return AutofillGroup(
- child: ListView(
- padding: const EdgeInsets.symmetric(horizontal: 16),
- children: [
- const SizedBox(height: 24),
- TextInputWidgetV2(
- label: AppLocalizations.of(context).email,
- hintText: AppLocalizations.of(context).email,
- textEditingController: _emailController,
- keyboardType: TextInputType.emailAddress,
- autoCorrect: false,
- isRequired: true,
- onChange: _onEmailChanged,
- message: _showEmailValidation && !_emailIsValid
- ? AppLocalizations.of(context).invalidEmailAddress
- : null,
- messageType: _showEmailValidation && !_emailIsValid
- ? TextInputMessageType.alert
- : TextInputMessageType.guide,
- ),
- const SizedBox(height: 24),
- TextInputWidgetV2(
- label: AppLocalizations.of(context).password,
- hintText: AppLocalizations.of(context).password,
- textEditingController: _passwordController1,
- isPasswordInput: true,
- isRequired: true,
- autoCorrect: false,
- autofillHints: const [AutofillHints.newPassword],
- message: passwordMessage,
- messageType: passwordMessageType,
- onChange: (password) {
- if (password != _password) {
- _passwordStrengthTimer?.cancel();
- setState(() {
- _password = password;
- _passwordStrength = estimatePasswordStrength(password);
- _passwordIsValid =
- _passwordStrength >= kMildPasswordStrengthThreshold;
- _passwordsMatch = _password == _cnfPassword;
- _showPasswordStrength = false;
- });
- _passwordStrengthTimer = Timer(
- const Duration(seconds: 1),
- () {
- if (mounted) {
+ child: CustomScrollView(
+ slivers: [
+ SliverPadding(
+ padding: const EdgeInsets.symmetric(horizontal: 16),
+ sliver: SliverToBoxAdapter(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ const SizedBox(height: 24),
+ TextInputWidgetV2(
+ label: AppLocalizations.of(context).email,
+ hintText: AppLocalizations.of(context).email,
+ textEditingController: _emailController,
+ keyboardType: TextInputType.emailAddress,
+ autoCorrect: false,
+ isRequired: true,
+ onChange: _onEmailChanged,
+ message: _showEmailValidation && !_emailIsValid
+ ? AppLocalizations.of(context).invalidEmailAddress
+ : null,
+ messageType: _showEmailValidation && !_emailIsValid
+ ? TextInputMessageType.alert
+ : TextInputMessageType.guide,
+ ),
+ const SizedBox(height: 24),
+ TextInputWidgetV2(
+ label: AppLocalizations.of(context).password,
+ hintText: AppLocalizations.of(context).password,
+ textEditingController: _passwordController1,
+ isPasswordInput: true,
+ isRequired: true,
+ autoCorrect: false,
+ autofillHints: const [AutofillHints.newPassword],
+ message: passwordMessage,
+ messageType: passwordMessageType,
+ onChange: (password) {
+ if (password != _password) {
+ _passwordStrengthTimer?.cancel();
+ setState(() {
+ _password = password;
+ _passwordStrength =
+ estimatePasswordStrength(password);
+ _passwordIsValid = _passwordStrength >=
+ kMildPasswordStrengthThreshold;
+ _passwordsMatch = _password == _cnfPassword;
+ _showPasswordStrength = false;
+ });
+ _passwordStrengthTimer = Timer(
+ const Duration(seconds: 1),
+ () {
+ if (mounted) {
+ setState(() {
+ _showPasswordStrength = true;
+ });
+ }
+ },
+ );
+ }
+ },
+ ),
+ const SizedBox(height: 24),
+ TextInputWidgetV2(
+ label: AppLocalizations.of(context).confirmPassword,
+ hintText: AppLocalizations.of(context).confirmPassword,
+ textEditingController: _passwordController2,
+ isPasswordInput: true,
+ isRequired: true,
+ autoCorrect: false,
+ autofillHints: const [],
+ finishAutofillContextOnEditingComplete: true,
+ message: confirmPasswordMessage,
+ messageType: confirmPasswordMessageType,
+ onChange: (cnfPassword) {
+ _confirmPasswordTimer?.cancel();
setState(() {
- _showPasswordStrength = true;
+ _cnfPassword = cnfPassword;
+ _showConfirmPasswordValidation = false;
+ if (_password != null && _password!.isNotEmpty) {
+ _passwordsMatch = _password == _cnfPassword;
+ }
});
- }
- },
- );
- }
- },
- ),
- const SizedBox(height: 24),
- TextInputWidgetV2(
- label: AppLocalizations.of(context).confirmPassword,
- hintText: AppLocalizations.of(context).confirmPassword,
- textEditingController: _passwordController2,
- isPasswordInput: true,
- isRequired: true,
- autoCorrect: false,
- autofillHints: const [],
- finishAutofillContextOnEditingComplete: true,
- message: confirmPasswordMessage,
- messageType: confirmPasswordMessageType,
- onChange: (cnfPassword) {
- _confirmPasswordTimer?.cancel();
- setState(() {
- _cnfPassword = cnfPassword;
- _showConfirmPasswordValidation = false;
- if (_password != null && _password!.isNotEmpty) {
- _passwordsMatch = _password == _cnfPassword;
- }
- });
- _confirmPasswordTimer = Timer(
- const Duration(seconds: 1),
- () {
- if (mounted) {
- setState(() {
- _showConfirmPasswordValidation = true;
- });
- }
- },
- );
- },
+ _confirmPasswordTimer = Timer(
+ const Duration(seconds: 1),
+ () {
+ if (mounted) {
+ setState(() {
+ _showConfirmPasswordValidation = true;
+ });
+ }
+ },
+ );
+ },
+ ),
+ 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),
+ ],
+ ),
+ ),
),
- if (widget.showReferralSourceField) ...[
- const SizedBox(height: 24),
- TextInputWidgetV2(
- label: AppLocalizations.of(context).hearUsWhereTitle,
- autoCorrect: false,
- onChange: (value) {
- _referralSource = value.trim();
- },
+ const SliverPadding(
+ padding: EdgeInsets.symmetric(horizontal: 16),
+ sliver: SliverFillRemaining(
+ hasScrollBody: false,
+ child: Column(
+ children: [
+ Expanded(
+ child: DeveloperSettingsTapArea(),
+ ),
+ SizedBox(height: 80),
+ ],
+ ),
),
- ],
- 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 83951d351f..f497a87ceb 100644
--- a/mobile/apps/photos/lib/ui/account/login_page.dart
+++ b/mobile/apps/photos/lib/ui/account/login_page.dart
@@ -17,6 +17,7 @@ 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";
import "package:photos/ui/components/text_input_widget_v2.dart";
+import "package:photos/ui/settings/developer_settings_tap_area.dart";
class LoginPage extends StatefulWidget {
const LoginPage({super.key});
@@ -125,6 +126,10 @@ class _LoginPageState extends State<LoginPage> {
? TextInputMessageType.alert
: TextInputMessageType.guide,
),
+ const SizedBox(height: 24),
+ const Expanded(
+ child: DeveloperSettingsTapArea(),
+ ),
],
),
),
diff --git a/mobile/apps/photos/lib/ui/home/landing_page_widget.dart b/mobile/apps/photos/lib/ui/home/landing_page_widget.dart
index e2584973ec..a47bcd1630 100644
--- a/mobile/apps/photos/lib/ui/home/landing_page_widget.dart
+++ b/mobile/apps/photos/lib/ui/home/landing_page_widget.dart
@@ -21,11 +21,10 @@ import 'package:photos/ui/components/buttons/button_widget_v2.dart';
import 'package:photos/ui/components/dialog_widget.dart';
import 'package:photos/ui/components/models/button_type.dart';
import 'package:photos/ui/payment/subscription.dart';
-import "package:photos/ui/settings/developer_settings_page.dart";
+import "package:photos/ui/settings/developer_settings_tap_area.dart";
import "package:photos/ui/settings/developer_settings_widget.dart";
import "package:photos/ui/settings/language_picker.dart";
import 'package:photos/ui/tabs/home_widget.dart';
-import "package:photos/utils/dialog_util.dart";
class LandingPageWidget extends StatefulWidget {
const LandingPageWidget({super.key});
@@ -35,13 +34,11 @@ class LandingPageWidget extends StatefulWidget {
}
class _LandingPageWidgetState extends State<LandingPageWidget> {
- static const kDeveloperModeTapCountThreshold = 7;
static const _featureCount = 3;
static const _autoScrollInterval = Duration(seconds: 4);
int _currentPage = 0;
int _activeDotIndex = 0;
- int _developerModeTapCount = 0;
bool _autoScrollDisabled = false;
Timer? _autoScrollTimer;
late final PageController _pageController;
@@ -129,9 +126,10 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {
),
backgroundColor: colorScheme.greenBase,
body: SafeArea(
- child: GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: _handleDeveloperModeTap,
+ child: DeveloperSettingsTapArea(
+ onSettingsChanged: () {
+ setState(() {});
+ },
child: Column(
children: [
if (kDebugMode) _buildDebugLanguageButton(),
@@ -310,30 +308,6 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {
);
}
- Future<void> _handleDeveloperModeTap() async {
- _developerModeTapCount++;
- if (_developerModeTapCount >= kDeveloperModeTapCountThreshold) {
- _developerModeTapCount = 0;
- final result = await showChoiceDialog(
- context,
- title: AppLocalizations.of(context).developerSettings,
- firstButtonLabel: AppLocalizations.of(context).yes,
- body: AppLocalizations.of(context).developerSettingsWarning,
- isDismissible: false,
- );
- if (result?.action == ButtonAction.first) {
- await Navigator.of(context).push(
- MaterialPageRoute(
- builder: (BuildContext context) {
- return const DeveloperSettingsPage();
- },
- ),
- );
- setState(() {});
- }
- }
- }
-
Future<void> _navigateToSignUpPage() async {
updateService.hideChangeLog().ignore();
Widget page;