diff --git a/assets/custom-icons/_data/custom-icons.json b/assets/custom-icons/_data/custom-icons.json index 5ab95c989a..4203494ccc 100644 --- a/assets/custom-icons/_data/custom-icons.json +++ b/assets/custom-icons/_data/custom-icons.json @@ -40,6 +40,7 @@ }, { "title": "Control D", + "slug": "controld", "hex": "5FD800" }, { @@ -54,7 +55,8 @@ "title": "Firefox" }, { - "title": "GitHub" + "title": "GitHub", + "hex": "858585" }, { "title": "Google" @@ -88,9 +90,9 @@ "title": "KuCoin", "hex": "01BC8D" }, - { + { "title": "La Poste", - "slug": "laposte" + "slug": "laposte" }, { "title": "Microsoft" @@ -137,10 +139,12 @@ "color": "EF8300" }, { - "title": "Privacy Guides" + "title": "Privacy Guides", + "slug": "privacyguides" }, { - "title": "Privacy.com" + "title": "Privacy.com", + "slug": "privacy" }, { "title": "Proton" @@ -157,6 +161,7 @@ }, { "title": "Standard Notes", + "slug": "standardnotes", "hex": "2173E6" }, { @@ -168,6 +173,7 @@ }, { "title": "Trading 212", + "slug": "trading212", "hex": "4BA4DE" }, { @@ -191,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 index 8857b34493..538ec5bf2a 100644 --- a/assets/custom-icons/icons/github.svg +++ b/assets/custom-icons/icons/github.svg @@ -1,5 +1 @@ - - - - - +GitHub \ No newline at end of file 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 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, 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 1fe339eacb..6494df5cf7 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'; @@ -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, ), @@ -371,8 +372,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 +390,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 +406,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; 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( 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, ], ); } diff --git a/lib/ui/utils/icon_utils.dart b/lib/ui/utils/icon_utils.dart index a1a9246585..bb37df628f 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,20 @@ class IconUtils { _simpleIcons[title], width, ); + } else if (title.isNotEmpty) { + 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 { return const SizedBox.shrink(); } diff --git a/pubspec.yaml b/pubspec.yaml index ec730a44e3..54f0cac223 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: ente_auth description: ente two-factor authenticator -version: 2.0.8+208 +version: 2.0.12+212 publish_to: none environment: