Compare commits

...
Author SHA1 Message Date
hugo 719fa83576 chore(release): publish packages
- wyatt_form_bloc@0.0.6
 - wyatt_authentication_bloc@0.2.1+4
2022-08-26 13:44:00 +02:00
hugo 7f56752fa7 style(auth): reformat some files 2022-08-26 13:43:39 +02:00
hugo d9d45db5c0 feat(auth): add reactive repo + extra data + router examples + tests 2022-08-26 13:42:53 +02:00
hugo a1e36f84be feat(form): add raw form validator 2022-08-26 13:42:01 +02:00
hugo 24ebdc008c chore(release): publish packages
- wyatt_form_bloc@0.0.5
 - wyatt_authentication_bloc@0.2.1+3
2022-08-25 18:03:00 +02:00
hugo 57b951ed0a feat(form): update deps 2022-08-25 18:02:43 +02:00
hugo d6bb3c2ac7 chore(release): publish packages
- wyatt_form_bloc@0.0.4
 - wyatt_authentication_bloc@0.2.1+2
2022-08-25 17:36:44 +02:00
hugo 5515c0e951 chore(release): publish packages
- wyatt_type_utils@0.0.2
2022-07-18 16:58:32 +02:00
hugo daf8ec27ab Merge pull request 'docs: remove useless web example' (#14) from types/clean_example_web into master
Reviewed-on: #14
2022-07-18 14:57:09 +00:00
hugo ec5e65ac82 docs: remove useless web example 2022-07-18 16:56:48 +02:00
hugo d7e618e04c Merge pull request 'types/new_package' (#13) from types/new_package into master
Reviewed-on: #13
2022-07-18 14:55:21 +00:00
hugo fc7a4560f0 feat(types): add strongly typed Option and Result. 2022-07-18 16:54:38 +02:00
hugo 52665cdee5 feat(types): add mason generated package 2022-07-17 22:29:36 +02:00
hugo 5300e684de Merge pull request 'feat(from): add form validator class with strategy design pattern' (#12) from form/feature/form_validator_class into master
Reviewed-on: #12
2022-07-15 16:24:33 +00:00
hugo 607b986848 feat(from): add form validator class with strategy design pattern 2022-07-14 16:59:24 +02:00
Malo Léon 61c6e637ec doc(bloc_helper): update readme 2022-07-14 11:55:49 +01:00
Malo Léon efda077f4b feat(bloc_helper): add wrap feature 2022-07-14 11:45:47 +01:00
Malo Léon e00f4f55b7 refactor(bloc_helper): general code update 2022-07-14 11:11:02 +01:00
hugo 58fec4bf48 chore(release): publish packages
- wyatt_analysis@2.2.1
2022-07-12 12:20:15 +02:00
hugo dd380a71db fix: import right version 2022-07-12 12:20:07 +02:00
hugo 0d130ce84a chore(release): publish packages
- wyatt_analysis@2.2.0
2022-07-11 23:54:57 +02:00
hugo 28d9aa69e7 fix: rename to follow melos versioning and remove redundant rule 2022-07-11 23:54:48 +02:00
hugo 45e737dde2 feat: promote experimental, update analyzer rules and add some linter rules 2022-07-11 23:52:37 +02:00
hugo 2d1826235f chore: update gitignore 2022-07-10 22:25:42 +02:00
hugo f558685f11 chore(release): publish packages
- form_bloc_example@1.1.0
 - wyatt_form_bloc@0.0.3
 - authentication_bloc_example@1.0.1
 - wyatt_authentication_bloc@0.2.1+1
2022-07-10 22:12:37 +02:00
hugo b21aa04557 fix(auth): update form plugin and fix auth 2022-07-10 22:11:16 +02:00
hugo 01df7a0dff fix: ignore google services 2022-07-10 22:10:40 +02:00
hugo 8909274543 feat(form): add helpers 2022-07-10 22:10:12 +02:00
hugo 89f94cf1ff Merge pull request 'form/feature/add_metadata' (#10) from form/feature/add_metadata into master
Reviewed-on: #10
2022-07-10 19:23:54 +00:00
hugo 65774010aa Merge branch 'master' into form/feature/add_metadata 2022-07-10 19:23:40 +00:00
hugo 42810c4fb3 Merge pull request 'chore(deps): update dependency flutter_lints to v2' (#4) from renovate/flutter_lints-2.x into master
Reviewed-on: #4
2022-07-10 19:23:17 +00:00
hugo 39d19b4c7b Merge branch 'master' into renovate/flutter_lints-2.x 2022-07-10 19:23:12 +00:00
hugo 8a0af954bf doc: remove deprecated FormEntry 2022-07-10 21:15:33 +02:00
hugo 94b0ff01ad doc: update readme with usage 2022-07-10 21:13:52 +02:00
hugo 741f05e1be doc: update example 2022-07-10 21:13:43 +02:00
hugo d0f1d07363 feat: add metadata on inputs 2022-07-10 21:13:13 +02:00
hugo 08ac6d8fda feat: update to latest dart version 2022-07-10 21:12:55 +02:00
hugo 9203df94a0 chore(release): publish packages
- wyatt_http_client@1.2.0
2022-06-24 16:01:45 +02:00
hugo a7204f588f Merge pull request 'Feature/middlewares' (#9) from Feature/middlewares into master
Reviewed-on: #9
2022-06-24 14:00:03 +00:00
hugo 81367e5f3a feat(http): add new middleware feature 2022-06-24 15:58:48 +02:00
hugo 14cb3485e4 feat(http): implements doublelinked list for middlewares 2022-06-24 10:47:28 +02:00
hugo 58d3b70bee feat(http): [WIP] implements middleware system 2022-06-23 17:07:04 +02:00
hugo ea4a30ca00 feat(http): [WIP] work on middleware feature 2022-06-23 11:48:32 +02:00
Renovate 83b75ee0e5 chore(deps): update dependency flutter_lints to v2 2022-06-01 14:25:58 +00:00
hugo 9e9ec9ba9b docs(bloc): update license 2022-05-23 21:22:38 +02:00
hugo a98c41f461 chore(release): publish packages
- wyatt_http_client@1.1.0
2022-05-23 20:38:24 +02:00
hugo 9064d5bd34 doc(cli): update readme 2022-05-23 20:37:51 +02:00
hugo de00c532c8 feat(http): add oauth2 refresh token client 2022-05-23 20:37:26 +02:00
hugo 8892337b93 chore(http): add new package 2022-05-23 16:29:44 +02:00
Malo Léon 15b9f979a2 chore(release): publish packages
- wyatt_analysis@2.1.0
2022-05-23 15:51:18 +02:00
Malo Léon a146adfd16 feat(analysis): add experimental rules in appropriate file 2022-05-23 15:18:31 +02:00
Malo Léon 4aed98ef04 docs(packages): update doc with details on allowed types in commits 2022-05-23 15:17:03 +02:00
hugo 7a89704c0b chore(cli): add new package 2022-05-22 23:28:23 +02:00
hugo d60ff3ee27 chore(release): publish packages
- wyatt_authentication_bloc@0.2.1
 - wyatt_bloc_helper@1.1.0
2022-05-20 22:33:30 +02:00
hugo 9ef37633cb feat(bloc): add provider, consumer and helpers 2022-05-20 22:32:30 +02:00
hugo 2ac2b4d2be chore(bloc): add new package 2022-05-20 22:31:46 +02:00
hugo dffa91eb23 chore(release): publish packages
- wyatt_medium_feeds@1.0.1
2022-05-05 21:29:48 +02:00
hugo 164877bb0b fix(medium): remove useless example file 2022-05-05 21:29:25 +02:00
hugo c787b065ad chore(medium): add new package 2022-05-05 21:26:04 +02:00
hugo 12f9cf6aa5 feat(auth): add google, facebook, apple, twitter login 2022-05-04 22:50:07 +02:00
hugo 74db784973 chore(release): publish packages
- wyatt_form_bloc@0.0.2
 - wyatt_authentication_bloc@0.2.0+1
2022-05-02 14:44:17 +02:00
hugo fe5fa692f7 feat(form): add list option validator 2022-05-02 14:41:24 +02:00
hugo 5ea5c510cb chore(release): publish packages
- wyatt_crud_bloc@0.0.2
 - wyatt_analysis@2.0.1
2022-04-20 23:12:12 +02:00
hugo bb264b7362 docs: update readme with some instructions 2022-04-20 23:08:59 +02:00
hugo 17ae855ffb docs(crud): add example app 2022-04-20 23:08:37 +02:00
hugo b38fea130f feat(crud) : new package for crud operations 2022-04-20 22:57:14 +02:00
hugo e3776259df style(auth): update analysis options 2022-04-20 22:54:00 +02:00
hugo 371cc33e3a chore(release): publish packages
- wyatt_authentication_bloc@0.2.0
2022-04-20 18:55:29 +02:00
hugo 3cbc268dea fix(auth): example needs multidex support 2022-04-20 18:55:12 +02:00
hugo 99b6a0a335 remove firebase_options secret file 2022-04-20 18:47:35 +02:00
hugo 88719576b7 bump(auth): upgrade form_bloc package 2022-04-20 18:37:27 +02:00
hugo d191afad33 chore(release): publish packages
- wyatt_form_bloc@0.0.1
2022-04-20 18:28:09 +02:00
hugo 7e433fc0dd docs: fix analyzer badge in root readme 2022-04-20 18:26:57 +02:00
hugo 27015b63d9 feat(auth)!: use form_bloc package 2022-04-20 18:25:46 +02:00
hugo 703e3deeaf fix(form)!: change validate() to selfValidate() 2022-04-20 18:23:05 +02:00
hugo b6b42f9366 chore(analysis): add vscode files 2022-04-20 00:06:37 +02:00
hugo 793b304c1d chore(release): publish packages
- wyatt_form_bloc@0.0.1-dev.0
2022-04-20 00:03:22 +02:00
hugo 9c7ea4adfd docs(form): add example app 2022-04-20 00:01:59 +02:00
hugo ae731f5877 refactor(form): all package structure/documentation 2022-04-20 00:01:12 +02:00
hugo aa2b51f3da docs(form): add few project files 2022-04-19 22:24:07 +02:00
hugo 27d60c9aa3 feat(form): new utility package for forms and bloc 2022-04-19 22:23:03 +02:00
486 changed files with 23075 additions and 1426 deletions
+1
View File
@@ -196,3 +196,4 @@ $RECYCLE.BIN/
.idea/
*.iml
google-services.json
+427
View File
@@ -3,6 +3,433 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## 2022-08-26
### Changes
---
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
- [`wyatt_form_bloc` - `v0.0.6`](#wyatt_form_bloc---v006)
- [`wyatt_authentication_bloc` - `v0.2.1+4`](#wyatt_authentication_bloc---v0214)
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.2.1+4`
---
#### `wyatt_form_bloc` - `v0.0.6`
- **FEAT**: add raw form validator.
## 2022-08-25
### Changes
---
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
- [`wyatt_form_bloc` - `v0.0.5`](#wyatt_form_bloc---v005)
- [`wyatt_authentication_bloc` - `v0.2.1+3`](#wyatt_authentication_bloc---v0213)
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.2.1+3`
---
#### `wyatt_form_bloc` - `v0.0.5`
- **FEAT**: update deps.
## 2022-08-25
### Changes
---
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
- [`wyatt_form_bloc` - `v0.0.4`](#wyatt_form_bloc---v004)
- [`wyatt_authentication_bloc` - `v0.2.1+2`](#wyatt_authentication_bloc---v0212)
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.2.1+2`
---
#### `wyatt_form_bloc` - `v0.0.4`
- **FEAT**: add form validator class with strategy design pattern.
## 2022-07-18
### Changes
---
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
- [`wyatt_type_utils` - `v0.0.2`](#wyatt_type_utils---v002)
---
#### `wyatt_type_utils` - `v0.0.2`
- **FEAT**: add strongly typed Option and Result.
- **FEAT**: add mason generated package.
- **DOCS**: remove useless web example.
## 2022-07-12
### Changes
---
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
- [`wyatt_analysis` - `v2.2.1`](#wyatt_analysis---v221)
---
#### `wyatt_analysis` - `v2.2.1`
- **FIX**: import right version.
## 2022-07-11
### Changes
---
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
- [`wyatt_analysis` - `v2.2.0`](#wyatt_analysis---v220)
---
#### `wyatt_analysis` - `v2.2.0`
- **FIX**: rename to follow melos versioning and remove redundant rule.
- **FEAT**: promote experimental, update analyzer rules and add some linter rules.
## 2022-07-10
### Changes
---
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
- [`form_bloc_example` - `v1.1.0`](#form_bloc_example---v110)
- [`wyatt_form_bloc` - `v0.0.3`](#wyatt_form_bloc---v003)
- [`authentication_bloc_example` - `v1.0.1`](#authentication_bloc_example---v101)
- [`wyatt_authentication_bloc` - `v0.2.1+1`](#wyatt_authentication_bloc---v0211)
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.
- `authentication_bloc_example` - `v1.0.1`
- `wyatt_authentication_bloc` - `v0.2.1+1`
---
#### `form_bloc_example` - `v1.1.0`
- **FEAT**: add list option validator.
- **DOCS**: add example app.
#### `wyatt_form_bloc` - `v0.0.3`
- **FEAT**: add helpers.
- **FEAT**: add metadata on inputs.
- **FEAT**: update to latest dart version.
## 2022-06-24
### Changes
---
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
- [`wyatt_http_client` - `v1.2.0`](#wyatt_http_client---v120)
---
#### `wyatt_http_client` - `v1.2.0`
- **FEAT**: add new middleware feature.
- **FEAT**: implements doublelinked list for middlewares.
- **FEAT**: [WIP] implements middleware system.
- **FEAT**: [WIP] work on middleware feature.
## 2022-05-23
### Changes
---
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
- [`wyatt_http_client` - `v1.1.0`](#wyatt_http_client---v110)
---
#### `wyatt_http_client` - `v1.1.0`
- **FEAT**: add oauth2 refresh token client.
## 2022-05-23
### Changes
---
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
- [`wyatt_analysis` - `v2.1.0`](#wyatt_analysis---v210)
---
#### `wyatt_analysis` - `v2.1.0`
- **FEAT**: add experimental rules in appropriate file.
## 2022-05-20
### Changes
---
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
- [`wyatt_authentication_bloc` - `v0.2.1`](#wyatt_authentication_bloc---v021)
- [`wyatt_bloc_helper` - `v1.1.0`](#wyatt_bloc_helper---v110)
---
#### `wyatt_authentication_bloc` - `v0.2.1`
- **FEAT**: add google, facebook, apple, twitter login.
#### `wyatt_bloc_helper` - `v1.1.0`
- **FEAT**: add provider, consumer and helpers.
## 2022-05-05
### Changes
---
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
- [`wyatt_medium_feeds` - `v1.0.1`](#wyatt_medium_feeds---v101)
---
#### `wyatt_medium_feeds` - `v1.0.1`
- **FIX**: remove useless example file.
## 2022-05-02
### Changes
---
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
- [`wyatt_form_bloc` - `v0.0.2`](#wyatt_form_bloc---v002)
- [`wyatt_authentication_bloc` - `v0.2.0+1`](#wyatt_authentication_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.2.0+1`
---
#### `wyatt_form_bloc` - `v0.0.2`
- **FEAT**: add list option validator.
## 2022-04-20
### Changes
---
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
- [`wyatt_crud_bloc` - `v0.0.2`](#wyatt_crud_bloc---v002)
- [`wyatt_analysis` - `v2.0.1`](#wyatt_analysis---v201)
---
#### `wyatt_crud_bloc` - `v0.0.2`
- Migrate crud_package in monorepo
- **DOCS**: add example app.
#### `wyatt_analysis` - `v2.0.1`
- **DOCS**: Update readme with new version.
## 2022-04-20
### Changes
---
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
- [`wyatt_authentication_bloc` - `v0.2.0`](#wyatt_authentication_bloc---v020)
Packages graduated to a stable release (see pre-releases prior to the stable version for changelog entries):
- `wyatt_authentication_bloc` - `v0.2.0`
---
#### `wyatt_authentication_bloc` - `v0.2.0`
## 2022-04-20
### Changes
---
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
- [`wyatt_form_bloc` - `v0.0.1`](#wyatt_form_bloc---v001)
Packages graduated to a stable release (see pre-releases prior to the stable version for changelog entries):
- `wyatt_form_bloc` - `v0.0.1`
---
#### `wyatt_form_bloc` - `v0.0.1`
## 2022-04-20
### Changes
---
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
- [`wyatt_form_bloc` - `v0.0.1-dev.0`](#wyatt_form_bloc---v001-dev0)
---
#### `wyatt_form_bloc` - `v0.0.1-dev.0`
- **REFACTOR**: all package structure/documentation.
- **FEAT**: new utility package for forms and bloc.
- **DOCS**: add example app.
- **DOCS**: add few project files.
## 2022-04-19
### Changes
+74 -14
View File
@@ -28,8 +28,8 @@
</p>
<p align="center">
<a href="https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt_analysis">
<img src="https://img.shields.io/badge/Style-Wyatt%20Analysis-blue.svg?style=flat-square"" alt="Style: Wyatt Analysis" />
<a href="https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_analysis">
<img src="https://img.shields.io/badge/Style-Wyatt%20Analysis-blue.svg?style=flat-square" alt="Style: Wyatt Analysis" />
</a>
<a href="https://github.com/invertase/melos">
<img src="https://img.shields.io/badge/Maintained%20with-melos-f700ff.svg?style=flat-square" alt="Maintained with Melos" />
@@ -63,22 +63,65 @@ dart pub global activate melos
Then bootstrap with `melos bs`.
---
### Create a new package
## Usage
Create a new package in `packages/` folder.
You can add any package of the `packages/` sub directory in your project.
```yaml
dependencies:
wyatt_analysis:
git:
url: ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-packages.git
ref: wyatt_analysis-v2.0.0
path: packages/wyatt_analysis
```shell
dart create -t package-simple wyatt_<name>
```
Here you can change `package name` and `package version`.
Remove any `example/` subfolder. Then create a new sample project.
```shell
flutter create --platforms android --project-name <name>_example example
```
Then bootstrap project with `melos bs` command.
### Convention
#### Naming
In the previous instructions `<name>` variable is important.
It have to be clear and intelligible.
You **MUST** use underscores.
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
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
tl;dr : `type(scope): description`.
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.
- **fix** for a bug fix for the user, not a fix to a build script. Such commit will trigger a release bumping a PATCH version.
- **perf** for performance improvements. Such commit will trigger a release bumping a PATCH version.
- **docs** for changes to the documentation.
- **style** for formatting changes, missing semicolons, etc.
- **refactor** for refactoring production code, e.g. renaming a variable.
- **test** for adding missing tests, refactoring tests; no production code change.
- **build** for updating build configuration, development tools or other changes irrelevant to the user.
Some examples :
- `feat(auth): add AWS support.` = add a feature in authentication_bloc package.
- `docs: update readme.` = update **this** readme file.
- `fix(crud)!: fix bug in awesome() function.` = fix a bug, `!` is important and indicate `BREAKING CHANGES`.
Conventional commits are important for `melos version` command !
#### Badging
In the package `readme.md` file, please specify the supported SDK:
@@ -97,6 +140,23 @@ or
---
## Usage
You can add any package of the `packages/` sub directory in your project.
```yaml
dependencies:
wyatt_analysis:
git:
url: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages
ref: wyatt_analysis-v2.0.0
path: packages/wyatt_analysis
```
Here you can change `package name` and `package version`.
---
## Status
![Status: Experimental](https://img.shields.io/badge/Status-WIP-red?style=flat-square)
+24
View File
@@ -0,0 +1,24 @@
/*
* 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/>.
*/
{
"recommendations": [
"psioniq.psi-header",
"blaugold.melos-code"
]
}
+71
View File
@@ -0,0 +1,71 @@
{
"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/>."
],
}
],
"dart.runPubGetOnPubspecChanges": false,
}
+17
View File
@@ -1,3 +1,20 @@
## 2.2.1
- **FIX**: import right version.
## 2.2.0
- **FIX**: rename to follow melos versioning and remove redundant rule.
- **FEAT**: promote experimental, update analyzer rules and add some linter rules.
## 2.1.0
- **FEAT**: add experimental rules in appropriate file.
## 2.0.1
- **DOCS**: Update readme with new version.
## 2.0.0
> Note: This release has breaking changes.
@@ -0,0 +1,206 @@
# 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/>.
analyzer:
language:
strict-casts: true
strict-inference: true
strict-raw-types: true
errors:
todo: ignore
close_sinks: ignore
missing_required_param: error
missing_return: error
exclude:
- example/**
- lib/l10n/**
- lib/generated/**
- lib/generated_plugin_registrant.dart
- test/.test_coverage.dart
linter:
rules:
- always_declare_return_types
- always_require_non_null_named_parameters
- always_put_control_body_on_new_line
- always_put_required_named_parameters_first
- always_use_package_imports
- annotate_overrides
- avoid_bool_literals_in_conditional_expressions
- avoid_catching_errors
- avoid_double_and_int_checks
- avoid_dynamic_calls
- avoid_empty_else
- avoid_equals_and_hash_code_on_mutable_classes
- avoid_escaping_inner_quotes
- avoid_field_initializers_in_const_classes
- avoid_function_literals_in_foreach_calls
- avoid_init_to_null
- avoid_js_rounded_ints
- avoid_null_checks_in_equality_operators
- avoid_positional_boolean_parameters
- avoid_private_typedef_functions
- avoid_redundant_argument_values
- avoid_relative_lib_imports
- avoid_renaming_method_parameters
- avoid_return_types_on_setters
- avoid_returning_null
- avoid_returning_null_for_future
- avoid_returning_null_for_void
- avoid_returning_this
- avoid_setters_without_getters
- avoid_shadowing_type_parameters
- avoid_single_cascade_in_expression_statements
- avoid_slow_async_io
- avoid_type_to_string
- avoid_types_as_parameter_names
- avoid_types_on_closure_parameters
- avoid_unused_constructor_parameters
- avoid_void_async
- await_only_futures
- camel_case_extensions
- camel_case_types
- cancel_subscriptions
- cascade_invocations
- cast_nullable_to_non_nullable
- comment_references
- conditional_uri_does_not_exist
- constant_identifier_names
- control_flow_in_finally
- curly_braces_in_flow_control_structures
- depend_on_referenced_packages
- deprecated_consistency
- directives_ordering
- empty_catches
- empty_constructor_bodies
- empty_statements
- eol_at_end_of_file
- exhaustive_cases
- file_names
- flutter_style_todos
- hash_and_equals
- implementation_imports
- iterable_contains_unrelated_type
- join_return_with_assignment
- leading_newlines_in_multiline_strings
- library_names
- library_prefixes
- library_private_types_in_public_api
- lines_longer_than_80_chars
- list_remove_unrelated_type
- literal_only_boolean_expressions
- missing_whitespace_between_adjacent_strings
- no_adjacent_strings_in_list
- no_default_cases
- no_duplicate_case_values
- no_leading_underscores_for_local_identifiers
- no_runtimeType_toString
- non_constant_identifier_names
- noop_primitive_operations
- null_check_on_nullable_type_parameter
- null_closures
- one_member_abstracts
- only_throw_errors
- overridden_fields
- package_api_docs
- package_names
- package_prefixed_library_names
- parameter_assignments
- prefer_adjacent_string_concatenation
- prefer_asserts_in_initializer_lists
- prefer_asserts_with_message
- prefer_collection_literals
- prefer_conditional_assignment
- prefer_const_constructors
- prefer_const_constructors_in_immutables
- prefer_const_declarations
- prefer_const_literals_to_create_immutables
- prefer_constructors_over_static_methods
- prefer_contains
- prefer_equal_for_default_values
- prefer_expression_function_bodies
- prefer_final_fields
- prefer_final_in_for_each
- prefer_final_locals
- prefer_for_elements_to_map_fromIterable
- prefer_function_declarations_over_variables
- prefer_generic_function_type_aliases
- prefer_if_elements_to_conditional_expressions
- prefer_if_null_operators
- prefer_initializing_formals
- prefer_inlined_adds
- prefer_int_literals
- prefer_interpolation_to_compose_strings
- prefer_is_empty
- prefer_is_not_empty
- prefer_is_not_operator
- prefer_iterable_whereType
- prefer_mixin
- prefer_null_aware_operators
- prefer_null_aware_method_calls
- prefer_single_quotes
- prefer_spread_collections
- prefer_typing_uninitialized_variables
- prefer_void_to_null
- provide_deprecation_message
- recursive_getters
- require_trailing_commas
- slash_for_doc_comments
- sort_unnamed_constructors_first
- test_types_in_equals
- throw_in_finally
- tighten_type_of_initializing_formals
- type_annotate_public_apis
- type_init_formals
- unawaited_futures
- unnecessary_await_in_return
- unnecessary_brace_in_string_interps
- unnecessary_const
- unnecessary_constructor_name
- unnecessary_getters_setters
- unnecessary_lambdas
- unnecessary_late
- unnecessary_new
- unnecessary_null_aware_assignments
- unnecessary_null_checks
- unnecessary_null_in_if_null_operators
- unnecessary_nullable_for_final_variable_declarations
- unnecessary_overrides
- unnecessary_parenthesis
- unnecessary_raw_strings
- unnecessary_statements
- unnecessary_string_escapes
- unnecessary_string_interpolations
- unnecessary_this
- unrelated_type_equality_checks
- unsafe_html
- use_enums
- use_function_type_syntax_for_parameters
- use_if_null_to_convert_nulls_to_bools
- use_is_even_rather_than_modulo
- use_late_for_private_fields_and_variables
- use_named_constants
- use_raw_strings
- use_rethrow_when_possible
- use_setters_to_change_properties
- use_string_buffers
- use_super_parameters
- use_test_throws_matchers
- use_to_and_as_if_applicable
- valid_regexps
- void_checks
@@ -0,0 +1,206 @@
# 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/>.
analyzer:
language:
strict-casts: true
strict-inference: true
strict-raw-types: true
errors:
todo: ignore
close_sinks: ignore
missing_required_param: error
missing_return: error
exclude:
- example/**
- lib/l10n/**
- lib/generated/**
- lib/generated_plugin_registrant.dart
- test/.test_coverage.dart
linter:
rules:
- always_declare_return_types
- always_require_non_null_named_parameters
- always_put_control_body_on_new_line
- always_put_required_named_parameters_first
- always_use_package_imports
- annotate_overrides
- avoid_bool_literals_in_conditional_expressions
- avoid_catching_errors
- avoid_double_and_int_checks
- avoid_dynamic_calls
- avoid_empty_else
- avoid_equals_and_hash_code_on_mutable_classes
- avoid_escaping_inner_quotes
- avoid_field_initializers_in_const_classes
- avoid_function_literals_in_foreach_calls
- avoid_init_to_null
- avoid_js_rounded_ints
- avoid_null_checks_in_equality_operators
- avoid_positional_boolean_parameters
- avoid_private_typedef_functions
- avoid_redundant_argument_values
- avoid_relative_lib_imports
- avoid_renaming_method_parameters
- avoid_return_types_on_setters
- avoid_returning_null
- avoid_returning_null_for_future
- avoid_returning_null_for_void
- avoid_returning_this
- avoid_setters_without_getters
- avoid_shadowing_type_parameters
- avoid_single_cascade_in_expression_statements
- avoid_slow_async_io
- avoid_type_to_string
- avoid_types_as_parameter_names
- avoid_types_on_closure_parameters
- avoid_unused_constructor_parameters
- avoid_void_async
- await_only_futures
- camel_case_extensions
- camel_case_types
- cancel_subscriptions
- cascade_invocations
- cast_nullable_to_non_nullable
- comment_references
- conditional_uri_does_not_exist
- constant_identifier_names
- control_flow_in_finally
- curly_braces_in_flow_control_structures
- depend_on_referenced_packages
- deprecated_consistency
- directives_ordering
- empty_catches
- empty_constructor_bodies
- empty_statements
- eol_at_end_of_file
- exhaustive_cases
- file_names
- flutter_style_todos
- hash_and_equals
- implementation_imports
- iterable_contains_unrelated_type
- join_return_with_assignment
- leading_newlines_in_multiline_strings
- library_names
- library_prefixes
- library_private_types_in_public_api
- lines_longer_than_80_chars
- list_remove_unrelated_type
- literal_only_boolean_expressions
- missing_whitespace_between_adjacent_strings
- no_adjacent_strings_in_list
- no_default_cases
- no_duplicate_case_values
- no_leading_underscores_for_local_identifiers
- no_runtimeType_toString
- non_constant_identifier_names
- noop_primitive_operations
- null_check_on_nullable_type_parameter
- null_closures
- one_member_abstracts
- only_throw_errors
- overridden_fields
- package_api_docs
- package_names
- package_prefixed_library_names
- parameter_assignments
- prefer_adjacent_string_concatenation
- prefer_asserts_in_initializer_lists
- prefer_asserts_with_message
- prefer_collection_literals
- prefer_conditional_assignment
- prefer_const_constructors
- prefer_const_constructors_in_immutables
- prefer_const_declarations
- prefer_const_literals_to_create_immutables
- prefer_constructors_over_static_methods
- prefer_contains
- prefer_equal_for_default_values
- prefer_expression_function_bodies
- prefer_final_fields
- prefer_final_in_for_each
- prefer_final_locals
- prefer_for_elements_to_map_fromIterable
- prefer_function_declarations_over_variables
- prefer_generic_function_type_aliases
- prefer_if_elements_to_conditional_expressions
- prefer_if_null_operators
- prefer_initializing_formals
- prefer_inlined_adds
- prefer_int_literals
- prefer_interpolation_to_compose_strings
- prefer_is_empty
- prefer_is_not_empty
- prefer_is_not_operator
- prefer_iterable_whereType
- prefer_mixin
- prefer_null_aware_operators
- prefer_null_aware_method_calls
- prefer_single_quotes
- prefer_spread_collections
- prefer_typing_uninitialized_variables
- prefer_void_to_null
- provide_deprecation_message
- recursive_getters
- require_trailing_commas
- slash_for_doc_comments
- sort_unnamed_constructors_first
- test_types_in_equals
- throw_in_finally
- tighten_type_of_initializing_formals
- type_annotate_public_apis
- type_init_formals
- unawaited_futures
- unnecessary_await_in_return
- unnecessary_brace_in_string_interps
- unnecessary_const
- unnecessary_constructor_name
- unnecessary_getters_setters
- unnecessary_lambdas
- unnecessary_late
- unnecessary_new
- unnecessary_null_aware_assignments
- unnecessary_null_checks
- unnecessary_null_in_if_null_operators
- unnecessary_nullable_for_final_variable_declarations
- unnecessary_overrides
- unnecessary_parenthesis
- unnecessary_raw_strings
- unnecessary_statements
- unnecessary_string_escapes
- unnecessary_string_interpolations
- unnecessary_this
- unrelated_type_equality_checks
- unsafe_html
- use_enums
- use_function_type_syntax_for_parameters
- use_if_null_to_convert_nulls_to_bools
- use_is_even_rather_than_modulo
- use_late_for_private_fields_and_variables
- use_named_constants
- use_raw_strings
- use_rethrow_when_possible
- use_setters_to_change_properties
- use_string_buffers
- use_super_parameters
- use_test_throws_matchers
- use_to_and_as_if_applicable
- valid_regexps
- void_checks
@@ -0,0 +1,32 @@
# 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/>.
include: package:wyatt_analysis/analysis_options.2.1.1.yaml
linter:
rules:
- avoid_print
- avoid_unnecessary_containers
- avoid_web_libraries_in_flutter
- no_logic_in_create_state
- sized_box_for_whitespace
- sized_box_shrink_expand
- sort_child_properties_last
- use_build_context_synchronously
- use_colored_box
- use_decorated_box
- use_full_hex_values_for_flutter_colors
- use_key_in_widget_constructors
@@ -0,0 +1,32 @@
# 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/>.
include: package:wyatt_analysis/analysis_options.2.2.1.yaml
linter:
rules:
- avoid_print
- avoid_unnecessary_containers
- avoid_web_libraries_in_flutter
- no_logic_in_create_state
- sized_box_for_whitespace
- sized_box_shrink_expand
- sort_child_properties_last
- use_build_context_synchronously
- use_colored_box
- use_decorated_box
- use_full_hex_values_for_flutter_colors
- use_key_in_widget_constructors
@@ -14,4 +14,4 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
include: package:wyatt_analysis/analysis_options.flutter.2.0.0.yaml
include: package:wyatt_analysis/analysis_options.flutter.2.2.1.yaml
@@ -14,4 +14,4 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
include: package:wyatt_analysis/analysis_options.2.0.0.yaml
include: package:wyatt_analysis/analysis_options.2.2.1.yaml
@@ -19,4 +19,4 @@
/// and [Wyatt Studio](https://wyatt-studio.fr).
library wyatt_analysis;
const String wyattAnalysisVersion = '2.0.0';
const String wyattAnalysisVersion = '2.2.1';
+1 -1
View File
@@ -1,7 +1,7 @@
name: wyatt_analysis
description: Lint rules for Dart and Flutter used internally at Wyatt and Wyatt Studio.
repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_analysis
version: 2.0.0
version: 2.2.1
environment:
sdk: '>=2.12.0 <3.0.0'
@@ -0,0 +1,24 @@
/*
* 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/>.
*/
{
"recommendations": [
"psioniq.psi-header",
"blaugold.melos-code"
]
}
@@ -0,0 +1,71 @@
{
"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/>."
],
}
],
"dart.runPubGetOnPubspecChanges": false,
}
@@ -1,3 +1,31 @@
## 0.2.1+4
- Update a dependency to the latest release.
## 0.2.1+3
- Update a dependency to the latest release.
## 0.2.1+2
- Update a dependency to the latest release.
## 0.2.1+1
- Update a dependency to the latest release.
## 0.2.1
- **FEAT**: add google, facebook, apple, twitter login.
## 0.2.0+1
- Update a dependency to the latest release.
## 0.2.0
- Graduate package to a stable release. See pre-releases prior to this version for changelog entries.
## 0.2.0-dev.0
> Note: This release has breaking changes.
+7 -7
View File
@@ -18,7 +18,12 @@
# Flutter - Authentication BLoC
[![style: wyatt analysis](https://img.shields.io/badge/Style-Wyatt%20Analysis-blue)](https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt_analysis)
<p align="left">
<a href="https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_analysis">
<img src="https://img.shields.io/badge/Style-Wyatt%20Analysis-blue.svg?style=flat-square" alt="Style: Wyatt Analysis" />
</a>
<img src="https://img.shields.io/badge/SDK-Flutter-blue?style=flat-square" alt="SDK: Flutter" />
</p>
Authentication Bloc for Flutter.
@@ -40,15 +45,10 @@ Authentication Bloc for Flutter.
* Start/Stop listening on demand
- `start()` to listen to user changes
- `stop()` to cancel listener
- Form
* FormInput: validation of one input
* Form: validation of all form inputs
* FormEntry: contains data of one input
* FormData: contains all entries
- SignUpCubit
* Handles email/password validation and password confirmation
* Handles register with email/password
* Handles custom form fields
* Handles custom form fields thanks `wyatt_form_bloc`
- Use `entries` to pass a `FormData` object
- You can use several pre configured `FormInput` for validation
- You can use `updateFormData()` to change FormData and validators during runtime (intersection, union, difference or replace)
@@ -1,6 +1 @@
include: package:wyatt_analysis/analysis_options.flutter.1.1.1.yaml
linter:
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
include: package:wyatt_analysis/analysis_options.flutter.yaml
@@ -44,3 +44,5 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release
lib/firebase_options.dart
@@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited.
version:
revision: 77d935af4db863f6abd0b9c31c7e6df2a13de57b
revision: 5464c5bac742001448fe4fc0597be939379f88ea
channel: stable
project_type: app
@@ -0,0 +1,4 @@
## 1.0.1
- Update a dependency to the latest release.
@@ -1,4 +1,4 @@
# example
# authentication_bloc_example
A new Flutter project.
@@ -22,6 +22,9 @@ if (flutterVersionName == null) {
}
apply plugin: 'com.android.application'
// START: FlutterFire Configuration
apply plugin: 'com.google.gms.google-services'
// END: FlutterFire Configuration
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
@@ -43,7 +46,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.example"
applicationId "com.example.authentication_bloc_example"
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
@@ -0,0 +1,91 @@
{
"project_info": {
"project_number": "136771801992",
"firebase_url": "https://tchat-beta.firebaseio.com",
"project_id": "tchat-beta",
"storage_bucket": "tchat-beta.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:136771801992:android:4ff419f07afdad6097203d",
"android_client_info": {
"package_name": "com.example.authentication_bloc_example"
}
},
"oauth_client": [
{
"client_id": "136771801992-nps7ic22shstvgdv0c2ojvbkj3dkntum.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.example.authentication_bloc_example",
"certificate_hash": "5d8790309e13b68c35e5d4d8437c35c6d15e6131"
}
},
{
"client_id": "136771801992-ncuib3rbu7p4ro4eo5su4vaudn2u4qrv.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAYS14uXupkS158Q5QAFP1864UrUN_yDSk"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "136771801992-ncuib3rbu7p4ro4eo5su4vaudn2u4qrv.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "136771801992-e585bm1n9b3lv89t4phrl9u0glsg52ua.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.example.example"
}
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:136771801992:android:8482c9b90bc29de697203d",
"android_client_info": {
"package_name": "com.example.crud_bloc_example"
}
},
"oauth_client": [
{
"client_id": "136771801992-ncuib3rbu7p4ro4eo5su4vaudn2u4qrv.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAYS14uXupkS158Q5QAFP1864UrUN_yDSk"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "136771801992-ncuib3rbu7p4ro4eo5su4vaudn2u4qrv.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "136771801992-e585bm1n9b3lv89t4phrl9u0glsg52ua.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.example.example"
}
}
]
}
}
}
],
"configuration_version": "1"
}
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.example">
package="com.example.authentication_bloc_example">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
@@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.example">
package="com.example.authentication_bloc_example">
<application
android:label="example"
android:label="authentication_bloc_example"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
@@ -0,0 +1,6 @@
package com.example.authentication_bloc_example
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() {
}
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.example">
package="com.example.authentication_bloc_example">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
@@ -7,6 +7,9 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
// START: FlutterFire Configuration
classpath 'com.google.gms:google-services:4.3.10'
// END: FlutterFire Configuration
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
@@ -1,2 +0,0 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
@@ -1,2 +0,0 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
@@ -1,41 +0,0 @@
# Uncomment this line to define a global platform for your project
platform :ios, '10.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
@@ -1,97 +0,0 @@
PODS:
- Firebase/Auth (8.10.0):
- Firebase/CoreOnly
- FirebaseAuth (~> 8.10.0)
- Firebase/CoreOnly (8.10.0):
- FirebaseCore (= 8.10.0)
- firebase_auth (3.3.5):
- Firebase/Auth (= 8.10.0)
- firebase_core
- Flutter
- firebase_core (1.11.0):
- Firebase/CoreOnly (= 8.10.0)
- Flutter
- FirebaseAuth (8.10.0):
- FirebaseCore (~> 8.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.6)
- GoogleUtilities/Environment (~> 7.6)
- GTMSessionFetcher/Core (~> 1.5)
- FirebaseCore (8.10.0):
- FirebaseCoreDiagnostics (~> 8.0)
- GoogleUtilities/Environment (~> 7.6)
- GoogleUtilities/Logger (~> 7.6)
- FirebaseCoreDiagnostics (8.10.0):
- GoogleDataTransport (~> 9.1)
- GoogleUtilities/Environment (~> 7.6)
- GoogleUtilities/Logger (~> 7.6)
- nanopb (~> 2.30908.0)
- Flutter (1.0.0)
- GoogleDataTransport (9.1.2):
- GoogleUtilities/Environment (~> 7.2)
- nanopb (~> 2.30908.0)
- PromisesObjC (< 3.0, >= 1.2)
- GoogleUtilities/AppDelegateSwizzler (7.7.0):
- GoogleUtilities/Environment
- GoogleUtilities/Logger
- GoogleUtilities/Network
- GoogleUtilities/Environment (7.7.0):
- PromisesObjC (< 3.0, >= 1.2)
- GoogleUtilities/Logger (7.7.0):
- GoogleUtilities/Environment
- GoogleUtilities/Network (7.7.0):
- GoogleUtilities/Logger
- "GoogleUtilities/NSData+zlib"
- GoogleUtilities/Reachability
- "GoogleUtilities/NSData+zlib (7.7.0)"
- GoogleUtilities/Reachability (7.7.0):
- GoogleUtilities/Logger
- GTMSessionFetcher/Core (1.7.0)
- nanopb (2.30908.0):
- nanopb/decode (= 2.30908.0)
- nanopb/encode (= 2.30908.0)
- nanopb/decode (2.30908.0)
- nanopb/encode (2.30908.0)
- PromisesObjC (2.0.0)
DEPENDENCIES:
- firebase_auth (from `.symlinks/plugins/firebase_auth/ios`)
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
- Flutter (from `Flutter`)
SPEC REPOS:
trunk:
- Firebase
- FirebaseAuth
- FirebaseCore
- FirebaseCoreDiagnostics
- GoogleDataTransport
- GoogleUtilities
- GTMSessionFetcher
- nanopb
- PromisesObjC
EXTERNAL SOURCES:
firebase_auth:
:path: ".symlinks/plugins/firebase_auth/ios"
firebase_core:
:path: ".symlinks/plugins/firebase_core/ios"
Flutter:
:path: Flutter
SPEC CHECKSUMS:
Firebase: 44213362f1dcc52555b935dc925ed35ac55f1b20
firebase_auth: 9d959bddc3b255ddfb67cf630a5bbb6186964356
firebase_core: 2ca2d6cc8a11693e701b37126afae4800be5dbac
FirebaseAuth: 59a2d2b933b5b79e18fb1e6ad230c6abdaa73d26
FirebaseCore: 04186597c095da37d90ff9fd3e53bc61a1ff2440
FirebaseCoreDiagnostics: 56fb7216d87e0e6ec2feddefa9d8a392fe8b2c18
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
GoogleDataTransport: 629c20a4d363167143f30ea78320d5a7eb8bd940
GoogleUtilities: e0913149f6b0625b553d70dae12b49fc62914fd1
GTMSessionFetcher: 43748f93435c2aa068b1cbe39655aaf600652e91
nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96
PromisesObjC: 68159ce6952d93e17b2dfe273b8c40907db5ba58
PODFILE CHECKSUM: fe0e1ee7f3d1f7d00b11b474b62dd62134535aea
COCOAPODS: 1.11.2
@@ -14,35 +14,46 @@
// 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:developer';
import 'package:authentication_bloc_example/constants.dart';
import 'package:authentication_bloc_example/home/home_page.dart';
import 'package:authentication_bloc_example/login/login_page.dart';
import 'package:authentication_bloc_example/model.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:example/constants.dart';
import 'package:example/home/home_page.dart';
import 'package:example/login/login_page.dart';
import 'package:example/model.dart';
import 'package:flutter/material.dart';
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
class App extends StatelessWidget {
const App({Key? key}) : super(key: key);
static FormData getNormalFormData() {
return const FormData([
FormEntry(formFieldName, Name.pure()),
FormEntry(formFieldPhone, Phone.pure()),
FormEntry(formFieldPro, Boolean.pure()),
FormEntry(formFieldConfirmedPassword, ConfirmedPassword.pure(), export: false),
FormInput(formFieldName, Name.pure()),
FormInput(formFieldPhone, Phone.pure()),
FormInput(formFieldPro, Boolean.pure()),
FormInput(
formFieldConfirmedPassword,
ConfirmedPassword.pure(),
metadata: FormInputMetadata(export: false),
),
]);
}
static FormData getProFormData() {
return const FormData([
FormEntry(formFieldName, Name.pure()),
FormEntry(formFieldPhone, Phone.pure()),
FormEntry(formFieldPro, Boolean.pure()),
FormEntry(formFieldSiren, Siren.pure()),
FormEntry(formFieldIban, Iban.pure()),
FormEntry(formFieldConfirmedPassword, ConfirmedPassword.pure(), export: false),
FormInput(formFieldName, Name.pure()),
FormInput(formFieldPhone, Phone.pure()),
FormInput(formFieldPro, Boolean.pure()),
FormInput(formFieldSiren, Siren.pure()),
FormInput(formFieldIban, Iban.pure()),
FormInput(
formFieldConfirmedPassword,
ConfirmedPassword.pure(),
metadata: FormInputMetadata(export: false),
),
]);
}
@@ -52,14 +63,32 @@ class App extends StatelessWidget {
if (user.isNotEmpty && !user.isAnonymous) {
// Check if user is register in Firesore.
DocumentSnapshot firestoreUser = await FirebaseFirestore.instance
.collection('users')
.collection(firestoreCollectionUsers)
.doc(user.uid)
.get();
return {
'user':
UserFirestore.fromMap(firestoreUser.data() as Map<String, dynamic>),
...firestoreUser.data() as Map<String, dynamic>? ?? {}
};
if (!firestoreUser.exists) {
// Register user in Firestore when sign in with social account.
final uid = user.uid;
final u = {'uid': uid, 'email': user.email};
await FirebaseFirestore.instance
.collection(firestoreCollectionUsers)
.doc(uid)
.set(u);
return {
'user': UserFirestore(
uid: uid,
email: user.email ?? '',
name: user.displayName ?? '',
phone: user.phoneNumber ?? ''),
};
} else {
return {
'user': UserFirestore.fromMap(
firestoreUser.data() as Map<String, dynamic>),
...firestoreUser.data() as Map<String, dynamic>? ?? {}
};
}
} else {
return {};
}
@@ -70,48 +99,52 @@ class App extends StatelessWidget {
if (uid != null) {
final data = state.data.toMap();
final user = {'uid': uid, 'email': state.email.value, ...data};
await FirebaseFirestore.instance.collection('users').doc(uid).set(user);
log('onSignUpSuccess: $user');
await FirebaseFirestore.instance
.collection(firestoreCollectionUsers)
.doc(uid)
.set(user);
}
}
@override
Widget build(BuildContext context) {
AuthenticationRepositoryInterface _authenticationRepository =
AuthenticationRepositoryInterface authenticationRepository =
AuthenticationRepositoryFirebase();
AuthenticationCubit _authenticationCubit = AuthenticationCubit(
authenticationRepository: _authenticationRepository,
AuthenticationCubit authenticationCubit = AuthenticationCubit(
authenticationRepository: authenticationRepository,
onAuthSuccess: onAuthSuccess,
);
SignUpCubit _signUpCubit = SignUpCubit(
authenticationRepository: _authenticationRepository,
authenticationCubit: _authenticationCubit,
SignUpCubit signUpCubit = SignUpCubit(
authenticationRepository: authenticationRepository,
authenticationCubit: authenticationCubit,
entries: getNormalFormData(),
onSignUpSuccess: onSignUpSuccess,
);
SignInCubit _signInCubit = SignInCubit(
authenticationRepository: _authenticationRepository,
authenticationCubit: _authenticationCubit,
SignInCubit signInCubit = SignInCubit(
authenticationRepository: authenticationRepository,
authenticationCubit: authenticationCubit,
);
return MultiRepositoryProvider(
providers: [
RepositoryProvider<AuthenticationRepositoryInterface>(
create: (context) => _authenticationRepository,
create: (context) => authenticationRepository,
),
],
child: MultiBlocProvider(
providers: [
BlocProvider<AuthenticationCubit>(
create: (context) => _authenticationCubit..init(),
create: (context) => authenticationCubit..init(),
),
BlocProvider<SignUpCubit>(
create: (context) => _signUpCubit,
create: (context) => signUpCubit,
),
BlocProvider<SignInCubit>(
create: (context) => _signInCubit,
create: (context) => signInCubit,
),
],
child: const AppView(),
@@ -20,3 +20,5 @@ const String formFieldPro = 'isPro';
const String formFieldConfirmedPassword = 'confirmedPassword';
const String formFieldSiren = 'siren';
const String formFieldIban = 'iban';
const String firestoreCollectionUsers = 'authentication_bloc_users';
@@ -14,7 +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/>.
import 'package:example/forgot_password/widgets/forgot_password_form.dart';
import 'package:authentication_bloc_example/forgot_password/widgets/forgot_password_form.dart';
import 'package:flutter/material.dart';
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -15,8 +15,9 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:flutter/material.dart';
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
class _EmailInput extends StatelessWidget {
@override
@@ -14,12 +14,12 @@
// 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:example/home/widgets/infos.dart';
import 'package:authentication_bloc_example/home/widgets/infos.dart';
import 'package:flutter/material.dart';
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:example/home/widgets/email_verification.dart';
import 'package:authentication_bloc_example/home/widgets/email_verification.dart';
class HomePage extends StatelessWidget {
const HomePage({Key? key}) : super(key: key);
@@ -14,11 +14,11 @@
// 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:example/home/widgets/avatar.dart';
import 'package:authentication_bloc_example/home/widgets/avatar.dart';
import 'package:flutter/material.dart';
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:example/constants.dart';
import 'package:authentication_bloc_example/constants.dart';
class UserInfo extends StatelessWidget {
const UserInfo({Key? key}) : super(key: key);
@@ -14,7 +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/>.
import 'package:example/login/widgets/login_form.dart';
import 'package:authentication_bloc_example/login/widgets/login_form.dart';
import 'package:flutter/material.dart';
class LoginPage extends StatelessWidget {
@@ -14,13 +14,14 @@
// 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:example/app/app.dart';
import 'package:example/constants.dart';
import 'package:example/forgot_password/forgot_password_page.dart';
import 'package:example/sign_up/sign_up_page.dart';
import 'package:authentication_bloc_example/app/app.dart';
import 'package:authentication_bloc_example/constants.dart';
import 'package:authentication_bloc_example/forgot_password/forgot_password_page.dart';
import 'package:authentication_bloc_example/sign_up/sign_up_page.dart';
import 'package:flutter/material.dart';
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
class _EmailInput extends StatelessWidget {
@override
@@ -101,6 +102,24 @@ class _LoginWithPasswordButton extends StatelessWidget {
}
}
class _LoginWithGoogleButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocBuilder<SignInCubit, SignInState>(
buildWhen: (previous, current) => previous.status != current.status,
builder: (context, state) {
return state.status.isSubmissionInProgress
? const CircularProgressIndicator()
: ElevatedButton(
onPressed: () =>
context.read<SignInCubit>().signInWithGoogle(),
child: const Text('LOGIN GOOGLE'),
);
},
);
}
}
class _SignUpButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
@@ -181,6 +200,8 @@ class LoginForm extends StatelessWidget {
const SizedBox(height: 8),
_LoginAnonButton(),
const SizedBox(height: 8),
_LoginWithGoogleButton(),
const SizedBox(height: 8),
_SignUpButton(),
const SizedBox(height: 8),
_SignUpAsProButton(),
@@ -14,9 +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 'package:example/app/app.dart';
import 'package:example/app/bloc_observer.dart';
import 'package:example/firebase_options.dart';
import 'package:authentication_bloc_example/app/app.dart';
import 'package:authentication_bloc_example/app/bloc_observer.dart';
import 'package:authentication_bloc_example/firebase_options.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -14,7 +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/>.
import 'package:example/sign_up/widgets/sign_up_form.dart';
import 'package:authentication_bloc_example/sign_up/widgets/sign_up_form.dart';
import 'package:flutter/material.dart';
class SignUpPage extends StatelessWidget {
@@ -16,11 +16,12 @@
import 'dart:developer';
import 'package:example/app/app.dart';
import 'package:example/constants.dart';
import 'package:authentication_bloc_example/app/app.dart';
import 'package:authentication_bloc_example/constants.dart';
import 'package:flutter/material.dart';
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
class _NameInput extends StatelessWidget {
@override
@@ -36,7 +37,7 @@ class _NameInput extends StatelessWidget {
labelText: 'name',
helperText: '',
errorText:
state.data.input(formFieldName).invalid ? 'invalid name' : null,
state.data.isNotValid(formFieldName) ? 'invalid name' : null,
),
);
},
@@ -57,7 +58,7 @@ class _PhoneInput extends StatelessWidget {
decoration: InputDecoration(
labelText: 'phone',
helperText: '',
errorText: state.data.input(formFieldPhone).invalid
errorText: state.data.isNotValid(formFieldPhone)
? 'invalid phone'
: null,
),
@@ -80,7 +81,7 @@ class _SirenInput extends StatelessWidget {
decoration: InputDecoration(
labelText: 'siren',
helperText: '',
errorText: state.data.input(formFieldSiren).invalid
errorText: state.data.isNotValid(formFieldSiren)
? 'invalid SIREN'
: null,
),
@@ -104,7 +105,7 @@ class _IbanInput extends StatelessWidget {
labelText: 'iban',
helperText: '',
errorText:
state.data.input(formFieldIban).invalid ? 'invalid IBAN' : null,
state.data.isNotValid(formFieldIban) ? 'invalid IBAN' : null,
),
);
},
@@ -148,8 +149,7 @@ class _PasswordInput extends StatelessWidget {
.read<SignUpCubit>()
.state
.data
.input(formFieldConfirmedPassword)
.value,
.valueOf<String>(formFieldConfirmedPassword),
),
);
},
@@ -184,7 +184,7 @@ class _ConfirmPasswordInput extends StatelessWidget {
decoration: InputDecoration(
labelText: 'confirm password',
helperText: '',
errorText: state.data.input(formFieldConfirmedPassword).invalid
errorText: state.data.isNotValid(formFieldConfirmedPassword)
? 'passwords do not match'
: null,
),
@@ -202,7 +202,7 @@ class _CheckIsProInput extends StatelessWidget {
trailing: BlocBuilder<SignUpCubit, SignUpState>(
builder: (context, state) {
return Checkbox(
value: state.data.input<bool>(formFieldPro).value,
value: state.data.valueOf<bool>(formFieldPro),
onChanged: (isPro) {
final value =
isPro!; // tristate is false, so value can't be null
@@ -253,11 +253,12 @@ class _DebugButton extends StatelessWidget {
return BlocBuilder<SignUpCubit, SignUpState>(
builder: (context, state) {
return ElevatedButton(
onPressed: () {
log(state.toString());
} ,
child: const Text('DEBUG'),
);
onPressed: () {
// log(state.toString());
log(state.data.toMap().toString());
},
child: const Text('DEBUG'),
);
},
);
}
@@ -295,7 +296,7 @@ class SignUpForm extends StatelessWidget {
const SizedBox(height: 8),
BlocBuilder<SignUpCubit, SignUpState>(
builder: (context, state) {
if (state.data.input<bool>(formFieldPro).value) {
if (state.data.valueOf<bool>(formFieldPro)) {
return Column(children: [
_SirenInput(),
const SizedBox(height: 8),
@@ -1,4 +1,4 @@
name: example
name: authentication_bloc_example
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
@@ -15,10 +15,10 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
version: 1.0.1
environment:
sdk: ">=2.15.1 <3.0.0"
sdk: ">=2.16.2 <3.0.0"
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
@@ -30,15 +30,21 @@ dependencies:
flutter:
sdk: flutter
firebase_core: ^1.13.1
firebase_core: ^1.14.1
flutter_bloc: ^8.0.1
wyatt_authentication_bloc:
path: "../"
wyatt_form_bloc:
git:
url: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages
ref: wyatt_form_bloc-v0.0.6
path: packages/wyatt_form_bloc
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.4
cloud_firestore: ^3.1.10
cloud_firestore: ^3.1.12
dev_dependencies:
flutter_test:
@@ -49,7 +55,7 @@ dev_dependencies:
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^1.0.4
flutter_lints: ^2.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
@@ -0,0 +1,47 @@
# 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/
# Web related
lib/generated_plugin_registrant.dart
# 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,30 @@
# 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: f1875d570e39de09040c8f79aa13cc56baab8db1
channel: stable
project_type: app
# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
- platform: android
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
# 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,25 @@
/*
* Author: Hugo Pointcheval
* Email: git@pcl.ovh
* -----
* File: launch.json
* Created Date: 19/08/2022 15:12:25
* Last Modified: 19/08/2022 15:22:02
* -----
* Copyright (c) 2022
*/
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "example_router",
"request": "launch",
"type": "dart",
"program": "lib/main.dart",
"flutterMode": "debug"
}
]
}
@@ -0,0 +1,16 @@
# example_router
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,74 @@
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'
// START: FlutterFire Configuration
apply plugin: 'com.google.gms.google-services'
// END: FlutterFire Configuration
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.example_router"
// 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 21
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.example_router">
<!-- 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.example_router">
<application
android:label="example_router"
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>
@@ -1,4 +1,4 @@
package com.example.example
package com.example.example_router
import io.flutter.embedding.android.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>
Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 721 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

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.example_router">
<!-- 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 @@
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
// START: FlutterFire Configuration
classpath 'com.google.gms:google-services:4.3.10'
// END: FlutterFire Configuration
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,6 @@
#Fri Jun 23 08:50:38 CEST 2017
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,40 @@
// Author: Hugo Pointcheval
// Email: git@pcl.ovh
// -----
// File: bootstrap.dart
// Created Date: 19/08/2022 15:05:17
// Last Modified: 19/08/2022 15:21:47
// -----
// Copyright (c) 2022
import 'dart:async';
import 'package:example_router/core/utils/app_bloc_observer.dart';
import 'package:example_router/firebase_options.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
Future<void> bootstrap(FutureOr<Widget> Function() builder) async {
await runZonedGuarded(
() async {
WidgetsFlutterBinding.ensureInitialized();
FlutterError.onError = (details) {
debugPrint(details.toString());
};
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
GoRouter.setUrlPathStrategy(UrlPathStrategy.path);
Bloc.observer = AppBlocObserver();
runApp(await builder());
},
(error, stackTrace) => debugPrint(error.toString()),
);
}
@@ -0,0 +1,12 @@
// Author: Hugo Pointcheval
// Email: git@pcl.ovh
// -----
// File: form_field.dart
// Created Date: 19/08/2022 11:52:33
// Last Modified: 19/08/2022 16:35:39
// -----
// Copyright (c) 2022
abstract class AppFormField {
static const confirmedPassword = 'confirmedPassword';
}
@@ -0,0 +1,79 @@
// Author: Hugo Pointcheval
// Email: git@pcl.ovh
// -----
// File: router.dart
// Created Date: 19/08/2022 11:52:22
// Last Modified: 19/08/2022 16:39:07
// -----
// Copyright (c) 2022
import 'package:example_router/presentation/features/home/home_page.dart';
import 'package:example_router/presentation/features/sign_in/sign_in_page.dart';
import 'package:example_router/presentation/features/sign_up/sign_up_page.dart';
import 'package:example_router/presentation/features/sub/sub_page.dart';
import 'package:example_router/presentation/features/welcome/welcome_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:go_router/go_router.dart';
class AppRouter {
/// Default transition for all pages
static Page<void> defaultTransition(
BuildContext context,
GoRouterState state,
Widget child,
) =>
CupertinoPage<void>(
key: state.pageKey,
child: child,
);
static final publicRoutes = ['/', '/sign_in', '/sign_up'];
static final List<GoRoute> routes = [
GoRoute(
path: '/',
name: WelcomePage.pageName,
pageBuilder: (context, state) => defaultTransition(
context,
state,
const WelcomePage(),
),
),
GoRoute(
path: '/sign_in',
name: SignInPage.pageName,
pageBuilder: (context, state) => defaultTransition(
context,
state,
const SignInPage(),
),
),
GoRoute(
path: '/sign_up',
name: SignUpPage.pageName,
pageBuilder: (context, state) => defaultTransition(
context,
state,
const SignUpPage(),
),
),
GoRoute(
path: '/home',
name: HomePage.pageName,
pageBuilder: (context, state) => defaultTransition(
context,
state,
const HomePage(),
),
),
GoRoute(
path: '/home/sub',
name: SubPage.pageName,
pageBuilder: (context, state) => defaultTransition(
context,
state,
const SubPage(),
),
),
];
}
@@ -0,0 +1,37 @@
// Author: Hugo Pointcheval
// Email: git@pcl.ovh
// -----
// File: app_bloc_observer.dart
// Created Date: 19/08/2022 12:02:23
// Last Modified: 19/08/2022 12:02:45
// -----
// Copyright (c) 2022
import 'package:flutter/foundation.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class AppBlocObserver extends BlocObserver {
@override
void onEvent(Bloc bloc, Object? event) {
super.onEvent(bloc, event);
debugPrint(event.toString());
}
@override
void onError(BlocBase bloc, Object error, StackTrace stackTrace) {
debugPrint(error.toString());
super.onError(bloc, error, stackTrace);
}
@override
void onChange(BlocBase bloc, Change change) {
super.onChange(bloc, change);
debugPrint('curr:\t${change.currentState}\nnext:\t${change.nextState}');
}
@override
void onTransition(Bloc bloc, Transition transition) {
super.onTransition(bloc, transition);
debugPrint(transition.toString());
}
}
@@ -0,0 +1,21 @@
// Author: Hugo Pointcheval
// Email: git@pcl.ovh
// -----
// File: forms.dart
// Created Date: 19/08/2022 12:00:31
// Last Modified: 19/08/2022 16:35:52
// -----
// Copyright (c) 2022
import 'package:example_router/core/constants/form_field.dart';
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
class Forms {
static FormData getNormalData() => const FormData([
FormInput(
AppFormField.confirmedPassword,
ConfirmedPassword.pure(),
metadata: FormInputMetadata<void>(export: false),
),
]);
}
@@ -1,5 +1,5 @@
// File generated by FlutterFire CLI.
// ignore_for_file: lines_longer_than_80_chars
// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
import 'package:flutter/foundation.dart'
show defaultTargetPlatform, kIsWeb, TargetPlatform;
@@ -17,54 +17,47 @@ import 'package:flutter/foundation.dart'
class DefaultFirebaseOptions {
static FirebaseOptions get currentPlatform {
if (kIsWeb) {
return web;
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for web - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
}
// ignore: missing_enum_constant_in_switch
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return android;
case TargetPlatform.iOS:
return ios;
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for ios - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.macOS:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for macos - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.windows:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for windows - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.linux:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for linux - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
default:
throw UnsupportedError(
'DefaultFirebaseOptions are not supported for this platform.',
);
}
throw UnsupportedError(
'DefaultFirebaseOptions are not supported for this platform.',
);
}
static const FirebaseOptions web = FirebaseOptions(
apiKey: 'AIzaSyCxdDUpkpW7onOicIcIDcIVvPC8ll1twCQ',
appId: '1:136771801992:web:e757595ae62e646297203d',
messagingSenderId: '136771801992',
projectId: 'tchat-beta',
authDomain: 'tchat-beta.firebaseapp.com',
databaseURL: 'https://tchat-beta.firebaseio.com',
storageBucket: 'tchat-beta.appspot.com',
);
static const FirebaseOptions android = FirebaseOptions(
apiKey: 'AIzaSyAYS14uXupkS158Q5QAFP1864UrUN_yDSk',
appId: '1:136771801992:android:d20e0361057e815197203d',
appId: '1:136771801992:android:ac3cfeb99fb0763e97203d',
messagingSenderId: '136771801992',
projectId: 'tchat-beta',
databaseURL: 'https://tchat-beta.firebaseio.com',
storageBucket: 'tchat-beta.appspot.com',
);
static const FirebaseOptions ios = FirebaseOptions(
apiKey: 'AIzaSyCDbbhjbFrQwLXuIANdJzjkDk8uOETnn7w',
appId: '1:136771801992:ios:6fe69c0bea08b7b397203d',
messagingSenderId: '136771801992',
projectId: 'tchat-beta',
databaseURL: 'https://tchat-beta.firebaseio.com',
storageBucket: 'tchat-beta.appspot.com',
iosClientId:
'136771801992-e585bm1n9b3lv89t4phrl9u0glsg52ua.apps.googleusercontent.com',
iosBundleId: 'com.example.example',
);
}
@@ -0,0 +1,6 @@
import 'package:example_router/bootstrap.dart';
import 'package:example_router/presentation/features/app/app.dart';
void main() {
bootstrap(App.new);
}
@@ -0,0 +1,115 @@
// Author: Hugo Pointcheval
// Email: git@pcl.ovh
// -----
// File: app.dart
// Created Date: 19/08/2022 12:05:38
// Last Modified: Fri Aug 26 2022
// -----
// Copyright (c) 2022
import 'package:example_router/core/routes/router.dart';
import 'package:example_router/core/utils/forms.dart';
import 'package:example_router/presentation/features/home/home_page.dart';
import 'package:example_router/presentation/features/welcome/welcome_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
class App extends StatelessWidget {
final AuthenticationRepository authenticationRepository =
AuthenticationRepositoryFirebase();
App({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
AuthenticationState? previous;
final AuthenticationCubit authenticationCubit = AuthenticationCubit(
authenticationRepository: authenticationRepository,
onAuthSuccess: (user) async {
debugPrint(user.toString());
return {};
},
);
final GoRouter router = GoRouter(
initialLocation: '/',
routes: AppRouter.routes,
debugLogDiagnostics: true,
errorBuilder: (_, __) => const ColoredBox(
color: Colors.red,
),
refreshListenable: GoRouterRefreshStream(authenticationCubit.stream),
redirect: (state) {
final authState = authenticationCubit.state;
if (authState != previous) {
previous = authState;
// Check if current user is logged in
final loggedIn =
authState.status == AuthenticationStatus.authenticated;
// Checking if current path is onboarding or not
final isOnboarding = AppRouter.publicRoutes.contains(state.subloc);
if (!loggedIn) {
debugPrint('Not logged');
if (isOnboarding) {
return null;
} else {
return state.namedLocation(WelcomePage.pageName);
}
} else {
final email = authState.user?.email;
debugPrint('Logged as: $email');
if (isOnboarding) {
return state.namedLocation(HomePage.pageName);
} else {
return null;
}
}
}
return null;
},
);
return MultiRepositoryProvider(
providers: [
RepositoryProvider<AuthenticationRepository>.value(
value: authenticationRepository,
),
],
child: MultiBlocProvider(
providers: [
BlocProvider<AuthenticationCubit>.value(
value: authenticationCubit..init(),
),
BlocProvider<SignUpCubit>(
create: (_) => SignUpCubit(
authenticationRepository: authenticationRepository,
formData: Forms.getNormalData(),
onSignUpSuccess: (state, uid) async {
debugPrint(state.toString());
debugPrint(uid);
},
),
),
BlocProvider<SignInCubit>(
create: (_) => SignInCubit(
authenticationRepository: authenticationRepository,
),
),
],
child: MaterialApp.router(
title: 'Demo Authentication',
debugShowCheckedModeBanner: false,
routerDelegate: router.routerDelegate,
routeInformationParser: router.routeInformationParser,
routeInformationProvider: router.routeInformationProvider,
),
),
);
}
}
@@ -0,0 +1,55 @@
// Author: Hugo Pointcheval
// Email: git@pcl.ovh
// -----
// File: home_page.dart
// Created Date: 19/08/2022 14:38:24
// Last Modified: 19/08/2022 16:12:22
// -----
// Copyright (c) 2022
import 'package:example_router/presentation/features/sub/sub_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
class HomePage extends StatelessWidget {
const HomePage({Key? key}) : super(key: key);
static String pageName = 'Home';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Home'),
actions: [
IconButton(
onPressed: () => context.read<AuthenticationCubit>().logOut(),
icon: const Icon(Icons.logout_rounded))
],
),
body: Padding(
padding: const EdgeInsets.all(8),
child: SingleChildScrollView(
child: Column(
children: [
BlocBuilder<AuthenticationCubit, AuthenticationState>(
builder: (context, state) {
final email = state.user?.email;
return Text('Logged as $email');
},
),
const SizedBox(
height: 8,
),
ElevatedButton(
onPressed: () => context.pushNamed(SubPage.pageName),
child: const Text('Go to sub page')),
],
),
),
),
);
}
}
@@ -0,0 +1,30 @@
// Author: Hugo Pointcheval
// Email: git@pcl.ovh
// -----
// File: sign_in_page.dart
// Created Date: 19/08/2022 12:41:42
// Last Modified: 19/08/2022 15:26:36
// -----
// Copyright (c) 2022
import 'package:example_router/presentation/features/sign_in/widgets/sign_in_form.dart';
import 'package:flutter/material.dart';
class SignInPage extends StatelessWidget {
const SignInPage({Key? key}) : super(key: key);
static String pageName = 'SignIn';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Sign In')),
body: const Padding(
padding: EdgeInsets.all(8),
child: SingleChildScrollView(
child: SignInForm(),
),
),
);
}
}
@@ -0,0 +1,105 @@
// Author: Hugo Pointcheval
// Email: git@pcl.ovh
// -----
// File: sign_in_form.dart
// Created Date: 19/08/2022 15:24:37
// Last Modified: 19/08/2022 16:35:01
// -----
// Copyright (c) 2022
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
class _EmailInput extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocBuilder<SignInCubit, SignInState>(
buildWhen: (previous, current) => previous.email != current.email,
builder: (context, state) {
return TextField(
onChanged: (email) => context.read<SignInCubit>().emailChanged(email),
keyboardType: TextInputType.emailAddress,
decoration: InputDecoration(
labelText: 'Email',
helperText: '',
errorText: state.email.invalid ? 'Invalid email' : null,
),
);
},
);
}
}
class _PasswordInput extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocBuilder<SignInCubit, SignInState>(
buildWhen: (previous, current) => previous.password != current.password,
builder: (context, state) {
return TextField(
onChanged: (password) {
context.read<SignInCubit>().passwordChanged(password);
},
obscureText: true,
decoration: InputDecoration(
labelText: 'Password',
helperText: '',
errorText: state.password.invalid ? 'Invalid password' : null,
),
);
},
);
}
}
class _SignInButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocBuilder<SignInCubit, SignInState>(
builder: (context, state) {
return state.status.isSubmissionInProgress
? const CircularProgressIndicator()
: ElevatedButton(
onPressed: state.status.isValidated
? () =>
context.read<SignInCubit>().signInWithEmailAndPassword()
: null,
child: const Text('Sign in'),
);
},
);
}
}
class SignInForm extends StatelessWidget {
const SignInForm({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return BlocListener<SignInCubit, SignInState>(
listener: (context, state) {
if (state.status.isSubmissionSuccess) {
Navigator.of(context).pop();
} else if (state.status.isSubmissionFailure) {
ScaffoldMessenger.of(context)
..hideCurrentSnackBar()
..showSnackBar(
SnackBar(content: Text(state.errorMessage ?? 'Sign In Failure')),
);
}
},
child: SingleChildScrollView(
child: Column(
children: [
_EmailInput(),
const SizedBox(height: 8),
_PasswordInput(),
const SizedBox(height: 16),
_SignInButton(),
],
),
),
);
}
}
@@ -0,0 +1,30 @@
// Author: Hugo Pointcheval
// Email: git@pcl.ovh
// -----
// File: sign_up_page.dart
// Created Date: 19/08/2022 12:41:27
// Last Modified: 19/08/2022 14:58:51
// -----
// Copyright (c) 2022
import 'package:example_router/presentation/features/sign_up/widgets/sign_up_form.dart';
import 'package:flutter/material.dart';
class SignUpPage extends StatelessWidget {
const SignUpPage({Key? key}) : super(key: key);
static String pageName = 'SignUp';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Sign Up')),
body: const Padding(
padding: EdgeInsets.all(8),
child: SingleChildScrollView(
child: SignUpForm(),
),
),
);
}
}
@@ -0,0 +1,149 @@
// Author: Hugo Pointcheval
// Email: git@pcl.ovh
// -----
// File: sign_up_form.dart
// Created Date: 19/08/2022 14:41:08
// Last Modified: Fri Aug 26 2022
// -----
// Copyright (c) 2022
import 'package:example_router/core/constants/form_field.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
class _EmailInput extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocBuilder<SignUpCubit, SignUpState>(
buildWhen: (previous, current) => previous.email != current.email,
builder: (context, state) {
return TextField(
onChanged: (email) => context.read<SignUpCubit>().emailChanged(email),
keyboardType: TextInputType.emailAddress,
decoration: InputDecoration(
labelText: 'Email',
helperText: '',
errorText: state.email.invalid ? 'Invalid email' : null,
),
);
},
);
}
}
class _PasswordInput extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocBuilder<SignUpCubit, SignUpState>(
buildWhen: (previous, current) => previous.password != current.password,
builder: (context, state) {
return TextField(
onChanged: (password) {
context.read<SignUpCubit>().passwordChanged(password);
context.read<SignUpCubit>().dataChanged(
AppFormField.confirmedPassword,
ConfirmedPassword.dirty(
password: password,
value: context
.read<SignUpCubit>()
.state
.data
.valueOf<String>(
AppFormField.confirmedPassword),
),
);
},
obscureText: true,
decoration: InputDecoration(
labelText: 'Password',
helperText: '',
errorText: state.password.invalid ? 'Invalid password' : null,
),
);
},
);
}
}
class _ConfirmPasswordInput extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocBuilder<SignUpCubit, SignUpState>(
builder: (context, state) {
return TextField(
onChanged: (confirmPassword) => context
.read<SignUpCubit>()
.dataChanged(
AppFormField.confirmedPassword,
ConfirmedPassword.dirty(
password: context.read<SignUpCubit>().state.password.value,
value: confirmPassword,
),
),
obscureText: true,
decoration: InputDecoration(
labelText: 'Confirm password',
helperText: '',
errorText: state.data.isNotValid(AppFormField.confirmedPassword)
? 'Passwords do not match'
: null,
),
);
},
);
}
}
class _SignUpButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocBuilder<SignUpCubit, SignUpState>(
builder: (context, state) {
return state.status.isSubmissionInProgress
? const CircularProgressIndicator()
: ElevatedButton(
onPressed: state.status.isValidated
? () => context.read<SignUpCubit>().signUpFormSubmitted()
: null,
child: const Text('Sign up'),
);
},
);
}
}
class SignUpForm extends StatelessWidget {
const SignUpForm({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return BlocListener<SignUpCubit, SignUpState>(
listener: (context, state) {
if (state.status.isSubmissionSuccess) {
Navigator.of(context).pop();
} else if (state.status.isSubmissionFailure) {
ScaffoldMessenger.of(context)
..hideCurrentSnackBar()
..showSnackBar(
SnackBar(content: Text(state.errorMessage ?? 'Sign Up Failure')),
);
}
},
child: SingleChildScrollView(
child: Column(
children: [
_EmailInput(),
const SizedBox(height: 8),
_PasswordInput(),
const SizedBox(height: 8),
_ConfirmPasswordInput(),
const SizedBox(height: 16),
_SignUpButton(),
],
),
),
);
}
}
@@ -0,0 +1,38 @@
// Author: Hugo Pointcheval
// Email: git@pcl.ovh
// -----
// File: sub_page.dart
// Created Date: 19/08/2022 16:10:05
// Last Modified: 19/08/2022 16:10:44
// -----
// Copyright (c) 2022
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
class SubPage extends StatelessWidget {
const SubPage({Key? key}) : super(key: key);
static String pageName = 'Sub';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Sub'),
actions: [
IconButton(
onPressed: () => context.read<AuthenticationCubit>().logOut(),
icon: const Icon(Icons.logout_rounded))
],
),
body: const Padding(
padding: EdgeInsets.all(8),
child: SingleChildScrollView(
child: Text('Another page'),
),
),
);
}
}
@@ -0,0 +1,53 @@
// Author: Hugo Pointcheval
// Email: git@pcl.ovh
// -----
// File: welcome_page.dart
// Created Date: 19/08/2022 12:33:21
// Last Modified: 19/08/2022 15:56:05
// -----
// Copyright (c) 2022
import 'package:example_router/presentation/features/sign_in/sign_in_page.dart';
import 'package:example_router/presentation/features/sign_up/sign_up_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
class WelcomePage extends StatelessWidget {
const WelcomePage({Key? key}) : super(key: key);
static String pageName = 'Welcome';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Welcome'),
actions: [
IconButton(
onPressed: () => context.read<AuthenticationCubit>().changeStatus(
context.read<AuthenticationCubit>().state.user!),
icon: const Icon(Icons.refresh_rounded))
],
),
body: SingleChildScrollView(
child: Column(
children: [
ElevatedButton(
onPressed: () => context.pushNamed(SignUpPage.pageName),
child: const Text('Sign Up')),
ElevatedButton(
onPressed: () => context.pushNamed(SignInPage.pageName),
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all<Color>(Colors.white),
foregroundColor:
MaterialStateProperty.all<Color>(Colors.blue)),
child: const Text('Sign In'))
],
),
),
);
}
}
@@ -0,0 +1,100 @@
name: example_router
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=2.17.6 <3.0.0"
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
flutter:
sdk: flutter
go_router: ^4.2.8
firebase_core: ^1.21.0
flutter_bloc: ^8.1.1
wyatt_authentication_bloc:
path: "../"
wyatt_form_bloc:
git:
url: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages
ref: wyatt_form_bloc-v0.0.6
path: packages/wyatt_form_bloc
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
dev_dependencies:
flutter_test:
sdk: flutter
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^2.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter packages.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
@@ -1,76 +0,0 @@
// 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:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:wyatt_authentication_bloc/src/models/user/user_interface.dart';
import 'package:wyatt_authentication_bloc/src/repositories/authentication_repository_interface.dart';
part 'authentication_state.dart';
class AuthenticationCubit extends Cubit<AuthenticationState> {
final AuthenticationRepositoryInterface _authenticationRepository;
StreamSubscription<UserInterface>? _userSubscription;
final Future<Map<String, dynamic>> Function(UserInterface user)?
_onAuthSuccess;
AuthenticationCubit({
required AuthenticationRepositoryInterface authenticationRepository,
Future<Map<String, dynamic>> Function(UserInterface user)? onAuthSuccess,
}) : _authenticationRepository = authenticationRepository,
_onAuthSuccess = onAuthSuccess,
super(const AuthenticationState.unknown());
Future<void> init() async {
final _firstUser = await _authenticationRepository.user.first;
start();
return changeStatus(_firstUser);
}
bool start() {
_userSubscription = _authenticationRepository.user.listen(changeStatus);
return true;
}
bool stop() {
_userSubscription?.cancel();
return true;
}
Future<void> changeStatus(UserInterface user) async {
if (user.isNotEmpty) {
final Map<String, dynamic>? userData = await _onAuthSuccess?.call(user);
emit(AuthenticationState.authenticated(user, userData));
} else {
stop();
emit(const AuthenticationState.unauthenticated());
}
}
void logOut() {
unawaited(_authenticationRepository.signOut());
}
@override
Future<void> close() {
_userSubscription?.cancel();
return super.close();
}
}
@@ -14,5 +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/>.
export 'user_firebase.dart';
export 'user_interface.dart';
enum AuthCubitStatus {
started,
stoped,
}
@@ -29,11 +29,10 @@ abstract class AuthenticationFailureInterface implements Exception {
abstract class ApplyActionCodeFailureInterface
extends AuthenticationFailureInterface {
/// {@macro apply_action_code_failure}
ApplyActionCodeFailureInterface(String code, String message)
: super(code, message);
ApplyActionCodeFailureInterface(super.code, super.message);
/// {@macro apply_action_code_failure}
ApplyActionCodeFailureInterface.fromCode(String code) : super.fromCode(code);
ApplyActionCodeFailureInterface.fromCode(super.code) : super.fromCode();
}
/// {@template sign_up_with_email_and_password_failure}
@@ -42,12 +41,11 @@ abstract class ApplyActionCodeFailureInterface
abstract class SignUpWithEmailAndPasswordFailureInterface
extends AuthenticationFailureInterface {
/// {@macro sign_up_with_email_and_password_failure}
SignUpWithEmailAndPasswordFailureInterface(String code, String message)
: super(code, message);
SignUpWithEmailAndPasswordFailureInterface(super.code, super.message);
/// {@macro sign_up_with_email_and_password_failure}
SignUpWithEmailAndPasswordFailureInterface.fromCode(String code)
: super.fromCode(code);
SignUpWithEmailAndPasswordFailureInterface.fromCode(super.code)
: super.fromCode();
}
/// {@template fetch_sign_in_methods_failure}
@@ -56,12 +54,23 @@ abstract class SignUpWithEmailAndPasswordFailureInterface
abstract class FetchSignInMethodsForEmailFailureInterface
extends AuthenticationFailureInterface {
/// {@macro fetch_sign_in_methods_failure}
FetchSignInMethodsForEmailFailureInterface(String code, String message)
: super(code, message);
FetchSignInMethodsForEmailFailureInterface(super.code, super.message);
/// {@macro fetch_sign_in_methods_failure}
FetchSignInMethodsForEmailFailureInterface.fromCode(String code)
: super.fromCode(code);
FetchSignInMethodsForEmailFailureInterface.fromCode(super.code)
: super.fromCode();
}
/// {@template sign_in_with_credential_failure}
/// Thrown during the sign in process if a failure occurs.
/// {@endtemplate}
abstract class SignInWithCredentialFailureInterface
extends AuthenticationFailureInterface {
/// {@macro sign_in_with_credential_failure}
SignInWithCredentialFailureInterface(super.code, super.message);
/// {@macro sign_in_with_credential_failure}
SignInWithCredentialFailureInterface.fromCode(super.code) : super.fromCode();
}
/// {@template sign_in_anonymously_failure}
@@ -70,12 +79,10 @@ abstract class FetchSignInMethodsForEmailFailureInterface
abstract class SignInAnonymouslyFailureInterface
extends AuthenticationFailureInterface {
/// {@macro sign_in_anonymously_failure}
SignInAnonymouslyFailureInterface(String code, String message)
: super(code, message);
SignInAnonymouslyFailureInterface(super.code, super.message);
/// {@macro sign_in_anonymously_failure}
SignInAnonymouslyFailureInterface.fromCode(String code)
: super.fromCode(code);
SignInAnonymouslyFailureInterface.fromCode(super.code) : super.fromCode();
}
/// {@template sign_in_with_google_failure}
@@ -84,11 +91,46 @@ abstract class SignInAnonymouslyFailureInterface
abstract class SignInWithGoogleFailureInterface
extends AuthenticationFailureInterface {
/// {@macro sign_in_with_google_failure}
SignInWithGoogleFailureInterface(String code, String message)
: super(code, message);
SignInWithGoogleFailureInterface(super.code, super.message);
/// {@macro sign_in_with_google_failure}
SignInWithGoogleFailureInterface.fromCode(String code) : super.fromCode(code);
SignInWithGoogleFailureInterface.fromCode(super.code) : super.fromCode();
}
/// {@template sign_in_with_facebook_failure}
/// Thrown during the sign in process if a failure occurs.
/// {@endtemplate}
abstract class SignInWithFacebookFailureInterface
extends AuthenticationFailureInterface {
/// {@macro sign_in_with_facebook_failure}
SignInWithFacebookFailureInterface(super.code, super.message);
/// {@macro sign_in_with_facebook_failure}
SignInWithFacebookFailureInterface.fromCode(super.code) : super.fromCode();
}
/// {@template sign_in_with_apple_failure}
/// Thrown during the sign in process if a failure occurs.
/// {@endtemplate}
abstract class SignInWithAppleFailureInterface
extends AuthenticationFailureInterface {
/// {@macro sign_in_with_apple_failure}
SignInWithAppleFailureInterface(super.code, super.message);
/// {@macro sign_in_with_apple_failure}
SignInWithAppleFailureInterface.fromCode(super.code) : super.fromCode();
}
/// {@template sign_in_with_twitter_failure}
/// Thrown during the sign in process if a failure occurs.
/// {@endtemplate}
abstract class SignInWithTwitterFailureInterface
extends AuthenticationFailureInterface {
/// {@macro sign_in_with_twitter_failure}
SignInWithTwitterFailureInterface(super.code, super.message);
/// {@macro sign_in_with_twitter_failure}
SignInWithTwitterFailureInterface.fromCode(super.code) : super.fromCode();
}
/// {@template sign_in_with_email_link_failure}
@@ -97,12 +139,10 @@ abstract class SignInWithGoogleFailureInterface
abstract class SignInWithEmailLinkFailureInterface
extends AuthenticationFailureInterface {
/// {@macro sign_in_with_email_link_failure}
SignInWithEmailLinkFailureInterface(String code, String message)
: super(code, message);
SignInWithEmailLinkFailureInterface(super.code, super.message);
/// {@macro sign_in_with_email_link_failure}
SignInWithEmailLinkFailureInterface.fromCode(String code)
: super.fromCode(code);
SignInWithEmailLinkFailureInterface.fromCode(super.code) : super.fromCode();
}
/// {@template sign_in_with_email_and_password_failure}
@@ -111,12 +151,11 @@ abstract class SignInWithEmailLinkFailureInterface
abstract class SignInWithEmailAndPasswordFailureInterface
extends AuthenticationFailureInterface {
/// {@macro sign_in_with_email_and_password_failure}
SignInWithEmailAndPasswordFailureInterface(String code, String message)
: super(code, message);
SignInWithEmailAndPasswordFailureInterface(super.code, super.message);
/// {@macro sign_in_with_email_and_password_failure}
SignInWithEmailAndPasswordFailureInterface.fromCode(String code)
: super.fromCode(code);
SignInWithEmailAndPasswordFailureInterface.fromCode(super.code)
: super.fromCode();
}
/// {@template send_email_verification_failure}
@@ -125,12 +164,10 @@ abstract class SignInWithEmailAndPasswordFailureInterface
abstract class SendEmailVerificationFailureInterface
extends AuthenticationFailureInterface {
/// {@macro send_email_verification_failure}
SendEmailVerificationFailureInterface(String code, String message)
: super(code, message);
SendEmailVerificationFailureInterface(super.code, super.message);
/// {@macro send_email_verification_failure}
SendEmailVerificationFailureInterface.fromCode(String code)
: super.fromCode(code);
SendEmailVerificationFailureInterface.fromCode(super.code) : super.fromCode();
}
/// {@template send_password_reset_email_failure}
@@ -139,12 +176,11 @@ abstract class SendEmailVerificationFailureInterface
abstract class SendPasswordResetEmailFailureInterface
extends AuthenticationFailureInterface {
/// {@macro send_password_reset_email_failure}
SendPasswordResetEmailFailureInterface(String code, String message)
: super(code, message);
SendPasswordResetEmailFailureInterface(super.code, super.message);
/// {@macro send_password_reset_email_failure}
SendPasswordResetEmailFailureInterface.fromCode(String code)
: super.fromCode(code);
SendPasswordResetEmailFailureInterface.fromCode(super.code)
: super.fromCode();
}
/// {@template send_sign_in_link_email_failure}
@@ -153,12 +189,10 @@ abstract class SendPasswordResetEmailFailureInterface
abstract class SendSignInLinkEmailFailureInterface
extends AuthenticationFailureInterface {
/// {@macro send_sign_in_link_email_failure}
SendSignInLinkEmailFailureInterface(String code, String message)
: super(code, message);
SendSignInLinkEmailFailureInterface(super.code, super.message);
/// {@macro send_sign_in_link_email_failure}
SendSignInLinkEmailFailureInterface.fromCode(String code)
: super.fromCode(code);
SendSignInLinkEmailFailureInterface.fromCode(super.code) : super.fromCode();
}
/// {@template confirm_password_reset_failure}
@@ -167,12 +201,10 @@ abstract class SendSignInLinkEmailFailureInterface
abstract class ConfirmPasswordResetFailureInterface
extends AuthenticationFailureInterface {
/// {@macro confirm_password_reset_failure}
ConfirmPasswordResetFailureInterface(String code, String message)
: super(code, message);
ConfirmPasswordResetFailureInterface(super.code, super.message);
/// {@macro confirm_password_reset_failure}
ConfirmPasswordResetFailureInterface.fromCode(String code)
: super.fromCode(code);
ConfirmPasswordResetFailureInterface.fromCode(super.code) : super.fromCode();
}
/// {@template verify_password_reset_code_failure}
@@ -181,12 +213,11 @@ abstract class ConfirmPasswordResetFailureInterface
abstract class VerifyPasswordResetCodeFailureInterface
extends AuthenticationFailureInterface {
/// {@macro verify_password_reset_code_failure}
VerifyPasswordResetCodeFailureInterface(String code, String message)
: super(code, message);
VerifyPasswordResetCodeFailureInterface(super.code, super.message);
/// {@macro verify_password_reset_code_failure}
VerifyPasswordResetCodeFailureInterface.fromCode(String code)
: super.fromCode(code);
VerifyPasswordResetCodeFailureInterface.fromCode(super.code)
: super.fromCode();
}
/// {@template refresh_failure}
@@ -194,10 +225,10 @@ abstract class VerifyPasswordResetCodeFailureInterface
/// {@endtemplate}
abstract class RefreshFailureInterface extends AuthenticationFailureInterface {
/// {@macro refresh_failure}
RefreshFailureInterface(String code, String message) : super(code, message);
RefreshFailureInterface(super.code, super.message);
/// {@macro refresh_failure}
RefreshFailureInterface.fromCode(String code) : super.fromCode(code);
RefreshFailureInterface.fromCode(super.code) : super.fromCode();
}
/// {@template sign_out_failure}
@@ -205,8 +236,8 @@ abstract class RefreshFailureInterface extends AuthenticationFailureInterface {
/// {@endtemplate}
abstract class SignOutFailureInterface extends AuthenticationFailureInterface {
/// {@macro sign_out_failure}
SignOutFailureInterface(String code, String message) : super(code, message);
SignOutFailureInterface(super.code, super.message);
/// {@macro sign_out_failure}
SignOutFailureInterface.fromCode(String code) : super.fromCode(code);
SignOutFailureInterface.fromCode(super.code) : super.fromCode();
}
@@ -14,7 +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/>.
import 'package:wyatt_authentication_bloc/src/models/exceptions/exceptions_interface.dart';
import 'package:wyatt_authentication_bloc/src/core/exceptions/exceptions.dart';
class ApplyActionCodeFailureFirebase extends ApplyActionCodeFailureInterface {
ApplyActionCodeFailureFirebase([String? code, String? message])
@@ -106,10 +106,12 @@ class SignInAnonymouslyFailureFirebase
}
}
class SignInWithGoogleFailureFirebase extends SignInWithGoogleFailureInterface {
SignInWithGoogleFailureFirebase([String? code, String? message])
class SignInWithCredentialFailureFirebase
extends SignInWithCredentialFailureInterface {
SignInWithCredentialFailureFirebase([String? code, String? message])
: super(code ?? 'unknown', message ?? 'An unknown error occurred.');
SignInWithGoogleFailureFirebase.fromCode(String code) : super.fromCode(code) {
SignInWithCredentialFailureFirebase.fromCode(String code)
: super.fromCode(code) {
switch (code) {
case 'account-exists-with-different-credential':
message = 'Account exists with different credentials.';
@@ -143,6 +145,33 @@ class SignInWithGoogleFailureFirebase extends SignInWithGoogleFailureInterface {
}
}
class SignInWithGoogleFailureFirebase
extends SignInWithCredentialFailureFirebase
implements SignInWithGoogleFailureInterface {
SignInWithGoogleFailureFirebase([super.code, super.message]);
SignInWithGoogleFailureFirebase.fromCode(super.code) : super.fromCode();
}
class SignInWithFacebookFailureFirebase
extends SignInWithCredentialFailureFirebase
implements SignInWithFacebookFailureInterface {
SignInWithFacebookFailureFirebase([super.code, super.message]);
SignInWithFacebookFailureFirebase.fromCode(super.code) : super.fromCode();
}
class SignInWithAppleFailureFirebase extends SignInWithCredentialFailureFirebase
implements SignInWithAppleFailureInterface {
SignInWithAppleFailureFirebase([super.code, super.message]);
SignInWithAppleFailureFirebase.fromCode(super.code) : super.fromCode();
}
class SignInWithTwitterFailureFirebase
extends SignInWithCredentialFailureFirebase
implements SignInWithAppleFailureInterface {
SignInWithTwitterFailureFirebase([super.code, super.message]);
SignInWithTwitterFailureFirebase.fromCode(super.code) : super.fromCode();
}
class SignInWithEmailLinkFailureFirebase
extends SignInWithEmailLinkFailureInterface {
SignInWithEmailLinkFailureFirebase([String? code, String? message])
@@ -199,16 +228,14 @@ class SendEmailVerificationFailureFirebase
SendEmailVerificationFailureFirebase([String? code, String? message])
: super(code ?? 'unknown', message ?? 'An unknown error occurred.');
SendEmailVerificationFailureFirebase.fromCode(String code)
: super.fromCode(code);
SendEmailVerificationFailureFirebase.fromCode(super.code) : super.fromCode();
}
class SendPasswordResetEmailFailureFirebase
extends SendPasswordResetEmailFailureInterface {
SendPasswordResetEmailFailureFirebase([String? code, String? message])
: super(code ?? 'unknown', message ?? 'An unknown error occurred.');
SendPasswordResetEmailFailureFirebase.fromCode(String code)
: super.fromCode(code);
SendPasswordResetEmailFailureFirebase.fromCode(super.code) : super.fromCode();
}
class SendSignInLinkEmailFailureFirebase
@@ -216,8 +243,7 @@ class SendSignInLinkEmailFailureFirebase
SendSignInLinkEmailFailureFirebase([String? code, String? message])
: super(code ?? 'unknown', message ?? 'An unknown error occurred.');
SendSignInLinkEmailFailureFirebase.fromCode(String code)
: super.fromCode(code);
SendSignInLinkEmailFailureFirebase.fromCode(super.code) : super.fromCode();
}
class ConfirmPasswordResetFailureFirebase
@@ -225,8 +251,7 @@ class ConfirmPasswordResetFailureFirebase
ConfirmPasswordResetFailureFirebase([String? code, String? message])
: super(code ?? 'unknown', message ?? 'An unknown error occurred.');
ConfirmPasswordResetFailureFirebase.fromCode(String code)
: super.fromCode(code);
ConfirmPasswordResetFailureFirebase.fromCode(super.code) : super.fromCode();
}
class VerifyPasswordResetCodeFailureFirebase
@@ -234,19 +259,19 @@ class VerifyPasswordResetCodeFailureFirebase
VerifyPasswordResetCodeFailureFirebase([String? code, String? message])
: super(code ?? 'unknown', message ?? 'An unknown error occurred.');
VerifyPasswordResetCodeFailureFirebase.fromCode(String code)
: super.fromCode(code);
VerifyPasswordResetCodeFailureFirebase.fromCode(super.code)
: super.fromCode();
}
class RefreshFailureFirebase extends RefreshFailureInterface {
RefreshFailureFirebase([String? code, String? message])
: super(code ?? 'unknown', message ?? 'An unknown error occurred.');
RefreshFailureFirebase.fromCode(String code) : super.fromCode(code);
RefreshFailureFirebase.fromCode(super.code) : super.fromCode();
}
class SignOutFailureFirebase extends SignOutFailureInterface {
SignOutFailureFirebase([String? code, String? message])
: super(code ?? 'unknown', message ?? 'An unknown error occurred.');
SignOutFailureFirebase.fromCode(String code) : super.fromCode(code);
SignOutFailureFirebase.fromCode(super.code) : super.fromCode();
}
@@ -0,0 +1,22 @@
// 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:firebase_auth/firebase_auth.dart';
import 'package:wyatt_authentication_bloc/src/data/models/user_firebase.dart';
extension FirebaseAuthUserX on User {
UserFirebase get model => UserFirebase(this);
}
@@ -0,0 +1,39 @@
// 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:convert';
import 'dart:math';
import 'package:crypto/crypto.dart';
class Cryptography {
/// Generates a cryptographically secure random nonce, to be included in a
/// credential request.
static String generateNonce([int length = 32]) {
const charset =
'0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-._';
final random = Random.secure();
return List.generate(length, (_) => charset[random.nextInt(charset.length)])
.join();
}
/// Returns the sha256 hash of [input] in hex notation.
static String sha256ofString(String input) {
final bytes = utf8.encode(input);
final digest = sha256.convert(bytes);
return digest.toString();
}
}
@@ -15,10 +15,9 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:firebase_auth/firebase_auth.dart';
import 'package:wyatt_authentication_bloc/src/domain/entities/user.dart' as wyatt;
import 'package:wyatt_authentication_bloc/src/models/user/user_interface.dart';
class UserFirebase implements UserInterface {
class UserFirebase implements wyatt.User {
final User? _user;
const UserFirebase(User user) : _user = user;
@@ -64,6 +63,9 @@ class UserFirebase implements UserInterface {
@override
String get uid => _user?.uid ?? '';
@override
String? get providerId => _user?.providerData.first.providerId;
@override
bool? get isNewUser {
if (_user?.metadata.lastSignInTime == null ||
@@ -14,36 +14,57 @@
// 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:firebase_auth/firebase_auth.dart';
import 'package:wyatt_authentication_bloc/src/models/exceptions/exceptions_firebase.dart';
import 'package:wyatt_authentication_bloc/src/models/user/user_firebase.dart';
import 'package:wyatt_authentication_bloc/src/models/user/user_interface.dart';
import 'package:wyatt_authentication_bloc/src/repositories/authentication_repository_interface.dart';
import 'dart:async';
class AuthenticationRepositoryFirebase
implements AuthenticationRepositoryInterface {
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter_facebook_auth/flutter_facebook_auth.dart';
import 'package:google_sign_in/google_sign_in.dart';
import 'package:sign_in_with_apple/sign_in_with_apple.dart';
import 'package:twitter_login/twitter_login.dart';
import 'package:wyatt_authentication_bloc/src/core/enum/auth_cubit_status.dart';
import 'package:wyatt_authentication_bloc/src/core/exceptions/exceptions_firebase.dart';
import 'package:wyatt_authentication_bloc/src/core/extensions/firebase_auth_user_x.dart';
import 'package:wyatt_authentication_bloc/src/core/utils/cryptography.dart';
import 'package:wyatt_authentication_bloc/src/data/models/user_firebase.dart';
import 'package:wyatt_authentication_bloc/src/domain/entities/user.dart'
as wyatt;
import 'package:wyatt_authentication_bloc/src/domain/repositories/authentication_repository.dart';
class AuthenticationRepositoryFirebase implements AuthenticationRepository {
final _controller = StreamController<AuthCubitStatus>();
final FirebaseAuth _firebaseAuth;
final TwitterLogin? _twitterLogin;
UserFirebase _userCache = const UserFirebase.empty();
AuthenticationRepositoryFirebase({FirebaseAuth? firebaseAuth})
: _firebaseAuth = firebaseAuth ?? FirebaseAuth.instance;
@override
Stream<UserInterface> get user {
return _firebaseAuth.userChanges().map((User? firebaseUser) {
final UserFirebase user = firebaseUser == null
? const UserFirebase.empty()
: firebaseUser.model;
_userCache = user;
return user;
});
AuthenticationRepositoryFirebase({
FirebaseAuth? firebaseAuth,
TwitterLogin? twitterLogin,
}) : _firebaseAuth = firebaseAuth ?? FirebaseAuth.instance,
_twitterLogin = twitterLogin {
_controller.sink.add(AuthCubitStatus.stoped);
}
@override
UserInterface get currentUser {
return _userCache;
}
Stream<AuthCubitStatus> get cubitStatus =>
_controller.stream.asBroadcastStream();
@override
void changeCubitStatus(AuthCubitStatus status) =>
_controller.sink.add(status);
@override
Stream<wyatt.User> get user =>
_firebaseAuth.userChanges().map((firebaseUser) {
final UserFirebase user = (firebaseUser == null)
? const UserFirebase.empty()
: firebaseUser.model;
_userCache = user;
return user;
});
@override
wyatt.User get currentUser => _userCache;
@override
Future<void> applyActionCode(String code) async {
@@ -99,9 +120,106 @@ class AuthenticationRepositoryFirebase
}
@override
Future<void> signInWithGoogle() {
// TODO(hpcl): implement signInWithGoogle
throw UnimplementedError();
Future<void> signInWithGoogle() async {
// Trigger the authentication flow
final GoogleSignInAccount? googleUser = await GoogleSignIn().signIn();
// Obtain the auth details from the request
final GoogleSignInAuthentication? googleAuth =
await googleUser?.authentication;
// Create a new credential
final credential = GoogleAuthProvider.credential(
accessToken: googleAuth?.accessToken,
idToken: googleAuth?.idToken,
);
try {
await _firebaseAuth.signInWithCredential(credential);
} on FirebaseAuthException catch (e) {
throw SignInWithGoogleFailureFirebase.fromCode(e.code);
} catch (_) {
throw SignInWithGoogleFailureFirebase();
}
}
@override
Future<void> signInWithFacebook() async {
// Trigger the sign-in flow
final LoginResult loginResult = await FacebookAuth.instance.login();
// Create a credential from the access token
final OAuthCredential credential =
FacebookAuthProvider.credential(loginResult.accessToken?.token ?? '');
try {
await _firebaseAuth.signInWithCredential(credential);
} on FirebaseAuthException catch (e) {
throw SignInWithFacebookFailureFirebase.fromCode(e.code);
} catch (_) {
throw SignInWithFacebookFailureFirebase();
}
}
@override
Future<void> signInWithApple() async {
// To prevent replay attacks with the credential returned from Apple, we
// include a nonce in the credential request. When signing in with
// Firebase, the nonce in the id token returned by Apple, is expected to
// match the sha256 hash of `rawNonce`.
final rawNonce = Cryptography.generateNonce();
final nonce = Cryptography.sha256ofString(rawNonce);
// Request credential for the currently signed in Apple account.
final appleCredential = await SignInWithApple.getAppleIDCredential(
scopes: [
AppleIDAuthorizationScopes.email,
AppleIDAuthorizationScopes.fullName,
],
nonce: nonce,
);
// Create an `OAuthCredential` from the credential returned by Apple.
final credential = OAuthProvider('apple.com').credential(
idToken: appleCredential.identityToken,
rawNonce: rawNonce,
);
// Sign in the user with Firebase. If the nonce we generated earlier does
// not match the nonce in `appleCredential.identityToken`,
// sign in will fail.
try {
await _firebaseAuth.signInWithCredential(credential);
} on FirebaseAuthException catch (e) {
throw SignInWithAppleFailureFirebase.fromCode(e.code);
} catch (_) {
throw SignInWithAppleFailureFirebase();
}
}
@override
Future<void> signInWithTwitter() async {
final twitterLogin = _twitterLogin;
if (twitterLogin == null) {
throw SignInWithTwitterFailureFirebase();
}
// Trigger the sign-in flow
final authResult = await twitterLogin.login();
// Create a credential from the access token
final credential = TwitterAuthProvider.credential(
accessToken: authResult.authToken!,
secret: authResult.authTokenSecret!,
);
try {
await _firebaseAuth.signInWithCredential(credential);
} on FirebaseAuthException catch (e) {
throw SignInWithCredentialFailureFirebase.fromCode(e.code);
} catch (_) {
throw SignInWithCredentialFailureFirebase();
}
}
@override
@@ -218,9 +336,3 @@ class AuthenticationRepositoryFirebase
}
}
}
extension on User {
UserFirebase get model {
return UserFirebase(this);
}
}
@@ -14,9 +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/>.
abstract class UserInterface {
abstract class User {
/// The empty user constructor.
const UserInterface.empty();
const User.empty();
/// The users display name.
///
@@ -71,6 +71,9 @@ abstract class UserInterface {
/// The user's unique ID.
String get uid;
/// The provider ID for the user.
String? get providerId;
/// Whether the user account has been recently created.
bool? get isNewUser;
@@ -14,22 +14,29 @@
// 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_authentication_bloc/src/models/exceptions/exceptions_interface.dart';
import 'package:wyatt_authentication_bloc/src/models/user/user_interface.dart';
import 'package:wyatt_authentication_bloc/src/core/enum/auth_cubit_status.dart';
import 'package:wyatt_authentication_bloc/src/core/exceptions/exceptions.dart';
import 'package:wyatt_authentication_bloc/src/domain/entities/user.dart';
/// {@template authentication_repository}
/// Repository which manages user authentication.
/// {@endtemplate}
abstract class AuthenticationRepositoryInterface {
/// Stream of [UserInterface] which will emit the current user when
abstract class AuthenticationRepository {
/// Stream of [AuthCubitStatus] wich will emit the current cubit status.
Stream<AuthCubitStatus> get cubitStatus;
/// Changes cubit status.(Useful to start or stop the engine.)
void changeCubitStatus(AuthCubitStatus status);
/// Stream of [User] which will emit the current user when
/// the authentication state changes.
///
/// Emits [UserInterface.empty] if the user is not authenticated.
Stream<UserInterface> get user;
/// Emits [User.empty] if the user is not authenticated.
Stream<User> get user;
/// Returns the current cached account.
/// Defaults to [UserInterface.empty] if there is no cached user.
UserInterface get currentUser;
/// Defaults to [User.empty] if there is no cached user.
User get currentUser;
/// Applies action code
///
@@ -61,6 +68,21 @@ abstract class AuthenticationRepositoryInterface {
/// Throws a [SignInWithGoogleFailureInterface] if an exception occurs.
Future<void> signInWithGoogle();
/// Starts the Sign In with Facebook Flow.
///
/// Throws a [SignInWithFacebookFailureInterface] if an exception occurs.
Future<void> signInWithFacebook();
/// Starts the Sign In with Apple Flow.
///
/// Throws a [SignInWithAppleFailureInterface] if an exception occurs.
Future<void> signInWithApple();
/// Starts the Sign In with Twitter Flow.
///
/// Throws a [SignInWithTwitterFailureInterface] if an exception occurs.
Future<void> signInWithTwitter();
/// Signs in using an email address and email sign-in link.
///
/// Throws a [SignInWithEmailLinkFailureInterface] if an exception occurs.
@@ -107,7 +129,7 @@ abstract class AuthenticationRepositoryInterface {
Future<void> verifyPasswordResetCode({required String code});
/// Signs out the current user which will emit
/// [UserInterface.empty] from the [user] Stream.
/// [User.empty] from the [user] Stream.
Future<void> signOut();
/// Refreshes the current user.
@@ -15,42 +15,41 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:flutter/material.dart';
import 'package:wyatt_authentication_bloc/src/authentication/cubit/authentication_cubit.dart';
import 'package:wyatt_authentication_bloc/src/models/user/user_interface.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:wyatt_authentication_bloc/src/domain/entities/user.dart';
import 'package:wyatt_authentication_bloc/src/features/authentication/cubit/authentication_cubit.dart';
class AuthenticationBuilder extends StatelessWidget {
class AuthenticationBuilder<Extra> extends StatelessWidget {
const AuthenticationBuilder({
Key? key,
required this.authenticated,
required this.unauthenticated,
required this.unknown,
}) : super(key: key);
super.key,
});
final Widget Function(
BuildContext context,
UserInterface user,
Map<String, dynamic>? userData,
User user,
Extra? extra,
) authenticated;
final Widget Function(BuildContext context) unauthenticated;
final Widget Function(BuildContext context) unknown;
@override
Widget build(BuildContext context) {
return BlocBuilder<AuthenticationCubit, AuthenticationState>(
builder: (context, state) {
if (state.status == AuthenticationStatus.authenticated) {
if (state.user != null) {
return authenticated(context, state.user!, state.userData);
} else {
Widget build(BuildContext context) =>
BlocBuilder<AuthenticationCubit<Extra>, AuthenticationState<Extra>>(
builder: (context, state) {
if (state.status == AuthenticationStatus.authenticated) {
if (state.user != null) {
return authenticated(context, state.user!, state.extra);
} else {
return unauthenticated(context);
}
} else if (state.status == AuthenticationStatus.unauthenticated) {
return unauthenticated(context);
} else {
return unknown(context);
}
} else if (state.status == AuthenticationStatus.unauthenticated) {
return unauthenticated(context);
} else {
return unknown(context);
}
},
);
}
},
);
}

Some files were not shown because too many files have changed in this diff Show More