Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a4e29f38c
|
||
|
|
ca70f2eb1d
|
||
|
|
f123e537ae
|
||
|
|
c3315d968c | ||
|
|
45312473d1 | ||
|
|
17e7bce9e6 | ||
|
|
3886ef080e
|
||
|
|
626d951443
|
||
|
|
f36e0b51e0
|
||
|
|
80ce7aff91 | ||
|
|
a9121b6862 | ||
|
|
54f92e8042 | ||
|
|
00393a6ba7 | ||
|
|
136e0e8c98 | ||
|
|
500a6ae51d | ||
|
|
79fdde25fc | ||
|
|
742bf1d614 | ||
|
|
0dbde68d7d | ||
|
|
cd881da072 | ||
|
|
5918a5cf1f | ||
|
|
775d766d14 | ||
|
|
383098b147 | ||
|
|
4d51e2b786 | ||
|
|
32cc1f55d9 | ||
|
|
6ee101bf36 | ||
|
|
f0ed08bd49
|
||
|
|
390fb81b1e
|
||
|
|
279d451cd8
|
||
|
|
a66db23ace
|
||
|
|
3d7af98ac9
|
||
|
|
b033b97917 | ||
|
|
14b7f31b53
|
||
|
|
403bcafe93
|
||
|
|
21ab6f6021
|
||
|
|
198ecac5da
|
@@ -197,4 +197,7 @@ $RECYCLE.BIN/
|
||||
.idea/
|
||||
*.iml
|
||||
google-services.json
|
||||
pubspec_overrides.yaml
|
||||
pubspec_overrides.yaml
|
||||
|
||||
# Mason
|
||||
.mason/
|
||||
@@ -3,6 +3,65 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## 2022-12-03
|
||||
|
||||
### Changes
|
||||
|
||||
---
|
||||
|
||||
Packages with breaking changes:
|
||||
|
||||
- [`wyatt_architecture` - `v0.1.0`](#wyatt_architecture---v010)
|
||||
|
||||
Packages with other changes:
|
||||
|
||||
- [`wyatt_authentication_bloc` - `v0.4.0+2`](#wyatt_authentication_bloc---v0402)
|
||||
- [`wyatt_crud_bloc` - `v0.1.0+1`](#wyatt_crud_bloc---v0101)
|
||||
- [`wyatt_form_bloc` - `v0.2.0+1`](#wyatt_form_bloc---v0201)
|
||||
|
||||
Packages with dependency updates only:
|
||||
|
||||
> Packages listed below depend on other packages in this workspace that have had changes. Their versions have been incremented to bump the minimum dependency versions of the packages they depend upon in this project.
|
||||
|
||||
- `wyatt_authentication_bloc` - `v0.4.0+2`
|
||||
- `wyatt_crud_bloc` - `v0.1.0+1`
|
||||
- `wyatt_form_bloc` - `v0.2.0+1`
|
||||
|
||||
---
|
||||
|
||||
#### `wyatt_architecture` - `v0.1.0`
|
||||
|
||||
- **REFACTOR**: update naming methodes (close #47).
|
||||
- **REFACTOR**: update example. (close #38).
|
||||
- **FIX**: fix execute method on error handler. (#38).
|
||||
- **FEAT**: update usecase en add & sepcific case. (#38).
|
||||
- **FEAT**: add obsevers for alternative usecase scenarions (#38).
|
||||
- **DOCS**: generate class model. (#38).
|
||||
- **DOCS**: update Readme. (#38).
|
||||
- **BREAKING** **CHORE**: update exports. (#38).
|
||||
|
||||
|
||||
## 2022-11-16
|
||||
|
||||
### Changes
|
||||
|
||||
---
|
||||
|
||||
Packages with breaking changes:
|
||||
|
||||
- There are no breaking changes in this release.
|
||||
|
||||
Packages with other changes:
|
||||
|
||||
- [`wyatt_authentication_bloc` - `v0.4.0+1`](#wyatt_authentication_bloc---v0401)
|
||||
|
||||
---
|
||||
|
||||
#### `wyatt_authentication_bloc` - `v0.4.0+1`
|
||||
|
||||
- **FIX**: add sort of mutex on onAuthChanges callback trigger.
|
||||
|
||||
|
||||
## 2022-11-16
|
||||
|
||||
### Changes
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<!--
|
||||
* Copyright (C) 2022 WYATT GROUP
|
||||
* Please see the AUTHORS file for details.
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
-->
|
||||
@@ -51,39 +51,54 @@ and open source.
|
||||
|
||||
---
|
||||
|
||||
## Development
|
||||
## Contribution
|
||||
|
||||
Clone this repo.
|
||||
|
||||
You have to install [melos](https://github.com/invertase/melos).
|
||||
```shell
|
||||
git clone ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-packages.git
|
||||
```
|
||||
|
||||
### Prerequisite
|
||||
|
||||
- [Flutter](https://github.com/flutter/flutter).
|
||||
|
||||
- [Melos](https://github.com/invertase/melos). Used to manage Dart projects with multiple packages.
|
||||
|
||||
```shell
|
||||
dart pub global activate melos
|
||||
```
|
||||
|
||||
Then bootstrap with `melos bs`.
|
||||
- [Mason](https://github.com/felangel/mason). Used for code generation.
|
||||
|
||||
```shell
|
||||
dart pub global activate mason_cli
|
||||
```
|
||||
|
||||
- [Lcov](https://github.com/linux-test-project/lcov). Used to generate coverage data.
|
||||
|
||||
```shell
|
||||
# on macos
|
||||
brew install lcov
|
||||
```
|
||||
|
||||
- genhtml. Used to convert coverage data into html pages.
|
||||
|
||||
After installing all these packages, bootstrap with `melos bs`.
|
||||
|
||||
### Create a new package
|
||||
|
||||
Create a new package in `packages/` folder.
|
||||
|
||||
```shell
|
||||
dart create -t package-simple wyatt_<name>
|
||||
```
|
||||
|
||||
Remove any `example/` subfolder. Then create a new sample project.
|
||||
|
||||
```shell
|
||||
flutter create --platforms android --project-name <name>_example example
|
||||
mason make wyatt_package --package_name wyatt_<name> --description A new Wyatt package --flutter_only false
|
||||
```
|
||||
|
||||
Then bootstrap project with `melos bs` command.
|
||||
|
||||
### Convention
|
||||
|
||||
#### Naming
|
||||
|
||||
In the previous instructions `<name>` variable is important.
|
||||
In the previous instructions `<name>` variable is important.
|
||||
It have to be clear and intelligible.
|
||||
|
||||
You **MUST** use underscores.
|
||||
@@ -93,15 +108,44 @@ You **MUST** use `wyatt` prefix for package.
|
||||
You **MUST** name example with specific name.
|
||||
|
||||
For example, if name is CRUD BLOC
|
||||
|
||||
- name will be crud_bloc
|
||||
- so the package will be: `wyatt_crud_bloc`
|
||||
- and the example will be: `crud_bloc_example`
|
||||
|
||||
#### Commits
|
||||
### Create issues
|
||||
|
||||
Add the issues directly related to what you want to develop and label them correctly.
|
||||
|
||||
```
|
||||
Type(scope): issue.
|
||||
```
|
||||
|
||||
For example, on notification bloc package :
|
||||
|
||||
- `Feature(notification_bloc): add firebase messaging data source.`
|
||||
- `Test(notification_bloc): add test for pushwoosh datasource.`
|
||||
|
||||
### Branches
|
||||
|
||||
Master is protected. You can't push on it. Please develop your feature on another branch. The name of your branch has to match with the issue opened.
|
||||
|
||||
`type(scope):issue`
|
||||
|
||||
Example :
|
||||
Issue :
|
||||
|
||||
- `Feature(notification_bloc): add firebase messaging data source.`
|
||||
|
||||
Branch related to this issue :
|
||||
|
||||
- `feature(notification_bloc)/add_firebase_messaging_data_source`
|
||||
|
||||
### Commits
|
||||
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
tl;dr : `type(scope): description`.
|
||||
tl;dr : `type(scope): description #issue`.
|
||||
Here allowed <type> values:
|
||||
|
||||
- **feat** for a new feature for the user, not a new feature for build script. Such commit will trigger a release bumping a MINOR version.
|
||||
@@ -115,11 +159,68 @@ Here allowed <type> values:
|
||||
|
||||
Some examples :
|
||||
|
||||
- `feat(auth): add AWS support.` = add a feature in authentication_bloc package.
|
||||
- `feat(auth): add AWS support. (#31)` = add a feature in authentication_bloc package, linked to the 31st issue.
|
||||
- `docs: update readme.` = update **this** readme file.
|
||||
- `fix(crud)!: fix bug in awesome() function.` = fix a bug, `!` is important and indicate `BREAKING CHANGES`.
|
||||
- `fix(crud)!: fix bug in awesome() function. (#32)` = fix a bug, `!` is important and indicate `BREAKING CHANGES` linked with the 32nd issue.
|
||||
|
||||
Conventional commits are important for `melos version` command !
|
||||
When you have finished developing, and are ready to close the issue, close it via your commit :
|
||||
|
||||
`feat(auth): add AWS support. (close #31)`
|
||||
|
||||
Note that your issue will be close after merging on master.
|
||||
Before closing the issue, please check tests and update coverage. You might run :
|
||||
|
||||
```shell
|
||||
melos run test
|
||||
melos run gen_coverage
|
||||
```
|
||||
|
||||
#### Merge your work
|
||||
|
||||
After closing your issue, some work may have been done on master in the meantime. To keep a clean git history, please rebase before opening a change request.
|
||||
|
||||
Two situations :
|
||||
|
||||
- You have not yet created your branch and have committed locally :
|
||||
|
||||
```shell
|
||||
git pull --rebase
|
||||
```
|
||||
|
||||
- You are already working on your branch :
|
||||
|
||||
```shell
|
||||
git rebase -i master
|
||||
```
|
||||
|
||||
If possible, please use `--fixup` on your commit in interactive rebase.
|
||||
|
||||
Then, opend your PR, get the necessary approval and merge your work. Then you're done ✅.
|
||||
|
||||
#### Update version.
|
||||
|
||||
Once your work is on the master, you can update your package version. Please filter packages to update only your package. `--scope` is used to do it.
|
||||
For example, after merging changes on `wyatt_otification_bloc` package, you might run :
|
||||
|
||||
```shell
|
||||
melos version --scope="*wyatt_notification_bloc*"
|
||||
```
|
||||
|
||||
In fact, melos will filter all packages that match the `wyatt_notification_block` pattern.
|
||||
|
||||
You can update check all packages tests by running :
|
||||
|
||||
```shell
|
||||
melos run test
|
||||
```
|
||||
|
||||
#### Publish your package
|
||||
|
||||
If package is ready for procution, publish it runnig :
|
||||
|
||||
```shell
|
||||
melos publish --scope"*package*"
|
||||
```
|
||||
|
||||
#### Badging
|
||||
|
||||
@@ -130,7 +231,8 @@ In the package `readme.md` file, please specify the supported SDK:
|
||||
```markdown
|
||||

|
||||
```
|
||||
or
|
||||
|
||||
or
|
||||
|
||||

|
||||
|
||||
@@ -161,4 +263,10 @@ Here you can change `package name` and `package version`.
|
||||
|
||||

|
||||
|
||||
This repository is maintained by Wyatt Studio but work is in progress.
|
||||
This repository is maintained by Wyatt Studio but work is in progress.
|
||||
|
||||
## Simple work flow diagramm
|
||||
|
||||
To sum up, here a simple work flow diagramm.
|
||||
|
||||

|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
escapedPath="$(echo `pwd` | sed 's/\//\\\//g')"
|
||||
|
||||
if grep flutter pubspec.yaml > /dev/null; then
|
||||
if [ -d "coverage" ]; then
|
||||
# combine line coverage info from package tests to a common file
|
||||
if [ ! -d "$MELOS_ROOT_PATH/coverage" ]; then
|
||||
mkdir "$MELOS_ROOT_PATH/coverage"
|
||||
fi
|
||||
sed "s/^SF:lib/SF:$escapedPath\/lib/g" coverage/lcov.info >> "$MELOS_ROOT_PATH/coverage/lcov.info"
|
||||
rm -rf "coverage"
|
||||
fi
|
||||
fi
|
||||
@@ -0,0 +1,15 @@
|
||||
@startuml Simple Developpment Workflow
|
||||
start
|
||||
:Create an issue;
|
||||
:Create branch related to the issue;
|
||||
repeat :Commit related to the issue;
|
||||
repeat while (feature is done)
|
||||
:Update coverage;
|
||||
:Close issue via last commit;
|
||||
:Rebase from `master`;
|
||||
:Create pull request;
|
||||
:Merge branches;
|
||||
:Update version;
|
||||
:Publish package;
|
||||
stop
|
||||
@enduml
|
||||
|
After Width: | Height: | Size: 7.5 KiB |
@@ -0,0 +1 @@
|
||||
{"bricks":{"wyatt_clean_code":{"git":{"url":"ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git","path":"bricks/wyatt_clean_code","ref":"033baa65408ec6b68e6a2ef43e64c24708ef16a1"}},"wyatt_feature_brick":{"git":{"url":"ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git","path":"bricks/wyatt_feature_brick","ref":"033baa65408ec6b68e6a2ef43e64c24708ef16a1"}},"wyatt_package":{"git":{"url":"ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git","path":"bricks/wyatt_package","ref":"033baa65408ec6b68e6a2ef43e64c24708ef16a1"}}}}
|
||||
@@ -0,0 +1,13 @@
|
||||
bricks:
|
||||
wyatt_clean_code:
|
||||
git:
|
||||
url: ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git
|
||||
path: bricks/wyatt_clean_code
|
||||
wyatt_feature_brick:
|
||||
git:
|
||||
url: ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git
|
||||
path: bricks/wyatt_feature_brick
|
||||
wyatt_package:
|
||||
git:
|
||||
url: ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git
|
||||
path: bricks/wyatt_package
|
||||
@@ -36,6 +36,20 @@ scripts:
|
||||
clean:deep:
|
||||
run: git clean -x -d -f -q
|
||||
description: Clean things very deeply with `git clean`.
|
||||
|
||||
test:selective_unit_test:
|
||||
run: melos exec --dir-exists="test" -- flutter test --no-pub --coverage
|
||||
description: Run Flutter tests for a specific package in this project.
|
||||
select-package:
|
||||
flutter: true
|
||||
|
||||
test:
|
||||
run: melos run test:selective_unit_test --no-select
|
||||
description: Run all Flutter tests in this project.
|
||||
|
||||
gen-coverage: melos exec -- sh "\$MELOS_ROOT_PATH/combine_coverage.sh" && genhtml coverage/lcov.info -o coverage/html
|
||||
|
||||
gen-class-models: melos exec --scope="*wyatt_*" -- dart pub global run dcdg -o models/class-models.puml
|
||||
|
||||
# Additional cleanup lifecycle script, executed when `melos clean` is run.
|
||||
postclean: >
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
## 0.1.0
|
||||
|
||||
> Note: This release has breaking changes.
|
||||
|
||||
- **REFACTOR**: update naming methodes (close #47).
|
||||
- **REFACTOR**: update example. (close #38).
|
||||
- **FIX**: fix execute method on error handler. (#38).
|
||||
- **FEAT**: update usecase en add & sepcific case. (#38).
|
||||
- **FEAT**: add obsevers for alternative usecase scenarions (#38).
|
||||
- **DOCS**: generate class model. (#38).
|
||||
- **DOCS**: update Readme. (#38).
|
||||
- **BREAKING** **CHORE**: update exports. (#38).
|
||||
|
||||
## 0.0.2
|
||||
|
||||
- Graduate package to a stable release. See pre-releases prior to this version for changelog entries.
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
@@ -31,10 +31,10 @@ The Wyatt Architecture for Flutter.
|
||||
|
||||
## Features
|
||||
|
||||
* Usecase
|
||||
* Repository
|
||||
* DataSource
|
||||
* Entity
|
||||
- Usecase
|
||||
- Repository
|
||||
- DataSource
|
||||
- Entity
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -73,19 +73,20 @@ abstract class PhotoRepository extends BaseRepository {
|
||||
}
|
||||
```
|
||||
|
||||
> Here the repository is just a proxy of the data sources with result type (to have beautiful error handling).
|
||||
> Here the repository is just a proxy of the data sources with result type (to have beautiful error handling).
|
||||
|
||||
And finaly create your different usecases by using `UseCase<Parameters, ReturnType>` :
|
||||
And finaly create your different usecases :
|
||||
|
||||
Several use cases are supported :
|
||||
|
||||
- Classic usecase :
|
||||
|
||||
```dart
|
||||
class RetrieveAllPhoto extends UseCase<QueryParameters, List<Photo>> {
|
||||
final PhotoRepository _photoRepository;
|
||||
|
||||
RetrieveAllPhotos(this._photoRepository);
|
||||
class Test extends AsyncUseCase<QueryParameters, List<Photo>>> {
|
||||
|
||||
@override
|
||||
FutureResult<List<Photo>> call(QueryParameters params) {
|
||||
final photos = _photoRepository.getAllPhotos(
|
||||
FuturOrResult<List<Photo>>> call(QueryParameters? params) {
|
||||
final photos = _photoRepository.getAllPhotos(
|
||||
start: params.start,
|
||||
limit: params.limit,
|
||||
);
|
||||
@@ -94,6 +95,54 @@ class RetrieveAllPhoto extends UseCase<QueryParameters, List<Photo>> {
|
||||
}
|
||||
```
|
||||
|
||||
You can add alternatve scenarios and check pre/post conditions using our extensions :
|
||||
|
||||
```dart
|
||||
class SearchPhotos extends AsyncUseCase<QueryParameters, List<Photo>>> {
|
||||
|
||||
@override
|
||||
FutureOrResult<List<Photo>>> call(QueryParameters? params) {
|
||||
final photos = _photoRepository.getAllPhotos(
|
||||
start: params.start,
|
||||
limit: params.limit,
|
||||
);
|
||||
return photos;
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
FutureOr<void> onStart(QueryParameters? params) {
|
||||
if(params.start == null || params.limit == null){
|
||||
throw ClientException('Préconndition non valides');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
You can implement error scenarios overriding `onError`, or check postconditions by overriding `onComplete` .
|
||||
|
||||
- Stream usecase :
|
||||
|
||||
```dart
|
||||
class SearchPhotos extends StreamUseCase<QueryParameters, List<Photo>>> {
|
||||
|
||||
@override
|
||||
FutureOrResult<Stream<List<Photo>>>> call(QueryParameters? params) {
|
||||
final photos = _photoRepository.getAllPhotos(
|
||||
start: params.start,
|
||||
limit: params.limit,
|
||||
);
|
||||
return photos;
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
On this case, observers allow you to add alternative scénarios when data changed, overriding `onData` or `onDone`.
|
||||
|
||||
Please note that to use handlers, call `call` method and not `execute`.
|
||||
|
||||
> In fact, here we need a new parameter object, so let's create it:
|
||||
|
||||
```dart
|
||||
@@ -171,4 +220,4 @@ class PhotoRepositoryImpl extends PhotoRepository {
|
||||
}
|
||||
```
|
||||
|
||||
That's all.
|
||||
That's all.
|
||||
|
||||
@@ -35,46 +35,47 @@ class PhotoRepositoryImpl extends PhotoRepository {
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<void> addPhotoToFavorites(Photo photo) => Result.tryCatchAsync(
|
||||
FutureOrResult<void> addPhotoToFavorites(Photo photo) => Result.tryCatchAsync(
|
||||
() => _favoriteLocalDataSource.addPhotoToFavorites(photo),
|
||||
(error) => ClientException('Cannot add photo to favorites.'),
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<bool> checkIfPhotoIsInFavorites(int id) => Result.tryCatchAsync(
|
||||
FutureOrResult<bool> checkIfPhotoIsInFavorites(int id) =>
|
||||
Result.tryCatchAsync(
|
||||
() => _favoriteLocalDataSource.checkIfPhotoIsInFavorites(id),
|
||||
(error) =>
|
||||
ClientException('Cannot check if photo `$id` is in favorites.'),
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<void> deletePhotoFromFavorites(int id) => Result.tryCatchAsync(
|
||||
FutureOrResult<void> deletePhotoFromFavorites(int id) => Result.tryCatchAsync(
|
||||
() => _favoriteLocalDataSource.deletePhotoFromFavorites(id),
|
||||
(error) => ClientException('Cannot delete photo `$id` from favorites.'),
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<Album> getAlbum(int id) => Result.tryCatchAsync(
|
||||
FutureOrResult<Album> getAlbum(int id) => Result.tryCatchAsync(
|
||||
() => _albumRemoteDataSource.getAlbum(id),
|
||||
(error) => ServerException('Cannot retrieve album $id.'),
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<List<Album>> getAllAlbums({int? start, int? limit}) =>
|
||||
FutureOrResult<List<Album>> getAllAlbums({int? start, int? limit}) =>
|
||||
Result.tryCatchAsync(
|
||||
() => _albumRemoteDataSource.getAllAlbums(start: start, limit: limit),
|
||||
(error) => ServerException('Cannot retrieve all albums.'),
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<List<Photo>> getAllPhotos({int? start, int? limit}) async =>
|
||||
FutureOrResult<List<Photo>> getAllPhotos({int? start, int? limit}) async =>
|
||||
Result.tryCatchAsync(
|
||||
() => _photoRemoteDataSource.getAllPhotos(start: start, limit: limit),
|
||||
(error) => ServerException('Cannot retrieve all photos.'),
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<List<Photo>> getAllPhotosFromFavorites() async {
|
||||
FutureOrResult<List<Photo>> getAllPhotosFromFavorites() async {
|
||||
try {
|
||||
final response = <Photo>[];
|
||||
final favorites =
|
||||
@@ -95,13 +96,13 @@ class PhotoRepositoryImpl extends PhotoRepository {
|
||||
}
|
||||
|
||||
@override
|
||||
FutureResult<Photo> getPhoto(int id) => Result.tryCatchAsync(
|
||||
FutureOrResult<Photo> getPhoto(int id) => Result.tryCatchAsync(
|
||||
() => _photoRemoteDataSource.getPhoto(id),
|
||||
(error) => ServerException('Cannot retrieve photo $id.'),
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<List<Photo>> getPhotosFromAlbum(
|
||||
FutureOrResult<List<Photo>> getPhotosFromAlbum(
|
||||
int albumId, {
|
||||
int? start,
|
||||
int? limit,
|
||||
|
||||
@@ -19,17 +19,17 @@ import 'package:architecture_example/domain/entities/photo.dart';
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
|
||||
abstract class PhotoRepository extends BaseRepository {
|
||||
FutureResult<Album> getAlbum(int id);
|
||||
FutureResult<List<Album>> getAllAlbums({int? start, int? limit});
|
||||
FutureResult<Photo> getPhoto(int id);
|
||||
FutureResult<List<Photo>> getAllPhotos({int? start, int? limit});
|
||||
FutureResult<List<Photo>> getPhotosFromAlbum(
|
||||
FutureOrResult<Album> getAlbum(int id);
|
||||
FutureOrResult<List<Album>> getAllAlbums({int? start, int? limit});
|
||||
FutureOrResult<Photo> getPhoto(int id);
|
||||
FutureOrResult<List<Photo>> getAllPhotos({int? start, int? limit});
|
||||
FutureOrResult<List<Photo>> getPhotosFromAlbum(
|
||||
int albumId, {
|
||||
int? start,
|
||||
int? limit,
|
||||
});
|
||||
FutureResult<void> addPhotoToFavorites(Photo photo);
|
||||
FutureResult<void> deletePhotoFromFavorites(int id);
|
||||
FutureResult<List<Photo>> getAllPhotosFromFavorites();
|
||||
FutureResult<bool> checkIfPhotoIsInFavorites(int id);
|
||||
FutureOrResult<void> addPhotoToFavorites(Photo photo);
|
||||
FutureOrResult<void> deletePhotoFromFavorites(int id);
|
||||
FutureOrResult<List<Photo>> getAllPhotosFromFavorites();
|
||||
FutureOrResult<bool> checkIfPhotoIsInFavorites(int id);
|
||||
}
|
||||
|
||||
@@ -1,31 +1,40 @@
|
||||
// Copyright (C) 2022 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:architecture_example/domain/entities/photo.dart';
|
||||
import 'package:architecture_example/domain/repositories/photo_repository.dart';
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
|
||||
class AddPhotoToFavorites extends UseCase<Photo, List<Photo>> {
|
||||
class AddPhotoToFavorites extends AsyncUseCase<Photo, List<Photo>> {
|
||||
final PhotoRepository _photoRepository;
|
||||
|
||||
AddPhotoToFavorites(this._photoRepository);
|
||||
|
||||
@override
|
||||
FutureResult<List<Photo>> call(Photo params) async {
|
||||
await _photoRepository.addPhotoToFavorites(params);
|
||||
FutureOrResult<List<Photo>> execute(Photo? params) async {
|
||||
await _photoRepository.addPhotoToFavorites(params!);
|
||||
return _photoRepository.getAllPhotosFromFavorites();
|
||||
}
|
||||
|
||||
@override
|
||||
FutureOr<void> onStart(Photo? params) {
|
||||
if (params == null) {
|
||||
throw ClientException('Photo cannot be null');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,15 +14,24 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:architecture_example/domain/repositories/photo_repository.dart';
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
|
||||
class CheckIfPhotoIsInFavorites extends UseCase<int, bool> {
|
||||
class CheckIfPhotoIsInFavorites extends AsyncUseCase<int, bool> {
|
||||
final PhotoRepository _photoRepository;
|
||||
|
||||
CheckIfPhotoIsInFavorites(this._photoRepository);
|
||||
|
||||
@override
|
||||
FutureResult<bool> call(int params) async =>
|
||||
_photoRepository.checkIfPhotoIsInFavorites(params);
|
||||
FutureOrResult<bool> execute(int? params) async =>
|
||||
_photoRepository.checkIfPhotoIsInFavorites(params!);
|
||||
|
||||
@override
|
||||
FutureOr<void> onStart(int? params) {
|
||||
if (params == null) {
|
||||
throw ClientException('id cannot be null');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
// Copyright (C) 2022 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
@@ -18,13 +18,13 @@ import 'package:architecture_example/domain/entities/photo.dart';
|
||||
import 'package:architecture_example/domain/repositories/photo_repository.dart';
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
|
||||
class DisplayFavorites extends UseCase<void, List<Photo>> {
|
||||
class DisplayFavorites extends AsyncUseCase<NoParam, List<Photo>> {
|
||||
final PhotoRepository _photoRepository;
|
||||
|
||||
DisplayFavorites(this._photoRepository);
|
||||
|
||||
@override
|
||||
FutureResult<List<Photo>> call(void params) {
|
||||
FutureOrResult<List<Photo>> execute(void params) {
|
||||
final photos = _photoRepository.getAllPhotosFromFavorites();
|
||||
return photos;
|
||||
}
|
||||
|
||||
@@ -14,18 +14,27 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:architecture_example/domain/entities/photo.dart';
|
||||
import 'package:architecture_example/domain/repositories/photo_repository.dart';
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
|
||||
class DisplayPhoto extends UseCase<int, Photo> {
|
||||
class DisplayPhoto extends AsyncUseCase<int, Photo> {
|
||||
final PhotoRepository _photoRepository;
|
||||
|
||||
DisplayPhoto(this._photoRepository);
|
||||
|
||||
@override
|
||||
FutureResult<Photo> call(int params) {
|
||||
final photo = _photoRepository.getPhoto(params);
|
||||
FutureOrResult<Photo> execute(int? params) {
|
||||
final photo = _photoRepository.getPhoto(params!);
|
||||
return photo;
|
||||
}
|
||||
|
||||
@override
|
||||
FutureOr<void> onStart(int? params) {
|
||||
if (params == null) {
|
||||
throw ClientException('id cannot be null');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,24 +14,33 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:architecture_example/domain/entities/photo.dart';
|
||||
import 'package:architecture_example/domain/repositories/photo_repository.dart';
|
||||
import 'package:architecture_example/domain/usecases/photos/params/query_parameters.dart';
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
|
||||
class OpenAlbum extends UseCase<QueryParameters, List<Photo>> {
|
||||
class OpenAlbum extends AsyncUseCase<QueryParameters, List<Photo>> {
|
||||
final PhotoRepository _photoRepository;
|
||||
|
||||
OpenAlbum(this._photoRepository);
|
||||
|
||||
@override
|
||||
FutureResult<List<Photo>> call(QueryParameters params) {
|
||||
FutureOrResult<List<Photo>> execute(QueryParameters? params) {
|
||||
final photos = _photoRepository.getPhotosFromAlbum(
|
||||
params.albumId,
|
||||
params!.albumId,
|
||||
start: params.start,
|
||||
limit: params.limit,
|
||||
);
|
||||
|
||||
return photos;
|
||||
}
|
||||
|
||||
@override
|
||||
FutureOr<void> onStart(QueryParameters? params) {
|
||||
if (params == null) {
|
||||
throw ClientException('params cannot be null');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,18 +14,27 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:architecture_example/domain/entities/photo.dart';
|
||||
import 'package:architecture_example/domain/repositories/photo_repository.dart';
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
|
||||
class RemovePhotoFromFavorites extends UseCase<int, List<Photo>> {
|
||||
class RemovePhotoFromFavorites extends AsyncUseCase<int, List<Photo>> {
|
||||
final PhotoRepository _photoRepository;
|
||||
|
||||
RemovePhotoFromFavorites(this._photoRepository);
|
||||
|
||||
@override
|
||||
FutureResult<List<Photo>> call(int params) async {
|
||||
await _photoRepository.deletePhotoFromFavorites(params);
|
||||
FutureOrResult<List<Photo>> execute(int? params) async {
|
||||
await _photoRepository.deletePhotoFromFavorites(params!);
|
||||
return _photoRepository.getAllPhotosFromFavorites();
|
||||
}
|
||||
|
||||
@override
|
||||
FutureOr<void> onStart(int? params) {
|
||||
if (params == null) {
|
||||
throw ClientException('id cannot be null');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,22 +14,31 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:architecture_example/domain/entities/album.dart';
|
||||
import 'package:architecture_example/domain/repositories/photo_repository.dart';
|
||||
import 'package:architecture_example/domain/usecases/photos/params/query_parameters.dart';
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
|
||||
class RetrieveAllAlbums extends UseCase<QueryParameters, List<Album>> {
|
||||
class RetrieveAllAlbums extends AsyncUseCase<QueryParameters, List<Album>> {
|
||||
final PhotoRepository _photoRepository;
|
||||
|
||||
RetrieveAllAlbums(this._photoRepository);
|
||||
|
||||
@override
|
||||
FutureResult<List<Album>> call(QueryParameters params) {
|
||||
FutureOrResult<List<Album>> execute(QueryParameters? params) {
|
||||
final albums = _photoRepository.getAllAlbums(
|
||||
start: params.start,
|
||||
start: params!.start,
|
||||
limit: params.limit,
|
||||
);
|
||||
return albums;
|
||||
}
|
||||
|
||||
@override
|
||||
FutureOr<void> onStart(QueryParameters? params) {
|
||||
if (params == null) {
|
||||
throw ClientException('params cannot be null');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
// Copyright (C) 2022 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
|
||||
/// Usecase observers
|
||||
mixin Observer<Parameters, ReturnType> {
|
||||
/// Called before usecase is runned.
|
||||
/// Usefull to check the preconditions
|
||||
FutureOr<void> onStart(Parameters? params) {}
|
||||
|
||||
/// Called when error occures during main scenario
|
||||
/// Usefull to run alternative scenario
|
||||
FutureOr<void> onError(AppException? error) {}
|
||||
}
|
||||
|
||||
/// Specific observer for classic usecase
|
||||
mixin AsyncObserver<ReturnType> {
|
||||
FutureOr<void> onComplete(ReturnType? data) {}
|
||||
}
|
||||
|
||||
/// Specific observer for stream case usecase
|
||||
mixin StreamObserver<ReturnType> {
|
||||
/// Replaces the data event handler of this subscription.
|
||||
void onDone() {}
|
||||
|
||||
/// Replaces the done event handler of this subscription.
|
||||
void onData(ReturnType? data) {}
|
||||
}
|
||||
@@ -1,27 +1,80 @@
|
||||
// Copyright (C) 2022 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:wyatt_architecture/src/core/exceptions/exceptions.dart';
|
||||
import 'package:wyatt_architecture/src/domain/usecases/observers.dart';
|
||||
import 'package:wyatt_type_utils/wyatt_type_utils.dart';
|
||||
|
||||
typedef FutureResult<T> = Future<Result<T, AppException>>;
|
||||
typedef FutureOrResult<T> = FutureOr<Result<T, AppException>>;
|
||||
typedef StreamResult<T> = Stream<Result<T, AppException>>;
|
||||
typedef Res<T> = Result<T, AppException>;
|
||||
|
||||
// ignore: one_member_abstracts
|
||||
abstract class UseCase<Parameters, ReturnType> {
|
||||
FutureResult<ReturnType> call(Parameters params);
|
||||
/// Abstract class of a use case
|
||||
abstract class BaseUseCase<Parameters, ReturnType> {
|
||||
/// Run use case scenarios
|
||||
ReturnType call(Parameters parameters);
|
||||
|
||||
/// Private function to implement main scenario
|
||||
/// of your usecase.
|
||||
ReturnType execute(Parameters params);
|
||||
}
|
||||
|
||||
/// Abstract class of a use case that deals specifically
|
||||
/// with the response and its state.
|
||||
abstract class UseCase<Parameters, ReturnType>
|
||||
extends BaseUseCase<Parameters?, FutureOrResult<ReturnType>>
|
||||
with Observer<Parameters, ReturnType> {
|
||||
FutureOr<void> _onSuccess(ReturnType data);
|
||||
|
||||
/// Supports the result of the main scenario and integrates
|
||||
/// some alternative scenarios if necessary.
|
||||
@override
|
||||
FutureOrResult<ReturnType> call(Parameters? parameters) async {
|
||||
try {
|
||||
await onStart(parameters);
|
||||
final response = await execute(parameters);
|
||||
if (response.isErr) {
|
||||
await onError(response.err);
|
||||
} else if (response.isOk && response.ok != null) {
|
||||
await _onSuccess(response.ok as ReturnType);
|
||||
}
|
||||
return response;
|
||||
} catch (e) {
|
||||
return Err(ClientException(e.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Abtstract classic usecase.
|
||||
abstract class AsyncUseCase<Parameters, ReturnType>
|
||||
extends UseCase<Parameters?, ReturnType> with AsyncObserver<ReturnType> {
|
||||
@override
|
||||
FutureOr<void> _onSuccess(ReturnType data) => onComplete(data);
|
||||
}
|
||||
|
||||
/// Abstract specific usecase bases on streams
|
||||
abstract class StreamUseCase<Parameters, ReturnType>
|
||||
extends UseCase<Parameters?, Stream<ReturnType>>
|
||||
with StreamObserver<ReturnType> {
|
||||
@override
|
||||
FutureOr<void> _onSuccess(Stream<ReturnType> data) {
|
||||
data.listen(
|
||||
onData,
|
||||
onDone: onDone,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,4 +15,5 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
export 'no_param.dart';
|
||||
export 'observers.dart';
|
||||
export 'usecase.dart';
|
||||
|
||||
|
After Width: | Height: | Size: 117 KiB |
@@ -0,0 +1,86 @@
|
||||
@startuml
|
||||
set namespaceSeparator ::
|
||||
|
||||
abstract class "wyatt_architecture::src::core::exceptions::exceptions.dart::AppException" {
|
||||
+String? message
|
||||
+String toString()
|
||||
}
|
||||
|
||||
"dart::core::Exception" <|-- "wyatt_architecture::src::core::exceptions::exceptions.dart::AppException"
|
||||
|
||||
class "wyatt_architecture::src::core::exceptions::exceptions.dart::ClientException" {
|
||||
}
|
||||
|
||||
"wyatt_architecture::src::core::exceptions::exceptions.dart::AppException" <|-- "wyatt_architecture::src::core::exceptions::exceptions.dart::ClientException"
|
||||
class "wyatt_architecture::src::core::exceptions::exceptions.dart::ServerException" {
|
||||
}
|
||||
|
||||
"wyatt_architecture::src::core::exceptions::exceptions.dart::AppException" <|-- "wyatt_architecture::src::core::exceptions::exceptions.dart::ServerException"
|
||||
|
||||
abstract class "wyatt_architecture::src::domain::repositories::base_repository.dart::BaseRepository" {
|
||||
}
|
||||
|
||||
abstract class "wyatt_architecture::src::domain::data_sources::local::base_local_data_source.dart::BaseLocalDataSource" {
|
||||
}
|
||||
|
||||
"wyatt_architecture::src::domain::data_sources::base_data_source.dart::BaseDataSource" <|-- "wyatt_architecture::src::domain::data_sources::local::base_local_data_source.dart::BaseLocalDataSource"
|
||||
|
||||
abstract class "wyatt_architecture::src::domain::data_sources::base_data_source.dart::BaseDataSource" {
|
||||
}
|
||||
|
||||
abstract class "wyatt_architecture::src::domain::data_sources::remote::base_remote_data_source.dart::BaseRemoteDataSource" {
|
||||
}
|
||||
|
||||
"wyatt_architecture::src::domain::data_sources::base_data_source.dart::BaseDataSource" <|-- "wyatt_architecture::src::domain::data_sources::remote::base_remote_data_source.dart::BaseRemoteDataSource"
|
||||
|
||||
class "wyatt_architecture::src::domain::usecases::no_param.dart::NoParam" {
|
||||
}
|
||||
|
||||
"wyatt_architecture::src::domain::entities::entity.dart::Entity" <|-- "wyatt_architecture::src::domain::usecases::no_param.dart::NoParam"
|
||||
|
||||
abstract class "wyatt_architecture::src::domain::usecases::observers.dart::Observer" {
|
||||
+FutureOr<void> onStart()
|
||||
+FutureOr<void> onError()
|
||||
}
|
||||
|
||||
abstract class "wyatt_architecture::src::domain::usecases::observers.dart::AsyncObserver" {
|
||||
+FutureOr<void> onComplete()
|
||||
}
|
||||
|
||||
abstract class "wyatt_architecture::src::domain::usecases::observers.dart::StreamObserver" {
|
||||
+void onDone()
|
||||
+void onData()
|
||||
}
|
||||
|
||||
abstract class "wyatt_architecture::src::domain::usecases::usecase.dart::BaseUseCase" {
|
||||
+ReturnType execute()
|
||||
+ReturnType call()
|
||||
}
|
||||
|
||||
abstract class "wyatt_architecture::src::domain::usecases::usecase.dart::UseCase" {
|
||||
-FutureOr<void> _onSuccess()
|
||||
+FutureOr<Result<ReturnType, AppException>> execute()
|
||||
}
|
||||
|
||||
"wyatt_architecture::src::domain::usecases::usecase.dart::BaseUseCase" <|-- "wyatt_architecture::src::domain::usecases::usecase.dart::UseCase"
|
||||
"wyatt_architecture::src::domain::usecases::observers.dart::Observer" <|-- "wyatt_architecture::src::domain::usecases::usecase.dart::UseCase"
|
||||
|
||||
abstract class "wyatt_architecture::src::domain::usecases::usecase.dart::AsyncUseCase" {
|
||||
-FutureOr<void> _onSuccess()
|
||||
}
|
||||
|
||||
"wyatt_architecture::src::domain::usecases::usecase.dart::UseCase" <|-- "wyatt_architecture::src::domain::usecases::usecase.dart::AsyncUseCase"
|
||||
"wyatt_architecture::src::domain::usecases::observers.dart::AsyncObserver" <|-- "wyatt_architecture::src::domain::usecases::usecase.dart::AsyncUseCase"
|
||||
|
||||
abstract class "wyatt_architecture::src::domain::usecases::usecase.dart::StreamUseCase" {
|
||||
-FutureOr<void> _onSuccess()
|
||||
}
|
||||
|
||||
"wyatt_architecture::src::domain::usecases::usecase.dart::UseCase" <|-- "wyatt_architecture::src::domain::usecases::usecase.dart::StreamUseCase"
|
||||
"wyatt_architecture::src::domain::usecases::observers.dart::StreamObserver" <|-- "wyatt_architecture::src::domain::usecases::usecase.dart::StreamUseCase"
|
||||
|
||||
abstract class "wyatt_architecture::src::domain::entities::entity.dart::Entity" {
|
||||
}
|
||||
|
||||
|
||||
@enduml
|
||||
@@ -1,7 +1,7 @@
|
||||
name: wyatt_architecture
|
||||
description: A new Wyatt package
|
||||
repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_architecture
|
||||
version: 0.0.2
|
||||
version: 0.1.0
|
||||
|
||||
publish_to: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
|
||||
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
firebase_options.dart
|
||||
firebase_options.dart
|
||||
.vscode
|
||||
@@ -1 +0,0 @@
|
||||
../../.vscode/
|
||||
@@ -0,0 +1,76 @@
|
||||
{
|
||||
// Dart
|
||||
"dart.runPubGetOnPubspecChanges": "never",
|
||||
// Gitea
|
||||
"gitea.owner": "Wyatt-FOSS",
|
||||
"gitea.repo": "wyatt-packages",
|
||||
// Header
|
||||
"psi-header.changes-tracking": {
|
||||
"isActive": true
|
||||
},
|
||||
"psi-header.config": {
|
||||
"blankLinesAfter": 1,
|
||||
"forceToTop": true
|
||||
},
|
||||
"psi-header.lang-config": [
|
||||
{
|
||||
"beforeHeader": [
|
||||
"# -*- coding:utf-8 -*-",
|
||||
"#!/usr/bin/env python3"
|
||||
],
|
||||
"begin": "###",
|
||||
"end": "###",
|
||||
"language": "python",
|
||||
"prefix": "# "
|
||||
},
|
||||
{
|
||||
"beforeHeader": [
|
||||
"#!/usr/bin/env sh",
|
||||
""
|
||||
],
|
||||
"language": "shellscript",
|
||||
"begin": "",
|
||||
"end": "",
|
||||
"prefix": "# "
|
||||
},
|
||||
{
|
||||
"begin": "",
|
||||
"end": "",
|
||||
"language": "dart",
|
||||
"prefix": "// "
|
||||
},
|
||||
{
|
||||
"begin": "",
|
||||
"end": "",
|
||||
"language": "yaml",
|
||||
"prefix": "# "
|
||||
},
|
||||
{
|
||||
"begin": "<!--",
|
||||
"end": "-->",
|
||||
"language": "markdown",
|
||||
},
|
||||
],
|
||||
"psi-header.templates": [
|
||||
{
|
||||
"language": "*",
|
||||
"template": [
|
||||
"Copyright (C) <<year>> WYATT GROUP",
|
||||
"Please see the AUTHORS file for details.",
|
||||
"",
|
||||
"This program is free software: you can redistribute it and/or modify",
|
||||
"it under the terms of the GNU General Public License as published by",
|
||||
"the Free Software Foundation, either version 3 of the License, or",
|
||||
"any later version.",
|
||||
"",
|
||||
"This program is distributed in the hope that it will be useful,",
|
||||
"but WITHOUT ANY WARRANTY; without even the implied warranty of",
|
||||
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
|
||||
"GNU General Public License for more details.",
|
||||
"",
|
||||
"You should have received a copy of the GNU General Public License",
|
||||
"along with this program. If not, see <https://www.gnu.org/licenses/>."
|
||||
],
|
||||
}
|
||||
],
|
||||
}
|
||||
@@ -1,3 +1,11 @@
|
||||
## 0.4.0+2
|
||||
|
||||
- Update a dependency to the latest release.
|
||||
|
||||
## 0.4.0+1
|
||||
|
||||
- **FIX**: add sort of mutex on onAuthChanges callback trigger.
|
||||
|
||||
## 0.4.0
|
||||
|
||||
> Note: This release has breaking changes.
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
// Copyright (C) 2022 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
|
||||
|
||||
class CustomPassword extends RegexValidator<ValidationStandardError> {
|
||||
const CustomPassword.pure([super.value]) : super.pure();
|
||||
const CustomPassword.dirty([super.value]) : super.dirty();
|
||||
|
||||
@override
|
||||
ValidationStandardError get onEmpty => ValidationStandardError.empty;
|
||||
@override
|
||||
ValidationStandardError get onError => ValidationStandardError.invalid;
|
||||
|
||||
@override
|
||||
RegExp get regex => RegExp(r'^(?=.*[A-Za-z\w\s])(?=.*\d).{6,}$');
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
// -----
|
||||
// File: app.dart
|
||||
// Created Date: 19/08/2022 12:05:38
|
||||
// Last Modified: Thu Nov 10 2022
|
||||
// Last Modified: Sat Dec 03 2022
|
||||
// -----
|
||||
// Copyright (c) 2022
|
||||
|
||||
@@ -13,6 +13,7 @@ import 'dart:math';
|
||||
import 'package:example_router/core/constants/form_field.dart';
|
||||
import 'package:example_router/core/dependency_injection/get_it.dart';
|
||||
import 'package:example_router/core/routes/router.dart';
|
||||
import 'package:example_router/core/utils/custom_password.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
@@ -21,7 +22,8 @@ import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
|
||||
import 'package:wyatt_type_utils/wyatt_type_utils.dart';
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
|
||||
FutureResult<int?> onSignUpSuccess(
|
||||
FutureOrResult<int?> onSignUpSuccess(
|
||||
AuthenticationRepository<int> repo,
|
||||
Account? account,
|
||||
WyattForm form,
|
||||
) async {
|
||||
@@ -34,9 +36,15 @@ FutureResult<int?> onSignUpSuccess(
|
||||
return const Ok<int, AppException>(id);
|
||||
}
|
||||
|
||||
FutureResult<int?> onAccountChanges(Account? account) async {
|
||||
FutureOrResult<int?> onAccountChanges(
|
||||
AuthenticationRepository<int> repo,
|
||||
Account? account,
|
||||
) async {
|
||||
final id = Random().nextInt(1000);
|
||||
debugPrint('onAccountChanges: $account, generatedId: $id');
|
||||
final token =
|
||||
await repo.getIdentityToken().fold((value) => value, (error) => 'null');
|
||||
|
||||
debugPrint('onAccountChanges: $account, token: $token, generatedId: $id');
|
||||
return Ok<int, AppException>(id);
|
||||
}
|
||||
|
||||
@@ -47,6 +55,7 @@ class App extends StatelessWidget {
|
||||
authenticationRemoteDataSource: getIt<AuthenticationRemoteDataSource>(),
|
||||
onSignUpSuccess: onSignUpSuccess,
|
||||
onAuthChange: onAccountChanges,
|
||||
customPasswordValidator: const CustomPassword.pure(),
|
||||
extraSignUpInputs: [
|
||||
FormInput(
|
||||
AppFormField.confirmedPassword,
|
||||
|
||||
@@ -3,10 +3,11 @@
|
||||
// -----
|
||||
// File: sign_in_form.dart
|
||||
// Created Date: 19/08/2022 15:24:37
|
||||
// Last Modified: Wed Nov 16 2022
|
||||
// Last Modified: Sat Dec 03 2022
|
||||
// -----
|
||||
// Copyright (c) 2022
|
||||
|
||||
import 'package:example_router/core/utils/custom_password.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
|
||||
@@ -38,7 +39,8 @@ class _PasswordInput extends StatelessWidget {
|
||||
field: AuthFormField.password,
|
||||
builder: ((context, cubit, state, field, input) {
|
||||
return TextField(
|
||||
onChanged: (pwd) => cubit.passwordChanged(pwd),
|
||||
onChanged: (pwd) => cubit
|
||||
.passwordCustomChanged<CustomPassword>(CustomPassword.dirty(pwd)),
|
||||
obscureText: true,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Password',
|
||||
@@ -59,7 +61,9 @@ class _SignInButton extends StatelessWidget {
|
||||
return status.isSubmissionInProgress
|
||||
? const CircularProgressIndicator()
|
||||
: ElevatedButton(
|
||||
onPressed: status.isValidated ? () => cubit.signInWithEmailAndPassword() : null,
|
||||
onPressed: status.isValidated
|
||||
? () => cubit.signInWithEmailAndPassword()
|
||||
: null,
|
||||
child: const Text('Sign in with credentials'),
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
// -----
|
||||
// File: sign_up_form.dart
|
||||
// Created Date: 19/08/2022 14:41:08
|
||||
// Last Modified: Wed Nov 16 2022
|
||||
// Last Modified: Sat Dec 03 2022
|
||||
// -----
|
||||
// Copyright (c) 2022
|
||||
|
||||
import 'package:example_router/core/constants/form_field.dart';
|
||||
import 'package:example_router/core/utils/custom_password.dart';
|
||||
import 'package:flutter/material.dart' hide FormField;
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
|
||||
@@ -40,7 +41,8 @@ class _PasswordInput extends StatelessWidget {
|
||||
builder: ((context, cubit, state, field, input) {
|
||||
return TextField(
|
||||
onChanged: (pwd) {
|
||||
cubit.passwordChanged(pwd);
|
||||
cubit.passwordCustomChanged<CustomPassword>(
|
||||
CustomPassword.dirty(pwd));
|
||||
cubit.dataChanged(
|
||||
AppFormField.confirmedPassword,
|
||||
ConfirmedPassword.dirty(
|
||||
|
||||
@@ -40,11 +40,11 @@ dependencies:
|
||||
|
||||
wyatt_form_bloc:
|
||||
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
|
||||
version: 0.2.0
|
||||
version: 0.2.0+1
|
||||
|
||||
wyatt_architecture:
|
||||
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
|
||||
version: 0.0.2
|
||||
version: 0.1.0
|
||||
|
||||
wyatt_type_utils:
|
||||
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
|
||||
|
||||
@@ -114,6 +114,7 @@ class AuthenticationMockDataSourceImpl extends AuthenticationRemoteDataSource {
|
||||
providerId: 'wyatt',
|
||||
creationTime: creation,
|
||||
lastSignInTime: creation,
|
||||
isNewUser: creation == creation,
|
||||
);
|
||||
_streamAccount.add(mock);
|
||||
_connectedMock = _connectedMock?.copyWith(left: mock);
|
||||
@@ -188,6 +189,7 @@ class AuthenticationMockDataSourceImpl extends AuthenticationRemoteDataSource {
|
||||
email: email,
|
||||
creationTime: creation,
|
||||
lastSignInTime: creation,
|
||||
isNewUser: creation == creation,
|
||||
);
|
||||
_streamAccount.add(mock);
|
||||
_registeredMock = Pair(mock, password);
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:rxdart/rxdart.dart';
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/core/constants/form_field.dart';
|
||||
import 'package:wyatt_authentication_bloc/src/core/constants/form_name.dart';
|
||||
@@ -26,12 +29,16 @@ import 'package:wyatt_authentication_bloc/src/domain/repositories/authentication
|
||||
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
|
||||
import 'package:wyatt_type_utils/wyatt_type_utils.dart';
|
||||
|
||||
typedef OnSignUpSuccess<T> = FutureResult<T?> Function(
|
||||
typedef OnSignUpSuccess<T> = FutureOrResult<T?> Function(
|
||||
AuthenticationRepository<T> repo,
|
||||
Account? account,
|
||||
WyattForm form,
|
||||
);
|
||||
|
||||
typedef OnAuthChange<T> = FutureResult<T?> Function(Account? account);
|
||||
typedef OnAuthChange<T> = FutureOrResult<T?> Function(
|
||||
AuthenticationRepository<T> repo,
|
||||
Account? account,
|
||||
);
|
||||
|
||||
class AuthenticationRepositoryImpl<T extends Object>
|
||||
extends AuthenticationRepository<T> {
|
||||
@@ -43,6 +50,10 @@ class AuthenticationRepositoryImpl<T extends Object>
|
||||
final OnSignUpSuccess<T>? _onSignUpSuccess;
|
||||
|
||||
final OnAuthChange<T>? _onAccountChanges;
|
||||
final StreamController<FutureOrResult<AccountWrapper<T>>> _signUpStream =
|
||||
StreamController();
|
||||
|
||||
bool _pause = false; // Semaphore
|
||||
|
||||
AuthenticationRepositoryImpl({
|
||||
required AuthenticationCacheDataSource<T> authenticationCacheDataSource,
|
||||
@@ -50,6 +61,8 @@ class AuthenticationRepositoryImpl<T extends Object>
|
||||
FormRepository? formRepository,
|
||||
// ignore: strict_raw_type
|
||||
List<FormInput>? extraSignUpInputs,
|
||||
FormInputValidator<String?, ValidationError>? customEmailValidator,
|
||||
FormInputValidator<String?, ValidationError>? customPasswordValidator,
|
||||
OnSignUpSuccess<T>? onSignUpSuccess,
|
||||
OnAuthChange<T>? onAuthChange,
|
||||
}) : _authenticationLocalDataSource = authenticationCacheDataSource,
|
||||
@@ -64,8 +77,14 @@ class AuthenticationRepositoryImpl<T extends Object>
|
||||
..registerForm(
|
||||
WyattFormImpl(
|
||||
[
|
||||
FormInput(AuthFormField.email, const Email.pure()),
|
||||
FormInput(AuthFormField.password, const Password.pure())
|
||||
FormInput(
|
||||
AuthFormField.email,
|
||||
customEmailValidator ?? const Email.pure(),
|
||||
),
|
||||
FormInput(
|
||||
AuthFormField.password,
|
||||
customPasswordValidator ?? const Password.pure(),
|
||||
)
|
||||
],
|
||||
name: AuthFormName.signInForm,
|
||||
),
|
||||
@@ -73,8 +92,14 @@ class AuthenticationRepositoryImpl<T extends Object>
|
||||
..registerForm(
|
||||
WyattFormImpl(
|
||||
[
|
||||
FormInput(AuthFormField.email, const Email.pure()),
|
||||
FormInput(AuthFormField.password, const Password.pure()),
|
||||
FormInput(
|
||||
AuthFormField.email,
|
||||
customEmailValidator ?? const Email.pure(),
|
||||
),
|
||||
FormInput(
|
||||
AuthFormField.password,
|
||||
customPasswordValidator ?? const Password.pure(),
|
||||
),
|
||||
...extraSignUpInputs ?? []
|
||||
],
|
||||
name: AuthFormName.signUpForm,
|
||||
@@ -86,7 +111,7 @@ class AuthenticationRepositoryImpl<T extends Object>
|
||||
FormRepository get formRepository => _formRepository;
|
||||
|
||||
@override
|
||||
FutureResult<Account> signInWithEmailAndPassword({
|
||||
FutureOrResult<Account> signInWithEmailAndPassword({
|
||||
required String email,
|
||||
required String password,
|
||||
}) =>
|
||||
@@ -104,7 +129,7 @@ class AuthenticationRepositoryImpl<T extends Object>
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<void> signOut() =>
|
||||
FutureOrResult<void> signOut() =>
|
||||
Result.tryCatchAsync<void, AppException, AppException>(
|
||||
() async {
|
||||
await _authenticationRemoteDataSource.signOut();
|
||||
@@ -114,12 +139,13 @@ class AuthenticationRepositoryImpl<T extends Object>
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<Account> signUp({
|
||||
FutureOrResult<Account> signUp({
|
||||
required String email,
|
||||
required String password,
|
||||
}) =>
|
||||
Result.tryCatchAsync<Account, AppException, AppException>(
|
||||
() async {
|
||||
_pause = true;
|
||||
final account = await _authenticationRemoteDataSource.signUp(
|
||||
email: email,
|
||||
password: password,
|
||||
@@ -127,42 +153,51 @@ class AuthenticationRepositoryImpl<T extends Object>
|
||||
await _authenticationLocalDataSource.storeAccount(account);
|
||||
if (_onSignUpSuccess.isNotNull) {
|
||||
final dataResult = await _onSignUpSuccess!.call(
|
||||
this,
|
||||
account,
|
||||
_formRepository.accessForm(AuthFormName.signUpForm).clone(),
|
||||
);
|
||||
await dataResult.foldAsync(
|
||||
_authenticationLocalDataSource.storeData,
|
||||
(data) async {
|
||||
await _authenticationLocalDataSource.storeData(data);
|
||||
_signUpStream
|
||||
.add(Future.value(Ok(AccountWrapperModel(account, data))));
|
||||
},
|
||||
(error) async => error,
|
||||
);
|
||||
}
|
||||
_pause = false;
|
||||
return account;
|
||||
},
|
||||
(error) => error,
|
||||
(error) {
|
||||
_pause = false;
|
||||
return error;
|
||||
},
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<void> destroyCache() =>
|
||||
FutureOrResult<void> destroyCache() =>
|
||||
Result.tryCatchAsync<void, AppException, AppException>(
|
||||
_authenticationLocalDataSource.destroy,
|
||||
(error) => error,
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<AccountWrapper<T>> getCache() =>
|
||||
FutureOrResult<AccountWrapper<T>> getCache() =>
|
||||
Result.tryCatchAsync<AccountWrapper<T>, AppException, AppException>(
|
||||
_authenticationLocalDataSource.load,
|
||||
(error) => error,
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<Account> getAccount() =>
|
||||
FutureOrResult<Account> getAccount() =>
|
||||
Result.tryCatchAsync<Account, AppException, AppException>(
|
||||
_authenticationLocalDataSource.loadAccount,
|
||||
(error) => error,
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<void> setAccount(
|
||||
FutureOrResult<void> setAccount(
|
||||
Account account,
|
||||
) =>
|
||||
Result.tryCatchAsync<void, AppException, AppException>(
|
||||
@@ -173,14 +208,14 @@ class AuthenticationRepositoryImpl<T extends Object>
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<T> getData() =>
|
||||
FutureOrResult<T> getData() =>
|
||||
Result.tryCatchAsync<T, AppException, AppException>(
|
||||
_authenticationLocalDataSource.loadData,
|
||||
(error) => error,
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<void> setData(
|
||||
FutureOrResult<void> setData(
|
||||
T? data,
|
||||
) =>
|
||||
Result.tryCatchAsync<void, AppException, AppException>(
|
||||
@@ -191,26 +226,31 @@ class AuthenticationRepositoryImpl<T extends Object>
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<String> getIdentityToken() =>
|
||||
FutureOrResult<String> getIdentityToken() =>
|
||||
Result.tryCatchAsync<String, AppException, AppException>(
|
||||
_authenticationRemoteDataSource.getIdentityToken,
|
||||
(error) => error,
|
||||
);
|
||||
|
||||
@override
|
||||
Stream<FutureResult<AccountWrapper<T>>> streamAccount() =>
|
||||
_authenticationRemoteDataSource.streamAccount().map((account) async {
|
||||
if (_onAccountChanges.isNotNull) {
|
||||
final dataResult = await _onAccountChanges!.call(account);
|
||||
return dataResult.map((data) => AccountWrapperModel(account, data));
|
||||
}
|
||||
return Ok<AccountWrapperModel<T>, AppException>(
|
||||
AccountWrapperModel<T>(account, null),
|
||||
);
|
||||
});
|
||||
Stream<FutureOrResult<AccountWrapper<T>>> streamAccount() => MergeStream([
|
||||
_signUpStream.stream.asBroadcastStream(),
|
||||
_authenticationRemoteDataSource.streamAccount().map((account) async {
|
||||
if (_onAccountChanges.isNotNull && !_pause) {
|
||||
final dataResult = await _onAccountChanges!.call(this, account);
|
||||
return dataResult.map((data) {
|
||||
_authenticationLocalDataSource.storeData(data);
|
||||
return AccountWrapperModel(account, data);
|
||||
});
|
||||
}
|
||||
return Ok<AccountWrapperModel<T>, AppException>(
|
||||
AccountWrapperModel<T>(account, null),
|
||||
);
|
||||
})
|
||||
]);
|
||||
|
||||
@override
|
||||
FutureResult<void> confirmPasswordReset({
|
||||
FutureOrResult<void> confirmPasswordReset({
|
||||
required String code,
|
||||
required String newPassword,
|
||||
}) =>
|
||||
@@ -225,7 +265,7 @@ class AuthenticationRepositoryImpl<T extends Object>
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<void> sendEmailVerification() =>
|
||||
FutureOrResult<void> sendEmailVerification() =>
|
||||
Result.tryCatchAsync<void, AppException, AppException>(
|
||||
() async {
|
||||
await _authenticationRemoteDataSource.sendEmailVerification();
|
||||
@@ -234,7 +274,7 @@ class AuthenticationRepositoryImpl<T extends Object>
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<void> sendPasswordResetEmail({required String email}) =>
|
||||
FutureOrResult<void> sendPasswordResetEmail({required String email}) =>
|
||||
Result.tryCatchAsync<void, AppException, AppException>(
|
||||
() async {
|
||||
await _authenticationRemoteDataSource.sendPasswordResetEmail(
|
||||
@@ -245,7 +285,7 @@ class AuthenticationRepositoryImpl<T extends Object>
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<Account> signInAnonymously() =>
|
||||
FutureOrResult<Account> signInAnonymously() =>
|
||||
Result.tryCatchAsync<Account, AppException, AppException>(
|
||||
() async {
|
||||
final account =
|
||||
@@ -256,7 +296,7 @@ class AuthenticationRepositoryImpl<T extends Object>
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<bool> verifyPasswordResetCode({required String code}) =>
|
||||
FutureOrResult<bool> verifyPasswordResetCode({required String code}) =>
|
||||
Result.tryCatchAsync<bool, AppException, AppException>(
|
||||
() async {
|
||||
final response = await _authenticationRemoteDataSource
|
||||
@@ -267,7 +307,7 @@ class AuthenticationRepositoryImpl<T extends Object>
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<void> refresh() =>
|
||||
FutureOrResult<void> refresh() =>
|
||||
Result.tryCatchAsync<void, AppException, AppException>(
|
||||
() async {
|
||||
await _authenticationRemoteDataSource.refresh();
|
||||
|
||||
@@ -30,7 +30,7 @@ abstract class AuthenticationRepository<T> extends BaseRepository {
|
||||
/// Throws a SignUpWithEmailAndPasswordFailureInterface if
|
||||
/// an exception occurs.
|
||||
/// {@endtemplate}
|
||||
FutureResult<Account> signUp({
|
||||
FutureOrResult<Account> signUp({
|
||||
required String email,
|
||||
required String password,
|
||||
});
|
||||
@@ -40,21 +40,21 @@ abstract class AuthenticationRepository<T> extends BaseRepository {
|
||||
///
|
||||
/// Throws a SendEmailVerificationFailureInterface if an exception occurs.
|
||||
/// {@endtemplate}
|
||||
FutureResult<void> sendEmailVerification();
|
||||
FutureOrResult<void> sendEmailVerification();
|
||||
|
||||
/// {@template send_password_reset_email}
|
||||
/// Sends a password reset email to the provided [email].
|
||||
///
|
||||
/// Throws a SendPasswordResetEmailFailureInterface if an exception occurs.
|
||||
/// {@endtemplate}
|
||||
FutureResult<void> sendPasswordResetEmail({required String email});
|
||||
FutureOrResult<void> sendPasswordResetEmail({required String email});
|
||||
|
||||
/// {@template confirm_password_reset}
|
||||
/// Confirms the password reset with the provided [newPassword] and [code].
|
||||
///
|
||||
/// Throws a ConfirmPasswordResetFailureInterface if an exception occurs.
|
||||
/// {@endtemplate}
|
||||
FutureResult<void> confirmPasswordReset({
|
||||
FutureOrResult<void> confirmPasswordReset({
|
||||
required String code,
|
||||
required String newPassword,
|
||||
});
|
||||
@@ -64,14 +64,14 @@ abstract class AuthenticationRepository<T> extends BaseRepository {
|
||||
///
|
||||
/// Throws a VerifyPasswordResetCodeFailureInterface if an exception occurs.
|
||||
/// {@endtemplate}
|
||||
FutureResult<bool> verifyPasswordResetCode({required String code});
|
||||
FutureOrResult<bool> verifyPasswordResetCode({required String code});
|
||||
|
||||
/// {@template signin_anom}
|
||||
/// Sign in anonymously.
|
||||
///
|
||||
/// Throws a SignInAnonymouslyFailureInterface if an exception occurs.
|
||||
/// {@endtemplate}
|
||||
FutureResult<Account> signInAnonymously();
|
||||
FutureOrResult<Account> signInAnonymously();
|
||||
|
||||
/// {@template signin_pwd}
|
||||
/// Signs in with the provided [email] and [password].
|
||||
@@ -79,7 +79,7 @@ abstract class AuthenticationRepository<T> extends BaseRepository {
|
||||
/// Throws a SignInWithEmailAndPasswordFailureInterface if
|
||||
/// an exception occurs.
|
||||
/// {@endtemplate}
|
||||
FutureResult<Account> signInWithEmailAndPassword({
|
||||
FutureOrResult<Account> signInWithEmailAndPassword({
|
||||
required String email,
|
||||
required String password,
|
||||
});
|
||||
@@ -88,9 +88,9 @@ abstract class AuthenticationRepository<T> extends BaseRepository {
|
||||
/// Signs out the current user.
|
||||
/// It also clears the cache and the associated data.
|
||||
/// {@endtemplate}
|
||||
FutureResult<void> signOut();
|
||||
FutureOrResult<void> signOut();
|
||||
|
||||
FutureResult<void> refresh();
|
||||
FutureOrResult<void> refresh();
|
||||
|
||||
/// {@template stream_account}
|
||||
/// Stream of [AccountWrapper] which will emit the current account when
|
||||
@@ -99,16 +99,16 @@ abstract class AuthenticationRepository<T> extends BaseRepository {
|
||||
/// Emits [AccountWrapper] with null [Account] if the user is not
|
||||
/// authenticated.
|
||||
/// {@endtemplate}
|
||||
Stream<FutureResult<AccountWrapper<T>>> streamAccount();
|
||||
Stream<FutureOrResult<AccountWrapper<T>>> streamAccount();
|
||||
|
||||
FutureResult<String> getIdentityToken();
|
||||
FutureOrResult<String> getIdentityToken();
|
||||
|
||||
FutureResult<Account> getAccount();
|
||||
FutureResult<void> setAccount(Account account);
|
||||
FutureOrResult<Account> getAccount();
|
||||
FutureOrResult<void> setAccount(Account account);
|
||||
|
||||
FutureResult<T> getData();
|
||||
FutureResult<void> setData(T? data);
|
||||
FutureOrResult<T> getData();
|
||||
FutureOrResult<void> setData(T? data);
|
||||
|
||||
FutureResult<AccountWrapper<T>> getCache();
|
||||
FutureResult<void> destroyCache();
|
||||
FutureOrResult<AccountWrapper<T>> getCache();
|
||||
FutureOrResult<void> destroyCache();
|
||||
}
|
||||
|
||||
@@ -56,6 +56,19 @@ class AuthenticationCubit<Extra> extends Cubit<AuthenticationState<Extra>> {
|
||||
});
|
||||
}
|
||||
|
||||
/// If authenticated, re-emits state with data freshly loaded from cache.
|
||||
FutureOr<void> reloadCache() async {
|
||||
if (state.status == AuthenticationStatus.authenticated) {
|
||||
final data = await _authenticationRepository.getCache();
|
||||
emit(
|
||||
data.fold(
|
||||
AuthenticationState<Extra>.authenticated,
|
||||
(error) => state,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
FutureOr<void> signOut() {
|
||||
// TODO(hpcl): maybe force unauthenticated by emitting an event
|
||||
_authenticationRepository.signOut();
|
||||
|
||||
@@ -41,15 +41,52 @@ class SignInCubit<Extra> extends FormDataCubit<SignInState> {
|
||||
String get formName => AuthFormName.signInForm;
|
||||
|
||||
void emailChanged(String value) {
|
||||
final emailValidatorType = _formRepository
|
||||
.accessForm(formName)
|
||||
.validatorOf(AuthFormField.email)
|
||||
.runtimeType;
|
||||
assert(
|
||||
emailValidatorType == Email,
|
||||
'Use emailCustomChanged(...) with validator $emailValidatorType',
|
||||
);
|
||||
|
||||
final Email email = Email.dirty(value);
|
||||
dataChanged(AuthFormField.email, email);
|
||||
}
|
||||
|
||||
void passwordChanged(String value) {
|
||||
final passwordValidatorType = _formRepository
|
||||
.accessForm(formName)
|
||||
.validatorOf(AuthFormField.password)
|
||||
.runtimeType;
|
||||
assert(
|
||||
passwordValidatorType == Password,
|
||||
'Use passwordCustomChanged(...) with validator $passwordValidatorType',
|
||||
);
|
||||
final Password password = Password.dirty(value);
|
||||
dataChanged(AuthFormField.password, password);
|
||||
}
|
||||
|
||||
/// Same as [emailChanged] but with a custom [Validator].
|
||||
///
|
||||
/// Sort of short hand for [dataChanged].
|
||||
void emailCustomChanged<
|
||||
Validator extends FormInputValidator<String?, ValidationError>>(
|
||||
Validator validator,
|
||||
) {
|
||||
dataChanged(AuthFormField.email, validator);
|
||||
}
|
||||
|
||||
/// Same as [passwordChanged] but with a custom [Validator].
|
||||
///
|
||||
/// Sort of short hand for [dataChanged].
|
||||
void passwordCustomChanged<
|
||||
Validator extends FormInputValidator<String?, ValidationError>>(
|
||||
Validator validator,
|
||||
) {
|
||||
dataChanged(AuthFormField.password, validator);
|
||||
}
|
||||
|
||||
@override
|
||||
FutureOr<void> dataChanged<Value>(
|
||||
String key,
|
||||
@@ -114,7 +151,7 @@ class SignInCubit<Extra> extends FormDataCubit<SignInState> {
|
||||
if (state.status.isSubmissionInProgress) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!state.status.isValidated) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -17,8 +17,10 @@
|
||||
part of 'sign_in_cubit.dart';
|
||||
|
||||
class SignInState extends FormDataState {
|
||||
Email get email => form.validatorOf(AuthFormField.email);
|
||||
Password get password => form.validatorOf(AuthFormField.password);
|
||||
FormInputValidator<String?, ValidationError> get email =>
|
||||
form.validatorOf(AuthFormField.email);
|
||||
FormInputValidator<String?, ValidationError> get password =>
|
||||
form.validatorOf(AuthFormField.password);
|
||||
|
||||
const SignInState({
|
||||
required super.form,
|
||||
|
||||
@@ -43,15 +43,52 @@ class SignUpCubit<Extra> extends FormDataCubit<SignUpState> {
|
||||
String get formName => AuthFormName.signUpForm;
|
||||
|
||||
void emailChanged(String value) {
|
||||
final emailValidatorType = _formRepository
|
||||
.accessForm(formName)
|
||||
.validatorOf(AuthFormField.email)
|
||||
.runtimeType;
|
||||
assert(
|
||||
emailValidatorType == Email,
|
||||
'Use emailCustomChanged(...) with validator $emailValidatorType',
|
||||
);
|
||||
|
||||
final Email email = Email.dirty(value);
|
||||
dataChanged(AuthFormField.email, email);
|
||||
}
|
||||
|
||||
void passwordChanged(String value) {
|
||||
final passwordValidatorType = _formRepository
|
||||
.accessForm(formName)
|
||||
.validatorOf(AuthFormField.password)
|
||||
.runtimeType;
|
||||
assert(
|
||||
passwordValidatorType == Password,
|
||||
'Use passwordCustomChanged(...) with validator $passwordValidatorType',
|
||||
);
|
||||
final Password password = Password.dirty(value);
|
||||
dataChanged(AuthFormField.password, password);
|
||||
}
|
||||
|
||||
/// Same as [emailChanged] but with a custom [Validator].
|
||||
///
|
||||
/// Sort of short hand for [dataChanged].
|
||||
void emailCustomChanged<
|
||||
Validator extends FormInputValidator<String?, ValidationError>>(
|
||||
Validator validator,
|
||||
) {
|
||||
dataChanged(AuthFormField.email, validator);
|
||||
}
|
||||
|
||||
/// Same as [passwordChanged] but with a custom [Validator].
|
||||
///
|
||||
/// Sort of short hand for [dataChanged].
|
||||
void passwordCustomChanged<
|
||||
Validator extends FormInputValidator<String?, ValidationError>>(
|
||||
Validator validator,
|
||||
) {
|
||||
dataChanged(AuthFormField.password, validator);
|
||||
}
|
||||
|
||||
@override
|
||||
FutureOr<void> dataChanged<Value>(
|
||||
String key,
|
||||
|
||||
@@ -17,8 +17,10 @@
|
||||
part of 'sign_up_cubit.dart';
|
||||
|
||||
class SignUpState extends FormDataState {
|
||||
Email get email => form.validatorOf(AuthFormField.email);
|
||||
Password get password => form.validatorOf(AuthFormField.password);
|
||||
FormInputValidator<String?, ValidationError> get email =>
|
||||
form.validatorOf(AuthFormField.email);
|
||||
FormInputValidator<String?, ValidationError> get password =>
|
||||
form.validatorOf(AuthFormField.password);
|
||||
|
||||
const SignUpState({
|
||||
required super.form,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
name: wyatt_authentication_bloc
|
||||
description: Authentication BLoC for Flutter
|
||||
repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_authentication_bloc
|
||||
version: 0.4.0
|
||||
version: 0.4.0+2
|
||||
|
||||
publish_to: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
|
||||
|
||||
@@ -21,14 +21,15 @@ dependencies:
|
||||
flutter_facebook_auth: ^4.3.0
|
||||
sign_in_with_apple: ^3.3.0
|
||||
twitter_login: ^4.2.3
|
||||
rxdart: ^0.27.7
|
||||
|
||||
wyatt_form_bloc:
|
||||
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
|
||||
version: ^0.2.0
|
||||
version: ^0.2.0+1
|
||||
|
||||
wyatt_architecture:
|
||||
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
|
||||
version: ^0.0.2
|
||||
version: ^0.1.0
|
||||
|
||||
wyatt_type_utils:
|
||||
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<!--
|
||||
* Copyright (C) 2022 WYATT GROUP
|
||||
* Please see the AUTHORS file for details.
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
-->
|
||||
@@ -116,11 +116,11 @@ Widget onBuild(BuildContext context, CounterState state) {
|
||||
}
|
||||
```
|
||||
|
||||
If needed, you can wrap what depends on the state with the function `onWrap`.
|
||||
If needed, you can wrap what depends on the state with the function `parent`.
|
||||
|
||||
```dart
|
||||
@override
|
||||
Widget onWrap(BuildContext context, Widget child) {
|
||||
Widget parent(BuildContext context, Widget child) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Title'),
|
||||
@@ -171,4 +171,4 @@ Widget onBuild(BuildContext context, CounterState state) {
|
||||
|
||||
> Note: check **BlocProvider** and **BlocConsumer** documentation for more information.
|
||||
|
||||
You'll find a more examples in the `example/lib/counter/` directory.
|
||||
You'll find a more examples in the `example/lib/counter/` directory.
|
||||
|
||||
@@ -62,7 +62,7 @@ abstract class BlocProviderScreen<Bloc extends blocbase.Bloc<Event, State>,
|
||||
/// [shouldListenWhen] and [shouldBuildWhen] are optional and if they
|
||||
/// aren't implemented, they will default to `true`.
|
||||
///
|
||||
/// An optional [onWrap] can also be implemented. This build a wrapper arround
|
||||
/// An optional [parent] can also be implemented. This build a wrapper arround
|
||||
/// the built BlocConsumer that is **not** rebuild on each state.
|
||||
/// {@endtemplate}
|
||||
abstract class BlocConsumerScreen<Bloc extends blocbase.Bloc<Event, State>,
|
||||
|
||||
@@ -33,7 +33,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
/// [shouldListenWhen] and [shouldBuildWhen] are optional and if they
|
||||
/// aren't implemented, they will default to `true`.
|
||||
///
|
||||
/// An optional [onWrap] can also be implemented. This build a wrapper arround
|
||||
/// An optional [parent] can also be implemented. This build a wrapper arround
|
||||
/// the built [BlocConsumer] that is **not** rebuild on each state.
|
||||
/// {@endtemplate}
|
||||
abstract class BlocBaseConsumerScreen<Bloc extends BlocBase<State>,
|
||||
@@ -51,10 +51,10 @@ abstract class BlocBaseConsumerScreen<Bloc extends BlocBase<State>,
|
||||
/// [onListen] with the current `state`.
|
||||
bool shouldListenWhen(State previous, State current) => true;
|
||||
|
||||
/// The [onWrap] function which will be invoked on build.
|
||||
/// The [onWrap] takes a `BuildContext` that **doesn't have** access
|
||||
/// The [parent] function which will be invoked on build.
|
||||
/// The [parent] takes a `BuildContext` that **doesn't have** access
|
||||
/// to the [Bloc] or [Cubit].
|
||||
Widget onWrap(BuildContext context, Widget child) => child;
|
||||
Widget parent(BuildContext context, Widget child) => child;
|
||||
|
||||
/// The [onBuild] function which will be invoked on each widget build.
|
||||
/// The [onBuild] takes the `BuildContext` and current `state` and
|
||||
@@ -66,7 +66,7 @@ abstract class BlocBaseConsumerScreen<Bloc extends BlocBase<State>,
|
||||
void onListen(BuildContext context, State state) {}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => onWrap(
|
||||
Widget build(BuildContext context) => parent(
|
||||
context,
|
||||
BlocConsumer<Bloc, State>(
|
||||
listenWhen: shouldListenWhen,
|
||||
|
||||
@@ -58,7 +58,7 @@ abstract class CubitProviderScreen<Cubit extends blocbase.Cubit<State>,
|
||||
/// [shouldListenWhen] and [shouldBuildWhen] are optional and if they
|
||||
/// aren't implemented, they will default to `true`.
|
||||
///
|
||||
/// An optional [onWrap] can also be implemented. This build a wrapper arround
|
||||
/// An optional [parent] can also be implemented. This build a wrapper arround
|
||||
/// the built BlocConsumer that is **not** rebuild on each state.
|
||||
/// {@endtemplate}
|
||||
abstract class CubitConsumerScreen<Cubit extends blocbase.Cubit<State>,
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
## 0.1.0+1
|
||||
|
||||
- Update a dependency to the latest release.
|
||||
|
||||
## 0.1.0
|
||||
|
||||
> Note: This release has breaking changes.
|
||||
|
||||
@@ -30,7 +30,7 @@ class CrudRepositoryImpl<Model extends ObjectModel>
|
||||
}) : _crudDataSource = crudDataSource;
|
||||
|
||||
@override
|
||||
FutureResult<void> create(Model object, {String? id}) =>
|
||||
FutureOrResult<void> create(Model object, {String? id}) =>
|
||||
Result.tryCatchAsync<void, AppException, AppException>(
|
||||
() async {
|
||||
await _crudDataSource.create(object, id: id);
|
||||
@@ -39,21 +39,21 @@ class CrudRepositoryImpl<Model extends ObjectModel>
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<Model?> get(String id) =>
|
||||
FutureOrResult<Model?> get(String id) =>
|
||||
Result.tryCatchAsync<Model?, AppException, AppException>(
|
||||
() async => _crudDataSource.get(id),
|
||||
(error) => error,
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<List<Model?>> getAll() =>
|
||||
FutureOrResult<List<Model?>> getAll() =>
|
||||
Result.tryCatchAsync<List<Model?>, AppException, AppException>(
|
||||
() async => _crudDataSource.getAll(),
|
||||
(error) => error,
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<void> update(
|
||||
FutureOrResult<void> update(
|
||||
String id, {
|
||||
Model? object,
|
||||
Map<String, dynamic>? raw,
|
||||
@@ -64,28 +64,28 @@ class CrudRepositoryImpl<Model extends ObjectModel>
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<void> updateAll(Map<String, Object?> raw) =>
|
||||
FutureOrResult<void> updateAll(Map<String, Object?> raw) =>
|
||||
Result.tryCatchAsync<void, AppException, AppException>(
|
||||
() async => _crudDataSource.updateAll(raw),
|
||||
(error) => error,
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<void> delete(String id) =>
|
||||
FutureOrResult<void> delete(String id) =>
|
||||
Result.tryCatchAsync<void, AppException, AppException>(
|
||||
() async => _crudDataSource.delete(id),
|
||||
(error) => error,
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<void> deleteAll() =>
|
||||
FutureOrResult<void> deleteAll() =>
|
||||
Result.tryCatchAsync<void, AppException, AppException>(
|
||||
() async => _crudDataSource.deleteAll(),
|
||||
(error) => error,
|
||||
);
|
||||
|
||||
@override
|
||||
FutureResult<List<Model?>> query(List<QueryInterface> conditions) =>
|
||||
FutureOrResult<List<Model?>> query(List<QueryInterface> conditions) =>
|
||||
Result.tryCatchAsync<List<Model?>, AppException, AppException>(
|
||||
() async => _crudDataSource.query(conditions),
|
||||
(error) => error,
|
||||
|
||||
@@ -20,18 +20,18 @@ import 'package:wyatt_crud_bloc/src/domain/entities/query.dart';
|
||||
|
||||
abstract class CrudRepository<Model extends ObjectModel>
|
||||
extends BaseRepository {
|
||||
FutureResult<void> create(Model object, {String? id});
|
||||
FutureResult<Model?> get(String id);
|
||||
FutureResult<List<Model?>> getAll();
|
||||
FutureResult<void> update(
|
||||
FutureOrResult<void> create(Model object, {String? id});
|
||||
FutureOrResult<Model?> get(String id);
|
||||
FutureOrResult<List<Model?>> getAll();
|
||||
FutureOrResult<void> update(
|
||||
String id, {
|
||||
Model? object,
|
||||
Map<String, dynamic>? raw,
|
||||
});
|
||||
FutureResult<void> updateAll(Map<String, Object?> raw);
|
||||
FutureResult<void> delete(String id);
|
||||
FutureResult<void> deleteAll();
|
||||
FutureResult<List<Model?>> query(List<QueryInterface> conditions);
|
||||
FutureOrResult<void> updateAll(Map<String, Object?> raw);
|
||||
FutureOrResult<void> delete(String id);
|
||||
FutureOrResult<void> deleteAll();
|
||||
FutureOrResult<List<Model?>> query(List<QueryInterface> conditions);
|
||||
StreamResult<List<Model?>> stream({
|
||||
String? id,
|
||||
List<QueryInterface>? conditions,
|
||||
|
||||
@@ -15,15 +15,24 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
import 'package:wyatt_crud_bloc/src/domain/entities/object_model.dart';
|
||||
import 'package:wyatt_crud_bloc/src/domain/repositories/crud_repository.dart';
|
||||
|
||||
class Create<Model extends ObjectModel> extends UseCase<Model, void> {
|
||||
class Create<Model extends ObjectModel> extends AsyncUseCase<Model, void> {
|
||||
final CrudRepository<Model> _crudRepository;
|
||||
|
||||
Create(this._crudRepository);
|
||||
|
||||
@override
|
||||
FutureResult<void> call(Model params) => _crudRepository.create(params);
|
||||
FutureOr<void> onStart(Model? params) {
|
||||
if(params == null){
|
||||
throw ClientException('$Model cannot be null.');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
FutureOrResult<void> call(Model? params) => _crudRepository.create(params!);
|
||||
}
|
||||
|
||||
@@ -14,15 +14,24 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
import 'package:wyatt_crud_bloc/src/domain/entities/object_model.dart';
|
||||
import 'package:wyatt_crud_bloc/src/domain/repositories/crud_repository.dart';
|
||||
|
||||
class Delete<Model extends ObjectModel> extends UseCase<String, void> {
|
||||
class Delete<Model extends ObjectModel> extends AsyncUseCase<String, void> {
|
||||
final CrudRepository<Model> _crudRepository;
|
||||
|
||||
Delete(this._crudRepository);
|
||||
|
||||
@override
|
||||
FutureResult<void> call(String params) => _crudRepository.delete(params);
|
||||
FutureOr<void> onStart(String? params) {
|
||||
if(params == null){
|
||||
throw ClientException('Id cannot be null.');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
FutureOrResult<void> call(String? params) => _crudRepository.delete(params!);
|
||||
}
|
||||
|
||||
@@ -18,11 +18,11 @@ import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
import 'package:wyatt_crud_bloc/src/domain/entities/object_model.dart';
|
||||
import 'package:wyatt_crud_bloc/src/domain/repositories/crud_repository.dart';
|
||||
|
||||
class DeleteAll<Model extends ObjectModel> extends UseCase<void, void> {
|
||||
class DeleteAll<Model extends ObjectModel> extends AsyncUseCase<void, void> {
|
||||
final CrudRepository<Model> _crudRepository;
|
||||
|
||||
DeleteAll(this._crudRepository);
|
||||
|
||||
@override
|
||||
FutureResult<void> call(void params) => _crudRepository.deleteAll();
|
||||
FutureOrResult<void> call(void params) => _crudRepository.deleteAll();
|
||||
}
|
||||
|
||||
@@ -14,15 +14,24 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
import 'package:wyatt_crud_bloc/src/domain/entities/object_model.dart';
|
||||
import 'package:wyatt_crud_bloc/src/domain/repositories/crud_repository.dart';
|
||||
|
||||
class Get<Model extends ObjectModel> extends UseCase<String, Model?> {
|
||||
class Get<Model extends ObjectModel> extends AsyncUseCase<String, Model?> {
|
||||
final CrudRepository<Model> _crudRepository;
|
||||
|
||||
Get(this._crudRepository);
|
||||
|
||||
@override
|
||||
FutureResult<Model?> call(String params) => _crudRepository.get(params);
|
||||
FutureOr<void> onStart(String? params) {
|
||||
if(params == null){
|
||||
throw ClientException('Id cannot be null.');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
FutureOrResult<Model?> call(String? params) => _crudRepository.get(params!);
|
||||
}
|
||||
|
||||
@@ -18,11 +18,12 @@ import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
import 'package:wyatt_crud_bloc/src/domain/entities/object_model.dart';
|
||||
import 'package:wyatt_crud_bloc/src/domain/repositories/crud_repository.dart';
|
||||
|
||||
class GetAll<Model extends ObjectModel> extends UseCase<void, List<Model?>> {
|
||||
class GetAll<Model extends ObjectModel>
|
||||
extends AsyncUseCase<void, List<Model?>> {
|
||||
final CrudRepository<Model> _crudRepository;
|
||||
|
||||
GetAll(this._crudRepository);
|
||||
|
||||
@override
|
||||
FutureResult<List<Model?>> call(void params) => _crudRepository.getAll();
|
||||
FutureOrResult<List<Model?>> call(void params) => _crudRepository.getAll();
|
||||
}
|
||||
|
||||
@@ -14,18 +14,27 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
import 'package:wyatt_crud_bloc/src/domain/entities/object_model.dart';
|
||||
import 'package:wyatt_crud_bloc/src/domain/entities/query.dart';
|
||||
import 'package:wyatt_crud_bloc/src/domain/repositories/crud_repository.dart';
|
||||
|
||||
class Query<Model extends ObjectModel>
|
||||
extends UseCase<List<QueryInterface>, List<Model?>> {
|
||||
extends AsyncUseCase<List<QueryInterface>, List<Model?>> {
|
||||
final CrudRepository<Model> _crudRepository;
|
||||
|
||||
Query(this._crudRepository);
|
||||
|
||||
@override
|
||||
FutureResult<List<Model?>> call(List<QueryInterface> params) =>
|
||||
_crudRepository.query(params);
|
||||
FutureOr<void> onStart(List<QueryInterface>? params) {
|
||||
if(params == null){
|
||||
throw ClientException('List of conditions cannot be null.');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
FutureOrResult<List<Model?>> call(List<QueryInterface>? params) =>
|
||||
_crudRepository.query(params!);
|
||||
}
|
||||
|
||||
@@ -14,11 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// TODO(hpcl): add streamed usecase in wyatt_architecture
|
||||
|
||||
// import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
// import 'package:wyatt_crud_bloc/src/domain/repositories/crud_repository.dart';
|
||||
// import 'package:wyatt_crud_bloc/src/domain/usecases/params/stream_parameters.dart';
|
||||
|
||||
// class Stream<Model extends ObjectModel> extends UseCase<StreamParameters, List<Model?>> {
|
||||
// final CrudRepository<Model> _crudRepository;
|
||||
@@ -29,3 +25,20 @@
|
||||
// StreamResult<List<Model?>> call(StreamParameters params) =>
|
||||
// _crudRepository.stream(id: params.id, conditions: params.conditions);
|
||||
// }
|
||||
|
||||
// class StreamQuery<Model extends ObjectModel>
|
||||
// extends StreamUseCase<StreamParameters, List<Model?>> {
|
||||
// final CrudRepository<Model> _crudRepository;
|
||||
|
||||
// StreamQuery(this._crudRepository);
|
||||
|
||||
// @override
|
||||
// FutureOr<void> onStart(StreamParameters? params) {
|
||||
// if(params == null){
|
||||
// throw ClientException('Stream parameters cannot be null.');
|
||||
// }
|
||||
// }
|
||||
|
||||
// @override
|
||||
// FutureOrResult<Stream<List<Model?>>> call(StreamParameters? params) => _crudRepository.stream();
|
||||
// }
|
||||
@@ -14,21 +14,30 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
import 'package:wyatt_crud_bloc/src/domain/entities/object_model.dart';
|
||||
import 'package:wyatt_crud_bloc/src/domain/repositories/crud_repository.dart';
|
||||
import 'package:wyatt_crud_bloc/src/domain/usecases/params/update_parameters.dart';
|
||||
|
||||
class Update<Model extends ObjectModel>
|
||||
extends UseCase<UpdateParameters<Model>, void> {
|
||||
extends AsyncUseCase<UpdateParameters<Model>, void> {
|
||||
final CrudRepository<Model> _crudRepository;
|
||||
|
||||
Update(this._crudRepository);
|
||||
|
||||
@override
|
||||
FutureResult<void> call(UpdateParameters<Model> params) =>
|
||||
FutureOr<void> onStart(UpdateParameters<Model>? params) {
|
||||
if(params == null){
|
||||
throw ClientException('Update parameters cannot be null.');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
FutureOrResult<void> call(UpdateParameters<Model>? params) =>
|
||||
_crudRepository.update(
|
||||
params.id,
|
||||
params!.id,
|
||||
object: params.object,
|
||||
raw: params.raw,
|
||||
);
|
||||
|
||||
@@ -14,17 +14,26 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
import 'package:wyatt_crud_bloc/src/domain/entities/object_model.dart';
|
||||
import 'package:wyatt_crud_bloc/src/domain/repositories/crud_repository.dart';
|
||||
|
||||
class UpdateAll<Model extends ObjectModel>
|
||||
extends UseCase<Map<String, Object?>, void> {
|
||||
extends AsyncUseCase<Map<String, Object?>, void> {
|
||||
final CrudRepository<Model> _crudRepository;
|
||||
|
||||
UpdateAll(this._crudRepository);
|
||||
|
||||
@override
|
||||
FutureResult<void> call(Map<String, Object?> params) =>
|
||||
_crudRepository.updateAll(params);
|
||||
FutureOr<void> onStart(Map<String, Object?>? params) {
|
||||
if(params == null){
|
||||
throw ClientException('Data cannot be null.');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
FutureOrResult<void> call(Map<String, Object?>? params) =>
|
||||
_crudRepository.updateAll(params!);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ export 'get.dart';
|
||||
export 'get_all.dart';
|
||||
export 'params/params.dart';
|
||||
export 'query.dart';
|
||||
export 'stream.dart';
|
||||
export 'stream_query.dart';
|
||||
export 'update.dart';
|
||||
export 'update_all.dart';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
name: wyatt_crud_bloc
|
||||
description: Create/Read/Update/Delete BLoC for Flutter
|
||||
repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_crud_bloc
|
||||
version: 0.1.0
|
||||
version: 0.1.0+1
|
||||
|
||||
publish_to: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
|
||||
|
||||
@@ -19,7 +19,7 @@ dependencies:
|
||||
|
||||
wyatt_architecture:
|
||||
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
|
||||
version: 0.0.2
|
||||
version: 0.1.0
|
||||
|
||||
wyatt_type_utils:
|
||||
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
firebase_options.dart
|
||||
.vscode
|
||||
@@ -1 +0,0 @@
|
||||
../../.vscode/
|
||||
@@ -0,0 +1,76 @@
|
||||
{
|
||||
// Dart
|
||||
"dart.runPubGetOnPubspecChanges": "never",
|
||||
// Gitea
|
||||
"gitea.owner": "Wyatt-FOSS",
|
||||
"gitea.repo": "wyatt-packages",
|
||||
// Header
|
||||
"psi-header.changes-tracking": {
|
||||
"isActive": true
|
||||
},
|
||||
"psi-header.config": {
|
||||
"blankLinesAfter": 1,
|
||||
"forceToTop": true
|
||||
},
|
||||
"psi-header.lang-config": [
|
||||
{
|
||||
"beforeHeader": [
|
||||
"# -*- coding:utf-8 -*-",
|
||||
"#!/usr/bin/env python3"
|
||||
],
|
||||
"begin": "###",
|
||||
"end": "###",
|
||||
"language": "python",
|
||||
"prefix": "# "
|
||||
},
|
||||
{
|
||||
"beforeHeader": [
|
||||
"#!/usr/bin/env sh",
|
||||
""
|
||||
],
|
||||
"language": "shellscript",
|
||||
"begin": "",
|
||||
"end": "",
|
||||
"prefix": "# "
|
||||
},
|
||||
{
|
||||
"begin": "",
|
||||
"end": "",
|
||||
"language": "dart",
|
||||
"prefix": "// "
|
||||
},
|
||||
{
|
||||
"begin": "",
|
||||
"end": "",
|
||||
"language": "yaml",
|
||||
"prefix": "# "
|
||||
},
|
||||
{
|
||||
"begin": "<!--",
|
||||
"end": "-->",
|
||||
"language": "markdown",
|
||||
},
|
||||
],
|
||||
"psi-header.templates": [
|
||||
{
|
||||
"language": "*",
|
||||
"template": [
|
||||
"Copyright (C) <<year>> WYATT GROUP",
|
||||
"Please see the AUTHORS file for details.",
|
||||
"",
|
||||
"This program is free software: you can redistribute it and/or modify",
|
||||
"it under the terms of the GNU General Public License as published by",
|
||||
"the Free Software Foundation, either version 3 of the License, or",
|
||||
"any later version.",
|
||||
"",
|
||||
"This program is distributed in the hope that it will be useful,",
|
||||
"but WITHOUT ANY WARRANTY; without even the implied warranty of",
|
||||
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
|
||||
"GNU General Public License for more details.",
|
||||
"",
|
||||
"You should have received a copy of the GNU General Public License",
|
||||
"along with this program. If not, see <https://www.gnu.org/licenses/>."
|
||||
],
|
||||
}
|
||||
],
|
||||
}
|
||||
@@ -1,3 +1,7 @@
|
||||
## 0.2.0+1
|
||||
|
||||
- Update a dependency to the latest release.
|
||||
|
||||
## 0.2.0
|
||||
|
||||
> Note: This release has breaking changes.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
name: wyatt_form_bloc
|
||||
description: Manage forms in Dart & Flutter with Bloc
|
||||
repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_form_bloc
|
||||
version: 0.2.0
|
||||
version: 0.2.0+1
|
||||
|
||||
publish_to: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
|
||||
|
||||
@@ -17,7 +17,7 @@ dependencies:
|
||||
|
||||
wyatt_architecture:
|
||||
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
|
||||
version: ^0.0.2
|
||||
version: ^0.1.0
|
||||
|
||||
wyatt_type_utils:
|
||||
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
# Files and directories created by pub.
|
||||
.dart_tool/
|
||||
.packages
|
||||
|
||||
# Conventional directory for build outputs.
|
||||
build/
|
||||
|
||||
# Omit committing pubspec.lock for library packages; see
|
||||
# https://dart.dev/guides/libraries/private-files#pubspeclock.
|
||||
pubspec.lock
|
||||
@@ -0,0 +1,3 @@
|
||||
## 1.0.0
|
||||
|
||||
- Initial version.
|
||||
@@ -0,0 +1,39 @@
|
||||
<!--
|
||||
This README describes the package. If you publish this package to pub.dev,
|
||||
this README's contents appear on the landing page for your package.
|
||||
|
||||
For information about how to write a good package README, see the guide for
|
||||
[writing package pages](https://dart.dev/guides/libraries/writing-package-pages).
|
||||
|
||||
For general information about developing packages, see the Dart guide for
|
||||
[creating packages](https://dart.dev/guides/libraries/create-library-packages)
|
||||
and the Flutter guide for
|
||||
[developing packages and plugins](https://flutter.dev/developing-packages).
|
||||
-->
|
||||
|
||||
TODO: Put a short description of the package here that helps potential users
|
||||
know whether this package might be useful for them.
|
||||
|
||||
## Features
|
||||
|
||||
TODO: List what your package can do. Maybe include images, gifs, or videos.
|
||||
|
||||
## Getting started
|
||||
|
||||
TODO: List prerequisites and provide or point to information on how to
|
||||
start using the package.
|
||||
|
||||
## Usage
|
||||
|
||||
TODO: Include short and useful examples for package users. Add longer examples
|
||||
to `/example` folder.
|
||||
|
||||
```dart
|
||||
const like = 'sample';
|
||||
```
|
||||
|
||||
## Additional information
|
||||
|
||||
TODO: Tell users more about the package: where to find more information, how to
|
||||
contribute to the package, how to file issues, what response they can expect
|
||||
from the package authors, and more.
|
||||
@@ -0,0 +1,30 @@
|
||||
# This file configures the static analysis results for your project (errors,
|
||||
# warnings, and lints).
|
||||
#
|
||||
# This enables the 'recommended' set of lints from `package:lints`.
|
||||
# This set helps identify many issues that may lead to problems when running
|
||||
# or consuming Dart code, and enforces writing Dart using a single, idiomatic
|
||||
# style and format.
|
||||
#
|
||||
# If you want a smaller set of lints you can change this to specify
|
||||
# 'package:lints/core.yaml'. These are just the most critical lints
|
||||
# (the recommended set includes the core lints).
|
||||
# The core lints are also what is used by pub.dev for scoring packages.
|
||||
|
||||
include: package:lints/recommended.yaml
|
||||
|
||||
# Uncomment the following section to specify additional rules.
|
||||
|
||||
# linter:
|
||||
# rules:
|
||||
# - camel_case_types
|
||||
|
||||
# analyzer:
|
||||
# exclude:
|
||||
# - path/to/excluded/files/**
|
||||
|
||||
# For more information about the core and recommended set of lints, see
|
||||
# https://dart.dev/go/core-lints
|
||||
|
||||
# For additional information about configuring this file, see
|
||||
# https://dart.dev/guides/language/analysis-options
|
||||
@@ -0,0 +1,44 @@
|
||||
# Miscellaneous
|
||||
*.class
|
||||
*.log
|
||||
*.pyc
|
||||
*.swp
|
||||
.DS_Store
|
||||
.atom/
|
||||
.buildlog/
|
||||
.history
|
||||
.svn/
|
||||
migrate_working_dir/
|
||||
|
||||
# IntelliJ related
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
.idea/
|
||||
|
||||
# The .vscode folder contains launch configuration and tasks you configure in
|
||||
# VS Code which you may wish to be included in version control, so this line
|
||||
# is commented out by default.
|
||||
#.vscode/
|
||||
|
||||
# Flutter/Dart/Pub related
|
||||
**/doc/api/
|
||||
**/ios/Flutter/.last_build_id
|
||||
.dart_tool/
|
||||
.flutter-plugins
|
||||
.flutter-plugins-dependencies
|
||||
.packages
|
||||
.pub-cache/
|
||||
.pub/
|
||||
/build/
|
||||
|
||||
# Symbolication related
|
||||
app.*.symbols
|
||||
|
||||
# Obfuscation related
|
||||
app.*.map.json
|
||||
|
||||
# Android Studio will place build artifacts here
|
||||
/android/app/debug
|
||||
/android/app/profile
|
||||
/android/app/release
|
||||
@@ -0,0 +1,33 @@
|
||||
# This file tracks properties of this Flutter project.
|
||||
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
||||
#
|
||||
# This file should be version controlled.
|
||||
|
||||
version:
|
||||
revision: eb6d86ee27deecba4a83536aa20f366a6044895c
|
||||
channel: stable
|
||||
|
||||
project_type: app
|
||||
|
||||
# Tracks metadata for the flutter migrate command
|
||||
migration:
|
||||
platforms:
|
||||
- platform: root
|
||||
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
|
||||
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
|
||||
- platform: android
|
||||
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
|
||||
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
|
||||
- platform: ios
|
||||
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
|
||||
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
|
||||
|
||||
# User provided section
|
||||
|
||||
# List of Local paths (relative to this file) that should be
|
||||
# ignored by the migrate tool.
|
||||
#
|
||||
# Files that are not part of the templates will be ignored by default.
|
||||
unmanaged_files:
|
||||
- 'lib/main.dart'
|
||||
- 'ios/Runner.xcodeproj/project.pbxproj'
|
||||
@@ -0,0 +1,16 @@
|
||||
# notification_bloc_example
|
||||
|
||||
A new Flutter project.
|
||||
|
||||
## Getting Started
|
||||
|
||||
This project is a starting point for a Flutter application.
|
||||
|
||||
A few resources to get you started if this is your first Flutter project:
|
||||
|
||||
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
|
||||
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
|
||||
|
||||
For help getting started with Flutter development, view the
|
||||
[online documentation](https://docs.flutter.dev/), which offers tutorials,
|
||||
samples, guidance on mobile development, and a full API reference.
|
||||
@@ -0,0 +1,29 @@
|
||||
# This file configures the analyzer, which statically analyzes Dart code to
|
||||
# check for errors, warnings, and lints.
|
||||
#
|
||||
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
|
||||
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
|
||||
# invoked from the command line by running `flutter analyze`.
|
||||
|
||||
# The following line activates a set of recommended lints for Flutter apps,
|
||||
# packages, and plugins designed to encourage good coding practices.
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
linter:
|
||||
# The lint rules applied to this project can be customized in the
|
||||
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
|
||||
# included above or to enable additional rules. A list of all available lints
|
||||
# and their documentation is published at
|
||||
# https://dart-lang.github.io/linter/lints/index.html.
|
||||
#
|
||||
# Instead of disabling a lint rule for the entire project in the
|
||||
# section below, it can also be suppressed for a single line of code
|
||||
# or a specific dart file by using the `// ignore: name_of_lint` and
|
||||
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
|
||||
# producing the lint.
|
||||
rules:
|
||||
# avoid_print: false # Uncomment to disable the `avoid_print` rule
|
||||
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
|
||||
|
||||
# Additional information about this file can be found at
|
||||
# https://dart.dev/guides/language/analysis-options
|
||||
@@ -0,0 +1,13 @@
|
||||
gradle-wrapper.jar
|
||||
/.gradle
|
||||
/captures/
|
||||
/gradlew
|
||||
/gradlew.bat
|
||||
/local.properties
|
||||
GeneratedPluginRegistrant.java
|
||||
|
||||
# Remember to never publicly share your keystore.
|
||||
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
|
||||
key.properties
|
||||
**/*.keystore
|
||||
**/*.jks
|
||||
@@ -0,0 +1,71 @@
|
||||
def localProperties = new Properties()
|
||||
def localPropertiesFile = rootProject.file('local.properties')
|
||||
if (localPropertiesFile.exists()) {
|
||||
localPropertiesFile.withReader('UTF-8') { reader ->
|
||||
localProperties.load(reader)
|
||||
}
|
||||
}
|
||||
|
||||
def flutterRoot = localProperties.getProperty('flutter.sdk')
|
||||
if (flutterRoot == null) {
|
||||
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
|
||||
}
|
||||
|
||||
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
||||
if (flutterVersionCode == null) {
|
||||
flutterVersionCode = '1'
|
||||
}
|
||||
|
||||
def flutterVersionName = localProperties.getProperty('flutter.versionName')
|
||||
if (flutterVersionName == null) {
|
||||
flutterVersionName = '1.0'
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||
|
||||
android {
|
||||
compileSdkVersion flutter.compileSdkVersion
|
||||
ndkVersion flutter.ndkVersion
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main.java.srcDirs += 'src/main/kotlin'
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId "com.example.notification_bloc_example"
|
||||
// You can update the following values to match your application needs.
|
||||
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
|
||||
minSdkVersion flutter.minSdkVersion
|
||||
targetSdkVersion flutter.targetSdkVersion
|
||||
versionCode flutterVersionCode.toInteger()
|
||||
versionName flutterVersionName
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
// TODO: Add your own signing config for the release build.
|
||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flutter {
|
||||
source '../..'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.notification_bloc_example">
|
||||
<!-- The INTERNET permission is required for development. Specifically,
|
||||
the Flutter tool needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
</manifest>
|
||||
@@ -0,0 +1,34 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.notification_bloc_example">
|
||||
<application
|
||||
android:label="notification_bloc_example"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/LaunchTheme"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
android:hardwareAccelerated="true"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<!-- Specifies an Android theme to apply to this Activity as soon as
|
||||
the Android process has started. This theme is visible to the user
|
||||
while the Flutter UI initializes. After that, this theme continues
|
||||
to determine the Window background behind the Flutter UI. -->
|
||||
<meta-data
|
||||
android:name="io.flutter.embedding.android.NormalTheme"
|
||||
android:resource="@style/NormalTheme"
|
||||
/>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<!-- Don't delete the meta-data below.
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
<meta-data
|
||||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.example.notification_bloc_example
|
||||
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
|
||||
class MainActivity: FlutterActivity() {
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Modify this file to customize your launch splash screen -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="?android:colorBackground" />
|
||||
|
||||
<!-- You can insert your own image assets here -->
|
||||
<!-- <item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@mipmap/launch_image" />
|
||||
</item> -->
|
||||
</layer-list>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Modify this file to customize your launch splash screen -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@android:color/white" />
|
||||
|
||||
<!-- You can insert your own image assets here -->
|
||||
<!-- <item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@mipmap/launch_image" />
|
||||
</item> -->
|
||||
</layer-list>
|
||||
|
After Width: | Height: | Size: 544 B |
|
After Width: | Height: | Size: 442 B |
|
After Width: | Height: | Size: 721 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<!-- Show a splash screen on the activity. Automatically removed when
|
||||
the Flutter engine draws its first frame -->
|
||||
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||
</style>
|
||||
<!-- Theme applied to the Android Window as soon as the process has started.
|
||||
This theme determines the color of the Android Window while your
|
||||
Flutter UI initializes, as well as behind your Flutter UI while its
|
||||
running.
|
||||
|
||||
This Theme is only used starting with V2 of Flutter's Android embedding. -->
|
||||
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<item name="android:windowBackground">?android:colorBackground</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<!-- Show a splash screen on the activity. Automatically removed when
|
||||
the Flutter engine draws its first frame -->
|
||||
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||
</style>
|
||||
<!-- Theme applied to the Android Window as soon as the process has started.
|
||||
This theme determines the color of the Android Window while your
|
||||
Flutter UI initializes, as well as behind your Flutter UI while its
|
||||
running.
|
||||
|
||||
This Theme is only used starting with V2 of Flutter's Android embedding. -->
|
||||
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<item name="android:windowBackground">?android:colorBackground</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -0,0 +1,8 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.notification_bloc_example">
|
||||
<!-- The INTERNET permission is required for development. Specifically,
|
||||
the Flutter tool needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
</manifest>
|
||||
@@ -0,0 +1,31 @@
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.6.10'
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:7.1.2'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.buildDir = '../build'
|
||||
subprojects {
|
||||
project.buildDir = "${rootProject.buildDir}/${project.name}"
|
||||
}
|
||||
subprojects {
|
||||
project.evaluationDependsOn(':app')
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
org.gradle.jvmargs=-Xmx1536M
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
@@ -0,0 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
|
||||
@@ -0,0 +1,11 @@
|
||||
include ':app'
|
||||
|
||||
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
|
||||
def properties = new Properties()
|
||||
|
||||
assert localPropertiesFile.exists()
|
||||
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
|
||||
|
||||
def flutterSdkPath = properties.getProperty("flutter.sdk")
|
||||
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
|
||||
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
|
||||
@@ -0,0 +1,34 @@
|
||||
**/dgph
|
||||
*.mode1v3
|
||||
*.mode2v3
|
||||
*.moved-aside
|
||||
*.pbxuser
|
||||
*.perspectivev3
|
||||
**/*sync/
|
||||
.sconsign.dblite
|
||||
.tags*
|
||||
**/.vagrant/
|
||||
**/DerivedData/
|
||||
Icon?
|
||||
**/Pods/
|
||||
**/.symlinks/
|
||||
profile
|
||||
xcuserdata
|
||||
**/.generated/
|
||||
Flutter/App.framework
|
||||
Flutter/Flutter.framework
|
||||
Flutter/Flutter.podspec
|
||||
Flutter/Generated.xcconfig
|
||||
Flutter/ephemeral/
|
||||
Flutter/app.flx
|
||||
Flutter/app.zip
|
||||
Flutter/flutter_assets/
|
||||
Flutter/flutter_export_environment.sh
|
||||
ServiceDefinitions.json
|
||||
Runner/GeneratedPluginRegistrant.*
|
||||
|
||||
# Exceptions to above rules.
|
||||
!default.mode1v3
|
||||
!default.mode2v3
|
||||
!default.pbxuser
|
||||
!default.perspectivev3
|
||||
@@ -0,0 +1,26 @@
|
||||
<?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>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>App</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>io.flutter.flutter.app</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>App</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>11.0</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1 @@
|
||||
#include "Generated.xcconfig"
|
||||
@@ -0,0 +1 @@
|
||||
#include "Generated.xcconfig"
|
||||
@@ -0,0 +1,484 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 50;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
|
||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
||||
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
|
||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
|
||||
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
|
||||
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
|
||||
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
|
||||
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
97C146EB1CF9000F007C117D /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
9740EEB11CF90186004384FC /* Flutter */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
|
||||
9740EEB21CF90195004384FC /* Debug.xcconfig */,
|
||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
|
||||
9740EEB31CF90195004384FC /* Generated.xcconfig */,
|
||||
);
|
||||
name = Flutter;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97C146E51CF9000F007C117D = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9740EEB11CF90186004384FC /* Flutter */,
|
||||
97C146F01CF9000F007C117D /* Runner */,
|
||||
97C146EF1CF9000F007C117D /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97C146EF1CF9000F007C117D /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
97C146EE1CF9000F007C117D /* Runner.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97C146F01CF9000F007C117D /* Runner */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
97C146FA1CF9000F007C117D /* Main.storyboard */,
|
||||
97C146FD1CF9000F007C117D /* Assets.xcassets */,
|
||||
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
|
||||
97C147021CF9000F007C117D /* Info.plist */,
|
||||
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
|
||||
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
|
||||
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
|
||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
|
||||
);
|
||||
path = Runner;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
97C146ED1CF9000F007C117D /* Runner */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
|
||||
buildPhases = (
|
||||
9740EEB61CF901F6004384FC /* Run Script */,
|
||||
97C146EA1CF9000F007C117D /* Sources */,
|
||||
97C146EB1CF9000F007C117D /* Frameworks */,
|
||||
97C146EC1CF9000F007C117D /* Resources */,
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = Runner;
|
||||
productName = Runner;
|
||||
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
97C146E61CF9000F007C117D /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 1300;
|
||||
ORGANIZATIONNAME = "";
|
||||
TargetAttributes = {
|
||||
97C146ED1CF9000F007C117D = {
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
LastSwiftMigration = 1100;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
|
||||
compatibilityVersion = "Xcode 9.3";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 97C146E51CF9000F007C117D;
|
||||
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
97C146ED1CF9000F007C117D /* Runner */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
97C146EC1CF9000F007C117D /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
|
||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
|
||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
|
||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Thin Binary";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
|
||||
};
|
||||
9740EEB61CF901F6004384FC /* Run Script */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Run Script";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
97C146EA1CF9000F007C117D /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
|
||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
97C146FA1CF9000F007C117D /* Main.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
97C146FB1CF9000F007C117D /* Base */,
|
||||
);
|
||||
name = Main.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
97C147001CF9000F007C117D /* Base */,
|
||||
);
|
||||
name = LaunchScreen.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
249021D3217E4FDB00AE95B9 /* Profile */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SUPPORTED_PLATFORMS = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Profile;
|
||||
};
|
||||
249021D4217E4FDB00AE95B9 /* Profile */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = W6464PZ8CJ;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.notificationBlocExample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
};
|
||||
name = Profile;
|
||||
};
|
||||
97C147031CF9000F007C117D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
97C147041CF9000F007C117D /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SUPPORTED_PLATFORMS = iphoneos;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
97C147061CF9000F007C117D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = W6464PZ8CJ;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.notificationBlocExample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
97C147071CF9000F007C117D /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = W6464PZ8CJ;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.notificationBlocExample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
97C147031CF9000F007C117D /* Debug */,
|
||||
97C147041CF9000F007C117D /* Release */,
|
||||
249021D3217E4FDB00AE95B9 /* Profile */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
97C147061CF9000F007C117D /* Debug */,
|
||||
97C147071CF9000F007C117D /* Release */,
|
||||
249021D4217E4FDB00AE95B9 /* Profile */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 97C146E61CF9000F007C117D /* Project object */;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||