Skip to content

Commit

Permalink
Merge branch 'main' into v8-deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
russellwheatley committed Nov 22, 2024
2 parents 5e5072d + 0103e12 commit 43429cb
Show file tree
Hide file tree
Showing 44 changed files with 413 additions and 360 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [21.6.0](https://github.com/invertase/react-native-firebase/compare/v21.5.0...v21.6.0) (2024-11-20)

### Features

- **ios, sdk:** allow FIREBASE_SDK_VERSION override ([8cbe59f](https://github.com/invertase/react-native-firebase/commit/8cbe59fbf771df6ba932832c9d4fd17bf500ea91))

### Bug Fixes

- **analytics:** update superstruct dependency / forward-port to new API ([#8153](https://github.com/invertase/react-native-firebase/issues/8153)) ([6db1fb4](https://github.com/invertase/react-native-firebase/commit/6db1fb471e62e2c7e434719f2616c76349f345be))

## [21.5.0](https://github.com/invertase/react-native-firebase/compare/v21.4.1...v21.5.0) (2024-11-16)

### Features
Expand Down
34 changes: 31 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,32 @@ If you are using the [Expo Tools](https://marketplace.visualstudio.com/items?ite

---

## Other / Web

If you are using the firebase-js-sdk fallback support for [web or "other" platforms](platforms#other-platforms) then you must initialize Firebase dynamically by calling [`initializeApp`](/reference/app#initializeApp).

However, you only want to do this for the web platform. For non-web / native apps the "default" firebase app instance will already be configured by the native google-services.json / GoogleServices-Info.plist files as mentioned above.

At some point during your application's bootstrap processes, initialize firebase like this:

```javascript
import { getApp, initializeApp } from '@react-native-firebase/app';

// web requires dynamic initialization on web prior to using firebase
if (Platform.OS === 'web') {
const firebaseConfig = {
// ... config items pasted from firebase console for your web app here
};

initializeApp(firebaseConfig);
}

// ...now throughout your app, use firebase APIs normally, for example:
const firebaseApp = getApp();
```

---

## Miscellaneous

### Android Enabling Multidex
Expand All @@ -267,10 +293,10 @@ React Native Firebase internally sets the versions of the native SDKs which each
is tested against a fixed set of SDK versions (e.g. Firebase SDKs), allowing us to be confident that every feature the
library supports is working as expected.

Sometimes it's required to change these versions to play nicely with other React Native libraries; therefore we allow
Sometimes it's required to change these versions to play nicely with other React Native libraries or to work around temporary build failures; therefore we allow
manually overriding these native SDK versions.

> Using your own SDK versions is generally not recommended as it can lead to breaking changes in your application. Proceed with caution.
> Using your own SDK versions is not recommended and not supported as it can lead to unexpected build failures when new react-native-firebase versions are released that expect to use new SDK versions. Proceed with caution and remove these overrides as soon as possible when no longer needed.
#### Android

Expand Down Expand Up @@ -305,11 +331,13 @@ Open your projects `/ios/Podfile` and add any of the globals shown below to the

```ruby
# Override Firebase SDK Version
$FirebaseSDKVersion = '11.4.0'
$FirebaseSDKVersion = '11.5.0'
```

Once changed, reinstall your projects pods via pod install and rebuild your project with `npx react-native run-ios`.

Alternatively, if you cannot edit the Podfile easily (as when using Expo), you may add the environment variable `FIREBASE_SDK_VERSION=11.5.0` (or whatever version you need) to the command line that installs pods. For example `FIREBASE_SDK_VERSION=11.5.0 yarn expo prebuild --clean`

### Increasing Android build memory

As you add more Firebase modules, there is an incredible demand placed on the Android build system, and the default memory
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,5 @@
"userUrlFormat": "{{host}}/{{user}}"
},
"ignoreChanges": ["**/docs/**", "**/.github/**", "**/e2e/**", "**/tests/**"],
"version": "21.5.0"
"version": "21.6.0"
}
6 changes: 6 additions & 0 deletions packages/analytics/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [21.6.0](https://github.com/invertase/react-native-firebase/compare/v21.5.0...v21.6.0) (2024-11-20)

### Bug Fixes

- **analytics:** update superstruct dependency / forward-port to new API ([#8153](https://github.com/invertase/react-native-firebase/issues/8153)) ([6db1fb4](https://github.com/invertase/react-native-firebase/commit/6db1fb471e62e2c7e434719f2616c76349f345be))

## [21.5.0](https://github.com/invertase/react-native-firebase/compare/v21.4.1...v21.5.0) (2024-11-16)

**Note:** Version bump only for package @react-native-firebase/analytics
Expand Down
2 changes: 1 addition & 1 deletion packages/analytics/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import {
isString,
isUndefined,
} from '@react-native-firebase/app/lib/common';
import { validateStruct, validateCompound } from '@react-native-firebase/app/lib/common/struct';

import {
createModuleNamespace,
Expand All @@ -36,6 +35,7 @@ import {
import { setReactNativeModule } from '@react-native-firebase/app/lib/internal/nativeModule';
import { isBoolean } from '@react-native-firebase/app/lib/common';

import { validateStruct, validateCompound } from './struct';
import fallBackModule from './web/RNFBAnalyticsModule';
import version from './version';
import * as structs from './structs';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,20 @@
* limitations under the License.
*/

import { superstruct } from 'superstruct/lib/index';
import { isUndefined } from './validate';

export default superstruct({
types: {
shortDate: value => typeof value === 'string' && !!value.match(/^\d{4}-\d{2}-\d{2}$/),
},
});
import { isUndefined } from '@react-native-firebase/app/lib/common/validate';
import { create } from 'superstruct';

export const validateStruct = (value = {}, struct, prefix = '') => {
try {
return struct(value);
return create(value, struct);
} catch (e) {
const { path, reason } = e;
const { path, message } = e;

const key = path[0];

if (reason === undefined) {
if (message === undefined) {
throw new Error(`${prefix} unknown property '${key}'.`);
}

e.message = `${prefix} ${e.message}`;

throw e;
Expand Down
Loading

0 comments on commit 43429cb

Please sign in to comment.