From 78af7dec6cdea7e845356082c2fb3dc9fa197c06 Mon Sep 17 00:00:00 2001 From: Sven <67653224+sv3nnie@users.noreply.github.com> Date: Wed, 18 Oct 2023 22:47:48 +0200 Subject: [PATCH 01/12] add slug to titles with space --- assets/custom-icons/_data/custom-icons.json | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/assets/custom-icons/_data/custom-icons.json b/assets/custom-icons/_data/custom-icons.json index 4f7501f280..00bde1eea3 100644 --- a/assets/custom-icons/_data/custom-icons.json +++ b/assets/custom-icons/_data/custom-icons.json @@ -34,6 +34,7 @@ }, { "title": "Control D", + "slug": "controld", "hex": "5FD800" }, { @@ -83,9 +84,9 @@ "title": "KuCoin", "hex": "01BC8D" }, - { + { "title": "La Poste", - "slug": "laposte" + "slug": "laposte" }, { "title": "Microsoft" @@ -126,10 +127,12 @@ "color": "EF8300" }, { - "title": "Privacy Guides" + "title": "Privacy Guides", + "slug": "privacyguides" }, { - "title": "Privacy.com" + "title": "Privacy.com", + "slug": "privacy" }, { "title": "Proton" @@ -143,6 +146,7 @@ }, { "title": "Standard Notes", + "slug": "standardnotes", "hex": "2173E6" }, { @@ -154,6 +158,7 @@ }, { "title": "Trading 212", + "slug": "trading212", "hex": "4BA4DE" }, { From e29cb244583f57573a491f5fd891f48f6255199e Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Thu, 19 Oct 2023 09:53:54 +0530 Subject: [PATCH 02/12] Disable swipe to open hamburger menu on droid --- lib/ui/home_page.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ui/home_page.dart b/lib/ui/home_page.dart index 41b03a182b..b8908650f1 100644 --- a/lib/ui/home_page.dart +++ b/lib/ui/home_page.dart @@ -158,7 +158,7 @@ class _HomePageState extends State { } }, child: Scaffold( - drawerEnableOpenDragGesture: true, + drawerEnableOpenDragGesture: !Platform.isAndroid, drawer: ConstrainedBox( constraints: const BoxConstraints(maxWidth: 428), child: Drawer( From 2448e8d01186bb56325e500e82709c78ec672c2a Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Thu, 19 Oct 2023 10:09:03 +0530 Subject: [PATCH 03/12] Fix edit/del when device authentication is not supported --- lib/ui/code_widget.dart | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/ui/code_widget.dart b/lib/ui/code_widget.dart index 1fe339eacb..7641e6d0f6 100644 --- a/lib/ui/code_widget.dart +++ b/lib/ui/code_widget.dart @@ -8,11 +8,11 @@ import 'package:ente_auth/l10n/l10n.dart'; import 'package:ente_auth/models/code.dart'; import 'package:ente_auth/onboarding/view/setup_enter_secret_key_page.dart'; import 'package:ente_auth/onboarding/view/view_qr_page.dart'; +import 'package:ente_auth/services/local_authentication_service.dart'; import 'package:ente_auth/services/preference_service.dart'; import 'package:ente_auth/store/code_store.dart'; import 'package:ente_auth/ui/code_timer_progress.dart'; import 'package:ente_auth/ui/utils/icon_utils.dart'; -import 'package:ente_auth/utils/auth_util.dart'; import 'package:ente_auth/utils/dialog_util.dart'; import 'package:ente_auth/utils/toast_util.dart'; import 'package:ente_auth/utils/totp_util.dart'; @@ -371,8 +371,9 @@ class _CodeWidgetState extends State { } Future _onEditPressed(_) async { - bool _isAuthSuccessful = await requestAuthentication(context.l10n.editCodeAuthMessage); - if(!_isAuthSuccessful) { + bool _isAuthSuccessful = await LocalAuthenticationService.instance + .requestLocalAuthentication(context, context.l10n.editCodeAuthMessage); + if (!_isAuthSuccessful) { return; } final Code? code = await Navigator.of(context).push( @@ -388,8 +389,9 @@ class _CodeWidgetState extends State { } Future _onShowQrPressed(_) async { - bool _isAuthSuccessful = await requestAuthentication(context.l10n.showQRAuthMessage); - if(!_isAuthSuccessful) { + bool _isAuthSuccessful = await LocalAuthenticationService.instance + .requestLocalAuthentication(context, context.l10n.showQRAuthMessage); + if (!_isAuthSuccessful) { return; } // ignore: unused_local_variable @@ -403,8 +405,12 @@ class _CodeWidgetState extends State { } void _onDeletePressed(_) async { - bool _isAuthSuccessful = await requestAuthentication(context.l10n.deleteCodeAuthMessage); - if(!_isAuthSuccessful) { + bool _isAuthSuccessful = + await LocalAuthenticationService.instance.requestLocalAuthentication( + context, + context.l10n.deleteCodeAuthMessage, + ); + if (!_isAuthSuccessful) { return; } final l10n = context.l10n; From 8aa3d28981f7be29408e664530563a1605a04e0f Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Thu, 19 Oct 2023 11:15:52 +0530 Subject: [PATCH 04/12] Bump version 2.0.9+209 --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 53cb28c596..3de5faf021 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: ente_auth description: ente two-factor authenticator -version: 2.0.7+207 +version: 2.0.9+209 publish_to: none environment: From 68de8b8d39c16dde129001b359d86c5a58ef6841 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Thu, 19 Oct 2023 11:48:37 +0530 Subject: [PATCH 05/12] Fix broken icon for Github and UbiSoft --- assets/custom-icons/_data/custom-icons.json | 6 ++++-- assets/custom-icons/icons/GitHub.svg | 1 + assets/custom-icons/icons/github.svg | 5 ----- assets/custom-icons/icons/ubisoft.svg | 6 +----- 4 files changed, 6 insertions(+), 12 deletions(-) create mode 100644 assets/custom-icons/icons/GitHub.svg delete mode 100644 assets/custom-icons/icons/github.svg diff --git a/assets/custom-icons/_data/custom-icons.json b/assets/custom-icons/_data/custom-icons.json index 629688fd0d..4203494ccc 100644 --- a/assets/custom-icons/_data/custom-icons.json +++ b/assets/custom-icons/_data/custom-icons.json @@ -55,7 +55,8 @@ "title": "Firefox" }, { - "title": "GitHub" + "title": "GitHub", + "hex": "858585" }, { "title": "Google" @@ -196,7 +197,8 @@ "slug": "x" }, { - "title": "Ubisoft" + "title": "Ubisoft", + "hex": "4285f4" }, { "title": "Unity", diff --git a/assets/custom-icons/icons/GitHub.svg b/assets/custom-icons/icons/GitHub.svg new file mode 100644 index 0000000000..538ec5bf2a --- /dev/null +++ b/assets/custom-icons/icons/GitHub.svg @@ -0,0 +1 @@ +GitHub \ No newline at end of file diff --git a/assets/custom-icons/icons/github.svg b/assets/custom-icons/icons/github.svg deleted file mode 100644 index 8857b34493..0000000000 --- a/assets/custom-icons/icons/github.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/assets/custom-icons/icons/ubisoft.svg b/assets/custom-icons/icons/ubisoft.svg index 8c3b4d6c2f..c1c69620c2 100644 --- a/assets/custom-icons/icons/ubisoft.svg +++ b/assets/custom-icons/icons/ubisoft.svg @@ -1,5 +1 @@ - - - - - +Ubisoft \ No newline at end of file From 20ab1d75d2a5692823fc1b788714c07c8d3025ca Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Thu, 19 Oct 2023 11:54:23 +0530 Subject: [PATCH 06/12] Fix: Show confirmation during edit when secret is updated --- .../view/setup_enter_secret_key_page.dart | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/lib/onboarding/view/setup_enter_secret_key_page.dart b/lib/onboarding/view/setup_enter_secret_key_page.dart index f2a2bf3a63..ee46d79539 100644 --- a/lib/onboarding/view/setup_enter_secret_key_page.dart +++ b/lib/onboarding/view/setup_enter_secret_key_page.dart @@ -128,23 +128,7 @@ class _SetupEnterSecretKeyPageState extends State { _showIncorrectDetailsDialog(context, message: message); return; } - if (widget.code == null) { - _saveCode(); - return; - } - ButtonResult? result = await showChoiceActionSheet( - context, - title: context.l10n.warning, - body: context.l10n.confirmUpdatingkey, - firstButtonLabel: context.l10n.yes, - secondButtonAction: ButtonAction.cancel, - secondButtonLabel: context.l10n.cancel, - ); - - if (result == null) return; - if (result.action == ButtonAction.first) { - _saveCode(); - } + await _saveCode(); }, child: Padding( padding: const EdgeInsets.symmetric( @@ -163,11 +147,25 @@ class _SetupEnterSecretKeyPageState extends State { ); } - void _saveCode() { + Future _saveCode() async { try { final account = _accountController.text.trim(); final issuer = _issuerController.text.trim(); final secret = _secretController.text.trim().replaceAll(' ', ''); + if (widget.code != null && widget.code!.secret != secret) { + ButtonResult? result = await showChoiceActionSheet( + context, + title: context.l10n.warning, + body: context.l10n.confirmUpdatingkey, + firstButtonLabel: context.l10n.yes, + secondButtonAction: ButtonAction.cancel, + secondButtonLabel: context.l10n.cancel, + ); + if (result == null) return; + if (result.action != ButtonAction.first) { + return; + } + } final Code newCode = widget.code == null ? Code.fromAccountAndSecret( account, From cab66cdea0b261c84537ff0a7bbc1928e1b853d3 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Thu, 19 Oct 2023 11:57:01 +0530 Subject: [PATCH 07/12] Bump version to 2.0.10 --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 3de5faf021..2f10128f92 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: ente_auth description: ente two-factor authenticator -version: 2.0.9+209 +version: 2.0.10+210 publish_to: none environment: From 016e85f3501ddf99db9c1621376ceb44eae2aa58 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Thu, 19 Oct 2023 12:20:03 +0530 Subject: [PATCH 08/12] Bump version to 2.0.11 --- assets/custom-icons/icons/{GitHub.svg => github.svg} | 0 pubspec.yaml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename assets/custom-icons/icons/{GitHub.svg => github.svg} (100%) diff --git a/assets/custom-icons/icons/GitHub.svg b/assets/custom-icons/icons/github.svg similarity index 100% rename from assets/custom-icons/icons/GitHub.svg rename to assets/custom-icons/icons/github.svg diff --git a/pubspec.yaml b/pubspec.yaml index 2f10128f92..b627c2b146 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: ente_auth description: ente two-factor authenticator -version: 2.0.10+210 +version: 2.0.11+211 publish_to: none environment: From d496adaed20a1e442b87123b18518685f5a10830 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Thu, 19 Oct 2023 12:38:27 +0530 Subject: [PATCH 09/12] Show placeholder icons when icon is missing --- lib/theme/colors.dart | 59 ++++++++++++++++++++++++++++++++++-- lib/ui/code_widget.dart | 1 + lib/ui/utils/icon_utils.dart | 22 +++++++++++++- 3 files changed, 79 insertions(+), 3 deletions(-) diff --git a/lib/theme/colors.dart b/lib/theme/colors.dart index ef068c9f66..1d4a8517c2 100644 --- a/lib/theme/colors.dart +++ b/lib/theme/colors.dart @@ -47,7 +47,7 @@ class EnteColorScheme { final Color warning800; final Color caution500; - + final List avatarColors; const EnteColorScheme( this.backgroundBase, this.backgroundElevated, @@ -69,7 +69,8 @@ class EnteColorScheme { this.strokeFainter, this.blurStrokeBase, this.blurStrokeFaint, - this.blurStrokePressed, { + this.blurStrokePressed, + this.avatarColors, { this.primaryGreen = _primaryGreen, this.primary700 = _primary700, this.primary500 = _primary500, @@ -105,6 +106,7 @@ const EnteColorScheme lightScheme = EnteColorScheme( blurStrokeBaseLight, blurStrokeFaintLight, blurStrokePressedLight, + avatarLight, ); const EnteColorScheme darkScheme = EnteColorScheme( @@ -129,6 +131,7 @@ const EnteColorScheme darkScheme = EnteColorScheme( blurStrokeBaseDark, blurStrokeFaintDark, blurStrokePressedDark, + avatarDark, ); // Background Colors @@ -204,3 +207,55 @@ const Color warning500 = Color.fromRGBO(255, 101, 101, 1); const Color _warning400 = Color.fromRGBO(255, 111, 111, 1); const Color _caution500 = Color.fromRGBO(255, 194, 71, 1); + +const List avatarLight = [ + Color.fromRGBO(118, 84, 154, 1), + Color.fromRGBO(223, 120, 97, 1), + Color.fromRGBO(148, 180, 159, 1), + Color.fromRGBO(135, 162, 251, 1), + Color.fromRGBO(198, 137, 198, 1), + Color.fromRGBO(198, 137, 198, 1), + Color.fromRGBO(50, 82, 136, 1), + Color.fromRGBO(133, 180, 224, 1), + Color.fromRGBO(193, 163, 163, 1), + Color.fromRGBO(193, 163, 163, 1), + Color.fromRGBO(66, 97, 101, 1), + Color.fromRGBO(66, 97, 101, 1), + Color.fromRGBO(66, 97, 101, 1), + Color.fromRGBO(221, 157, 226, 1), + Color.fromRGBO(130, 171, 139, 1), + Color.fromRGBO(155, 187, 232, 1), + Color.fromRGBO(143, 190, 190, 1), + Color.fromRGBO(138, 195, 161, 1), + Color.fromRGBO(168, 176, 242, 1), + Color.fromRGBO(176, 198, 149, 1), + Color.fromRGBO(233, 154, 173, 1), + Color.fromRGBO(209, 132, 132, 1), + Color.fromRGBO(120, 181, 167, 1), +]; + +const List avatarDark = [ + Color.fromRGBO(118, 84, 154, 1), + Color.fromRGBO(223, 120, 97, 1), + Color.fromRGBO(148, 180, 159, 1), + Color.fromRGBO(135, 162, 251, 1), + Color.fromRGBO(198, 137, 198, 1), + Color.fromRGBO(147, 125, 194, 1), + Color.fromRGBO(50, 82, 136, 1), + Color.fromRGBO(133, 180, 224, 1), + Color.fromRGBO(193, 163, 163, 1), + Color.fromRGBO(225, 160, 89, 1), + Color.fromRGBO(66, 97, 101, 1), + Color.fromRGBO(107, 119, 178, 1), + Color.fromRGBO(149, 127, 239, 1), + Color.fromRGBO(221, 157, 226, 1), + Color.fromRGBO(130, 171, 139, 1), + Color.fromRGBO(155, 187, 232, 1), + Color.fromRGBO(143, 190, 190, 1), + Color.fromRGBO(138, 195, 161, 1), + Color.fromRGBO(168, 176, 242, 1), + Color.fromRGBO(176, 198, 149, 1), + Color.fromRGBO(233, 154, 173, 1), + Color.fromRGBO(209, 132, 132, 1), + Color.fromRGBO(120, 181, 167, 1), +]; diff --git a/lib/ui/code_widget.dart b/lib/ui/code_widget.dart index 7641e6d0f6..6494df5cf7 100644 --- a/lib/ui/code_widget.dart +++ b/lib/ui/code_widget.dart @@ -325,6 +325,7 @@ class _CodeWidgetState extends State { ? const EdgeInsets.only(left: 16) : const EdgeInsets.all(0), child: IconUtils.instance.getIcon( + context, safeDecode(widget.code.issuer).trim(), width: _shouldShowLargeIcon ? 42 : 24, ), diff --git a/lib/ui/utils/icon_utils.dart b/lib/ui/utils/icon_utils.dart index a1a9246585..cfb6cc29ec 100644 --- a/lib/ui/utils/icon_utils.dart +++ b/lib/ui/utils/icon_utils.dart @@ -1,8 +1,8 @@ import 'dart:convert'; +import 'package:ente_auth/theme/ente_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_svg/svg.dart'; class IconUtils { @@ -19,6 +19,7 @@ class IconUtils { } Widget getIcon( + BuildContext context, String provider, { double width = 24, }) { @@ -37,6 +38,25 @@ class IconUtils { _simpleIcons[title], width, ); + } else if (title.isNotEmpty) { + return SizedBox( + width: width + 6, + child: CircleAvatar( + backgroundColor: getEnteColorScheme(context).avatarColors[ + title.hashCode % getEnteColorScheme(context).avatarColors.length], + child: Text( + title.toUpperCase()[0], + // fixed color + style: width > 24 + ? getEnteTextTheme(context) + .largeBold + .copyWith(color: Colors.white) + : getEnteTextTheme(context) + .bodyBold + .copyWith(color: Colors.white), + ), + ), + ); } else { return const SizedBox.shrink(); } From 3f5ef23e1b019539f03f4b71a24490a0e3219302 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Thu, 19 Oct 2023 12:46:03 +0530 Subject: [PATCH 10/12] Update ui --- lib/ui/utils/icon_utils.dart | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/lib/ui/utils/icon_utils.dart b/lib/ui/utils/icon_utils.dart index cfb6cc29ec..bb37df628f 100644 --- a/lib/ui/utils/icon_utils.dart +++ b/lib/ui/utils/icon_utils.dart @@ -39,22 +39,17 @@ class IconUtils { width, ); } else if (title.isNotEmpty) { - return SizedBox( - width: width + 6, - child: CircleAvatar( - backgroundColor: getEnteColorScheme(context).avatarColors[ - title.hashCode % getEnteColorScheme(context).avatarColors.length], - child: Text( - title.toUpperCase()[0], - // fixed color - style: width > 24 - ? getEnteTextTheme(context) - .largeBold - .copyWith(color: Colors.white) - : getEnteTextTheme(context) - .bodyBold - .copyWith(color: Colors.white), - ), + bool showLargeIcon = width > 24; + return CircleAvatar( + radius: width / 2, + backgroundColor: getEnteColorScheme(context).avatarColors[ + title.hashCode % getEnteColorScheme(context).avatarColors.length], + child: Text( + title.toUpperCase()[0], + // fixed color + style: showLargeIcon + ? getEnteTextTheme(context).h3Bold.copyWith(color: Colors.white) + : getEnteTextTheme(context).body.copyWith(color: Colors.white), ), ); } else { From ec895546f6c92b5f402c15543766480f25811b73 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Thu, 19 Oct 2023 12:50:48 +0530 Subject: [PATCH 11/12] Bump version to 2.0.12 --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index b627c2b146..54f0cac223 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: ente_auth description: ente two-factor authenticator -version: 2.0.11+211 +version: 2.0.12+212 publish_to: none environment: From a09a4e5c9b52faa95f8dfa3d0c963072ab7c2608 Mon Sep 17 00:00:00 2001 From: vishnukvmd Date: Thu, 19 Oct 2023 21:03:35 +0530 Subject: [PATCH 12/12] Bunch together app specific settings --- lib/ui/settings/general_section_widget.dart | 30 ++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/ui/settings/general_section_widget.dart b/lib/ui/settings/general_section_widget.dart index 986ef3a8e7..3810b49d7f 100644 --- a/lib/ui/settings/general_section_widget.dart +++ b/lib/ui/settings/general_section_widget.dart @@ -107,21 +107,6 @@ class _AdvancedSectionWidgetState extends State { ), ), sectionOptionSpacing, - MenuItemWidget( - captionedTextWidget: CaptionedTextWidget( - title: l10n.crashAndErrorReporting, - ), - trailingWidget: ToggleSwitchWidget( - value: () => SuperLogging.shouldReportErrors(), - onChanged: () async { - await SuperLogging.setShouldReportErrors( - !SuperLogging.shouldReportErrors(), - ); - setState(() {}); - }, - ), - ), - sectionOptionSpacing, if (Platform.isAndroid) ...[ MenuItemWidget( captionedTextWidget: CaptionedTextWidget( @@ -139,6 +124,21 @@ class _AdvancedSectionWidgetState extends State { ), sectionOptionSpacing, ], + MenuItemWidget( + captionedTextWidget: CaptionedTextWidget( + title: l10n.crashAndErrorReporting, + ), + trailingWidget: ToggleSwitchWidget( + value: () => SuperLogging.shouldReportErrors(), + onChanged: () async { + await SuperLogging.setShouldReportErrors( + !SuperLogging.shouldReportErrors(), + ); + setState(() {}); + }, + ), + ), + sectionOptionSpacing, ], ); }