From c45b49c0edefc600bebef4f316deb0d19f47fc85 Mon Sep 17 00:00:00 2001 From: Tyler-Larkin Date: Thu, 15 May 2025 14:28:22 -0700 Subject: [PATCH 01/15] chore(worker_bee): pinned analyzer version --- packages/worker_bee/worker_bee_builder/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/worker_bee/worker_bee_builder/pubspec.yaml b/packages/worker_bee/worker_bee_builder/pubspec.yaml index aef5122385..68997ba675 100644 --- a/packages/worker_bee/worker_bee_builder/pubspec.yaml +++ b/packages/worker_bee/worker_bee_builder/pubspec.yaml @@ -9,7 +9,7 @@ environment: sdk: ^3.7.0 dependencies: - analyzer: ^7.3.0 + analyzer: ">=7.3.0 <7.4.0" async: ^2.10.0 build: ^2.2.1 code_builder: ^4.10.1 From 748534c4d0450cbbb2487d6efaf89a2e7598b38b Mon Sep 17 00:00:00 2001 From: Ekjot <43255916+ekjotmultani@users.noreply.github.com> Date: Tue, 20 May 2025 09:56:59 -0700 Subject: [PATCH 02/15] test comment --- .../example/integration_test/sign_in_mfa_sms_email_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_sms_email_test.dart b/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_sms_email_test.dart index 9ecc0cde14..c2499c09e4 100644 --- a/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_sms_email_test.dart +++ b/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_sms_email_test.dart @@ -19,7 +19,7 @@ void main() { // Scenario: Sign in using a totp code when both SMS and EMAIL are enabled // Note: When email and sms are both enabled, // one of them must be selected as preferred. - // This is different from other mfa methods and + // This is different from other mfa methods and abcd // is expected behavior from cognito testWidgets('can select EMAIL MFA', (tester) async { final username = env.generateUsername(); From f29b92d751f40a8b3c7ec5308ebcd38af5992177 Mon Sep 17 00:00:00 2001 From: Ekjot <43255916+ekjotmultani@users.noreply.github.com> Date: Tue, 20 May 2025 12:36:50 -0700 Subject: [PATCH 03/15] test --- .../example/integration_test/sign_in_mfa_sms_email_test.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_sms_email_test.dart b/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_sms_email_test.dart index c2499c09e4..289317fa36 100644 --- a/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_sms_email_test.dart +++ b/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_sms_email_test.dart @@ -37,6 +37,8 @@ void main() { }, ); + generateEmail(); + await loadAuthenticator(tester: tester); expect( From 845a546d44fb3ad648a9b62852f420aa9a4cc6f5 Mon Sep 17 00:00:00 2001 From: Ekjot <43255916+ekjotmultani@users.noreply.github.com> Date: Tue, 20 May 2025 12:45:49 -0700 Subject: [PATCH 04/15] change --- .../example/integration_test/sign_in_mfa_sms_email_test.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_sms_email_test.dart b/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_sms_email_test.dart index 289317fa36..73fa9a256e 100644 --- a/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_sms_email_test.dart +++ b/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_sms_email_test.dart @@ -37,8 +37,6 @@ void main() { }, ); - generateEmail(); - await loadAuthenticator(tester: tester); expect( @@ -119,7 +117,7 @@ void main() { }); // Scenario: Sign in using a SMS code when both SMS and TOTP are enabled - testWidgets('can select SMS MFA', (tester) async { + testWidgets('can select SMS TOTP MFA', (tester) async { final username = env.generateUsername(); final password = generatePassword(); final phoneNumber = generateUSPhoneNumber(); From d6d978fff458a0e8eed78cf87f5fd07cf69278cb Mon Sep 17 00:00:00 2001 From: Ekjot <43255916+ekjotmultani@users.noreply.github.com> Date: Tue, 20 May 2025 12:49:37 -0700 Subject: [PATCH 05/15] asdf --- .../example/integration_test/sign_in_mfa_sms_email_test.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_sms_email_test.dart b/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_sms_email_test.dart index 73fa9a256e..e7d805de96 100644 --- a/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_sms_email_test.dart +++ b/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_sms_email_test.dart @@ -15,6 +15,9 @@ void main() { testRunner.setupTests(); group('sign-in-sms-totp-mfa', () { + for (final mfaRequiredEmailSms in [true, false]) { + print(mfaRequiredEmailSms); + } testRunner.withEnvironment(mfaRequiredEmailSms, (env) { // Scenario: Sign in using a totp code when both SMS and EMAIL are enabled // Note: When email and sms are both enabled, From 18ed80dc240f93ff28255f2a5c4b9de5149cd08f Mon Sep 17 00:00:00 2001 From: Ekjot <43255916+ekjotmultani@users.noreply.github.com> Date: Tue, 20 May 2025 12:57:11 -0700 Subject: [PATCH 06/15] added test print statement --- .../integration_test/sign_in_mfa_sms_email_test.dart | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_sms_email_test.dart b/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_sms_email_test.dart index e7d805de96..ea8e10721d 100644 --- a/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_sms_email_test.dart +++ b/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_sms_email_test.dart @@ -15,9 +15,7 @@ void main() { testRunner.setupTests(); group('sign-in-sms-totp-mfa', () { - for (final mfaRequiredEmailSms in [true, false]) { - print(mfaRequiredEmailSms); - } + testRunner.withEnvironment(mfaRequiredEmailSms, (env) { // Scenario: Sign in using a totp code when both SMS and EMAIL are enabled // Note: When email and sms are both enabled, @@ -61,7 +59,7 @@ void main() { final smsResult = await getOtpCode( UserAttribute.phone(phoneNumber.toE164()), ); - + print("abcd"); // When I type my "username" await signInPage.enterUsername(username); From e79cf4c6d84951ef7f29f06d9c9f5a998b0cea79 Mon Sep 17 00:00:00 2001 From: Ekjot <43255916+ekjotmultani@users.noreply.github.com> Date: Tue, 20 May 2025 13:01:01 -0700 Subject: [PATCH 07/15] changed to single quotes --- .../example/integration_test/sign_in_mfa_sms_email_test.dart | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_sms_email_test.dart b/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_sms_email_test.dart index ea8e10721d..affbfe1eff 100644 --- a/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_sms_email_test.dart +++ b/packages/authenticator/amplify_authenticator/example/integration_test/sign_in_mfa_sms_email_test.dart @@ -15,7 +15,6 @@ void main() { testRunner.setupTests(); group('sign-in-sms-totp-mfa', () { - testRunner.withEnvironment(mfaRequiredEmailSms, (env) { // Scenario: Sign in using a totp code when both SMS and EMAIL are enabled // Note: When email and sms are both enabled, @@ -59,7 +58,7 @@ void main() { final smsResult = await getOtpCode( UserAttribute.phone(phoneNumber.toE164()), ); - print("abcd"); + print('abcd'); // When I type my "username" await signInPage.enterUsername(username); From 6060276b2e2fa0bab6b0d7769950885055d92928 Mon Sep 17 00:00:00 2001 From: Ekjot <43255916+ekjotmultani@users.noreply.github.com> Date: Tue, 20 May 2025 16:12:29 -0700 Subject: [PATCH 08/15] updated TabBarTheme to TabBarThemeData to enable test --- .../amplify_authenticator/test/ui/main_test.dart | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/authenticator/amplify_authenticator/test/ui/main_test.dart b/packages/authenticator/amplify_authenticator/test/ui/main_test.dart index c332f502e1..1f22642562 100644 --- a/packages/authenticator/amplify_authenticator/test/ui/main_test.dart +++ b/packages/authenticator/amplify_authenticator/test/ui/main_test.dart @@ -80,11 +80,10 @@ enum TestTheme { primarySwatch: Colors.red, backgroundColor: Colors.white, ), - ).copyWith(indicatorColor: Colors.red); + ).copyWith(tabBarTheme: const TabBarThemeData(indicatorColor: Colors.red)); case TestTheme.custom: return ThemeData.light().copyWith( - tabBarTheme: const TabBarTheme(labelColor: Colors.amber), - indicatorColor: Colors.pink, + tabBarTheme: const TabBarThemeData(labelColor: Colors.amber), ); } } @@ -109,8 +108,7 @@ enum TestTheme { ); case TestTheme.custom: return ThemeData.dark().copyWith( - tabBarTheme: const TabBarTheme(labelColor: Colors.amber), - indicatorColor: Colors.pink, + tabBarTheme: const TabBarThemeData(labelColor: Colors.amber), ); } } From 708b4398b9b83bb42611320c06313a5b3d851308 Mon Sep 17 00:00:00 2001 From: Ekjot <43255916+ekjotmultani@users.noreply.github.com> Date: Tue, 20 May 2025 16:31:15 -0700 Subject: [PATCH 09/15] formatting --- .../amplify_authenticator/test/ui/main_test.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/authenticator/amplify_authenticator/test/ui/main_test.dart b/packages/authenticator/amplify_authenticator/test/ui/main_test.dart index 1f22642562..83e1d65be3 100644 --- a/packages/authenticator/amplify_authenticator/test/ui/main_test.dart +++ b/packages/authenticator/amplify_authenticator/test/ui/main_test.dart @@ -80,7 +80,9 @@ enum TestTheme { primarySwatch: Colors.red, backgroundColor: Colors.white, ), - ).copyWith(tabBarTheme: const TabBarThemeData(indicatorColor: Colors.red)); + ).copyWith( + tabBarTheme: const TabBarThemeData(indicatorColor: Colors.red), + ); case TestTheme.custom: return ThemeData.light().copyWith( tabBarTheme: const TabBarThemeData(labelColor: Colors.amber), From 720857da0fa62a66da2d8a98f85d16b913c0fadf Mon Sep 17 00:00:00 2001 From: Ekjot <43255916+ekjotmultani@users.noreply.github.com> Date: Tue, 20 May 2025 16:52:29 -0700 Subject: [PATCH 10/15] fixed flutter breaking change https://docs.flutter.dev/release/breaking-changes/flutter-generate-i10n-source --- packages/authenticator/amplify_authenticator/example/l10n.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/authenticator/amplify_authenticator/example/l10n.yaml b/packages/authenticator/amplify_authenticator/example/l10n.yaml index 1370f13145..815f2aa87f 100644 --- a/packages/authenticator/amplify_authenticator/example/l10n.yaml +++ b/packages/authenticator/amplify_authenticator/example/l10n.yaml @@ -1,6 +1,7 @@ arb-dir: lib/l10n template-arb-file: amplify_en.arb output-localization-file: app_localizations.dart +synthetic-package: false # To make use of Authenticator enums header: import 'package:amplify_authenticator/amplify_authenticator.dart'; From 122edf4fff095ffb58f6ed8c917d3fef389cd209 Mon Sep 17 00:00:00 2001 From: Ekjot <43255916+ekjotmultani@users.noreply.github.com> Date: Wed, 21 May 2025 10:08:35 -0700 Subject: [PATCH 11/15] removed localizations to proceed with fixing authenticator mfa test --- .../amplify_authenticator/example/lib/main.dart | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/packages/authenticator/amplify_authenticator/example/lib/main.dart b/packages/authenticator/amplify_authenticator/example/lib/main.dart index 35e0a714a1..6fb92e53cc 100644 --- a/packages/authenticator/amplify_authenticator/example/lib/main.dart +++ b/packages/authenticator/amplify_authenticator/example/lib/main.dart @@ -9,7 +9,6 @@ import 'package:amplify_authenticator_example/resolvers/localized_input_resolver import 'package:amplify_authenticator_example/resolvers/localized_title_resolver.dart'; import 'package:amplify_flutter/amplify_flutter.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'amplifyconfiguration.dart'; @@ -131,15 +130,6 @@ class _MyAppState extends State { themeMode: ThemeMode.system, debugShowCheckedModeBanner: false, - // These lines enable our custom localizations specified in the lib/l10n - // directory, which will be used later to customize the values displayed - // in the Authenticator component. - localizationsDelegates: const [AppLocalizations.delegate], - supportedLocales: const [ - Locale('en'), // English - Locale('es'), // Spanish - ], - // The Authenticator component must wrap your Navigator component which // can be done using the `builder` method. builder: Authenticator.builder(), From 794d38be3bb2672de412eb3ac1ecab43e44f7643 Mon Sep 17 00:00:00 2001 From: Ekjot <43255916+ekjotmultani@users.noreply.github.com> Date: Wed, 21 May 2025 10:31:48 -0700 Subject: [PATCH 12/15] followed migration guide for localizations from flutter gen --- .../example/lib/l10n/app_localizations.dart | 248 ++++++++++++++++++ .../lib/l10n/app_localizations_en.dart | 91 +++++++ .../lib/l10n/app_localizations_es.dart | 91 +++++++ .../example/lib/main.dart | 11 + .../resolvers/localized_button_resolver.dart | 1 + .../localized_dial_code_resolver.dart | 1 + .../resolvers/localized_title_resolver.dart | 1 + .../example/pubspec.yaml | 1 + 8 files changed, 445 insertions(+) create mode 100644 packages/authenticator/amplify_authenticator/example/lib/l10n/app_localizations.dart create mode 100644 packages/authenticator/amplify_authenticator/example/lib/l10n/app_localizations_en.dart create mode 100644 packages/authenticator/amplify_authenticator/example/lib/l10n/app_localizations_es.dart diff --git a/packages/authenticator/amplify_authenticator/example/lib/l10n/app_localizations.dart b/packages/authenticator/amplify_authenticator/example/lib/l10n/app_localizations.dart new file mode 100644 index 0000000000..3f31b9d632 --- /dev/null +++ b/packages/authenticator/amplify_authenticator/example/lib/l10n/app_localizations.dart @@ -0,0 +1,248 @@ +import 'dart:async'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:intl/intl.dart' as intl; + +import 'app_localizations_en.dart'; +import 'app_localizations_es.dart'; + +// ignore_for_file: type=lint + +/// Callers can lookup localized strings with an instance of AppLocalizations +/// returned by `AppLocalizations.of(context)`. +/// +/// Applications need to include `AppLocalizations.delegate()` in their app's +/// `localizationDelegates` list, and the locales they support in the app's +/// `supportedLocales` list. For example: +/// +/// ```dart +/// import 'l10n/app_localizations.dart'; +/// +/// return MaterialApp( +/// localizationsDelegates: AppLocalizations.localizationsDelegates, +/// supportedLocales: AppLocalizations.supportedLocales, +/// home: MyApplicationHome(), +/// ); +/// ``` +/// +/// ## Update pubspec.yaml +/// +/// Please make sure to update your pubspec.yaml to include the following +/// packages: +/// +/// ```yaml +/// dependencies: +/// # Internationalization support. +/// flutter_localizations: +/// sdk: flutter +/// intl: any # Use the pinned version from flutter_localizations +/// +/// # Rest of dependencies +/// ``` +/// +/// ## iOS Applications +/// +/// iOS applications define key application metadata, including supported +/// locales, in an Info.plist file that is built into the application bundle. +/// To configure the locales supported by your app, you’ll need to edit this +/// file. +/// +/// First, open your project’s ios/Runner.xcworkspace Xcode workspace file. +/// Then, in the Project Navigator, open the Info.plist file under the Runner +/// project’s Runner folder. +/// +/// Next, select the Information Property List item, select Add Item from the +/// Editor menu, then select Localizations from the pop-up menu. +/// +/// Select and expand the newly-created Localizations item then, for each +/// locale your application supports, add a new item and select the locale +/// you wish to add from the pop-up menu in the Value field. This list should +/// be consistent with the languages listed in the AppLocalizations.supportedLocales +/// property. +abstract class AppLocalizations { + AppLocalizations(String locale) + : localeName = intl.Intl.canonicalizedLocale(locale.toString()); + + final String localeName; + + static AppLocalizations of(BuildContext context) { + return Localizations.of(context, AppLocalizations)!; + } + + static const LocalizationsDelegate delegate = + _AppLocalizationsDelegate(); + + /// A list of this localizations delegate along with the default localizations + /// delegates. + /// + /// Returns a list of localizations delegates containing this delegate along with + /// GlobalMaterialLocalizations.delegate, GlobalCupertinoLocalizations.delegate, + /// and GlobalWidgetsLocalizations.delegate. + /// + /// Additional delegates can be added by appending to this list in + /// MaterialApp. This list does not have to be used at all if a custom list + /// of delegates is preferred or required. + static const List> localizationsDelegates = + >[ + delegate, + GlobalMaterialLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ]; + + /// A list of this localizations delegate's supported locales. + static const List supportedLocales = [ + Locale('en'), + Locale('es'), + ]; + + /// Label of the button to sign in the user. + /// + /// In en, this message translates to: + /// **'Sign In'** + String get signIn; + + /// Label of the button to sign up the user. + /// + /// In en, this message translates to: + /// **'Create Account'** + String get signUp; + + /// Label of button to confirm an action + /// + /// In en, this message translates to: + /// **'Confirm'** + String get confirm; + + /// Label of button to submit a form + /// + /// In en, this message translates to: + /// **'Submit'** + String get submit; + + /// Label of button to change a password + /// + /// In en, this message translates to: + /// **'Change Password'** + String get changePassword; + + /// Label of button to send a verification code to the user's device + /// + /// In en, this message translates to: + /// **'Send Code'** + String get sendCode; + + /// Label of button prompting user if they've not received or have misplaced a verification code we sent + /// + /// In en, this message translates to: + /// **'Lost your code?'** + String get lostCode; + + /// Hint text for the 'Go to Sign Up' button + /// + /// In en, this message translates to: + /// **'No account?'** + String get noAccount; + + /// Hint text for the 'Go to Sign In' button + /// + /// In en, this message translates to: + /// **'Have an account?'** + String get haveAccount; + + /// Hint text for the 'Reset Password' button + /// + /// In en, this message translates to: + /// **'Forgot your password?'** + String get forgotPassword; + + /// Label of button to confirm the reset of a user's password + /// + /// In en, this message translates to: + /// **'Reset Password'** + String get confirmResetPassword; + + /// Label of button to verify a user's attribute, such as their email or phone number + /// + /// In en, this message translates to: + /// **'Verify'** + String get verify; + + /// Label of button to skip the current step or action. + /// + /// In en, this message translates to: + /// **'Skip'** + String get skip; + + /// Label of button to sign out the user + /// + /// In en, this message translates to: + /// **'Sign Out'** + String get signOut; + + /// Label of button to return to the previous step + /// + /// In en, this message translates to: + /// **'Back to {previousStep, select, signUp{Sign Up} signIn{Sign In} confirmSignUp{Confirm Sign-up} confirmSignInMfa{Confirm Sign-in} confirmSignInNewPassword{Confirm Sign-in} sendCode{Send Code} resetPassword{Reset Password} verifyUser{Verify User} confirmVerifyUser{Confirm Verify User} other{ERROR}}'** + String backTo(String previousStep); + + /// Label of button to sign in with a social provider + /// + /// In en, this message translates to: + /// **'Sign In with {provider, select, google{Google} facebook{Facebook} amazon{Amazon} apple{Apple} other{ERROR}}'** + String signInWith(String provider); + + /// Label of the us + /// + /// In en, this message translates to: + /// **'United States'** + String get us; + + /// Label of the dial code selector modal + /// + /// In en, this message translates to: + /// **'Select country'** + String get selectDialCode; + + /// Label of the custom auth confirm sign in form + /// + /// In en, this message translates to: + /// **'Custom Login Challenge'** + String get confirmSignInCustomAuth; +} + +class _AppLocalizationsDelegate + extends LocalizationsDelegate { + const _AppLocalizationsDelegate(); + + @override + Future load(Locale locale) { + return SynchronousFuture(lookupAppLocalizations(locale)); + } + + @override + bool isSupported(Locale locale) => + ['en', 'es'].contains(locale.languageCode); + + @override + bool shouldReload(_AppLocalizationsDelegate old) => false; +} + +AppLocalizations lookupAppLocalizations(Locale locale) { + // Lookup logic when only language code is specified. + switch (locale.languageCode) { + case 'en': + return AppLocalizationsEn(); + case 'es': + return AppLocalizationsEs(); + } + + throw FlutterError( + 'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely ' + 'an issue with the localizations generation tool. Please file an issue ' + 'on GitHub with a reproducible sample app and the gen-l10n configuration ' + 'that was used.', + ); +} diff --git a/packages/authenticator/amplify_authenticator/example/lib/l10n/app_localizations_en.dart b/packages/authenticator/amplify_authenticator/example/lib/l10n/app_localizations_en.dart new file mode 100644 index 0000000000..6fce8cc2ef --- /dev/null +++ b/packages/authenticator/amplify_authenticator/example/lib/l10n/app_localizations_en.dart @@ -0,0 +1,91 @@ +// ignore: unused_import +import 'package:intl/intl.dart' as intl; + +import 'app_localizations.dart'; + +// ignore_for_file: type=lint + +/// The translations for English (`en`). +class AppLocalizationsEn extends AppLocalizations { + AppLocalizationsEn([String locale = 'en']) : super(locale); + + @override + String get signIn => 'Sign In'; + + @override + String get signUp => 'Create Account'; + + @override + String get confirm => 'Confirm'; + + @override + String get submit => 'Submit'; + + @override + String get changePassword => 'Change Password'; + + @override + String get sendCode => 'Send Code'; + + @override + String get lostCode => 'Lost your code?'; + + @override + String get noAccount => 'No account?'; + + @override + String get haveAccount => 'Have an account?'; + + @override + String get forgotPassword => 'Forgot your password?'; + + @override + String get confirmResetPassword => 'Reset Password'; + + @override + String get verify => 'Verify'; + + @override + String get skip => 'Skip'; + + @override + String get signOut => 'Sign Out'; + + @override + String backTo(String previousStep) { + String _temp0 = intl.Intl.selectLogic(previousStep, { + 'signUp': 'Sign Up', + 'signIn': 'Sign In', + 'confirmSignUp': 'Confirm Sign-up', + 'confirmSignInMfa': 'Confirm Sign-in', + 'confirmSignInNewPassword': 'Confirm Sign-in', + 'sendCode': 'Send Code', + 'resetPassword': 'Reset Password', + 'verifyUser': 'Verify User', + 'confirmVerifyUser': 'Confirm Verify User', + 'other': 'ERROR', + }); + return 'Back to $_temp0'; + } + + @override + String signInWith(String provider) { + String _temp0 = intl.Intl.selectLogic(provider, { + 'google': 'Google', + 'facebook': 'Facebook', + 'amazon': 'Amazon', + 'apple': 'Apple', + 'other': 'ERROR', + }); + return 'Sign In with $_temp0'; + } + + @override + String get us => 'United States'; + + @override + String get selectDialCode => 'Select country'; + + @override + String get confirmSignInCustomAuth => 'Custom Login Challenge'; +} diff --git a/packages/authenticator/amplify_authenticator/example/lib/l10n/app_localizations_es.dart b/packages/authenticator/amplify_authenticator/example/lib/l10n/app_localizations_es.dart new file mode 100644 index 0000000000..bc5b79df91 --- /dev/null +++ b/packages/authenticator/amplify_authenticator/example/lib/l10n/app_localizations_es.dart @@ -0,0 +1,91 @@ +// ignore: unused_import +import 'package:intl/intl.dart' as intl; + +import 'app_localizations.dart'; + +// ignore_for_file: type=lint + +/// The translations for Spanish Castilian (`es`). +class AppLocalizationsEs extends AppLocalizations { + AppLocalizationsEs([String locale = 'es']) : super(locale); + + @override + String get signIn => 'Iniciar Sesión'; + + @override + String get signUp => 'Crear una Cuenta'; + + @override + String get confirm => 'Confirmar'; + + @override + String get submit => 'Enviar'; + + @override + String get changePassword => 'Cambiar contraseña'; + + @override + String get sendCode => 'Enviar Código'; + + @override + String get lostCode => '¿Perdiste su código?'; + + @override + String get noAccount => '¿Sin cuenta?'; + + @override + String get haveAccount => '¿Tiene una cuenta?'; + + @override + String get forgotPassword => '¿Olvidase?'; + + @override + String get confirmResetPassword => 'Restablecer su contraseña'; + + @override + String get verify => 'Verificar'; + + @override + String get skip => 'Omitir'; + + @override + String get signOut => 'Salir'; + + @override + String backTo(String previousStep) { + String _temp0 = intl.Intl.selectLogic(previousStep, { + 'signUp': 'registro', + 'signIn': 'inicio de sesión', + 'confirmSignUp': 'Confirmar registro', + 'confirmSignInMfa': 'Confirmar inicio de sesión', + 'confirmSignInNewPassword': 'Confirmar inicio de sesión', + 'sendCode': 'Enviar código', + 'resetPassword': 'Restablecer contraseña', + 'verifyUser': 'Verificar usuario', + 'confirmVerifyUser': 'Confirmar verificación de usuario', + 'other': 'ERROR', + }); + return 'Regresar al $_temp0'; + } + + @override + String signInWith(String provider) { + String _temp0 = intl.Intl.selectLogic(provider, { + 'google': 'Google', + 'facebook': 'Facebook', + 'amazon': 'Amazon', + 'apple': 'Apple', + 'other': 'ERROR', + }); + return 'Iniciar Sesión con $_temp0'; + } + + @override + String get us => 'Estados Unidos'; + + @override + String get selectDialCode => 'seleccionar país'; + + @override + String get confirmSignInCustomAuth => 'Título de formulario personalizado'; +} diff --git a/packages/authenticator/amplify_authenticator/example/lib/main.dart b/packages/authenticator/amplify_authenticator/example/lib/main.dart index 6fb92e53cc..395be11f34 100644 --- a/packages/authenticator/amplify_authenticator/example/lib/main.dart +++ b/packages/authenticator/amplify_authenticator/example/lib/main.dart @@ -3,12 +3,14 @@ import 'package:amplify_auth_cognito/amplify_auth_cognito.dart'; import 'package:amplify_authenticator/amplify_authenticator.dart'; +import 'package:amplify_authenticator_example/l10n/app_localizations.dart'; import 'package:amplify_authenticator_example/resolvers/localized_button_resolver.dart'; import 'package:amplify_authenticator_example/resolvers/localized_dial_code_resolver.dart'; import 'package:amplify_authenticator_example/resolvers/localized_input_resolver.dart'; import 'package:amplify_authenticator_example/resolvers/localized_title_resolver.dart'; import 'package:amplify_flutter/amplify_flutter.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'amplifyconfiguration.dart'; @@ -130,6 +132,15 @@ class _MyAppState extends State { themeMode: ThemeMode.system, debugShowCheckedModeBanner: false, + // These lines enable our custom localizations specified in the lib/l10n + // directory, which will be used later to customize the values displayed + // in the Authenticator component. + localizationsDelegates: const [AppLocalizations.delegate], + supportedLocales: const [ + Locale('en'), // English + Locale('es'), // Spanish + ], + // The Authenticator component must wrap your Navigator component which // can be done using the `builder` method. builder: Authenticator.builder(), diff --git a/packages/authenticator/amplify_authenticator/example/lib/resolvers/localized_button_resolver.dart b/packages/authenticator/amplify_authenticator/example/lib/resolvers/localized_button_resolver.dart index bdd106874a..44500483e5 100644 --- a/packages/authenticator/amplify_authenticator/example/lib/resolvers/localized_button_resolver.dart +++ b/packages/authenticator/amplify_authenticator/example/lib/resolvers/localized_button_resolver.dart @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import 'package:amplify_authenticator/amplify_authenticator.dart'; +import 'package:amplify_authenticator_example/l10n/app_localizations.dart'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; diff --git a/packages/authenticator/amplify_authenticator/example/lib/resolvers/localized_dial_code_resolver.dart b/packages/authenticator/amplify_authenticator/example/lib/resolvers/localized_dial_code_resolver.dart index 2a7449e8ed..eb7a2c6257 100644 --- a/packages/authenticator/amplify_authenticator/example/lib/resolvers/localized_dial_code_resolver.dart +++ b/packages/authenticator/amplify_authenticator/example/lib/resolvers/localized_dial_code_resolver.dart @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import 'package:amplify_authenticator/amplify_authenticator.dart'; +import 'package:amplify_authenticator_example/l10n/app_localizations.dart'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; diff --git a/packages/authenticator/amplify_authenticator/example/lib/resolvers/localized_title_resolver.dart b/packages/authenticator/amplify_authenticator/example/lib/resolvers/localized_title_resolver.dart index 792ca9780e..4ba2d4f852 100644 --- a/packages/authenticator/amplify_authenticator/example/lib/resolvers/localized_title_resolver.dart +++ b/packages/authenticator/amplify_authenticator/example/lib/resolvers/localized_title_resolver.dart @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import 'package:amplify_authenticator/amplify_authenticator.dart'; +import 'package:amplify_authenticator_example/l10n/app_localizations.dart'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; diff --git a/packages/authenticator/amplify_authenticator/example/pubspec.yaml b/packages/authenticator/amplify_authenticator/example/pubspec.yaml index 843b6bc2e7..a311dfdf49 100644 --- a/packages/authenticator/amplify_authenticator/example/pubspec.yaml +++ b/packages/authenticator/amplify_authenticator/example/pubspec.yaml @@ -33,6 +33,7 @@ dependencies: # # See https://flutter.dev/docs/development/accessibility-and-localization/internationalization # for more information. + flutter_gen: ^5.10.0 flutter_localizations: sdk: flutter From 452af1af556a8abc60a45b7aa0c4d69da63359dc Mon Sep 17 00:00:00 2001 From: Ekjot <43255916+ekjotmultani@users.noreply.github.com> Date: Wed, 21 May 2025 11:15:01 -0700 Subject: [PATCH 13/15] removed unused imports --- .../example/lib/l10n/app_localizations_en.dart | 1 + .../example/lib/l10n/app_localizations_es.dart | 1 + .../authenticator/amplify_authenticator/example/lib/main.dart | 1 - .../example/lib/resolvers/localized_button_resolver.dart | 1 - .../example/lib/resolvers/localized_dial_code_resolver.dart | 1 - .../example/lib/resolvers/localized_title_resolver.dart | 1 - 6 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/authenticator/amplify_authenticator/example/lib/l10n/app_localizations_en.dart b/packages/authenticator/amplify_authenticator/example/lib/l10n/app_localizations_en.dart index 6fce8cc2ef..3f3dd6094e 100644 --- a/packages/authenticator/amplify_authenticator/example/lib/l10n/app_localizations_en.dart +++ b/packages/authenticator/amplify_authenticator/example/lib/l10n/app_localizations_en.dart @@ -1,6 +1,7 @@ // ignore: unused_import import 'package:intl/intl.dart' as intl; +// ignore: unused_import import 'app_localizations.dart'; // ignore_for_file: type=lint diff --git a/packages/authenticator/amplify_authenticator/example/lib/l10n/app_localizations_es.dart b/packages/authenticator/amplify_authenticator/example/lib/l10n/app_localizations_es.dart index bc5b79df91..d88ac3f38c 100644 --- a/packages/authenticator/amplify_authenticator/example/lib/l10n/app_localizations_es.dart +++ b/packages/authenticator/amplify_authenticator/example/lib/l10n/app_localizations_es.dart @@ -1,6 +1,7 @@ // ignore: unused_import import 'package:intl/intl.dart' as intl; +// ignore: unused_import import 'app_localizations.dart'; // ignore_for_file: type=lint diff --git a/packages/authenticator/amplify_authenticator/example/lib/main.dart b/packages/authenticator/amplify_authenticator/example/lib/main.dart index 395be11f34..211a267dff 100644 --- a/packages/authenticator/amplify_authenticator/example/lib/main.dart +++ b/packages/authenticator/amplify_authenticator/example/lib/main.dart @@ -10,7 +10,6 @@ import 'package:amplify_authenticator_example/resolvers/localized_input_resolver import 'package:amplify_authenticator_example/resolvers/localized_title_resolver.dart'; import 'package:amplify_flutter/amplify_flutter.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'amplifyconfiguration.dart'; diff --git a/packages/authenticator/amplify_authenticator/example/lib/resolvers/localized_button_resolver.dart b/packages/authenticator/amplify_authenticator/example/lib/resolvers/localized_button_resolver.dart index 44500483e5..7dfe482c78 100644 --- a/packages/authenticator/amplify_authenticator/example/lib/resolvers/localized_button_resolver.dart +++ b/packages/authenticator/amplify_authenticator/example/lib/resolvers/localized_button_resolver.dart @@ -4,7 +4,6 @@ import 'package:amplify_authenticator/amplify_authenticator.dart'; import 'package:amplify_authenticator_example/l10n/app_localizations.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_gen/gen_l10n/app_localizations.dart'; /// Our custom button string resolver which calls into our localizations class. class LocalizedButtonResolver extends ButtonResolver { diff --git a/packages/authenticator/amplify_authenticator/example/lib/resolvers/localized_dial_code_resolver.dart b/packages/authenticator/amplify_authenticator/example/lib/resolvers/localized_dial_code_resolver.dart index eb7a2c6257..1d0c766843 100644 --- a/packages/authenticator/amplify_authenticator/example/lib/resolvers/localized_dial_code_resolver.dart +++ b/packages/authenticator/amplify_authenticator/example/lib/resolvers/localized_dial_code_resolver.dart @@ -4,7 +4,6 @@ import 'package:amplify_authenticator/amplify_authenticator.dart'; import 'package:amplify_authenticator_example/l10n/app_localizations.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_gen/gen_l10n/app_localizations.dart'; /// Our custom country string resolver which calls into our localizations class. diff --git a/packages/authenticator/amplify_authenticator/example/lib/resolvers/localized_title_resolver.dart b/packages/authenticator/amplify_authenticator/example/lib/resolvers/localized_title_resolver.dart index 4ba2d4f852..0f3aba89cc 100644 --- a/packages/authenticator/amplify_authenticator/example/lib/resolvers/localized_title_resolver.dart +++ b/packages/authenticator/amplify_authenticator/example/lib/resolvers/localized_title_resolver.dart @@ -4,7 +4,6 @@ import 'package:amplify_authenticator/amplify_authenticator.dart'; import 'package:amplify_authenticator_example/l10n/app_localizations.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_gen/gen_l10n/app_localizations.dart'; class LocalizedTitleResolver extends TitleResolver { const LocalizedTitleResolver(); From 5640857ef78583f31c3599a1917a5847dc14377f Mon Sep 17 00:00:00 2001 From: Ekjot <43255916+ekjotmultani@users.noreply.github.com> Date: Wed, 21 May 2025 11:20:23 -0700 Subject: [PATCH 14/15] further unused import cleanup --- .../example/lib/l10n/app_localizations.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/authenticator/amplify_authenticator/example/lib/l10n/app_localizations.dart b/packages/authenticator/amplify_authenticator/example/lib/l10n/app_localizations.dart index 3f31b9d632..6f859f18f1 100644 --- a/packages/authenticator/amplify_authenticator/example/lib/l10n/app_localizations.dart +++ b/packages/authenticator/amplify_authenticator/example/lib/l10n/app_localizations.dart @@ -5,6 +5,7 @@ import 'package:flutter/widgets.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:intl/intl.dart' as intl; +//ignore_for_file: unused_import import 'app_localizations_en.dart'; import 'app_localizations_es.dart'; From a8baa4f9a73886f84bf21fee77495946722bfa18 Mon Sep 17 00:00:00 2001 From: Ekjot <43255916+ekjotmultani@users.noreply.github.com> Date: Wed, 21 May 2025 11:39:45 -0700 Subject: [PATCH 15/15] updated yaml --- packages/authenticator/amplify_authenticator/example/l10n.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/authenticator/amplify_authenticator/example/l10n.yaml b/packages/authenticator/amplify_authenticator/example/l10n.yaml index 815f2aa87f..a1b111e959 100644 --- a/packages/authenticator/amplify_authenticator/example/l10n.yaml +++ b/packages/authenticator/amplify_authenticator/example/l10n.yaml @@ -4,6 +4,6 @@ output-localization-file: app_localizations.dart synthetic-package: false # To make use of Authenticator enums -header: import 'package:amplify_authenticator/amplify_authenticator.dart'; +#header: import 'package:amplify_authenticator/amplify_authenticator.dart'; nullable-getter: false