Skip to content

Commit

Permalink
Merge branch 'main' into database-8144
Browse files Browse the repository at this point in the history
  • Loading branch information
russellwheatley authored Dec 18, 2024
2 parents 21929fd + 6874d2e commit 8e9c83d
Show file tree
Hide file tree
Showing 46 changed files with 535 additions and 368 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [21.6.1](https://github.com/invertase/react-native-firebase/compare/v21.6.0...v21.6.1) (2024-11-25)

### Bug Fixes

- **android, app:** fix hot-reload on react-native <= 0.73 ([81e5fc2](https://github.com/invertase/react-native-firebase/commit/81e5fc2b6c89fdb4aa5f0f5aa95e1e90dae5f2e4))

## [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
32 changes: 31 additions & 1 deletion docs/messaging/ios-notification-images.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ end

![step-2](/assets/docs/messaging/ios-notification-images-step-2.gif)

### Step 3 - Use the extension helper
### Step 3 - Use the extension helper (Objective-C)

> If you selected to create your extension as a Swift project, jump to the next section.
At this point everything should still be running normally. This is the final step which is invoking the extension helper.

Expand All @@ -68,6 +70,34 @@ At this point everything should still be running normally. This is the final ste

![step-3](/assets/docs/messaging/ios-notification-images-step-3.gif)

### Step 3 - Use the extension helper (Swift)

At this point everything should still be running normally. This is the final step which is invoking the extension helper.

- From the navigator select your `ImageNotification` extension
- Open the `NotificationService.swift` file
- At the top of the file import `Firebase` right after the `NotificationService` as shown below

```diff
import UserNotifications
+ import Firebase

class NotificationService: UNNotificationServiceExtension {
```

- then replace everything from line 19 to 23 with the extension helper

```diff
if let bestAttemptContent = bestAttemptContent {
- // Modify the notification content here...
- bestAttemptContent.title = "\(bestAttemptContent.title) [modified]"
-
- contentHandler(bestAttemptContent)
+ Messaging.serviceExtension()
+ .populateNotificationContent(bestAttemptContent, withContentHandler: contentHandler)
}
```

## All done

Run the app and check it builds successfully – **make sure you have the correct target selected**. Now you can use the [Notifications composer](https://console.firebase.google.com/u/0/project/_/notification) to test sending notifications with an image (`300KB` max size). You can also create custom notifications via [`FCM HTTP`](https://firebase.google.com/docs/cloud-messaging/http-server-ref) or [`firebase-admin`](https://www.npmjs.com/package/firebase-admin). Read this page to send [messages from a server](/messaging/server-integration).
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.1"
}
10 changes: 10 additions & 0 deletions packages/analytics/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.1](https://github.com/invertase/react-native-firebase/compare/v21.6.0...v21.6.1) (2024-11-25)

**Note:** Version bump only for package @react-native-firebase/analytics

## [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 8e9c83d

Please sign in to comment.