Skip to content

Commit 32894c4

Browse files
committed
docs: readability updates
1 parent b11d928 commit 32894c4

20 files changed

+2457
-2173
lines changed

.yarn/releases/yarn-4.7.0.cjs

Lines changed: 0 additions & 935 deletions
This file was deleted.

.yarn/releases/yarn-4.9.2.cjs

Lines changed: 942 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
nodeLinker: node-modules
22

3-
yarnPath: .yarn/releases/yarn-4.7.0.cjs
3+
yarnPath: .yarn/releases/yarn-4.9.2.cjs

babel.config.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/buttons/google-logo-button.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ sidebar_class_name: sponsor-heart
44

55
# GoogleLogoButton
66

7-
A Google Sign-In button that follows Google's official branding guidelines. Intended for native apps.
7+
A Google Sign-In button that follows Google's official branding guidelines. Intended for native apps. It renders null when used on the web.
88

99
import Banner from '../_sponsorBanner.mdx';
1010

docs/buttons/web.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ As the Universal sign in Guide explains, there are two ways to sign in on the we
1919

2020
One-tap UI may not always be available: This happens if user has [opted out](https://developers.google.com/identity/gsi/web/guides/features#globally_opt_out) or when they close the dialog several times in a row, entering the [cooldown period](https://developers.google.com/identity/gsi/web/guides/features#exponential_cooldown).
2121

22-
The Google Sign-In button serves as a fallback. Tapping it will open the regular Google Sign-In dialog.
22+
The Google Sign-In button serves as a fallback. Tapping it opens the regular Google Sign-In dialog.
2323

2424
```tsx
2525
import { WebGoogleSigninButton } from '@react-native-google-signin/google-signin';

docs/errors.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ try {
3636
import { statusCodes } from '@react-native-google-signin/google-signin';
3737
```
3838

39-
Status codes are useful when determining which kind of error has occurred during the sign-in process. Under the hood, these constants are derived from native GoogleSignIn error codes and are platform-specific. Always compare `error.code` to `statusCodes.*` and do not rely on the raw value of `error.code`.
39+
Status codes are useful when determining which kind of error has occurred during the sign-in process. Under the hood, these constants are derived from native error codes and are platform-specific. Always compare `error.code` to `statusCodes.*` and do not rely on the raw value of `error.code`.
4040

4141
See [example usage](one-tap#signin).
4242

43-
| Name | Description |
44-
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
45-
| `IN_PROGRESS` | Trying to invoke another operation (e.g. `signInSilently`) when previous one has not yet finished. If you call e.g. `signInSilently` twice, two calls to `signInSilently` in the native module will be done. The promise from the first call to `signInSilently` will be rejected with this error, and the second will resolve / reject with the result of the native call. |
46-
| `PLAY_SERVICES_NOT_AVAILABLE` | Play services are not available or outdated. This happens on Android, or on the web when you're calling the exposed APIs [before the Client library is loaded](setting-up/web). |
43+
| Name | Description |
44+
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
45+
| `IN_PROGRESS` | Trying to invoke another operation (e.g. `signInSilently`) when previous one has not yet finished. If you call e.g. `signInSilently` twice, two calls to `signInSilently` in the native module are done. The promise from the first call to `signInSilently` will be rejected with this error, and the second will resolve / reject with the result of the native call. |
46+
| `PLAY_SERVICES_NOT_AVAILABLE` | Play services are not available or outdated. This happens on Android, or on the web when you're calling the exposed APIs [before the Client library is loaded](setting-up/web). |
4747

4848
### Status codes specific to Universal sign in {#universal-status-codes}
4949

docs/integration-notes.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 55
2+
sidebar_position: 61
33
---
44

55
# Integration notes
@@ -18,6 +18,7 @@ sidebar_position: 55
1818

1919
The default requested scopes are `email` and `profile`.
2020

21-
If you want to manage other data from your application (for example access user agenda or upload a file to drive) you need to request additional permissions. This can be accomplished by adding the necessary scopes when configuring the GoogleSignin instance.
21+
If you want to manage other data from your application (for example, access user agenda or upload a file to drive) you need to request additional permissions. This can be accomplished by calling [`requestAuthorization`](one-tap#requestauthorization) or by
22+
adding the necessary scopes when calling [`configure`](one-tap#configure).
2223

2324
Visit https://developers.google.com/identity/protocols/googlescopes or https://developers.google.com/oauthplayground/ for a list of available scopes.

docs/one-tap.mdx

Lines changed: 19 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ sidebar_label: Universal Google sign in
44
sidebar_class_name: sponsor-heart
55
---
66

7-
# Universal Google sign in
7+
# Universal sign in
88

99
This is Google's recommended way to implement Google Sign In. This API is available on Android, iOS, macOS and web (with a little extra work [described below](#web-support)). It is a replacement for the [Original Google sign in](original). The module APIs are named `GoogleOneTapSignIn` for historical reasons.
1010

@@ -71,7 +71,7 @@ signature: (`params`: [`OneTapConfigureParams`](api#onetapconfigureparams)) => `
7171

7272
It is mandatory to call `configure` before attempting to call any of the sign-in methods. This method is synchronous, meaning you can call e.g. `signIn` right after it. Typically, you would call `configure` only once, soon after your app starts.
7373

74-
`webClientId` is a required parameter. Use "autoDetect" for [automatic webClientId detection](#automatic-config).
74+
`webClientId` is a required parameter. Use `"autoDetect"` for [automatic webClientId detection](#automatic-config).
7575

7676
If you're using neither Expo nor Firebase, you also need to provide the `iosClientId` parameter. All other parameters are optional.
7777

@@ -93,9 +93,7 @@ signature: (`params`?: [`OneTapSignInParams`](api#onetapsigninparams)) => `Promi
9393
| Apple | Attempts to restore a previous user sign-in without interaction. [Docs](https://developers.google.com/identity/sign-in/ios/reference/Classes/GIDSignIn#-restoreprevioussigninwithcompletion:). |
9494
| Web | Attempts to sign in user automatically, without interaction. [Docs](https://developers.google.com/identity/gsi/web/reference/js-reference#auto_select). If none is found, presents a sign-in UI. [Read below](#web-support) for web support. |
9595

96-
Returns a `Promise` that resolves with [`OneTapResponse`](api#onetapresponse) or rejects in case of error.
97-
98-
If there is no user that was previously signed in, the promise resolves with [`NoSavedCredentialFound`](api#nosavedcredentialfound) object. In that case, you can call [`createAccount`](one-tap#createaccount) to start a flow to create a new account. You don't need to call `signIn` as a response to a user action - you can call it when your app starts or when suitable.
96+
If there is no user that was previously signed in, the returned promise resolves with [`NoSavedCredentialFound`](api#nosavedcredentialfound) object. In that case, you can call [`createAccount`](one-tap#createaccount) to start a flow to create a new account. You don't need to call `signIn` as a response to a user action - you can call it when your app starts or when suitable.
9997

10098
import SignInScreenshots from './screenshots/_signIn.mdx';
10199

@@ -170,61 +168,51 @@ You don't need to call `createAccount` as a response to a user action - you can
170168

171169
Use `createAccount` if `signIn` resolved with [`NoSavedCredentialFound` result](api#nosavedcredentialfound), as indicated in the code snippet above.
172170

173-
Returns a `Promise` that resolves with [`OneTapResponse`](api#onetapresponse) or rejects in case of error.
174-
175171
import CreateAccount from './screenshots/_createAccount.mdx';
176172

177173
<CreateAccount />
178174

179175
```ts
180-
await GoogleOneTapSignIn.createAccount({
181-
nonce: 'your_nonce', // nonce is supported on all platforms!
182-
});
176+
await GoogleOneTapSignIn.createAccount();
183177
```
184178

185179
---
186180

187181
### `presentExplicitSignIn`
188182

189-
✨since v14.2.0
190-
191183
signature: (`params`?: [`OneTapExplicitSignInParams`](api#onetapexplicitsigninparams)) => `Promise`\<[`OneTapExplicitSignInResponse`](api#onetapexplicitsigninresponse)\>
192184

193-
| Platform | Behavior |
194-
| -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
195-
| Android | Presents the sign in dialog explicitly. This is useful when the user has hit rate limiting ([`ONE_TAP_START_FAILED`](errors#universal-status-codes)) and the one-tap flow is thus not available, or if both `signIn` and `createAccount` resolve with [`NoSavedCredentialFound`](api#nosavedcredentialfound) object - which happens (in the unlikely case) when no Google account is present on the device. This will prompt the user to add a Google account. |
196-
| Apple | Starts an interactive sign-in flow. Same as `createAccount`. |
197-
| Web | Presents a one-tap prompt. Same as `createAccount`. |
185+
| Platform | Behavior |
186+
| -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
187+
| Android | Presents the sign in dialog explicitly. This is useful when the user has hit rate limiting ([`ONE_TAP_START_FAILED`](errors#universal-status-codes)) and the one-tap flow is thus not available, or if both `signIn` and `createAccount` resolve with [`NoSavedCredentialFound`](api#nosavedcredentialfound) object - which happens (in the unlikely case) when no Google account is present on the device. This prompts the user to add a Google account. |
188+
| Apple | Starts an interactive sign-in flow. Same as `createAccount`. |
189+
| Web | Presents a one-tap prompt. Same as `createAccount`. |
198190

199-
Preferably, call this method only as a reaction to when user taps a "sign in with Google" button.
191+
Preferably, call this method only as a reaction to when user taps a [sign in button](buttons/google-logo-button).
200192

201193
import PresentExplicitSignIn from './screenshots/_presentExplicitSignIn.mdx';
202194

203195
<PresentExplicitSignIn />
204196

205197
```ts
206-
await GoogleOneTapSignIn.presentExplicitSignIn({
207-
nonce: 'your_nonce', // nonce is supported on all platforms!
208-
});
198+
await GoogleOneTapSignIn.presentExplicitSignIn();
209199
```
210200

211201
---
212202

213203
### `checkPlayServices`
214204

215-
✨since v17.3.0
216-
217205
signature: (`showErrorResolutionDialog`?: `boolean`): `Promise`\<[`PlayServicesInfo`](api#playservicesinfo)\>
218206

219207
The behavior of `checkPlayServices` varies across platforms:
220208

221209
- Android: The function resolves if the device has Play Services installed and their version is >= the minimum required version. Otherwise, it rejects with `statusCodes.PLAY_SERVICES_NOT_AVAILABLE` error code, and more information in `userInfo` field (see [below](#example-code-snippet)).
222210

223-
On Android, the presence of up-to-date Google Play Services is required to call any of the provided authentication and authorization methods. It is therefore necessary to call `checkPlayServices` any time prior to calling the authentication / authorization methods and only call those if `checkPlayServices` is successful.
224-
225211
The `showErrorResolutionDialog` parameter (default `true`) controls whether a dialog that helps to resolve an error is shown (only in case the error is user-resolvable).
226212

227-
Some errors are user-resolvable (e.g. when Play Services are outdated, or disabled) while other errors cannot be resolved (e.g. when the phone doesn't ship Play Services at all - which is the case with some device vendors).
213+
On Android, the presence of up-to-date Google Play Services is required to call any of the provided authentication and authorization methods. It is therefore necessary to call `checkPlayServices` any time prior to calling the authentication / authorization methods and only call those if `checkPlayServices` is successful.
214+
215+
Some errors are user-resolvable (e.g. when Play Services are outdated or disabled) while other errors cannot be resolved (e.g. when the phone doesn't ship Play Services at all - which is the case with some device vendors).
228216

229217
<details>
230218
<summary>Dialog screenshots</summary>
@@ -234,19 +222,11 @@ Some errors are user-resolvable (e.g. when Play Services are outdated, or disabl
234222

235223
</details>
236224

237-
- Apple: Play Services are an Android-only concept and are not needed on Apple. Hence, the method always resolves with:
238-
239-
```ts
240-
{
241-
minRequiredVersion: -1,
242-
installedVersion: -1,
243-
}
244-
```
245-
246-
- Web: resolves (with the same value as on Apple) when the Google Client Library [is loaded](setting-up/web), rejects otherwise.
225+
- Apple: Play Services are an Android-only concept and are not needed on Apple. Hence, the method always resolves.
226+
- Web: resolves when the Google Client Library [is loaded](setting-up/web), rejects otherwise.
247227

248-
```ts title="Example of showPlayServicesUpdateDialog() method"
249-
await GoogleOneTapSignIn.showPlayServicesUpdateDialog();
228+
```ts title="Example of checkPlayServices() method"
229+
await GoogleOneTapSignIn.checkPlayServices();
250230
```
251231

252232
---
@@ -269,7 +249,7 @@ await GoogleOneTapSignIn.signOut();
269249

270250
signature: (`emailOrUniqueId`: `string`) => `Promise`\<`null`\>
271251

272-
Revokes access given to the current application and signs the user out. Use when user deletes their account in your app. On the web, you need to provide the `id` or email of the user. On Android and Apple, the `emailOrUniqueId` parameter does not have any effect.
252+
Revokes access given to the current application and signs the user out. Use when a user deletes their account in your app. On the web, you need to provide the `id` or email of the user. On Android and Apple, the `emailOrUniqueId` parameter does not have any effect.
273253

274254
Returns a `Promise` that resolves with `null` or rejects in case of error.
275255

@@ -281,8 +261,6 @@ await GoogleOneTapSignIn.revokeAccess(user.id);
281261

282262
### `requestAuthorization`
283263

284-
✨since v15.0.0
285-
286264
signature: (`params`: [`RequestAuthorizationParams`](api#requestauthorizationparams)) => `Promise`\<[`AuthorizationResponse`](api#authorizationresponse)\>
287265

288266
The underlying Android SDK separates authentication and authorization - that means that on Android you can request an access token and call Google APIs on behalf of the user without previously signing the user in.
@@ -295,16 +273,12 @@ This method is used to request extra authorization from the user. Use this on An
295273
| Apple | Calls [`addScopes`](./original.mdx#addscopes). The resulting `accessToken` has access to the requested scopes. Use this if you want to read more user metadata than just the basic info. |
296274
| Web | Not implemented at the moment. |
297275

298-
> There are minor differences between the Android and Apple implementations stemming from the underlying Google SDKs. For example, Apple returns all granted scopes, while Android may only return the scopes that were requested.
299-
300276
import RequestAuthorization from './screenshots/_requestAuthorization.mdx';
301277

302278
<RequestAuthorization />
303279

304280
## Automatic `webClientId` & `iosClientId` detection {#automatic-config}
305281

306-
✨since v15.2.0 for `webClientId`, 18.2.0 for `iosClientId`
307-
308282
If you use Expo (with the config plugin and prebuild), or if you're using Firebase, you don't need to provide the `iosClientId` parameter to the `configure` method.
309283

310284
Additionally, this module can automatically detect the `webClientId` from Firebase's configuration file (does not work on web where you need to provide it explicitly).

0 commit comments

Comments
 (0)