Skip to content

Commit c8d7bfd

Browse files
cozvtieg9DemeoStepfedorenkoalexOnix-IvanColoud1
authored
update_25 (#65)
* Feat/documentation (#57) * fix: remove git inint and commits * fix: fix existing project RGBO & ARGB colors parse * fix: skip colors generate if no figma file added * fix: skip colors generate if no figma file added * fix: skip colors generate if no figma file added * feat(v24_update): added documentation generation fix(issue_54): fixed firebase import in remote.dart * feat(v24_update): flutter_secure_storage version set to 9.0 * feat(v24_update): flutter_secure_storage version set to 9.0 * feat(v24_update): fixed install instructions for single flavor * feat(v24_update): light refactor of generation bloc fix(firebase): remote di syntax fix * fix(codestyle): organize imports * fix(fix): fixed post_gen script for mason * fix(codestyle): clear some warnings and unused code * fix(tests): fixed request processor test * fix(documentation): added package names description fix(brick): macos flavorizr * fix(brick): added branch config * fix(branches): added option to select branch for Mason brick * fix(pr57): improves based on PR comments * fix(pr57): improves based on PR comments * fix(pr57): improves based on PR comments * fix(pr57): hide branch option in release * fix(brick): fix mac os configuration * fix(brick): fix mac os configuration * fix(brick): temporary removed mac os flavors * fix(brick): tailor version * fix(brick): tailor constructor * fix(tailor): tailor generation fixes * fix(tailor): ThemeTailor migrated to v3+ * fix(version): fixed version check --------- Co-authored-by: DemeoStep <[email protected]> Co-authored-by: alexandr.fedorenko <[email protected]> * feat(Fastlane): Added documentation * temp * feat(Fastlane): Added Fastlane files generator service * feat(Fastlane): Added logic * fix(Fastlane): Removed clean line from flavorizr makefile * feat(Fastlane): Added logic for skipping documentation and fastlane generation when is modifying the project * feat(Fastlane): Updated INSTALL_INSTRUCTION * fix(flavors): command run fix * fix(flavors): command run fix * fix(flavors): command run fix * fix(flavors): command run fix * fix(docs): fixed flavr documentation * feat(Fastlane): Fixed bug with copying files, added error output * feat(Fastlane): Added .gitignore file instructions * fix(Fastlane): Fixed async call issue with writeAsStringSync method * fix(Fastlane): Updated fastlane instructions * fix(Fastlane): Updated Android Appfile * fix(Fastlane): Updated Fastfile android and ios * feat(version): fixed version check * feat(Fastlane): Updated .gitignore * feat(L10n): commited * fix(Fastlane): Fixed bugs with Fastlane generation utils * fix(Fastlane): Removed default flavor from fastlane line command * fix(Fastlane): Added extra space * feat(Services): Services refactoring * fix(screen_generation): refactored screen generation * fix(themes_generation): refactored themes generation * fix(themes_generation): refactored styles generation * fix(clean): imports and formatting * fix(data_components): data components refactor * fix(generation): fixed bloc generation * fix(generation): fixed manual theming generation * fix(generation): fixed manual theming generation * feat(source_generation): source generation refactor * feat(data_generation): data generation refactor * feat(output): refactor output feat(process): refactor process * feat(UI): UI improvements * feat(UI): UI improvements * feat(i10): fixed i10 * fix(conflicts): fixed after merge conflicts * fix(docs): fixed issue id docs service * fix(SummaryScreen): Fixed bug with SummaryScreen extra * fix(Services): Updated RequestGenerator, RequestGenerator, StyleGeneratorConsts, FigmaStylesDialog * fix(generator): fixed async file creation fix(cubit): remove useless constructor for cubit * fix(generator): fixed async file creation fix(cubit): remove useless constructor for cubit * fix(merge): after merge fix * fix(fastlane): fixed several bugs with the makefile generators * fix(flavorizr): fixed prod package name * fix(flavorizr): fixed prod package name * fix(flavorizr): fixed prod package name * fix(flavorizr): fixed prod package name * fix(flavorizr): fixed prod package name * fix(flavorizr): fixed prod package name * fix(flavorizr): fixed prod package name * fix(flavorizr): fixed prod package name * fix(flavorizr): fixed prod package name * fix(docs): added flavorizr command * fix(fiel_gen): cubit constructor * fix(file_gen): screen imports * fix(file_gen): screen di * fix(file_gen): screen di * fix(docs): fixed package names in docs * feat(Fastlane): Updated flavors logic. Added statements --------- Co-authored-by: alexandr.fedorenko <[email protected]> Co-authored-by: Ivan Modlo <[email protected]> * feat(Platforms): Update PlatformList screen (#64) * feat(Platforms): Updated PlatformScreen * fix(Platforms): Updated state logic, updated platformsList * fix(Imports): Fixed import in PlatformScreenBody --------- Co-authored-by: Ivan Modlo <[email protected]> * fix(Flavors Field): Fixed bug with multi spacing.Added TextInputFormatter. Updated codeformat (#66) Co-authored-by: Ivan Modlo <[email protected]> --------- Co-authored-by: DemeoStep <[email protected]> Co-authored-by: alexandr.fedorenko <[email protected]> Co-authored-by: Ivan Modlo <[email protected]> Co-authored-by: Coloud1 <[email protected]>
1 parent a1e5fb8 commit c8d7bfd

File tree

198 files changed

+7454
-3442
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+7454
-3442
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.freezed.dart linguist-generated=true
2+
*.g.dart linguist-generated=true

analysis_options.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ include: package:flutter_lints/flutter.yaml
1212
analyzer:
1313
exclude:
1414
- "bricks/**"
15+
- '**/*.g.dart'
16+
- '**/*.freezed.dart'
1517

1618
linter:
1719
# The lint rules applied to this project can be customized in the

assets/documentation/docs/ARCH_OVERVIEW.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
{app_name} project code built on Clean based hybrid Architecture (I'll just call it Clean architecture for simplicity's sake).
44

5-
The main concept of regular [Clean Architecture](http://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html) is codes splitted to layers, where every low-level layer knows nothing about up layers, separation of business logic from UI, not depending on frameworks or libraries, etc.
5+
The main concept of regular [Clean Architecture](http://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html) is codes split to layers, where every low-level layer knows nothing about up layers, separation of business logic from UI, not depending on frameworks or libraries, etc.
66

77
The architecture we used in {app_name} project is very similar to the regular Clean architecture, but it has its own values, which is why we call it Clean based quasi-architecture.
88

assets/documentation/docs/INSTALL_INSTRUCTION.md

Lines changed: 71 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This section describes different installation options. It consists of the following parts:
44

5-
* Terminology
5+
* Terminology
66
* Platforms supported
77
* Environment variables and setup
88
* Important installation instructions
@@ -14,19 +14,14 @@ This section describes different installation options. It consists of the follow
1414

1515
## Terminology
1616

17-
* **Output Type** - platform keyword used in run or build commands to specify for what platform app will be built. Available platforms are:
17+
* **Output Type** - platform keyword used in run or build commands to specify for what platform app will be built. Available platforms are:
1818

1919
```
2020
{output_types}
2121
```
2222
Apk and AppBundle refers to Android and specifies a type of output file (`*.apk` or `*.aab`).
2323

24-
25-
* **Flavor** - type of application configuration. {app_name} supports following flavors:
26-
27-
```
2824
{app_flavors}
29-
```
3025

3126
* **Build type** - type of build process: `release` or `debug`.
3227
* **main.dart** file - main file and entry point of your application. {main_count_description}:
@@ -36,12 +31,12 @@ Apk and AppBundle refers to Android and specifies a type of output file (`*.apk`
3631
```
3732

3833
When you specifying a flavor in run or build command you also need to specify corresponding `main.dart` file for that flavor.
39-
34+
4035
## Platforms supported
4136

4237
{app_name} application supported on following platforms:
4338

44-
{app_platforms}
39+
{app_platforms}
4540

4641
## Important installation instructions
4742

@@ -58,14 +53,14 @@ When you sure you installed followed software follow steps to prepare {app_name}
5853

5954
## Environment variables and setup
6055

61-
To add project environment keys need to create `.env` file in root folder for each of flavors:
56+
To add project environment keys need to create `.env` file in root folder for each of flavors:
6257

6358
```
6459
{app_env_files}
6560
```
6661

67-
{app_env_explanation}
68-
Environment file scheme:
62+
{app_env_explanation}
63+
Environment file scheme:
6964

7065
```
7166
STRIPE_KEY=enter_stripe_key
@@ -86,7 +81,7 @@ You can use commands to run applications also. To run app:
8681

8782
## How to run {app_name} automatic tests
8883

89-
{app_name} application is covered with **unit** and **widgets** tests.
84+
{app_name} application is covered with **unit** and **widgets** tests.
9085
The goal of a unit test is to verify the correctness of a unit of logic under a variety of conditions.
9186
The goal of a widget test is to verify that the widget’s UI looks and interacts as expected.
9287

@@ -102,7 +97,7 @@ To launch specific test run following command in IDE terminal:
10297

10398
To build application open IDE terminal use following command:
10499

105-
`flutter build {output_type} --flavor {flavor} -t {{path_to_main.dart}}`
100+
`flutter build {output_type} --flavor {flavor} --release -t {{path_to_main.dart}}`
106101

107102
Add obfuscation params if you build application for mobile platforms:
108103
`--obfuscate --split-debug-info=debug_info`
@@ -111,15 +106,75 @@ Next step is depending on platform:
111106

112107
* For iOS and MacOS open ios/macos folder of project in XCode and follow instructions How to upload app to AppStore
113108
* For Android you'll see the location of the output file in the terminal after build finished. Follow the instruction to upload build to Play Store
114-
* For Web - after build completed - deploy content of `/web` folder to your server
109+
* For Web - after build completed - deploy content of `/web` folder to your server
110+
111+
## How to build and distribute {app_name} application using fastlane
112+
113+
Before you use fastlane to build and distribute:
114+
115+
1. Make sure you are using **ruby version 3.0 or newer**
116+
2. Using the iOS build, call `xcode-select --install`
117+
3. Install fastlane using `brew install fastlane` or `gem install fastlane`
118+
4. Install the bundler using `gem install bundler`
119+
5. Go to the `android` & `ios` directory and call `[sudo] bundle install`
120+
121+
To submit a build to the App Store or Google Play Console you need:
122+
123+
**For iOS:**
124+
125+
1. If the `.env.{flavor}` file is not created, create it in the `/ios/fastlane/` folder
126+
2. Go to the Apple Developer portal and create an AppStoreConnect API key, save it, then open the file and copy the contents of that file, not including the `BEGIN PRIVATE KEY` and `END PRIVATE KEY` with dashes. Then add this key in `.env.{flavor}` to the `KEY_CONTENT` variable
127+
3. After creating the key, copy the `ISSUER_ID`, `KEY_ID` variables and add them to `.env.{flavor}`
128+
4. After that, add a few more variables `BUNDLE_ID`, `APPLE_DEVELOPER_USERNAME`, `APP_STORE_CONNECT_TEAM_ID`, `DEVELOPER_PORTAL_TEAM_ID`. You can find them on the Apple Developer portal and AppStore Connect
129+
130+
For more information on creating a AppStore Connect API key go to [Creating API Keys for App Store Connect API](https://developer.apple.com/documentation/appstoreconnectapi/creating_api_keys_for_app_store_connect_api)
131+
132+
**For Android:**
133+
134+
1. If the `.env.{flavor}` file is not created, create it in the `/android/fastlane/` folder
135+
2. Download and save the service account key and place it in the project folder
136+
3. Specify the relative path to the service account key by adding the `JSON_KEY_FILE` variable to `.env.{flavor}`
137+
4. Specify the applicationId in the `PACKAGE_NAME` variable to `.env.{flavor}`
138+
139+
For more information on creating a service account key go to [Google Play Developer API](https://developers.google.com/android-publisher/getting_started/?hl=en) portal
140+
141+
To submit a build to the Firebase App Distribution you need:
142+
143+
1. Install Firebase CLI using `curl -sL firebase.tools | bash`
144+
2. Sign in using the Firebase CLI `firebase login`
145+
3. Create the `.env.{flavor}` file in `/android/fastlane/` and `/ios/fastlane/` if it was not created earlier
146+
4. Add the `FIREBASE_APP_ID` variable to the file by specifying the `app_id`, which you can find in the Firebase Console
147+
148+
For more detailed information you can go to [Firebase App Distribution Android](https://firebase.google.com/docs/app-distribution/ios/distribute-fastlane) and [Firebase App Distribution iOS](https://firebase.google.com/docs/app-distribution/android/distribute-fastlane)
149+
150+
Now you can build and distribute the build using the Makefile command:
151+
152+
**For iOS:**
153+
154+
* TestFlight and Firebase App Distribution `make build_{flavor}_ios_with_distribution`
155+
* Firebase App Distribution only `make build_{flavor}_ios_firebase_only`
156+
* TestFlight only `make build_{flavor}_ios_test_flight_only`
157+
158+
> Make sure the correct signing method is selected in Xcode under the "Signing & Capabilities" tab, and if signing manually, the correct Provisioning Profile and Certificate are selected as well
159+
160+
**For Android:**
161+
162+
* Play Store and Firebase App Distribution `make build_{flavor}_android_with_distribution`
163+
* Firebase App Distribution only `make build_{flavor}_android_firebase_only`
164+
* Play Store only `make build_{flavor}_android_store_only`
165+
166+
> Make sure when submitting a build to the Play Store android artifact type is "aab"
167+
> Make sure when submitting a build to the Firebase App Distribution android artifact type is "apk" (if you have not set up firebase integration with your Google Play project)
168+
169+
For more flexible build or distribution settings, you can change the parameters specified in `fastlane_config.yaml`
115170

116171
## Possible build errors
117172

118173
### Some files are underlined red in project file tree:
119174

120175
Try to run `dart pub get` command in IDE terminal
121176

122-
### When you build an iOS or MacOS application you might get Pod's issue.
177+
### When you build an iOS or MacOS application you might get Pod's issue.
123178

124179
To fix that run following command in IDE terminal:
125180

assets/documentation/docs/TECH_DESCRIPTION.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ This file contains a description of technologies, packages and libraries used in
55
## Main Technologies
66

77
### Core packages
8-
* [GetIt](https://pub.dev/packages/get_it) - service locator, used for fast and effective acces to objects
8+
* [GetIt](https://pub.dev/packages/get_it) - service locator, used for fast and effective access to objects
99
* [Screen Util](https://pub.dev/packages/flutter_screenutil) - adaptive UI tools providing autoscaling UI features
1010
* [Go Router](https://pub.dev/packages/go_router) - navigation library that complies with Flutter Navigation 2.0
11-
* [Freezed](https://pub.dev/packages/freezed_annotation) - code generarion of data classes withh boilerplate functions
11+
* [Freezed](https://pub.dev/packages/freezed_annotation) - code generation of data classes with boilerplate functions
1212

1313
### Local storage and database
1414

@@ -26,11 +26,11 @@ This file contains a description of technologies, packages and libraries used in
2626

2727
### UI
2828

29-
* [Native Splash](https://pub.dev/packages/flutter_native_splash) - utitity to generate splash screen from yaml configuration(in `pubspec.yaml`)
29+
* [Native Splash](https://pub.dev/packages/flutter_native_splash) - utility to generate splash screen from yaml configuration(in `pubspec.yaml`)
3030

3131
## Build runner
3232

33-
{app_name} project uses Build Runner to generate additional code. This features mostly used in **freezed** and **jsonAnnotation** utilities. So when you chaning build runner related classes you need to regenerate additional generated classes (mostly it's `*.g.dart`, `*.freezed.dart` classes).
33+
{app_name} project uses Build Runner to generate additional code. This features mostly used in **freezed** and **jsonAnnotation** utilities. So when you changing build runner related classes you need to regenerate additional generated classes (mostly it's `*.g.dart`, `*.freezed.dart` classes).
3434

3535
To generate classes:
3636

@@ -55,9 +55,11 @@ If project contains flavors and need to regenerate icons for ech flavor run:
5555

5656
`flutter pub run flutter_launcher_icons:main -f flutter_launcher_icons*`
5757

58+
{flavorizr_instructions}
59+
5860
## Deep links
5961

60-
{app_name} has a deep link features, and here describe all deeplinks options are available in the application.
62+
{app_name} has a deep link features, and here describe all deep links options are available in the application.
6163

6264
Deep links schemes are:
6365

assets/documentation/docs/dev_solutions/EXAMPLE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
This section describing how Example flow works in {app_name} application.
5-
For verifying user identity [Onfido](https://onfido.com/) library used. Onfido incapsulates all business logic about capturing user documents and send it to verify and jus return a status KYC of validation.
5+
For verifying user identity [Onfido](https://onfido.com/) library used. Onfido incapsulate all business logic about capturing user documents and send it to verify and jus return a status KYC of validation.
66

77
```mermaid
88
flowchart TD

assets/fastlane/android/Appfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
json_key_file(ENV['JSON_KEY_FILE']) # Relative path to google_service_account.json
2+
package_name(ENV['PACKAGE_NAME']) # The application id of your app

assets/fastlane/android/Fastfile

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
require 'yaml'
2+
3+
YAML_PATH = "../../fastlane_config.yaml" # An important note. Default path to configuration
4+
$yaml_vars = {}
5+
$selected_flavor = ""
6+
7+
default_platform(:android)
8+
9+
platform :android do
10+
desc "Build android app"
11+
lane :build do |options|
12+
flavor = options[:flavor]
13+
firebase = options[:firebase]
14+
store = options[:store]
15+
artifact_type = options[:artifact_type]
16+
17+
load_fastlane_vars(flavor)
18+
path = get_artifact_path(artifact_type, flavor)
19+
#gradle(task: "clean assembleRelease")
20+
upload_to_play_store_if_possible(store, path, artifact_type)
21+
upload_to_firebase_if_possible(firebase, path, artifact_type)
22+
end
23+
24+
def load_fastlane_vars(flavor)
25+
$yaml_vars = YAML.load_file(YAML_PATH)
26+
$selected_flavor = flavor.nil? ? $yaml_vars['default_scheme'] : flavor
27+
end
28+
29+
def get_artifact_path(artifact_type, flavor)
30+
if artifact_type == "apk"
31+
return "../build/app/outputs/flutter-apk/#{flavor.nil? ? 'app-release.apk' : "app-#{flavor}-release.apk"}"
32+
elsif artifact_type == "aab"
33+
return "../build/app/outputs/bundle/#{flavor.nil? ? 'release/app-release.aab' : "#{flavor}Release/app-#{flavor}-release.aab"}"
34+
else
35+
UI.user_error!("You must specify artifact type when calling the fastlane build method. Valid value apk or aab")
36+
return
37+
end
38+
end
39+
40+
def upload_to_play_store_if_possible(distribute, path, artifact_type)
41+
if distribute == nil || !distribute
42+
return
43+
end
44+
45+
if $yaml_vars['schemes'] == nil || $yaml_vars['schemes']['android'] == nil
46+
UI.user_error!("distribute_store is specified, but the configuration is incomplete. Check scheme android #{$selected_flavor}")
47+
return
48+
end
49+
50+
play_store = $yaml_vars['schemes']['android']
51+
play_store_flavor_settings = play_store.find { |scheme| scheme['name'] == $selected_flavor }
52+
53+
if play_store_flavor_settings.nil?
54+
UI.user_error!("distribute_store is specified, but the configuration is incomplete. Check scheme android #{$selected_flavor}")
55+
return
56+
end
57+
58+
play_store_config = {
59+
"release_status" => play_store_flavor_settings['release_status'],
60+
"track" => play_store_flavor_settings['track'],
61+
"rollout" => play_store_flavor_settings['rollout'],
62+
}
63+
64+
if artifact_type == "apk"
65+
UI.user_error!("You cannot submit a build to the Play Store using apk artifact")
66+
end
67+
68+
validate_play_store_json_key json_key:CredentialsManager::AppfileConfig.try_fetch_value(:json_key_file)
69+
upload_to_play_store(
70+
package_name: play_store_config['package_name'],
71+
aab: path,
72+
release_status: play_store_config['release_status'],
73+
track: play_store_config['track'],
74+
skip_upload_metadata: true,
75+
skip_upload_images: true,
76+
skip_upload_screenshots: true,
77+
skip_upload_changelogs: true,
78+
skip_upload_apk: true,
79+
)
80+
end
81+
82+
def upload_to_firebase_if_possible(distribute, path, artifact_type)
83+
if distribute == nil || !distribute
84+
return
85+
end
86+
87+
if $yaml_vars['firebase'] == nil || $yaml_vars['firebase']['android'] == nil
88+
UI.user_error!("distribute_to_firebase is specified, but the configuration is incomplete. Check fastlane_config firebase")
89+
return
90+
end
91+
92+
firebase_settings = $yaml_vars['firebase']['android']
93+
firebase_flavor_settings = firebase_settings.find { |scheme| scheme['name'] == $selected_flavor }
94+
95+
if firebase_flavor_settings == nil
96+
UI.user_error!("distribute_to_firebase is specified, but the configuration is incomplete. Check fastlane_config firebase")
97+
return
98+
end
99+
100+
firebase_distribution = {
101+
"app_id" => firebase_flavor_settings['app_id'],
102+
"release_notes_file" => firebase_flavor_settings['release_notes_file'],
103+
"testers" => firebase_flavor_settings['testers'],
104+
"groups" => firebase_flavor_settings['groups'],
105+
"deploy_apk_only" => firebase_flavor_settings['deploy_apk_only'],
106+
}
107+
108+
if ENV['FIREBASE_APP_ID'] == nil
109+
UI.user_error!("Using firebase app distribution you must specify a valid FIREBASE_APP_ID in the '.env.flavor_name' file located in the fastlane directory.")
110+
end
111+
112+
if !firebase_distribution['deploy_apk_only'] || (firebase_distribution['deploy_apk_only'] && artifact_type == "apk")
113+
firebase_app_distribution(
114+
app: ENV['FIREBASE_APP_ID'],
115+
release_notes_file: firebase_distribution['release_notes_file'],
116+
testers: firebase_distribution['testers'],
117+
groups: firebase_distribution['groups'],
118+
android_artifact_path: path,
119+
android_artifact_type: artifact_type.upcase,
120+
)
121+
else
122+
UI.important "firebase_app_distribution was skipped because android artifact type is aab, and distribution is specified only for apk"
123+
end
124+
end
125+
end

assets/fastlane/android/Gemfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
source "https://rubygems.org"
2+
3+
gem "fastlane"
4+
5+
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
6+
eval_gemfile(plugins_path) if File.exist?(plugins_path)

assets/fastlane/android/Pluginfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Autogenerated by fastlane
2+
#
3+
# Ensure this file is checked in to source control!
4+
5+
gem 'fastlane-plugin-firebase_app_distribution'

0 commit comments

Comments
 (0)