Skip to content

Commit c8d1558

Browse files
author
Luca Van Zelst
committed
Merge branch 'master' into #292-build-ipa
2 parents f147db8 + d3a85bb commit c8d1558

37 files changed

+121
-92
lines changed

.github/workflows/analyzer.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ jobs:
1414
- uses: subosito/[email protected]
1515
with:
1616
channel: 'stable'
17-
- run: flutter packages get
18-
- run: flutter analyze
17+
- run: ./tool/install_fvm.sh
18+
- run: fvm flutter packages get
19+
- run: fvm flutter analyze

.github/workflows/rename_project.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ jobs:
1414
- uses: subosito/[email protected]
1515
with:
1616
channel: 'stable'
17-
- run: flutter packages get
18-
- run: printf 'Test Project\ndescription\ntest_project\nTestProject\ncom.test.project\nn\ny\n' | flutter pub run ./tool/dart_tool/rename_project.dart
17+
- run: ./tool/install_fvm.sh
18+
- run: fvm flutter packages get
19+
- run: printf 'Test Project\ndescription\ntest_project\nTestProject\ncom.test.project\nn\ny\n' | fvm flutter pub run ./tool/setup/dart/rename_project.dart

.github/workflows/strip_boilerplate_project.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
- uses: subosito/[email protected]
1515
with:
1616
channel: 'stable'
17-
- run: flutter packages get
1817
- run: ./tool/install_fvm.sh
19-
- run: printf 'yes\n' | fvm flutter pub run ./tool/dart_tool/strip_boilerplate_project.dart
18+
- run: fvm flutter packages get
19+
- run: printf 'yes\n' | fvm flutter pub run ./tool/setup/dart/strip_boilerplate_project.dart
2020
- run: fvm flutter analyze
2121
- run: fvm flutter test --update-goldens test/screen/home/home_screen_test.dart
2222
- run: fvm flutter test

.github/workflows/strip_boilerplate_project_remove_tests.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- uses: subosito/[email protected]
1515
with:
1616
channel: 'stable'
17-
- run: flutter packages get
1817
- run: ./tool/install_fvm.sh
19-
- run: printf 'no\n' | flutter pub run ./tool/dart_tool/strip_boilerplate_project.dart
20-
- run: flutter analyze
18+
- run: fvm flutter packages get
19+
- run: printf 'no\n' | fvm flutter pub run ./tool/setup/dart/strip_boilerplate_project.dart
20+
- run: fvm flutter analyze

.github/workflows/test.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616
channel: 'stable'
1717
- run: ./tool/install_fvm.sh
1818
- run: fvm flutter packages get
19-
- run: dart run ./tool/test_coverage_create_helper.dart
19+
- run: fvm dart run ./tool/github/test_coverage_create_helper.dart
2020
- run: fvm flutter test --coverage
21-
- run: dart run ./tool/test_coverage_filter.dart
22-
- run: dart run ./tool/test_coverage_validate_percentage.dart
21+
- run: fvm dart run ./tool/github/test_coverage_filter.dart
22+
- run: fvm dart run ./tool/github/test_coverage_validate_percentage.dart
2323
- name: Coveralls
2424
uses: coverallsapp/github-action@master
2525
with:

.vscode/settings.json

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
{
22
"dart.flutterSdkPath": ".fvm/flutter_sdk",
3-
"dart.sdkPath": ".fvm/flutter_sdk/bin/cache/dart-sdk"
3+
"dart.sdkPath": ".fvm/flutter_sdk/bin/cache/dart-sdk",
4+
// Remove .fvm files from search
5+
"search.exclude": {
6+
"**/.fvm": true
7+
},
8+
// Remove from file watching
9+
"files.watcherExclude": {
10+
"**/.fvm": true
11+
}
412
}

README.md

+33-28
Original file line numberDiff line numberDiff line change
@@ -38,56 +38,55 @@ flutter:
3838

3939
Command to run to update the translations
4040
```
41-
flutter packages pub run icapps_translations
41+
fvm flutter packages pub run icapps_translations
4242
```
4343

4444
## Json Serializable & Kiwi
4545

4646
```
47-
flutter packages pub run build_runner build
48-
flutter packages pub run build_runner build --delete-conflicting-outputs
49-
flutter packages pub run build_runner watch
47+
fvm flutter packages pub run build_runner build --delete-conflicting-outputs
48+
fvm flutter packages pub run build_runner watch
5049
```
5150
## Environments
5251

5352
`--release` is not available for emulators. Performance will be better
5453

5554
### Dev, Debug
5655
```
57-
flutter run --flavor dev -t lib/main.dart
56+
fvm flutter run --flavor dev -t lib/main.dart
5857
59-
flutter run --release --flavor dev -t lib/main.dart
58+
fvm flutter run --release --flavor dev -t lib/main.dart
6059
```
6160

6261
### Dummy
6362

6463
Note: a hot reload is required after launch to use the correct launch file.
6564

6665
```
67-
flutter run --flavor dev -t lib/main_dummy.dart
66+
fvm flutter run --flavor dev -t lib/main_dummy.dart
6867
69-
flutter run --release --flavor dev -t lib/main_dummy.dart
68+
fvm flutter run --release --flavor dev -t lib/main_dummy.dart
7069
```
7170

7271
### Alpha
7372
```
74-
flutter run --flavor alpha -t lib/main_alpha.dart
73+
fvm flutter run --flavor alpha -t lib/main_alpha.dart
7574
76-
flutter run --release --flavor alpha -t lib/main_alpha.dart
75+
fvm flutter run --release --flavor alpha -t lib/main_alpha.dart
7776
```
7877

7978
### Beta
8079
```
81-
flutter run --flavor beta -t lib/main_beta.dart
80+
fvm flutter run --flavor beta -t lib/main_beta.dart
8281
83-
flutter run --release --flavor beta -t lib/main_beta.dart
82+
fvm flutter run --release --flavor beta -t lib/main_beta.dart
8483
```
8584

8685
### Prod, Release
8786
```
88-
flutter run --flavor prod -t lib/main_prod.dart
87+
fvm flutter run --flavor prod -t lib/main_prod.dart
8988
90-
flutter run --release --flavor prod -t lib/main_prod.dart
89+
fvm flutter run --release --flavor prod -t lib/main_prod.dart
9190
```
9291

9392
## Niddler
@@ -100,7 +99,7 @@ Niddler is also available for Android & Java (OkHttp: https://github.com/icapps/
10099

101100
## Linting
102101

103-
To check your code matches our linting. The analysis_options.yaml contains all our code checks.
102+
To check your code matches our linting. The `analysis_options.yaml` contains all our code checks.
104103

105104
```
106105
flutter analyze
@@ -111,13 +110,13 @@ flutter analyze
111110
In order to run our test we need to run
112111

113112
```
114-
flutter test
113+
fvm flutter test
115114
```
116115

117116
If we want to update our golden files we need to run
118117

119118
```
120-
flutter test --update-goldens
119+
fvm flutter test --update-goldens
121120
```
122121

123122
## Fastlane
@@ -135,15 +134,21 @@ This script will run a dart script. The dart script itself will ask you some inp
135134

136135
#### Add provisioning files
137136

138-
```
139-
place the provisioning profiles -> provision_profile/**
140-
naming should be the same as provided in the iOS/Configuration/** files (underscore will be replaced with a space in the configuration files)
141-
```
137+
Add the provisioning profiles in the ios/provisioning/ folder. The naming of the files should be the same as provided in the `ios/Configuration/{flavor}.xcconfig` files (underscore will be replaced with a space in the configuration files)
138+
139+
#### Firebase
140+
141+
To setup firebase you will need to create a new firebase project with 8 new apps, 1 for each flavor on both iOS and Android.
142+
143+
When creating the iOS apps on firebase you will be able to download a `GoogleService-Info.plist` file which you will need to rename according to the flavor you just created an app for e.g.: You just created the iOS App for the Dev flavor so your file should be named `GoogleService-Info-dev.plist`.
144+
Each `.plist` file you download from firebase needs to be placed in the ios/Configuration/GoogleService/ folder. Whenever the project is run with a different flavor from the currently active flavor, it will automatically copy the correct `GoogleService-Info-{flavor}.plist` file into the ios/Runner/ folder.
145+
146+
When creating the Android apps you will be able to download a `google-services.json` file, you only need to download this file once at the end of the last Android app setup on firebase. This `.json` file contains all the configurations for the 4 Android apps which you just created. Add the `.json` file in the android/app/src/ folder.
142147

143148
#### Languages
144149

145150
```
146-
Configure the required languages in xCode
151+
Configure the required languages in Xcode
147152
```
148153

149154
### icapps Translations
@@ -157,34 +162,34 @@ Update the translations.py file (edit the todos)
157162
Obfuscation is enabled by default when using fastlane for building. The symbol files are stored in
158163
`./build/debug-info/#{options[:flavor]}`
159164

160-
**Important**: Add the following regex to jenking configuration to also archive the symbol files
165+
**Important**: Add the following regex to jenkins configuration to also archive the symbol files
161166
```
162167
**/*.symbols
163168
```
164169

165170
### Icons
166171

167-
Replace the files in assets_launcher_icons/
172+
Replace the files in the `assets_launcher_icons/**` folder.
168173

169-
You can also change the adaptive_icon_background in the flutter_launcher_icons-{flavor}.yaml (currently "#CB2E63") (only available for Android 8.0 devices and above)
174+
You can also change the adaptive_icon_background in the `flutter_launcher_icons-{flavor}.yaml` (currently "#CB2E63") (only available for Android 8.0 devices and above)
170175

171176
After this, run the following command
172177

173178
```
174-
flutter pub run flutter_launcher_icons:main -f flutter_launcher_icons-dev.yaml
179+
fvm flutter pub run flutter_launcher_icons:main -f flutter_launcher_icons-dev.yaml
175180
```
176181

177182
### Common issues
178183

179184
```
180-
No Flavor provided
185+
No flavor provided
181186
```
182187

183188
Add a flavor to your configuration. Extra info can be found in this issue -> https://github.com/icapps/flutter-template/issues/3
184189

185190
### Questions?
186191

187-
For question contact Koen Van Looveren
192+
For question contact William Verhaeghe
188193

189194
### Finish
190195

lib/model/exceptions/bad_request_error.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class BadRequestError extends NetworkError {
88
static const statusCode = HttpStatus.badRequest;
99

1010
BadRequestError(
11-
super.dioError, {
11+
super.dioException, {
1212
super.statusCodeValue,
1313
});
1414

@@ -25,7 +25,7 @@ class BadRequestError extends NetworkError {
2525
final dynamic data = err.response?.data;
2626
if (data is! Map) return BadRequestError(err);
2727
if (!data.containsKey('code')) return BadRequestError(err);
28-
final code = data['code'] as String;
28+
final code = data['code'] as String?;
2929
switch (code) {
3030
default:
3131
return BadRequestError(err);

lib/model/exceptions/forbidden_error.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class ForbiddenError extends NetworkError {
88
static const statusCode = HttpStatus.forbidden;
99

1010
ForbiddenError(
11-
super.dioError, {
11+
super.dioException, {
1212
super.statusCodeValue,
1313
});
1414

@@ -25,7 +25,7 @@ class ForbiddenError extends NetworkError {
2525
final dynamic data = err.response?.data;
2626
if (data is! Map) return ForbiddenError(err);
2727
if (!data.containsKey('code')) return ForbiddenError(err);
28-
final code = data['code'] as String;
28+
final code = data['code'] as String?;
2929
switch (code) {
3030
default:
3131
return ForbiddenError(err);
+2-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
import 'package:flutter_template/util/locale/localization_keys.dart';
22
import 'package:icapps_architecture/icapps_architecture.dart';
33

4-
class GeneralNetworkError extends NetworkError {
5-
GeneralNetworkError(super.dioError);
4+
class GeneralError with LocalizedError {
5+
GeneralError() : super();
66

77
@override
88
String getLocalizedKey() => LocalizationKeys.errorGeneral;
9-
10-
@override
11-
String? get getErrorCode => null;
129
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import 'package:flutter_template/util/locale/localization_keys.dart';
22
import 'package:icapps_architecture/icapps_architecture.dart';
33

4-
class GeneralError with LocalizedError {
5-
GeneralError() : super();
4+
class GeneralNetworkError extends NetworkError {
5+
GeneralNetworkError(super.dioException);
66

77
@override
88
String getLocalizedKey() => LocalizationKeys.errorGeneral;
9+
10+
@override
11+
String? get getErrorCode => null;
912
}

lib/model/exceptions/internal_server_error.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class InternalServerError extends NetworkError {
77
static const statusCode = HttpStatus.internalServerError;
88

99
InternalServerError(
10-
super.dioError, {
10+
super.dioException, {
1111
super.statusCodeValue,
1212
});
1313

lib/model/exceptions/no_internet_error.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import 'package:flutter_template/util/locale/localization_keys.dart';
22
import 'package:icapps_architecture/icapps_architecture.dart';
33

44
class NoInternetError extends NetworkError {
5-
NoInternetError(super.dioError);
5+
NoInternetError(super.dioException);
66

77
@override
88
String getLocalizedKey() => LocalizationKeys.errorNoNetwork;

lib/model/exceptions/un_authorized_error.dart

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import 'dart:io';
22

3+
import 'package:dio/dio.dart';
34
import 'package:flutter_template/util/locale/localization_keys.dart';
45
import 'package:icapps_architecture/icapps_architecture.dart';
56

67
class UnAuthorizedError extends NetworkError {
78
static const statusCode = HttpStatus.unauthorized;
89

910
UnAuthorizedError(
10-
super.dioError, {
11+
super.dioException, {
1112
super.statusCodeValue,
1213
});
1314

@@ -19,4 +20,15 @@ class UnAuthorizedError extends NetworkError {
1920
if (statusCodeValue == null) return '$statusCode';
2021
return '$statusCode [$statusCodeValue]';
2122
}
23+
24+
static NetworkError parseError(DioException err) {
25+
final dynamic data = err.response?.data;
26+
if (data is! Map) return UnAuthorizedError(err);
27+
if (!data.containsKey('code')) return UnAuthorizedError(err);
28+
final code = data['code'] as String?;
29+
switch (code) {
30+
default:
31+
return UnAuthorizedError(err);
32+
}
33+
}
2234
}

lib/util/interceptor/network_error_interceptor.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import 'package:dio/dio.dart';
22
import 'package:flutter_template/model/exceptions/bad_request_error.dart';
33
import 'package:flutter_template/model/exceptions/code_error.dart';
44
import 'package:flutter_template/model/exceptions/forbidden_error.dart';
5-
import 'package:flutter_template/model/exceptions/general_error.dart';
5+
import 'package:flutter_template/model/exceptions/general_network_error.dart';
66
import 'package:flutter_template/model/exceptions/internal_server_error.dart';
77
import 'package:flutter_template/model/exceptions/no_internet_error.dart';
88
import 'package:flutter_template/model/exceptions/un_authorized_error.dart';
@@ -31,7 +31,7 @@ class NetworkErrorInterceptor extends SimpleInterceptor {
3131
final statusCode = error.response?.statusCode;
3232
switch (statusCode) {
3333
case UnAuthorizedError.statusCode:
34-
return UnAuthorizedError(error);
34+
return UnAuthorizedError.parseError(error);
3535
case BadRequestError.statusCode:
3636
return BadRequestError.parseError(error);
3737
case ForbiddenError.statusCode:

lib/util/interceptor/network_log_interceptor.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'dart:io';
22

33
import 'package:dio/dio.dart';
4-
import 'package:flutter_template/model/exceptions/general_error.dart';
4+
import 'package:flutter_template/model/exceptions/general_network_error.dart';
55
import 'package:icapps_architecture/icapps_architecture.dart';
66
import 'package:injectable/injectable.dart';
77

test/repository/refresh/refresh_repository_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import 'package:dio/dio.dart';
2-
import 'package:flutter_template/model/exceptions/general_network_error.dart';
2+
import 'package:flutter_template/model/exceptions/general_error.dart';
33
import 'package:flutter_template/model/exceptions/un_authorized_error.dart';
44
import 'package:flutter_template/repository/refresh/refresh_repository.dart';
55
import 'package:flutter_template/repository/secure_storage/auth/auth_storage.dart';

test/util/interceptor/network_error_interceptor_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
33
import 'package:flutter_template/model/exceptions/bad_request_error.dart';
44
import 'package:flutter_template/model/exceptions/code_error.dart';
55
import 'package:flutter_template/model/exceptions/forbidden_error.dart';
6-
import 'package:flutter_template/model/exceptions/general_error.dart';
6+
import 'package:flutter_template/model/exceptions/general_network_error.dart';
77
import 'package:flutter_template/model/exceptions/internal_server_error.dart';
88
import 'package:flutter_template/model/exceptions/un_authorized_error.dart';
99
import 'package:flutter_template/util/env/flavor_config.dart';

test/viewmodel/login/login_viewmodel_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import 'package:flutter_template/model/exceptions/general_network_error.dart';
1+
import 'package:flutter_template/model/exceptions/general_error.dart';
22
import 'package:flutter_template/navigator/main_navigator.dart';
33
import 'package:flutter_template/navigator/onboarding_navigator.dart';
44
import 'package:flutter_template/repository/login/login_repository.dart';

0 commit comments

Comments
 (0)