feat(auth): add fully functionnal mock data source
This commit is contained in:
+24
-2
@@ -16,6 +16,7 @@
|
||||
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||
import 'package:wyatt_type_utils/wyatt_type_utils.dart';
|
||||
|
||||
final getIt = GetIt.I;
|
||||
|
||||
@@ -23,12 +24,33 @@ abstract class GetItInitializer {
|
||||
static Future<void> init() async {
|
||||
getIt
|
||||
..registerLazySingleton<AuthenticationRemoteDataSource>(
|
||||
() => AuthenticationFirebaseDataSourceImpl(),
|
||||
() => AuthenticationMockDataSourceImpl(registeredAccounts: [
|
||||
Pair(
|
||||
AccountModel(
|
||||
uid: '1',
|
||||
emailVerified: true,
|
||||
isAnonymous: false,
|
||||
providerId: 'wyatt',
|
||||
email: 'toto@test.fr',
|
||||
),
|
||||
'toto1234',
|
||||
),
|
||||
Pair(
|
||||
AccountModel(
|
||||
uid: '2',
|
||||
emailVerified: false,
|
||||
isAnonymous: false,
|
||||
providerId: 'wyatt',
|
||||
email: 'tata@test.fr',
|
||||
),
|
||||
'tata1234',
|
||||
),
|
||||
]),
|
||||
)
|
||||
..registerLazySingleton<AuthenticationCacheDataSource<int>>(
|
||||
() => AuthenticationCacheDataSourceImpl<int>(),
|
||||
);
|
||||
|
||||
|
||||
await getIt.allReady();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ class SignInForm extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SignInListener(
|
||||
return SignInListener<int>(
|
||||
onError: (context, status, errorMessage) => ScaffoldMessenger.of(context)
|
||||
..hideCurrentSnackBar()
|
||||
..showSnackBar(
|
||||
|
||||
+1
-1
@@ -109,7 +109,7 @@ class SignUpForm extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SignUpListener(
|
||||
return SignUpListener<int>(
|
||||
onError: (context, status, errorMessage) =>
|
||||
ScaffoldMessenger.of(context)
|
||||
..hideCurrentSnackBar()
|
||||
|
||||
Reference in New Issue
Block a user