Skip to content

Commit

Permalink
feat: add test user login for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
tusharlock10 committed Mar 6, 2024
1 parent 90e4db2 commit fe6924c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions lib/constants/environment.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,7 @@ abstract class AppType {

return developmentShort;
}

static bool get isProd => Env.appType == production;
static bool get isDev => Env.appType == development;
}
9 changes: 5 additions & 4 deletions lib/providers/auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand All @@ -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(),
Expand Down

0 comments on commit fe6924c

Please sign in to comment.