packages/chore/upgrade-authentication #196

Merged
hugo merged 3 commits from packages/chore/upgrade-authentication into master 2023-05-06 09:28:24 +00:00
5 changed files with 37 additions and 3 deletions

View File

@ -584,7 +584,6 @@ new_version.sh
.latest_version
.vscode/
example/
models/
build/
*.iml

View File

@ -3,6 +3,27 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## 2023-05-06
### Changes
---
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
- [`wyatt_authentication_bloc` - `v0.5.0+1`](#wyatt_authentication_bloc---v0501)
---
#### `wyatt_authentication_bloc` - `v0.5.0+1`
- **REFACTOR**(authentication): controle cache checking.
## 2023-05-04
### Changes

View File

@ -1,3 +1,7 @@
## 0.5.0+1
- **REFACTOR**(authentication): controle cache checking.
## 0.5.0
> Note: This release has breaking changes.

View File

@ -40,6 +40,7 @@ abstract class AuthenticationCubit<Data>
/// {@macro authentication_cubit}
AuthenticationCubit({
required this.authenticationRepository,
this.checkForCachedAccountOnInitialization = true,
}) : super(const AuthenticationState.unknown()) {
_init();
}
@ -47,6 +48,9 @@ abstract class AuthenticationCubit<Data>
/// The authentication repository.
final AuthenticationRepository<Data> authenticationRepository;
/// Automatically check for cached account on initialization.
final bool checkForCachedAccountOnInitialization;
/// The latest session.
AuthenticationSession<Data>? _latestSession;
@ -56,7 +60,9 @@ abstract class AuthenticationCubit<Data>
_listenForAuthenticationChanges();
/// Check if there is a cached account.
await authenticationRepository.checkForCachedAccount();
if (checkForCachedAccountOnInitialization) {
await checkForCachedAccount();
}
}
void _listenForAuthenticationChanges() {
@ -148,6 +154,10 @@ abstract class AuthenticationCubit<Data>
),
).call();
/// Checks for cached account.
FutureOr<void> checkForCachedAccount() async =>
authenticationRepository.checkForCachedAccount();
/// Returns latest session.
///
/// Contains latest event and latest session data (account + extra data)

View File

@ -1,7 +1,7 @@
name: wyatt_authentication_bloc
description: Authentication BLoC for Flutter
repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_authentication_bloc
version: 0.5.0
version: 0.5.0+1
publish_to: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub