From fe6924c3024cc3d77ad8c166c0e9b0f47a38525a Mon Sep 17 00:00:00 2001 From: Tushar Jain Date: Thu, 7 Mar 2024 01:41:44 +0530 Subject: [PATCH] feat: add test user login for windows --- lib/constants/environment.dart | 3 +++ lib/providers/auth.dart | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/constants/environment.dart b/lib/constants/environment.dart index f270d7b..20852dd 100644 --- a/lib/constants/environment.dart +++ b/lib/constants/environment.dart @@ -44,4 +44,7 @@ abstract class AppType { return developmentShort; } + + static bool get isProd => Env.appType == production; + static bool get isDev => Env.appType == development; } diff --git a/lib/providers/auth.dart b/lib/providers/auth.dart index 70bd839..32821d1 100644 --- a/lib/providers/auth.dart +++ b/lib/providers/auth.dart @@ -132,8 +132,6 @@ class _AuthNotifier extends ChangeNotifier { final firebaseAuthResponse = await _getFirebaseAuthCredentials(); final idToken = firebaseAuthResponse.idToken; - print("ID TOKEN : $idToken"); - if (firebaseAuthResponse.errorCode == 0) { // user has closed the popup window return data_classes.SignInProviderResponse(result: false); @@ -430,11 +428,15 @@ class _AuthNotifier extends ChangeNotifier { } Future<_GetFirebaseAuthResponse> _getFirebaseAuthCredentials() async { + // NOTE: for development login in windows + if (constants.isWindows && constants.AppType.isDev) { + return _GetFirebaseAuthResponse(idToken: "testUser"); + } + final GoogleSignInAccount? googleUser; try { googleUser = await GoogleSignIn().signIn(); } catch (error) { - print("Error 1 :: ${error.toString()}"); if (error is PlatformException) { return _GetFirebaseAuthResponse( errorCode: 0, @@ -459,7 +461,6 @@ class _AuthNotifier extends ChangeNotifier { try { googleAuth = await googleUser.authentication; } catch (error) { - print("Error 2 :: $error"); return _GetFirebaseAuthResponse( errorCode: 3, errorMessage: error.toString(),