Skip to content

1.0.0-rc5

Choose a tag to compare

@jozan jozan released this 07 Sep 21:47
d957260

New features

GoogleSignin.isSignedIn() (#510)

This method may be used to find out whether some user is currently signed in. It returns a promise which resolves with a boolean value (it never rejects). In the native layer, this is a synchronous call. This means that it will resolve even when the device is offline. Note that it may happen that isSignedIn() resolves to true and calling signInSilently() rejects with an error (eg. due to a network issue).

isSignedIn = async () => {
  const isSignedIn = await GoogleSignin.isSignedIn();
  this.setState({ isLoginScreenPresented: !isSignedIn });
};

Improvements

statusCodes.SIGN_IN_REQUIRED (#510)

New status code which can be used to determine if user has signed in or not. Meant to be used with signInSilently() method.

GoogleSignin.signInSilently() (#510)

Error code can now be statusCodes.SIGN_IN_REQUIRED if user has not signed in. This is consistent with the underlying native library.

Usage:

getCurrentUserInfo = async () => {
  try {
    const userInfo = await GoogleSignin.signInSilently();
    this.setState({ userInfo });
  } catch (error) {
    if (error.code === statusCodes.SIGN_IN_REQUIRED) {
      // user has not signed in yet
    } else {
      // some other error
    }
  }
};

Documentation changes

Added mention where to find what scopes can be used.