Skip to content

Commit

Permalink
Merge 9a04b68 into a9da1b7
Browse files Browse the repository at this point in the history
  • Loading branch information
hsubox76 committed May 15, 2023
2 parents a9da1b7 + 9a04b68 commit 4c32520
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 41 deletions.
6 changes: 6 additions & 0 deletions .changeset/two-bags-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@firebase/auth': major
'firebase': major
---

Change `getAuth()` in the React Native bundle to default to importing `AsyncStorage` from `@react-native-async-storage/async-storage` instead of from the `react-native` core package (which has recently removed it).
11 changes: 0 additions & 11 deletions docs-devsite/auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ Firebase Authentication
| [OperationType](./auth.md#operationtype) | Enumeration of supported operation types. |
| [prodErrorMap](./auth.md#proderrormap) | A minimal error map with all verbose error messages stripped.<!-- -->See discussion at [AuthErrorMap](./auth.autherrormap.md#autherrormap_interface) |
| [ProviderId](./auth.md#providerid) | Enumeration of supported providers. |
| [reactNativeLocalPersistence](./auth.md#reactnativelocalpersistence) | An implementation of [Persistence](./auth.persistence.md#persistence_interface) of type 'LOCAL' for use in React Native environments. |
| [SignInMethod](./auth.md#signinmethod) | Enumeration of supported sign-in methods. |

## Type Aliases
Expand Down Expand Up @@ -1969,16 +1968,6 @@ ProviderId: {
}
```

## reactNativeLocalPersistence

An implementation of [Persistence](./auth.persistence.md#persistence_interface) of type 'LOCAL' for use in React Native environments.

<b>Signature:</b>

```typescript
reactNativeLocalPersistence: Persistence
```

## SignInMethod

Enumeration of supported sign-in methods.
Expand Down
5 changes: 1 addition & 4 deletions packages/auth/index.doc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,4 @@
export * from './index';

export { cordovaPopupRedirectResolver } from './index.cordova';
export {
reactNativeLocalPersistence,
getReactNativePersistence
} from './index.rn';
export { getReactNativePersistence } from './index.rn';
29 changes: 3 additions & 26 deletions packages/auth/index.rn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@
* just use index.ts
*/

import * as ReactNative from 'react-native';

import { FirebaseApp, getApp, _getProvider } from '@firebase/app';
import { Auth, Persistence } from './src/model/public_types';
import { Auth } from './src/model/public_types';

import { initializeAuth } from './src';
import { registerAuth } from './src/core/auth/register';
import { ClientPlatform } from './src/core/util/version';
import { getReactNativePersistence } from './src/platform_react_native/persistence/react_native';
import ReactNativeAsyncStorage from '@react-native-async-storage/async-storage';

// Core functionality shared by all clients
export * from './index.shared';
Expand All @@ -50,28 +49,6 @@ export {
// MFA
export { PhoneMultiFactorGenerator } from './src/platform_browser/mfa/assertions/phone';

/**
* An implementation of {@link Persistence} of type 'LOCAL' for use in React
* Native environments.
*
* @public
*/
export const reactNativeLocalPersistence: Persistence =
getReactNativePersistence({
getItem(...args) {
// Called inline to avoid deprecation warnings on startup.
return ReactNative.AsyncStorage.getItem(...args);
},
setItem(...args) {
// Called inline to avoid deprecation warnings on startup.
return ReactNative.AsyncStorage.setItem(...args);
},
removeItem(...args) {
// Called inline to avoid deprecation warnings on startup.
return ReactNative.AsyncStorage.removeItem(...args);
}
});

export { getReactNativePersistence };

export function getAuth(app: FirebaseApp = getApp()): Auth {
Expand All @@ -82,7 +59,7 @@ export function getAuth(app: FirebaseApp = getApp()): Auth {
}

return initializeAuth(app, {
persistence: reactNativeLocalPersistence
persistence: getReactNativePersistence(ReactNativeAsyncStorage)
});
}

Expand Down
2 changes: 2 additions & 0 deletions packages/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
"@firebase/component": "0.6.4",
"@firebase/logger": "0.4.0",
"@firebase/util": "1.9.3",
"@react-native-async-storage/async-storage": "1.17.12",
"node-fetch": "2.6.7",
"tslib": "^2.1.0"
},
Expand All @@ -122,6 +123,7 @@
"@firebase/app": "0.9.10",
"@rollup/plugin-json": "4.1.0",
"@rollup/plugin-strip": "2.1.0",
"@types/express": "4.17.17",
"chromedriver": "98.0.1",
"rollup": "2.79.1",
"rollup-plugin-sourcemaps": "0.6.3",
Expand Down
14 changes: 14 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3050,6 +3050,13 @@
resolved "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570"
integrity sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=

"@react-native-async-storage/async-storage@1.17.12":
version "1.17.12"
resolved "https://registry.npmjs.org/@react-native-async-storage/async-storage/-/async-storage-1.17.12.tgz#a39e4df5b06795ce49b2ca5b7ca9b8faadf8e621"
integrity sha512-BXg4OxFdjPTRt+8MvN6jz4muq0/2zII3s7HeT/11e4Zeh3WCgk/BleLzUcDfVqF3OzFHUqEkSrb76d6Ndjd/Nw==
dependencies:
merge-options "^3.0.4"

"@rollup/plugin-alias@3.1.9":
version "3.1.9"
resolved "https://registry.npmjs.org/@rollup/plugin-alias/-/plugin-alias-3.1.9.tgz#a5d267548fe48441f34be8323fb64d1d4a1b3fdf"
Expand Down Expand Up @@ -12251,6 +12258,13 @@ merge-descriptors@1.0.1:
resolved "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61"
integrity sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=

merge-options@^3.0.4:
version "3.0.4"
resolved "https://registry.npmjs.org/merge-options/-/merge-options-3.0.4.tgz#84709c2aa2a4b24c1981f66c179fe5565cc6dbb7"
integrity sha512-2Sug1+knBjkaMsMgf1ctR1Ujx+Ayku4EdJN4Z+C2+JzoeF7A3OZ9KM2GY0CpQS51NR61LTurMJrRKPhSs3ZRTQ==
dependencies:
is-plain-obj "^2.1.0"

merge-stream@^2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60"
Expand Down

0 comments on commit 4c32520

Please sign in to comment.