authentication/feature/google_signin #105

Merged
malo merged 7 commits from authentication/feature/google_signin into master 2022-12-13 22:07:17 +00:00
Showing only changes of commit 197c5d54e6 - Show all commits

View File

@ -19,10 +19,13 @@ import 'package:wyatt_type_utils/wyatt_type_utils.dart';
class AuthenticationFirebaseDataSourceImpl class AuthenticationFirebaseDataSourceImpl
extends AuthenticationRemoteDataSource { extends AuthenticationRemoteDataSource {
AuthenticationFirebaseDataSourceImpl({FirebaseAuth? firebaseAuth}) AuthenticationFirebaseDataSourceImpl(
: _firebaseAuth = firebaseAuth ?? FirebaseAuth.instance; {FirebaseAuth? firebaseAuth, GoogleSignIn? googleSignIn,})
: _firebaseAuth = firebaseAuth ?? FirebaseAuth.instance,
_googleSignIn = googleSignIn ?? GoogleSignIn();
final FirebaseAuth _firebaseAuth; final FirebaseAuth _firebaseAuth;
final GoogleSignIn _googleSignIn;
UserCredential? _latestCreds; UserCredential? _latestCreds;
Account _mapper(User user) => AccountModel( Account _mapper(User user) => AccountModel(
@ -185,7 +188,7 @@ class AuthenticationFirebaseDataSourceImpl
Future<Account> signInWithGoogle() async { Future<Account> signInWithGoogle() async {
try { try {
// Trigger the authentication flow // Trigger the authentication flow
final GoogleSignInAccount? googleUser = await GoogleSignIn().signIn(); final GoogleSignInAccount? googleUser = await _googleSignIn.signIn();
// Obtain the auth details from the request // Obtain the auth details from the request
final GoogleSignInAuthentication? googleAuth = final GoogleSignInAuthentication? googleAuth =