Skip to content

armgit / ente

Public Imported from GitHub
0

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

Merge upstream/main into fix_leaks

Neeraj Guptad5bc327554e5
diff --cc mobile/apps/photos/lib/ui/account/ott_verification_page.dart
index b9c9ce2dad,9769cab80d..9667140f26
--- a/mobile/apps/photos/lib/ui/account/ott_verification_page.dart
+++ b/mobile/apps/photos/lib/ui/account/ott_verification_page.dart
@@@ -26,14 -27,32 +27,38 @@@ class OTTVerificationPage extends State
}
class _OTTVerificationPageState extends State<OTTVerificationPage> {
- final _verificationCodeController = TextEditingController();
+ final _pinController = TextEditingController();
+ String _code = "";
+
+ Future<void> _onVerifyPressed() async {
+ if (widget.isChangeEmail) {
+ await UserService.instance.changeEmail(
+ context,
+ widget.email,
+ _pinController.text,
+ );
+ } else {
+ await UserService.instance.verifyEmail(
+ context,
+ _pinController.text,
+ isResettingPasswordScreen: widget.isResetPasswordScreen,
+ );
+ }
+ FocusScope.of(context).unfocus();
+ }
+
+ @override
+ void dispose() {
+ _pinController.dispose();
+ super.dispose();
+ }
+ @override
+ void dispose() {
+ _verificationCodeController.dispose();
+ super.dispose();
+ }
+
@override
Widget build(BuildContext context) {
final isKeypadOpen = MediaQuery.of(context).viewInsets.bottom > 100;
diff --cc mobile/apps/photos/lib/ui/account/password_entry_page.dart
index 3295713fd3,52e914f58f..a06de18236
--- a/mobile/apps/photos/lib/ui/account/password_entry_page.dart
+++ b/mobile/apps/photos/lib/ui/account/password_entry_page.dart
@@@ -73,27 -74,17 +74,26 @@@ class _PasswordEntryPageState extends S
() => _showRecoveryCodeDialog(_volatilePassword!),
);
}
- _password1FocusNode.addListener(() {
- setState(() {
- _password1InFocus = _password1FocusNode.hasFocus;
- });
- });
- _password2FocusNode.addListener(() {
- setState(() {
- _password2InFocus = _password2FocusNode.hasFocus;
- });
- });
+ }
+
+ @override
+ void dispose() {
+ _passwordStrengthTimer?.cancel();
+ _confirmPasswordTimer?.cancel();
+ _passwordController1.dispose();
+ _passwordController2.dispose();
+ super.dispose();
}
+ @override
+ void dispose() {
+ _passwordController1.dispose();
+ _passwordController2.dispose();
+ _password1FocusNode.dispose();
+ _password2FocusNode.dispose();
+ super.dispose();
+ }
+
@override
Widget build(BuildContext context) {
final isKeypadOpen = MediaQuery.of(context).viewInsets.bottom > 100;
diff --cc mobile/apps/photos/lib/ui/account/recovery_page.dart
index d627bcedba,feca172afb..39c5a6b4b4
--- a/mobile/apps/photos/lib/ui/account/recovery_page.dart
+++ b/mobile/apps/photos/lib/ui/account/recovery_page.dart
@@@ -15,17 -17,14 +17,20 @@@ class RecoveryPage extends StatefulWidg
}
class _RecoveryPageState extends State<RecoveryPage> {
- final _recoveryKey = TextEditingController();
+ final _recoveryKeyController = TextEditingController();
+ @override
+ void dispose() {
+ _recoveryKey.dispose();
+ super.dispose();
+ }
+
@override
Widget build(BuildContext context) {
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
final isKeypadOpen = MediaQuery.of(context).viewInsets.bottom > 100;
+
FloatingActionButtonLocation? fabLocation() {
if (isKeypadOpen) {
return null;
diff --cc mobile/apps/photos/lib/ui/account/two_factor_recovery_page.dart
index 97bddae36a,a3a253a99b..aee99c82c0
--- a/mobile/apps/photos/lib/ui/account/two_factor_recovery_page.dart
+++ b/mobile/apps/photos/lib/ui/account/two_factor_recovery_page.dart
@@@ -24,99 -29,118 +29,124 @@@ class TwoFactorRecoveryPage extends Sta
}
class _TwoFactorRecoveryPageState extends State<TwoFactorRecoveryPage> {
- final _recoveryKey = TextEditingController();
+ final _recoveryKeyController = TextEditingController();
+ String _recoveryKey = '';
+
+ @override
+ void dispose() {
+ _recoveryKeyController.dispose();
+ super.dispose();
+ }
+ @override
+ void dispose() {
+ _recoveryKey.dispose();
+ super.dispose();
+ }
+
@override
Widget build(BuildContext context) {
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
+ final isKeypadOpen = MediaQuery.of(context).viewInsets.bottom > 100;
+
+ FloatingActionButtonLocation? fabLocation() {
+ if (isKeypadOpen) {
+ return null;
+ } else {
+ return FloatingActionButtonLocation.centerFloat;
+ }
+ }
+
return Scaffold(
+ resizeToAvoidBottomInset: isKeypadOpen,
+ backgroundColor: colorScheme.backgroundColour,
appBar: AppBar(
+ elevation: 0,
+ scrolledUnderElevation: 0,
+ backgroundColor: colorScheme.backgroundColour,
+ leading: IconButton(
+ icon: const Icon(Icons.arrow_back),
+ color: colorScheme.content,
+ onPressed: () {
+ Navigator.of(context).pop();
+ },
+ ),
title: Text(
AppLocalizations.of(context).recoverAccount,
- style: const TextStyle(
- fontSize: 18,
- ),
+ style: textTheme.largeBold,
),
+ centerTitle: true,
),
- body: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- mainAxisAlignment: MainAxisAlignment.center,
- mainAxisSize: MainAxisSize.max,
- children: [
- Padding(
- padding: const EdgeInsets.fromLTRB(60, 0, 60, 0),
- child: TextFormField(
- decoration: InputDecoration(
- hintText: AppLocalizations.of(context).enterYourRecoveryKey,
- contentPadding: const EdgeInsets.all(20),
- ),
- style: const TextStyle(
- fontSize: 14,
- fontFeatures: [FontFeature.tabularFigures()],
- ),
- controller: _recoveryKey,
- autofocus: false,
- autocorrect: false,
+ body: _getBody(colorScheme, textTheme),
+ floatingActionButton: DynamicFAB(
+ key: const ValueKey("recover2FAButton"),
+ isKeypadOpen: isKeypadOpen,
+ isFormValid: _recoveryKey.isNotEmpty,
+ buttonText: AppLocalizations.of(context).recover,
+ onPressedFunction: () async {
+ FocusScope.of(context).unfocus();
+ await UserService.instance.removeTwoFactor(
+ context,
+ widget.type,
+ widget.sessionID,
+ _recoveryKeyController.text,
+ widget.encryptedSecret,
+ widget.secretDecryptionNonce,
+ );
+ },
+ ),
+ floatingActionButtonLocation: fabLocation(),
+ floatingActionButtonAnimator: NoScalingAnimation(),
+ );
+ }
+
+ Widget _getBody(EnteColorScheme colorScheme, EnteTextTheme textTheme) {
+ return SafeArea(
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16),
+ child: Column(
+ children: [
+ const SizedBox(height: 24),
+ TextInputWidgetV2(
+ label: AppLocalizations.of(context).recoveryKey,
+ hintText: AppLocalizations.of(context).enterYourRecoveryKey,
+ textEditingController: _recoveryKeyController,
+ autoCorrect: false,
keyboardType: TextInputType.multiline,
- maxLines: null,
- onChanged: (_) {
- setState(() {});
+ minLines: 4,
+ onChange: (value) {
+ final hasKey = value.isNotEmpty;
+ if ((_recoveryKey.isNotEmpty) != hasKey) {
+ setState(() {
+ _recoveryKey = value;
+ });
+ } else {
+ _recoveryKey = value;
+ }
},
),
- ),
- const Padding(padding: EdgeInsets.all(24)),
- Container(
- padding: const EdgeInsets.fromLTRB(80, 0, 80, 0),
- width: double.infinity,
- height: 64,
- child: OutlinedButton(
- onPressed: _recoveryKey.text.isNotEmpty
- ? () async {
- await UserService.instance.removeTwoFactor(
- context,
- widget.type,
- widget.sessionID,
- _recoveryKey.text,
- widget.encryptedSecret,
- widget.secretDecryptionNonce,
- );
- }
- : null,
- child: Text(AppLocalizations.of(context).recover),
- ),
- ),
- GestureDetector(
- behavior: HitTestBehavior.translucent,
- onTap: () {
- showErrorDialog(
- context,
- AppLocalizations.of(context).contactSupport,
- AppLocalizations.of(context)
- .dropSupportEmail(supportEmail: "[email protected]"),
- );
- },
- child: Container(
- padding: const EdgeInsets.all(40),
- child: Center(
- child: Text(
- AppLocalizations.of(context).noRecoveryKey,
- style: TextStyle(
- decoration: TextDecoration.underline,
- fontSize: 12,
- color: getEnteColorScheme(context)
- .textBase
- .withValues(alpha: 0.9),
- ),
- ),
+ const SizedBox(height: 12),
+ Align(
+ alignment: Alignment.centerRight,
+ child: ButtonWidgetV2(
+ buttonType: ButtonTypeV2.link,
+ labelText: AppLocalizations.of(context).noRecoveryKey,
+ buttonSize: ButtonSizeV2.small,
+ onTap: () async {
+ // ignore: unawaited_futures
+ showErrorDialog(
+ context,
+ AppLocalizations.of(context).contactSupport,
+ AppLocalizations.of(context).dropSupportEmail(
+ supportEmail: "[email protected]",
+ ),
+ );
+ },
),
),
- ),
- ],
+ ],
+ ),
),
);
}
diff --cc mobile/apps/photos/lib/ui/notification/update/change_log_page.dart
index da3e05bd4b,4e307d03d7..fe429634b5
--- a/mobile/apps/photos/lib/ui/notification/update/change_log_page.dart
+++ b/mobile/apps/photos/lib/ui/notification/update/change_log_page.dart
@@@ -98,6 -90,8 +98,7 @@@ class _ChangeLogPageState extends State
}
Widget _getChangeLog(BuildContext ctx) {
- final scrollController = ScrollController();
+ final strings = ChangeLogStrings.forLocale(Localizations.localeOf(context));
final List<ChangeLogEntry> items = [];
items.addAll([
ChangeLogEntry(