From 8a35b71bb87a9e19377e99354ec746dbf51fd045 Mon Sep 17 00:00:00 2001 From: ashilkn Date: Tue, 23 Jul 2024 17:11:16 +0530 Subject: [PATCH] [mob][auth] Extract strings --- auth/lib/l10n/arb/app_en.arb | 13 ++++++- .../lock_screen/lock_screen_auto_lock.dart | 7 ++-- .../lock_screen_confirm_password.dart | 7 ++-- .../lock_screen/lock_screen_confirm_pin.dart | 3 +- .../lock_screen/lock_screen_password.dart | 9 ++--- .../ui/settings/security_section_widget.dart | 10 +++--- auth/lib/ui/tools/lock_screen.dart | 8 ++--- .../ui/two_factor_authentication_page.dart | 11 ------ auth/pubspec.lock | 36 +++++++++++++++++-- 9 files changed, 70 insertions(+), 34 deletions(-) diff --git a/auth/lib/l10n/arb/app_en.arb b/auth/lib/l10n/arb/app_en.arb index 1ef825f3f8..c7010cf14b 100644 --- a/auth/lib/l10n/arb/app_en.arb +++ b/auth/lib/l10n/arb/app_en.arb @@ -445,5 +445,16 @@ "updateNotAvailable": "Update not available", "viewRawCodes": "View raw codes", "rawCodes": "Raw codes", - "rawCodeData": "Raw code data" + "rawCodeData": "Raw code data", + "appLock": "App lock", + "noSystemLockFound": "No system lock found", + "toEnableAppLockPleaseSetupDevicePasscodeOrScreen": "To enable app lock, please setup device passcode or screen lock in your system settings.", + "autoLock": "Auto lock", + "immediately": "Immediately", + "reEnterPassword": "Re-enter password", + "reEnterPin": "Re-enter PIN", + "next": "Next", + "tooManyIncorrectAttempts": "Too many incorrect attempts", + "tapToUnlock": "Tap to unlock", + "setNewPassword": "Set new password" } \ No newline at end of file diff --git a/auth/lib/ui/settings/lock_screen/lock_screen_auto_lock.dart b/auth/lib/ui/settings/lock_screen/lock_screen_auto_lock.dart index 0f0bc8b708..869bb1e40a 100644 --- a/auth/lib/ui/settings/lock_screen/lock_screen_auto_lock.dart +++ b/auth/lib/ui/settings/lock_screen/lock_screen_auto_lock.dart @@ -1,3 +1,4 @@ +import 'package:ente_auth/l10n/l10n.dart'; import 'package:ente_auth/theme/ente_theme.dart'; import 'package:ente_auth/ui/components/captioned_text_widget.dart'; import 'package:ente_auth/ui/components/divider_widget.dart'; @@ -22,9 +23,9 @@ class _LockScreenAutoLockState extends State { body: CustomScrollView( primary: false, slivers: [ - const TitleBarWidget( + TitleBarWidget( flexibleSpaceTitle: TitleBarTitleWidget( - title: "Auto lock", + title: context.l10n.autoLock, ), ), SliverList( @@ -136,7 +137,7 @@ class _AutoLockItemsState extends State { } else if (duration.inSeconds != 0) { return "${duration.inSeconds}s"; } else { - return "Immediately"; + return context.l10n.immediately; } } } diff --git a/auth/lib/ui/settings/lock_screen/lock_screen_confirm_password.dart b/auth/lib/ui/settings/lock_screen/lock_screen_confirm_password.dart index c24d35391d..dee6fd2db9 100644 --- a/auth/lib/ui/settings/lock_screen/lock_screen_confirm_password.dart +++ b/auth/lib/ui/settings/lock_screen/lock_screen_confirm_password.dart @@ -1,3 +1,4 @@ +import "package:ente_auth/l10n/l10n.dart"; import "package:ente_auth/theme/ente_theme.dart"; import "package:ente_auth/ui/common/dynamic_fab.dart"; import "package:ente_auth/ui/components/buttons/icon_button_widget.dart"; @@ -87,7 +88,7 @@ class _LockScreenConfirmPasswordState extends State { builder: (context, isFormValid, child) { return DynamicFAB( isKeypadOpen: isKeypadOpen, - buttonText: "Confirm", + buttonText: context.l10n.confirm, isFormValid: isFormValid, onPressedFunction: () async { _submitNotifier.value = !_submitNotifier.value; @@ -152,14 +153,14 @@ class _LockScreenConfirmPasswordState extends State { ), ), Text( - "Re-enter Password", + context.l10n.reEnterPassword, style: textTheme.bodyBold, ), const Padding(padding: EdgeInsets.all(12)), Padding( padding: const EdgeInsets.symmetric(horizontal: 16), child: TextInputWidget( - hintText: "Confirm Password", + hintText: context.l10n.confirmPassword, autoFocus: true, textCapitalization: TextCapitalization.none, isPasswordInput: true, diff --git a/auth/lib/ui/settings/lock_screen/lock_screen_confirm_pin.dart b/auth/lib/ui/settings/lock_screen/lock_screen_confirm_pin.dart index 77a2c155fc..5ed7c48796 100644 --- a/auth/lib/ui/settings/lock_screen/lock_screen_confirm_pin.dart +++ b/auth/lib/ui/settings/lock_screen/lock_screen_confirm_pin.dart @@ -1,5 +1,6 @@ import "dart:io"; +import "package:ente_auth/l10n/l10n.dart"; import "package:ente_auth/theme/ente_theme.dart"; import "package:ente_auth/ui/settings/lock_screen/custom_pin_keypad.dart"; import "package:ente_auth/utils/lock_screen_settings.dart"; @@ -158,7 +159,7 @@ class _LockScreenConfirmPinState extends State { ), ), Text( - "Re-enter PIN", + context.l10n.reEnterPin, style: textTheme.bodyBold, ), const Padding(padding: EdgeInsets.all(12)), diff --git a/auth/lib/ui/settings/lock_screen/lock_screen_password.dart b/auth/lib/ui/settings/lock_screen/lock_screen_password.dart index 5252a2def9..43a103523a 100644 --- a/auth/lib/ui/settings/lock_screen/lock_screen_password.dart +++ b/auth/lib/ui/settings/lock_screen/lock_screen_password.dart @@ -1,5 +1,6 @@ import "dart:convert"; +import "package:ente_auth/l10n/l10n.dart"; import "package:ente_auth/theme/ente_theme.dart"; import "package:ente_auth/ui/common/dynamic_fab.dart"; import "package:ente_auth/ui/components/buttons/icon_button_widget.dart"; @@ -98,7 +99,7 @@ class _LockScreenPasswordState extends State { builder: (context, isFormValid, child) { return DynamicFAB( isKeypadOpen: isKeypadOpen, - buttonText: "Next", + buttonText: context.l10n.next, isFormValid: isFormValid, onPressedFunction: () async { _submitNotifier.value = !_submitNotifier.value; @@ -164,8 +165,8 @@ class _LockScreenPasswordState extends State { ), Text( widget.isChangingLockScreenSettings - ? "Enter Password" - : "Set new Password", + ? context.l10n.enterPassword + : context.l10n.setNewPassword, textAlign: TextAlign.center, style: textTheme.bodyBold, ), @@ -173,7 +174,7 @@ class _LockScreenPasswordState extends State { Padding( padding: const EdgeInsets.symmetric(horizontal: 16), child: TextInputWidget( - hintText: "Password", + hintText: context.l10n.password, autoFocus: true, textCapitalization: TextCapitalization.none, isPasswordInput: true, diff --git a/auth/lib/ui/settings/security_section_widget.dart b/auth/lib/ui/settings/security_section_widget.dart index 8fa3249bf5..b98c59d7d8 100644 --- a/auth/lib/ui/settings/security_section_widget.dart +++ b/auth/lib/ui/settings/security_section_widget.dart @@ -137,8 +137,8 @@ class _SecuritySectionWidgetState extends State { } children.addAll([ MenuItemWidget( - captionedTextWidget: const CaptionedTextWidget( - title: "App lock", + captionedTextWidget: CaptionedTextWidget( + title: context.l10n.appLock, ), trailingIcon: Icons.chevron_right_outlined, trailingIconIsMuted: true, @@ -146,7 +146,7 @@ class _SecuritySectionWidgetState extends State { if (await LocalAuthentication().isDeviceSupported()) { final bool result = await requestAuthentication( context, - "Please authenticate to change lockscreen setting", + context.l10n.authToChangeLockscreenSetting, ); if (result) { await Navigator.of(context).push( @@ -160,8 +160,8 @@ class _SecuritySectionWidgetState extends State { } else { await showErrorDialog( context, - "No system lock found", - "To enable app lock, please setup device passcode or screen lock in your system settings.", + context.l10n.noSystemLockFound, + context.l10n.toEnableAppLockPleaseSetupDevicePasscodeOrScreen, ); } }, diff --git a/auth/lib/ui/tools/lock_screen.dart b/auth/lib/ui/tools/lock_screen.dart index fcacea8231..a77ba6d155 100644 --- a/auth/lib/ui/tools/lock_screen.dart +++ b/auth/lib/ui/tools/lock_screen.dart @@ -149,7 +149,7 @@ class _LockScreenState extends State with WidgetsBindingObserver { alignment: Alignment.center, children: [ Text( - "Too many incorrect attempts", + context.l10n.tooManyIncorrectAttempts, style: textTheme.small, ) .animate( @@ -175,7 +175,7 @@ class _LockScreenState extends State with WidgetsBindingObserver { : GestureDetector( onTap: () => _showLockScreen(source: "tap"), child: Text( - "Tap to unlock", + context.l10n.tapToUnlock, style: textTheme.small, ), ), @@ -201,8 +201,8 @@ class _LockScreenState extends State with WidgetsBindingObserver { void _onLogoutTapped(BuildContext context) { showChoiceActionSheet( context, - title: "Are you sure you want to logout?", - firstButtonLabel: "Yes, logout", + title: context.l10n.areYouSureYouWantToLogout, + firstButtonLabel: context.l10n.yesLogout, isCritical: true, firstButtonOnTap: () async { await UserService.instance.logout(context); diff --git a/auth/lib/ui/two_factor_authentication_page.dart b/auth/lib/ui/two_factor_authentication_page.dart index 14b352a95f..86dfa503e9 100644 --- a/auth/lib/ui/two_factor_authentication_page.dart +++ b/auth/lib/ui/two_factor_authentication_page.dart @@ -102,10 +102,6 @@ class _TwoFactorAuthenticationPageState ), ), ), - // submittedFieldDecoration: _pinPutDecoration.copyWith( - // borderRadius: BorderRadius.circular(20.0), - // ), - // selectedFieldDecoration: _pinPutDecoration, defaultPinTheme: _pinPutDecoration, followingPinTheme: _pinPutDecoration.copyWith( decoration: BoxDecoration( @@ -115,13 +111,6 @@ class _TwoFactorAuthenticationPageState ), ), ), - // followingFieldDecoration: _pinPutDecoration.copyWith( - // borderRadius: BorderRadius.circular(5.0), - // border: Border.all( - // color: const Color.fromRGBO(45, 194, 98, 0.5), - // ), - // ), - autofocus: true, ), ), diff --git a/auth/pubspec.lock b/auth/pubspec.lock index 99f3295f5f..8d3705ac5f 100644 --- a/auth/pubspec.lock +++ b/auth/pubspec.lock @@ -440,6 +440,14 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_animate: + dependency: "direct main" + description: + name: flutter_animate + sha256: "7c8a6594a9252dad30cc2ef16e33270b6248c4dedc3b3d06c86c4f3f4dc05ae5" + url: "https://pub.dev" + source: hosted + version: "4.5.0" flutter_bloc: dependency: "direct main" description: @@ -639,6 +647,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.1.2" + flutter_shaders: + dependency: transitive + description: + name: flutter_shaders + sha256: "02750b545c01ff4d8e9bbe8f27a7731aa3778402506c67daa1de7f5fc3f4befe" + url: "https://pub.dev" + source: hosted + version: "0.1.2" flutter_slidable: dependency: "direct main" description: @@ -1133,10 +1149,10 @@ packages: dependency: "direct main" description: name: pinput - sha256: "27eb69042f75755bdb6544f6e79a50a6ed09d6e97e2d75c8421744df1e392949" + sha256: "543da5bfdefd9e06914a12100f8c9156f84cef3efc14bca507c49e966c5b813b" url: "https://pub.dev" source: hosted - version: "1.2.2" + version: "2.3.0" platform: dependency: transitive description: @@ -1358,6 +1374,14 @@ packages: description: flutter source: sdk version: "0.0.99" + smart_auth: + dependency: transitive + description: + name: smart_auth + sha256: a25229b38c02f733d0a4e98d941b42bed91a976cb589e934895e60ccfa674cf6 + url: "https://pub.dev" + source: hosted + version: "1.1.1" sodium: dependency: transitive description: @@ -1575,6 +1599,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.2.2" + universal_platform: + dependency: transitive + description: + name: universal_platform + sha256: "64e16458a0ea9b99260ceb5467a214c1f298d647c659af1bff6d3bf82536b1ec" + url: "https://pub.dev" + source: hosted + version: "1.1.0" url_launcher: dependency: "direct main" description: