Skip to content

Commit a1e5fb8

Browse files
cozvtieg9DemeoStepfedorenkoalex
authored
Feat/documentation (#57) (#59)
* 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 <demeo.alex@gmail.com> Co-authored-by: alexandr.fedorenko <fedorenkoalex1992@gmail.com>
1 parent 3419752 commit a1e5fb8

File tree

142 files changed

+2351
-1132
lines changed

Some content is hidden

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

142 files changed

+2351
-1132
lines changed

assets/documentation/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
## v0.0.1 - 1
4+
5+
* ProjectSetup: Initialized new project with base architecture

assets/documentation/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# {app_name}
2+
3+
Readme file contains a technical description of the {app_name} project, provides instructions on how to install the applications and contains description of complex technical solutions and flows used.
4+
5+
## Contents:
6+
7+
* [Installation instructions](docs/INSTALL_INSTRUCTION.md)
8+
* [Architecture overview](docs/ARCH_OVERVIEW.md)
9+
* [Technical description](docs/TECH_DESCRIPTION.md)
10+
* [Development solutions](docs/dev_solutions/DEV_SOLUTIONS.md)
11+
* [Changelog](CHANGELOG.md)
12+
13+
## Project environment
14+
15+
* Supported Dart SDK `>=3.2.0 <4.0.0`
16+
* Flutter SDK `Channel stable, 3.19.1`
17+
* Min Android SDK version `22`
18+
* Compile Android API version `34`
19+
* Target Android API version `34`
20+
* Minimum deployment iOS version: `12`
21+
22+
## Application packages
23+
24+
Here described package names and bundle ids used in the {app_name} application project:
25+
26+
{platform_package_names}
27+
28+
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Architecture overview
2+
3+
{app_name} project code built on Clean based hybrid Architecture (I'll just call it Clean architecture for simplicity's sake).
4+
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.
6+
7+
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.
8+
9+
The main features of the architecture:
10+
11+
* a clear separation of code into layers: data, domain, presentation is preserved;
12+
* each layer operates with data within its responsibility;
13+
* interaction between layers occurs through interfaces;
14+
* data models are separated from general use models;
15+
* DI is used to provide access to code components;
16+
* the chain of access to components and method calls is strictly defined and cannot be broken;
17+
* there is an additional app layer to meet the needs of the application;
18+
19+
## Layers, components, and their interaction
20+
21+
### App level
22+
Contains classes that meet the needs of the entire application. These are usually global components that affect the operation of the entire application. For example: navigation components, localization, utilities, etc.
23+
This layer also contains application-level services. Usually, these are services that process and store data on which the application globally depends. For example: authorization status, current user profile, etc.
24+
These services are created and transferred using DI.
25+
26+
### Data layer
27+
The data layer operates with the lowest-level data and deals with receiving data from various sources, transferring data to storage locations, transforming it, organizing it, and then transferring it to the next layer.
28+
To be more specific, the main operations that take place in the data layer are as follows:
29+
30+
* work with APIs;
31+
* work with data storage;
32+
* work with other data providers;
33+
* data transformation for further use in other layers;
34+
35+
The data layer has 2 main components: **source** and **repository implementation**.
36+
37+
**Source** receives data directly from the provider: API, Storage, or others data providers and transmits it in the data format or class of a specific error.
38+
39+
The **repository** interacts with different sources, receives data from them, transforms, combines and performs other necessary operations and passes it on in the format of data or error.
40+
41+
Both components are created through DI, and have a dependency between them, so that **source can be called from repository but not vice versa**. The dependency is ensured by passing source to the repository constructor (in the DI configuration).
42+
43+
### Domain layer
44+
The Domain layer is the link layer between data and presentation. In this layer, data is retrieved from the data layer and data calls are organized into specific scenarios.
45+
46+
The main components are: **usecase** and **repository interface**.
47+
48+
**Usecase** executes specific scenarios in the application by calling repositories, services, and other auxiliary components and returns a result that is ready to be used in the presentation in the format of data or error.
49+
50+
The **repository interface** is a simple interface that describes the functions of a specific repository and from which a specific repository in the data layer is inherited.
51+
52+
Both components are created through DI and have a dependency between them, so that **usecase can call functions of repository (or service) but not vice versa**. The dependency is ensured by passing source to the repository constructor (in the DI configuration).
53+
54+
### Presentation layer
55+
The presentation layer contains classes that are responsible for the visual display of the application, UI and screens, as well as **state controllers and presentation logic holders**(BLoC).
56+
57+
Usually, a separate state controller is used for each screen. But there are cases when it can be used in several places.
58+
59+
The **state controller** is the highest component in the call chain by calling **usecase** and it initiates calls to other components sequentially. In turn, the state controller depends on the events that occur in the UI.
60+
61+
### Call chain
62+
63+
To be more specific, the call chain works from the highest level (UI and state controller) to the lowest and usually looks like this:
64+
65+
* usecase called from state controller (BLoC);
66+
* one or more repositories(interface) (or services) called from usecase;
67+
* one or more sources called from repository(implementation);
68+
* source called data provider (API request or else);
69+
* result is providing back to caller by returning result in each component;
70+
71+
72+
73+
74+
75+
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# {app_name} Installation guide
2+
3+
This section describes different installation options. It consists of the following parts:
4+
5+
* Terminology
6+
* Platforms supported
7+
* Environment variables and setup
8+
* Important installation instructions
9+
* How to run {app_name} application locally
10+
* How to run {app_name} automatic tests
11+
* How to build {app_name} application
12+
13+
14+
15+
## Terminology
16+
17+
* **Output Type** - platform keyword used in run or build commands to specify for what platform app will be built. Available platforms are:
18+
19+
```
20+
{output_types}
21+
```
22+
Apk and AppBundle refers to Android and specifies a type of output file (`*.apk` or `*.aab`).
23+
24+
25+
* **Flavor** - type of application configuration. {app_name} supports following flavors:
26+
27+
```
28+
{app_flavors}
29+
```
30+
31+
* **Build type** - type of build process: `release` or `debug`.
32+
* **main.dart** file - main file and entry point of your application. {main_count_description}:
33+
34+
```
35+
{app_main_files}
36+
```
37+
38+
When you specifying a flavor in run or build command you also need to specify corresponding `main.dart` file for that flavor.
39+
40+
## Platforms supported
41+
42+
{app_name} application supported on following platforms:
43+
44+
{app_platforms}
45+
46+
## Important installation instructions
47+
48+
Before opening {app_name} project make sure that you have installed followed software on your Mac or PC:
49+
50+
* IDE (Android Studio or VSCode)
51+
* Dart SDK
52+
* Flutter SDK and Flutter plugin for IDE
53+
54+
When you sure you installed followed software follow steps to prepare {app_name} project to build.
55+
56+
* Open project folder in your IDE and wait for project indexing finished
57+
* Open IDE terminal and run `dart pub get` command and wait to complete and import errors disappeared
58+
59+
## Environment variables and setup
60+
61+
To add project environment keys need to create `.env` file in root folder for each of flavors:
62+
63+
```
64+
{app_env_files}
65+
```
66+
67+
{app_env_explanation}
68+
Environment file scheme:
69+
70+
```
71+
STRIPE_KEY=enter_stripe_key
72+
OPENAI_PUBLIC_KEY=enter_openAi_key
73+
```
74+
## How to run {app_name} application locally
75+
76+
To run {app_name} application locally on device follow steps:
77+
78+
* Connect device or open an device emulator and make sure it appeared in devices list in IDE;
79+
* Select build configuration in Flutter plugin toolbar
80+
* Press Run button
81+
82+
You can use commands to run applications also. To run app:
83+
84+
* Open IDE terminal
85+
* Run command `flutter run --flavor {flavor} --{build_type} -t {path_to_main.dart}`
86+
87+
## How to run {app_name} automatic tests
88+
89+
{app_name} application is covered with **unit** and **widgets** tests.
90+
The goal of a unit test is to verify the correctness of a unit of logic under a variety of conditions.
91+
The goal of a widget test is to verify that the widget’s UI looks and interacts as expected.
92+
93+
To lauch all tests run following command in IDE terminal:
94+
95+
`flutter test`
96+
97+
To launch specific test run following command in IDE terminal:
98+
99+
`flutter test {path_to test_file.dart}`
100+
101+
## How to build {app_name} application
102+
103+
To build application open IDE terminal use following command:
104+
105+
`flutter build {output_type} --flavor {flavor} -t {{path_to_main.dart}}`
106+
107+
Add obfuscation params if you build application for mobile platforms:
108+
`--obfuscate --split-debug-info=debug_info`
109+
110+
Next step is depending on platform:
111+
112+
* For iOS and MacOS open ios/macos folder of project in XCode and follow instructions How to upload app to AppStore
113+
* 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
115+
116+
## Possible build errors
117+
118+
### Some files are underlined red in project file tree:
119+
120+
Try to run `dart pub get` command in IDE terminal
121+
122+
### When you build an iOS or MacOS application you might get Pod's issue.
123+
124+
To fix that run following command in IDE terminal:
125+
126+
`cd ios && pod cache clean --all && pod repo update && pod update && cd .. && flutter clean && flutter pub get`
127+
128+
129+
130+
131+
132+
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# {app_name} Technical description
2+
3+
This file contains a description of technologies, packages and libraries used in {app_name} project.
4+
5+
## Main Technologies
6+
7+
### Core packages
8+
* [GetIt](https://pub.dev/packages/get_it) - service locator, used for fast and effective acces to objects
9+
* [Screen Util](https://pub.dev/packages/flutter_screenutil) - adaptive UI tools providing autoscaling UI features
10+
* [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
12+
13+
### Local storage and database
14+
15+
* [Hive](https://pub.dev/packages/hive) - effective noSQL database
16+
* [Shared Preferences](https://pub.dev/packages/shared_preferences) - key-value storage
17+
18+
### Networking
19+
20+
* [Dio](https://pub.dev/packages/dio) - Http client
21+
* [Json Annotation](https://pub.dev/packages/json_annotation) - code generation based JSON parsing utility
22+
23+
### State management
24+
25+
* [Bloc](https://pub.dev/packages/flutter_bloc) - state management
26+
27+
### UI
28+
29+
* [Native Splash](https://pub.dev/packages/flutter_native_splash) - utitity to generate splash screen from yaml configuration(in `pubspec.yaml`)
30+
31+
## Build runner
32+
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).
34+
35+
To generate classes:
36+
37+
`flutter packages pub run build_runner build`
38+
39+
Use the [watch] flag to watch the files' system for edits and rebuild as necessary.
40+
41+
`flutter packages pub run build_runner watch`
42+
43+
If you have conflicts use command:
44+
45+
`flutter pub run build_runner build --delete-conflicting-outputs`
46+
47+
## Launcher Icons
48+
49+
{app_name} uses [flutter_launcher_icons](https://pub.dev/packages/flutter_launcher_icons) plugin fro quick generation on icons for mobile applications. Flutter Launcher Icons configuration placed in pubspec.yaml (`flutter_launcher_icons` section) or in config file called `flutter_launcher_icons.yaml`.
50+
After you changing configuration or icon images need to rerun icons generation to apply changes using command:
51+
52+
`flutter pub run flutter_launcher_icons:main`
53+
54+
If project contains flavors and need to regenerate icons for ech flavor run:
55+
56+
`flutter pub run flutter_launcher_icons:main -f flutter_launcher_icons*`
57+
58+
## Deep links
59+
60+
{app_name} has a deep link features, and here describe all deeplinks options are available in the application.
61+
62+
Deep links schemes are:
63+
64+
* Android: `https://dev-backend.myapp.com/{action}`
65+
* iOS: `myappappscheme://myapp.com/{action}`
66+
* iOS Unilink: `https://dev-backend.myapp.com/{action}`
67+
68+
Deeplink actions:
69+
70+
* Move money (deeplink to open transfer money to some user): `move_money`
71+
72+
### Testing Deep links
73+
**Android:**
74+
```
75+
adb shell am start -a android.intent.action.VIEW \
76+
-c android.intent.category.BROWSABLE \
77+
-d https://dev-backend.myapp.com/move_money
78+
```
79+
80+
**iOS Scheme links:**
81+
82+
`xcrun simctl openurl booted myappappscheme://myapp.com/move_money`
83+
84+
**IOS Uni Links:**
85+
86+
`xcrun simctl openurl booted https://dev-backend.myapp.com/move_money`
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Development solutions
2+
3+
This section describes complex flows, custom complex solutions and describes package modifications used in {app_name} application.
4+
5+
Contents:
6+
* [Example Flow](EXAMPLE.md)
7+
8+
9+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Example Flow
2+
3+
4+
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.
6+
7+
```mermaid
8+
flowchart TD
9+
A[User Logged In] --> B[Check KYC status];
10+
B ----> C{KYC Approved}
11+
C -- Yes --> D[User allowed to order physical card];
12+
C -- No --> E[Show Verify identity button on Home screen];
13+
D ----> F[Verify button pressed]
14+
E ----> G{Launch Onfido verifying}
15+
G -- Verified --> D;
16+
G -- Verification failed --> J[Show Verification failure message];
17+
J ----> E
18+
```

bricks/flutter_clean_base/__brick__/{{project_name.snakeCase()}}/lib/app/service/app_service.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class AppService {
1919
final _secureFromJailbreak = true;
2020

2121
Future<bool> initialize() async {
22-
if (_secureFromJailbreak && !kIsWeb) {
22+
if (_secureFromJailbreak && !kIsWeb && !kDebugMode) {
2323
final isJailBroken = await FlutterJailbreakDetection.jailbroken;
2424
if (isJailBroken) {
2525
return false;

bricks/flutter_clean_base/__brick__/{{project_name.snakeCase()}}/lib/core/di/remote.dart

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,18 @@ import 'package:{{project_name}}/core/arch/data/remote/clients/dio/dio_request_p
77
{{#graphql}}import 'package:{{project_name}}/core/arch/data/remote/clients/graph_ql/graph_ql_client.dart';
88
import 'package:{{project_name}}/core/arch/data/remote/clients/graph_ql/request_processor/graph_ql_request_processor.dart';
99
import 'package:{{project_name}}/core/arch/data/remote/clients/graph_ql/request_processor/graph_ql_request_processor_impl.dart';{{/graphql}}
10-
10+
{{#firebase_auth}}import 'package:firebase_auth/firebase_auth.dart';{{/firebase_auth}}
1111
void registerRemote(GetIt getIt) {
1212
final dioClientModule = _DioClientModule();
1313

1414
getIt.registerLazySingleton<DioRequestProcessor>(
1515
dioClientModule.makeDioErrorHandler,
16-
);{{#graphql}}
17-
getIt.registerLazySingleton<GraphQlRequestProcessor>(
16+
);{{#firebase_auth}}
17+
getIt.registerLazySingleton<FirebaseAuth>(
18+
() => FirebaseAuth.instance,
19+
);{{/firebase_auth}}
20+
21+
{{#graphql}}getIt.registerLazySingleton<GraphQlRequestProcessor>(
1822
GraphQlRequestProcessorImpl.new,
1923
);
2024
getIt.registerLazySingleton<GraphQlClient>(
@@ -23,6 +27,5 @@ void registerRemote(GetIt getIt) {
2327
//{remote end}
2428
}
2529

26-
{{#graphql}}GraphQlClient graphQlApiClient() => GetIt.I.get<GraphQlClient>();
27-
{{/graphql}}
30+
{{#graphql}}GraphQlClient graphQlApiClient() => GetIt.I.get<GraphQlClient>();{{/graphql}}
2831
class _DioClientModule extends DioClientModule {}

0 commit comments

Comments
 (0)