feat(authentication): add google sign in parameter in firebase data source constructor

This commit is contained in:
Hugo Pointcheval 2022-12-12 23:47:29 -05:00
parent c7b241de2d
commit 197c5d54e6
Signed by: hugo
GPG Key ID: A9E8E9615379254F

View File

@ -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<Account> 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 =