Skip to content

armgit / ente

Public Imported from GitHub
0

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

Minor fixes

AmanRajSinghMouryaa493c46cf0dd
diff --git a/mobile/apps/photos/lib/emergency/recover_others_account.dart b/mobile/apps/photos/lib/emergency/recover_others_account.dart
index 98f512aa7d..1c2ec435e1 100644
--- a/mobile/apps/photos/lib/emergency/recover_others_account.dart
+++ b/mobile/apps/photos/lib/emergency/recover_others_account.dart
@@ -97,8 +97,8 @@ class _RecoverOthersAccountState extends State<RecoverOthersAccount> {
isKeypadOpen: isKeypadOpen,
isFormValid: _passwordsMatch && _isPasswordValid,
buttonText: title,
- onPressedFunction: () {
- _updatePassword();
+ onPressedFunction: () async {
+ await _updatePassword();
FocusScope.of(context).unfocus();
},
),
@@ -303,7 +303,7 @@ class _RecoverOthersAccountState extends State<RecoverOthersAccount> {
);
}
- void _updatePassword() async {
+ Future<void> _updatePassword() async {
final dialog = createProgressDialog(
context,
AppLocalizations.of(context).generatingEncryptionKeys,
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 ce0329d1ea..1ba6b81c39 100644
--- a/mobile/apps/photos/lib/ui/account/email_entry_page.dart
+++ b/mobile/apps/photos/lib/ui/account/email_entry_page.dart
@@ -47,6 +47,17 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
Timer? _passwordStrengthTimer;
Timer? _confirmPasswordTimer;
+ @override
+ void initState() {
+ super.initState();
+ final storedEmail = _config.getEmail();
+ if (storedEmail != null && storedEmail.isNotEmpty) {
+ _email = storedEmail;
+ _emailController.text = storedEmail;
+ _emailIsValid = EmailValidator.validate(storedEmail);
+ }
+ }
+
@override
void dispose() {
_emailValidationTimer?.cancel();
diff --git a/mobile/apps/photos/lib/ui/account/login_page.dart b/mobile/apps/photos/lib/ui/account/login_page.dart
index 57261646a3..30ec0055e0 100644
--- a/mobile/apps/photos/lib/ui/account/login_page.dart
+++ b/mobile/apps/photos/lib/ui/account/login_page.dart
@@ -30,12 +30,15 @@ class _LoginPageState extends State<LoginPage> {
bool _showValidationMessage = false;
String? _email;
Timer? _validationTimer;
+ final _config = Configuration.instance;
final Logger _logger = Logger('_LoginPageState');
@override
void didChangeDependencies() {
super.didChangeDependencies();
- if (kDebugMode) {
+ if ((_config.getEmail() ?? '').isNotEmpty) {
+ _updateEmail(_config.getEmail()!);
+ } else if (kDebugMode) {
_updateEmail(const String.fromEnvironment("email"));
}
}
diff --git a/mobile/apps/photos/lib/ui/account/recovery_key_page.dart b/mobile/apps/photos/lib/ui/account/recovery_key_page.dart
index 96f52e9316..280f55b09f 100644
--- a/mobile/apps/photos/lib/ui/account/recovery_key_page.dart
+++ b/mobile/apps/photos/lib/ui/account/recovery_key_page.dart
@@ -62,13 +62,15 @@ class _RecoveryKeyPageState extends State<RecoveryKeyPage> {
elevation: 0,
scrolledUnderElevation: 0,
backgroundColor: colorScheme.backgroundColour,
- leading: IconButton(
- icon: const Icon(Icons.arrow_back),
- color: colorScheme.content,
- onPressed: () {
- Navigator.of(context).pop();
- },
- ),
+ leading: widget.isOnboarding
+ ? const SizedBox.shrink()
+ : IconButton(
+ icon: const Icon(Icons.arrow_back),
+ color: colorScheme.content,
+ onPressed: () {
+ Navigator.of(context).pop();
+ },
+ ),
),
body: _getBody(recoveryKey, colorScheme, textTheme),
);
diff --git a/mobile/apps/photos/lib/ui/common/dynamic_fab.dart b/mobile/apps/photos/lib/ui/common/dynamic_fab.dart
index b85ec0c2e1..319e7c2c3f 100644
--- a/mobile/apps/photos/lib/ui/common/dynamic_fab.dart
+++ b/mobile/apps/photos/lib/ui/common/dynamic_fab.dart
@@ -2,13 +2,14 @@ import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:photos/ente_theme_data.dart';
+import 'package:photos/models/typedefs.dart';
import 'package:photos/ui/components/buttons/button_widget_v2.dart';
class DynamicFAB extends StatelessWidget {
final bool? isKeypadOpen;
final bool? isFormValid;
final String? buttonText;
- final Function? onPressedFunction;
+ final FutureVoidCallback? onPressedFunction;
const DynamicFAB({
super.key,
@@ -43,7 +44,9 @@ class DynamicFAB extends StatelessWidget {
foregroundColor:
Theme.of(context).colorScheme.dynamicFABTextColor,
onPressed: isFormValid!
- ? onPressedFunction as void Function()?
+ ? () {
+ onPressedFunction!();
+ }
: () {
FocusScope.of(context).unfocus();
},
@@ -65,7 +68,7 @@ class DynamicFAB extends StatelessWidget {
buttonType: ButtonTypeV2.primary,
labelText: buttonText!,
isDisabled: !isFormValid!,
- onTap: isFormValid! ? onPressedFunction as Future<void> Function()? : null,
+ onTap: isFormValid! ? onPressedFunction : null,
),
);
}
diff --git a/mobile/apps/photos/lib/ui/components/text_input_widget_v2.dart b/mobile/apps/photos/lib/ui/components/text_input_widget_v2.dart
index 21b56907a1..217cf44e73 100644
--- a/mobile/apps/photos/lib/ui/components/text_input_widget_v2.dart
+++ b/mobile/apps/photos/lib/ui/components/text_input_widget_v2.dart
@@ -10,6 +10,11 @@ import 'package:photos/theme/ente_theme.dart';
import 'package:photos/theme/text_style.dart';
import 'package:photos/ui/components/models/text_input_type_v2.dart';
+/// A styled text input widget with built-in support for submission states,
+/// password visibility toggling, clearable input, and validation messages.
+///
+/// To show a wrong-password state, throw an exception containing
+/// "Incorrect password" in [onSubmit].
class TextInputWidgetV2 extends StatefulWidget {
final String? label;
final String? message;
@@ -17,7 +22,13 @@ class TextInputWidgetV2 extends StatefulWidget {
final String? initialValue;
final bool? autoFocus;
final int? maxLength;
+
+ /// The widget listens to this notifier and executes [onSubmit] when notified.
+ /// The value of this notifier is irrelevant.
final ValueNotifier? submitNotifier;
+
+ /// The widget listens to this notifier and clears and unfocuses the
+ /// text field when notified.
final ValueNotifier? cancelNotifier;
final bool alwaysShowSuccessState;
final bool showOnlyLoadingState;
@@ -27,6 +38,8 @@ class TextInputWidgetV2 extends StatefulWidget {
final bool shouldSurfaceExecutionStates;
final TextCapitalization? textCapitalization;
final bool isPasswordInput;
+
+ /// Shows a clear (x) icon as a trailing widget. Unrelated to [onCancel].
final bool isClearable;
final bool shouldUnfocusOnClearOrSubmit;
final FocusNode? focusNode;
@@ -116,6 +129,9 @@ class _TextInputWidgetV2State extends State<TextInputWidgetV2>
bool _isFocused = false;
bool _incorrectPassword = false;
+
+ /// Stored so it can be passed via Navigator.pop() when the widget is used
+ /// inside a dialog and [popNavAfterSubmission] is true.
Exception? _exception;
@override
@@ -547,6 +563,10 @@ class _TextInputWidgetV2State extends State<TextInputWidgetV2>
_syncLoadingController();
}
+ // When onSubmit takes roughly as long as the debounce duration, the
+ // debounce callback can fire during or after the checks below, leaving
+ // the state stuck at idle. This short delay lets the debouncer finish
+ // first.
await Future.delayed(const Duration(milliseconds: 5));
if (_executionState == ExecutionState.inProgress ||