feat(authentication)!: add repo in callback usecases (close #55)
This commit was merged in pull request #61.
This commit is contained in:
+7
-2
@@ -30,11 +30,15 @@ import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
|
||||
import 'package:wyatt_type_utils/wyatt_type_utils.dart';
|
||||
|
||||
typedef OnSignUpSuccess<T> = FutureOrResult<T?> Function(
|
||||
AuthenticationRepository<T> repo,
|
||||
Account? account,
|
||||
WyattForm form,
|
||||
);
|
||||
|
||||
typedef OnAuthChange<T> = FutureOrResult<T?> Function(Account? account);
|
||||
typedef OnAuthChange<T> = FutureOrResult<T?> Function(
|
||||
AuthenticationRepository<T> repo,
|
||||
Account? account,
|
||||
);
|
||||
|
||||
class AuthenticationRepositoryImpl<T extends Object>
|
||||
extends AuthenticationRepository<T> {
|
||||
@@ -149,6 +153,7 @@ class AuthenticationRepositoryImpl<T extends Object>
|
||||
await _authenticationLocalDataSource.storeAccount(account);
|
||||
if (_onSignUpSuccess.isNotNull) {
|
||||
final dataResult = await _onSignUpSuccess!.call(
|
||||
this,
|
||||
account,
|
||||
_formRepository.accessForm(AuthFormName.signUpForm).clone(),
|
||||
);
|
||||
@@ -232,7 +237,7 @@ class AuthenticationRepositoryImpl<T extends Object>
|
||||
_signUpStream.stream.asBroadcastStream(),
|
||||
_authenticationRemoteDataSource.streamAccount().map((account) async {
|
||||
if (_onAccountChanges.isNotNull && !_pause) {
|
||||
final dataResult = await _onAccountChanges!.call(account);
|
||||
final dataResult = await _onAccountChanges!.call(this, account);
|
||||
return dataResult.map((data) {
|
||||
_authenticationLocalDataSource.storeData(data);
|
||||
return AccountWrapperModel(account, data);
|
||||
|
||||
Reference in New Issue
Block a user