From 197c5d54e6ce3dcd7d7fa88a8da9dfec21545859 Mon Sep 17 00:00:00 2001 From: Hugo Pointcheval Date: Mon, 12 Dec 2022 23:47:29 -0500 Subject: [PATCH] feat(authentication): add google sign in parameter in firebase data source constructor --- .../remote/authentication_firebase_data_source_impl.dart | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/wyatt_authentication_bloc/lib/src/data/data_sources/remote/authentication_firebase_data_source_impl.dart b/packages/wyatt_authentication_bloc/lib/src/data/data_sources/remote/authentication_firebase_data_source_impl.dart index 78c4bf79..8a16490c 100644 --- a/packages/wyatt_authentication_bloc/lib/src/data/data_sources/remote/authentication_firebase_data_source_impl.dart +++ b/packages/wyatt_authentication_bloc/lib/src/data/data_sources/remote/authentication_firebase_data_source_impl.dart @@ -19,10 +19,13 @@ import 'package:wyatt_type_utils/wyatt_type_utils.dart'; class AuthenticationFirebaseDataSourceImpl extends AuthenticationRemoteDataSource { - AuthenticationFirebaseDataSourceImpl({FirebaseAuth? firebaseAuth}) - : _firebaseAuth = firebaseAuth ?? FirebaseAuth.instance; + AuthenticationFirebaseDataSourceImpl( + {FirebaseAuth? firebaseAuth, GoogleSignIn? googleSignIn,}) + : _firebaseAuth = firebaseAuth ?? FirebaseAuth.instance, + _googleSignIn = googleSignIn ?? GoogleSignIn(); final FirebaseAuth _firebaseAuth; + final GoogleSignIn _googleSignIn; UserCredential? _latestCreds; Account _mapper(User user) => AccountModel( @@ -185,7 +188,7 @@ class AuthenticationFirebaseDataSourceImpl Future signInWithGoogle() async { try { // Trigger the authentication flow - final GoogleSignInAccount? googleUser = await GoogleSignIn().signIn(); + final GoogleSignInAccount? googleUser = await _googleSignIn.signIn(); // Obtain the auth details from the request final GoogleSignInAuthentication? googleAuth =