Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add flavorizr config file and update flutter version #184

Merged
merged 5 commits into from
Sep 1, 2023
Merged
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
2 changes: 1 addition & 1 deletion .fvm/fvm_config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"flutterSdkVersion": "3.10.2",
"flutterSdkVersion": "3.13.2",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

"flavors": {}
}
2 changes: 0 additions & 2 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,8 @@ linter:
- exhaustive_cases
- file_names
- hash_and_equals
- iterable_contains_unrelated_type
- library_names
- lines_longer_than_80_chars
- list_remove_unrelated_type
- literal_only_boolean_expressions
- missing_whitespace_between_adjacent_strings
- no_default_cases
Expand Down
40 changes: 40 additions & 0 deletions flavorizr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
flavors:
dev:
app:
name: 'Template Dev'
android:
applicationId: 'com.xmartlabs.template.dev'
ios:
bundleId: 'com.xmartlabs.template.dev'
variables:
FLUTTER_TARGET:
value: 'lib/main.dart'
staging:
app:
name: 'Template Sta'
android:
applicationId: 'com.xmartlabs.template.sta'
ios:
bundleId: 'com.xmartlabs.template.sta'
variables:
FLUTTER_TARGET:
value: 'lib/main.dart'
prod:
app:
name: 'Template'
android:
applicationId: 'com.xmartlabs.template'
ios:
bundleId: 'com.xmartlabs.template'
variables:
FLUTTER_TARGET:
value: 'lib/main.dart'
instructions:
- assets:download
- assets:extract
- android:buildGradle
- ios:xcconfig
- ios:buildTargets
- ios:schema
- ios:plist
- assets:clean
18 changes: 9 additions & 9 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@
baseConfigurationReference = 6C37016DF19997B0AAD05FAF /* prodProfile.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon";
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -506,7 +506,7 @@
baseConfigurationReference = 51B5A3EF356677109FE751EB /* prodRelease.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon";
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -577,7 +577,7 @@
baseConfigurationReference = 5626E2C804EE32F56C2D8F06 /* prodDebug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon";
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -801,7 +801,7 @@
baseConfigurationReference = 78DFC5A53E53B9D74505FF20 /* devDebug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon";
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -896,7 +896,7 @@
baseConfigurationReference = 113F326E4F1DD43142CE6D30 /* stagingDebug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon";
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -991,7 +991,7 @@
baseConfigurationReference = ED9BFBD52F04E77F2174E192 /* devRelease.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon";
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -1082,7 +1082,7 @@
baseConfigurationReference = D7BA5182467EB92CA3E895F1 /* stagingRelease.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon";
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -1173,7 +1173,7 @@
baseConfigurationReference = BF41E84758AF984855B34375 /* devProfile.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon";
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -1262,7 +1262,7 @@
baseConfigurationReference = FA08A5EF6F6A019FEADEFC1B /* stagingProfile.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon";
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down
100 changes: 50 additions & 50 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(BUNDLE_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>CFBundleDisplayName</key>
<string>$(BUNDLE_DISPLAY_NAME)</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIStatusBarHidden</key>
<false/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(BUNDLE_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>CFBundleDisplayName</key>
<string>$(BUNDLE_DISPLAY_NAME)</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIStatusBarHidden</key>
<false/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
38 changes: 17 additions & 21 deletions lib/core/common/logger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,27 @@ interface class Logger {
static Future init() => _crashReportTool.init();

static void v(dynamic message, [dynamic error, StackTrace? stackTrace]) =>
_instance.log(Level.verbose, message, error, stackTrace);
_instance.log(Level.trace, message, error: error, stackTrace: stackTrace);

static void d(dynamic message, [dynamic error, StackTrace? stackTrace]) =>
_instance.log(Level.debug, message, error, stackTrace);
_instance.log(Level.debug, message, error: error, stackTrace: stackTrace);

static void i(dynamic message, [dynamic error, StackTrace? stackTrace]) =>
_instance.log(Level.info, message, error, stackTrace);
_instance.log(Level.info, message, error: error, stackTrace: stackTrace);

static void w(dynamic message, [dynamic error, StackTrace? stackTrace]) =>
_instance.log(Level.warning, message, error, stackTrace);
_instance.log(
Level.warning,
message,
error: error,
stackTrace: stackTrace,
);

static void e(dynamic message, [dynamic error, StackTrace? stackTrace]) =>
_instance.log(Level.error, message, error, stackTrace);
_instance.log(Level.error, message, error: error, stackTrace: stackTrace);

static void wtf(dynamic message, [dynamic error, StackTrace? stackTrace]) =>
_instance.log(Level.wtf, message, error, stackTrace);
_instance.log(Level.off, message, error: error, stackTrace: stackTrace);

static Future<void> fatal({dynamic error, StackTrace? stackTrace}) async {
d('Fatal', error, stackTrace);
Expand All @@ -52,7 +57,7 @@ class _CrashReportWrappedPrinter extends LogPrinter {
_CrashReportWrappedPrinter(this._printer, this._crashReportTool);

@override
void init() => _printer.init();
Future<void> init() => _printer.init();

StackTrace _currentStacktrace() {
// Filter: FirebaseCrashlytics.record, _CrashReportWrappedPrinter
Expand All @@ -75,26 +80,17 @@ class _CrashReportWrappedPrinter extends LogPrinter {
final sanitizedEvent = dart_log.LogEvent(
event.level,
event.message,
event.error,
event.stackTrace ?? _currentStacktrace(),
error: event.error,
stackTrace: event.stackTrace ?? _currentStacktrace(),
);
switch (event.level) {
case Level.verbose:
case Level.debug:
case Level.nothing:
case Level.info:
break;
case Level.warning:
case Level.error:
case Level.wtf:
_crashReportTool.logNonFatal(sanitizedEvent);
break;
if (event.level case Level.warning || Level.error) {
_crashReportTool.logNonFatal(sanitizedEvent);
}
return _printer.log(sanitizedEvent);
}

@override
void destroy() => _printer.destroy();
Future<void> destroy() => _printer.destroy();
}

class _PrintableTrace extends Trace {
Expand Down
28 changes: 13 additions & 15 deletions lib/core/common/network_exceptions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,21 @@ sealed class NetworkException with _$NetworkException implements Exception {
if (error is Exception) {
try {
NetworkException networkExceptions;
if (error is DioError) {
switch (error.type) {
case DioErrorType.connectionTimeout ||
DioErrorType.cancel ||
DioErrorType.sendTimeout ||
DioErrorType.receiveTimeout ||
DioErrorType.connectionError ||
DioErrorType.unknown ||
DioErrorType.badCertificate:
networkExceptions = const NetworkException.noInternetConnection();
break;
case DioErrorType.badResponse:
networkExceptions = NetworkException.handleResponse(
if (error is DioException) {
networkExceptions = switch (error.type) {
DioExceptionType.connectionTimeout ||
DioExceptionType.cancel ||
DioExceptionType.sendTimeout ||
DioExceptionType.badCertificate ||
DioExceptionType.unknown ||
DioExceptionType.receiveTimeout ||
DioExceptionType.connectionError =>
const NetworkException.noInternetConnection(),
DioExceptionType.badResponse => NetworkException.handleResponse(
error.response?.statusCode,
error.response?.data,
);
}
),
};
} else if (error is SocketException) {
networkExceptions = const NetworkException.noInternetConnection();
} else {
Expand Down
2 changes: 1 addition & 1 deletion lib/core/source/common/auth_interceptor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class AuthInterceptor extends Interceptor {

@override
Future onError(
DioError err,
DioException err,
ErrorInterceptorHandler handler,
) async {
if (err.response?.statusCode == HttpStatus.unauthorized) {
Expand Down
Loading