attemptAutoSignIn method

Future<bool> attemptAutoSignIn()

Implementation

Future<bool> attemptAutoSignIn() async {
  if (!kIsWeb && Platform.isWindows && await hasAuthToken()) {
    verbose("Attempting Auto Sign In with Google on Windows");
    try {
      await signInWithGoogle(retry: false);

      if (isSignedIn()) {
        await svc<UserService>().bind(svc<UserService>().uid());
        return true;
      } else {
        await clearAuthToken();
      }
    } catch (e, es) {
      error("Failed to auto sign in with Google");
      error(e);
      error(es);
    }
  }

  if (!kIsWeb && Platform.isWindows) {
    await clearAuthToken();
  }

  return false;
}