From a72babfafead3b81310e36813321e6f384ef2341 Mon Sep 17 00:00:00 2001 From: Hugo Pointcheval Date: Fri, 30 Dec 2022 17:03:29 +0100 Subject: [PATCH] fix(authentication): anonymous sign in event --- .../data/repositories/authentication_repository_impl.dart | 3 +++ .../lib/src/domain/entities/auth_change_event.dart | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/packages/wyatt_authentication_bloc/lib/src/data/repositories/authentication_repository_impl.dart b/packages/wyatt_authentication_bloc/lib/src/data/repositories/authentication_repository_impl.dart index d5514589..686be61a 100644 --- a/packages/wyatt_authentication_bloc/lib/src/data/repositories/authentication_repository_impl.dart +++ b/packages/wyatt_authentication_bloc/lib/src/data/repositories/authentication_repository_impl.dart @@ -348,6 +348,9 @@ class AuthenticationRepositoryImpl if (_lastChange == null && account != null) { _lastChange = account; if (account.isNewUser ?? false) { + if (account.isAnonymous) { + return AnonymousSignInAuthChangeEvent(account); + } return SignUpAuthChangeEvent(account); } return SignInAuthChangeEvent(account); diff --git a/packages/wyatt_authentication_bloc/lib/src/domain/entities/auth_change_event.dart b/packages/wyatt_authentication_bloc/lib/src/domain/entities/auth_change_event.dart index 71a311a3..d2e38a33 100644 --- a/packages/wyatt_authentication_bloc/lib/src/domain/entities/auth_change_event.dart +++ b/packages/wyatt_authentication_bloc/lib/src/domain/entities/auth_change_event.dart @@ -26,6 +26,14 @@ class SignInAuthChangeEvent extends AuthChangeEvent { SignInAuthChangeEvent(super.account); } +class AnonymousSignInAuthChangeEvent extends AuthChangeEvent { + AnonymousSignInAuthChangeEvent(super.account); +} + +class ProviderSignInAuthChangeEvent extends AuthChangeEvent { + ProviderSignInAuthChangeEvent(super.account); +} + class SignUpAuthChangeEvent extends AuthChangeEvent { SignUpAuthChangeEvent(super.account); }