Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions lib/l10n/intl_en.arb → assets/translations/en-US.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
{
"error": "Error: {text}",
"@error": {
"description": "Gives the user an error explanation",
"placeholders": {
"text": {
"type": "String",
"example": "Something went wrong try again"
}
}
},
"error_button_ok": "Ok",
"error_button_retry": "Retry",
"error_no_internet_connection_error_description": "You have no internet connection",
Expand All @@ -20,4 +11,4 @@
"password": "Password",
"sign_in": "Sign In",
"xmartlabs_projects": "Xmartlabs' projects"
}
}
17 changes: 6 additions & 11 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,20 @@ lane :fetch_dependencies do
flutter_command(command: "pub get --suppress-analytics", subdirectory: "design_system/design_system_gallery")
end

desc "**Generate flutter generated code**"
desc "**Generate flutter generated code (includes build_runner and locale keys)**"
lane :build_autogenerated_code do
flutter_command(command: "pub run build_runner build --delete-conflicting-outputs")
generate_locale_keys
end

desc "**Lint: Check code format**"
lane :lint_format do
sh_on_root(command: "find lib -name '*.dart' ! -path 'lib/l10n/*' -print0 | xargs -0 fvm dart format -o none --set-exit-if-changed")
sh_on_root(command: "find lib -name '*.dart' ! -path 'lib/gen/*' -print0 | xargs -0 fvm dart format -o none --set-exit-if-changed")
end

desc "**Lint: Check code format**"
lane :lint_check_language_sorting do
current_content = sh_on_root(command: "cat lib/l10n/intl_en.arb")
sh_on_root(command: "arb_utils sort lib/l10n/intl_en.arb")
new_content = sh_on_root(command: "cat lib/l10n/intl_en.arb")
unless current_content == new_content
UI.user_error!("Language file is not sorted")
end
desc "**Generate locale keys from translations**"
lane :generate_locale_keys do
flutter_command(command: "pub run easy_localization:generate -S assets/translations -O lib/gen -f keys -o locale_keys.g.dart")
end

desc "**Lint: Analyze code**"
Expand All @@ -93,7 +89,6 @@ end
desc "**Run linters**"
lane :lints do
lint_format
lint_check_language_sorting
lint_analyze
lint_code_metrics
end
Expand Down
2 changes: 2 additions & 0 deletions integration_test/common/general_helpers.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_template/core/di/di_provider.dart';
import 'package:flutter_template/core/source/auth_remote_source.dart';
Expand All @@ -11,6 +12,7 @@ Future<void> commonSetup({
required MockAuthRemoteSource mockAuthRemoteSource,
required MockProjectRemoteSource mockProjectRemoteSource,
}) async {
await EasyLocalization.ensureInitialized();
await app.initSdks();

DiProvider.instance.unregister<AuthRemoteSource>();
Expand Down
39 changes: 26 additions & 13 deletions integration_test/test/signin_test.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_template/core/common/network_exceptions.dart';
import 'package:flutter_template/core/di/di_provider.dart';
import 'package:flutter_template/core/model/service/auth_models.dart';
import 'package:flutter_template/core/model/user.dart';
import 'package:flutter_template/gen/locale_keys.g.dart';
import 'package:flutter_template/main.dart' as app;
import 'package:flutter_template/ui/extensions/context_extensions.dart';
import 'package:flutter_template/ui/signin/signin_screen.dart';
import 'package:flutter_template/ui/welcome/welcome_screen.dart';
import 'package:integration_test/integration_test.dart';
import 'package:flutter_test/flutter_test.dart';
Expand Down Expand Up @@ -42,20 +42,26 @@ void main() {
),
);

await tester.pumpWidget(const app.MyApp());
await tester.pumpWidget(
EasyLocalization(
supportedLocales: const [Locale('en', 'US')],
path: 'assets/translations',
fallbackLocale: const Locale('en', 'US'),
child: const app.MyApp(),
),
);
await tester.pumpAndSettle();

final context = tester.contextOfType<SignInScreen>();
await tester.enterText(
find.widgetWithText(TextField, context.localizations.mail),
find.widgetWithText(TextField, LocaleKeys.mail.tr()),
email,
);
await tester.enterText(
find.widgetWithText(TextField, context.localizations.password),
find.widgetWithText(TextField, LocaleKeys.password.tr()),
password,
);
await tester.tap(
find.widgetWithText(TextButton, context.localizations.sign_in),
find.widgetWithText(TextButton, LocaleKeys.sign_in.tr()),
);
await tester.pumpAndSettle();
expect(find.byType(AlertDialog), findsOneWidget);
Expand All @@ -72,20 +78,27 @@ void main() {
when(() => mockProjectRemoteSource.getProjects())
.thenAnswer((_) => Future.value([]));

await tester.pumpWidget(const app.MyApp());
await tester.pumpWidget(
EasyLocalization(
supportedLocales: const [Locale('en', 'US')],
path: 'assets/translations',
fallbackLocale: const Locale('en', 'US'),
child: const app.MyApp(),
),
);
await tester.pumpAndSettle();

final context = tester.contextOfType<SignInScreen>();
await tester.enterText(
find.widgetWithText(TextField, context.localizations.mail),
find.widgetWithText(TextField, LocaleKeys.mail.tr()),
email,
);
await tester.enterText(
find.widgetWithText(TextField, context.localizations.password),
find.widgetWithText(TextField, LocaleKeys.password.tr()),
password,
);
await tester
.tap(find.widgetWithText(TextButton, context.localizations.sign_in));
await tester.tap(
find.widgetWithText(TextButton, LocaleKeys.sign_in.tr()),
);
await tester.pumpAndSettle();
expect(find.byType(WelcomeScreen), findsOneWidget);
});
Expand Down
24 changes: 12 additions & 12 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ PODS:
- Flutter
- flutter_secure_storage (6.0.0):
- Flutter
- flutter_web_browser (0.17.1):
- Flutter
- integration_test (0.0.1):
- Flutter
- path_provider_foundation (0.0.1):
Expand All @@ -17,16 +15,18 @@ PODS:
- sqflite (0.0.3):
- Flutter
- FlutterMacOS
- url_launcher_ios (0.0.1):
- Flutter

DEPENDENCIES:
- Flutter (from `Flutter`)
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
- flutter_web_browser (from `.symlinks/plugins/flutter_web_browser/ios`)
- integration_test (from `.symlinks/plugins/integration_test/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sqflite (from `.symlinks/plugins/sqflite/darwin`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)

EXTERNAL SOURCES:
Flutter:
Expand All @@ -35,8 +35,6 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/flutter_native_splash/ios"
flutter_secure_storage:
:path: ".symlinks/plugins/flutter_secure_storage/ios"
flutter_web_browser:
:path: ".symlinks/plugins/flutter_web_browser/ios"
integration_test:
:path: ".symlinks/plugins/integration_test/ios"
path_provider_foundation:
Expand All @@ -45,16 +43,18 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
sqflite:
:path: ".symlinks/plugins/sqflite/darwin"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"

SPEC CHECKSUMS:
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_native_splash: 35ddbc7228eafcb3969dcc5f1fbbe27c1145a4f0
flutter_secure_storage: 1ed9476fba7e7a782b22888f956cce43e2c62f13
flutter_web_browser: 8fe4d18e7b1328ab3fbec6e67029d6996c2335d9
integration_test: d5929033778cc4991a187e4e1a85396fa4f59b3a
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7
sqflite: c35dad70033b8862124f8337cc994a809fcd9fa3
flutter_native_splash: edf599c81f74d093a4daf8e17bd7a018854bc778
flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12
integration_test: 252f60fa39af5e17c3aa9899d35d908a0721b573
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe

PODFILE CHECKSUM: 4e8f8b2be68aeea4c0d5beb6ff1e79fface1d048

Expand Down
2 changes: 2 additions & 0 deletions ios/Runner.xcodeproj/xcshareddata/xcschemes/dev.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
buildConfiguration = "Debug-dev"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
Expand All @@ -27,6 +28,7 @@
buildConfiguration = "Debug-dev"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
2 changes: 1 addition & 1 deletion ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import UIKit
import Flutter

@UIApplicationMain
@main
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
Expand Down
3 changes: 0 additions & 3 deletions l10n.yaml

This file was deleted.

19 changes: 19 additions & 0 deletions lib/gen/locale_keys.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading