react-native-notify-kit 9.7.0 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -2
- package/RNNotifeeCore.podspec +2 -0
- package/cli/bin/react-native-notify-kit +2 -0
- package/cli/dist/cli.bundle.js +20834 -0
- package/cli/dist/cli.d.ts +2 -0
- package/cli/dist/cli.js +87 -0
- package/cli/dist/cli.js.map +1 -0
- package/cli/dist/commands/initNse.d.ts +12 -0
- package/cli/dist/commands/initNse.js +212 -0
- package/cli/dist/commands/initNse.js.map +1 -0
- package/cli/dist/lib/detectProject.d.ts +15 -0
- package/cli/dist/lib/detectProject.js +156 -0
- package/cli/dist/lib/detectProject.js.map +1 -0
- package/cli/dist/lib/logger.d.ts +4 -0
- package/cli/dist/lib/logger.js +24 -0
- package/cli/dist/lib/logger.js.map +1 -0
- package/cli/dist/lib/patchPodfile.d.ts +12 -0
- package/cli/dist/lib/patchPodfile.js +143 -0
- package/cli/dist/lib/patchPodfile.js.map +1 -0
- package/cli/dist/lib/patchXcodeProject.d.ts +25 -0
- package/cli/dist/lib/patchXcodeProject.js +239 -0
- package/cli/dist/lib/patchXcodeProject.js.map +1 -0
- package/cli/dist/lib/writeTemplates.d.ts +11 -0
- package/cli/dist/lib/writeTemplates.js +82 -0
- package/cli/dist/lib/writeTemplates.js.map +1 -0
- package/cli/dist/templates/Info.plist.tmpl +29 -0
- package/cli/dist/templates/NotificationService.swift.tmpl +32 -0
- package/cli/dist/templates/NotifyKitNSE.entitlements.tmpl +6 -0
- package/cli/dist/templates/templates/Info.plist.tmpl +29 -0
- package/cli/dist/templates/templates/NotificationService.swift.tmpl +73 -0
- package/cli/dist/templates/templates/NotifyKitNSE.entitlements.tmpl +6 -0
- package/dist/NotifeeApiModule.d.ts +17 -0
- package/dist/NotifeeApiModule.js +66 -1
- package/dist/NotifeeApiModule.js.map +1 -1
- package/dist/fcm/index.d.ts +4 -0
- package/dist/fcm/index.js +3 -0
- package/dist/fcm/index.js.map +1 -0
- package/dist/fcm/parseFcmPayload.d.ts +16 -0
- package/dist/fcm/parseFcmPayload.js +37 -0
- package/dist/fcm/parseFcmPayload.js.map +1 -0
- package/dist/fcm/reconstructNotification.d.ts +8 -0
- package/dist/fcm/reconstructNotification.js +167 -0
- package/dist/fcm/reconstructNotification.js.map +1 -0
- package/dist/fcm/types.d.ts +51 -0
- package/dist/fcm/types.js +6 -0
- package/dist/fcm/types.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/types/Module.d.ts +21 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +38 -3
- package/server/README.md +129 -0
- package/server/dist/android.d.ts +8 -0
- package/server/dist/android.d.ts.map +1 -0
- package/server/dist/android.js +20 -0
- package/server/dist/android.js.map +1 -0
- package/server/dist/buildPayload.d.ts +3 -0
- package/server/dist/buildPayload.d.ts.map +1 -0
- package/server/dist/buildPayload.js +82 -0
- package/server/dist/buildPayload.js.map +1 -0
- package/server/dist/index.d.ts +6 -0
- package/server/dist/index.d.ts.map +1 -0
- package/server/dist/index.js +12 -0
- package/server/dist/index.js.map +1 -0
- package/server/dist/ios.d.ts +11 -0
- package/server/dist/ios.d.ts.map +1 -0
- package/server/dist/ios.js +61 -0
- package/server/dist/ios.js.map +1 -0
- package/server/dist/serialize.d.ts +11 -0
- package/server/dist/serialize.d.ts.map +1 -0
- package/server/dist/serialize.js +32 -0
- package/server/dist/serialize.js.map +1 -0
- package/server/dist/types.d.ts +2 -0
- package/server/dist/types.d.ts.map +1 -0
- package/server/dist/types.js +3 -0
- package/server/dist/types.js.map +1 -0
- package/server/dist/validation.d.ts +3 -0
- package/server/dist/validation.d.ts.map +1 -0
- package/server/dist/validation.js +101 -0
- package/server/dist/validation.js.map +1 -0
- package/server/package.json +5 -0
- package/server/src/android.ts +27 -0
- package/server/src/buildPayload.ts +91 -0
- package/server/src/index.ts +12 -0
- package/server/src/ios.ts +88 -0
- package/server/src/serialize.ts +39 -0
- package/server/src/types.ts +24 -0
- package/server/src/validation.ts +134 -0
- package/server/tsconfig.json +25 -0
- package/src/NotifeeApiModule.ts +80 -1
- package/src/fcm/index.ts +4 -0
- package/src/fcm/parseFcmPayload.ts +56 -0
- package/src/fcm/reconstructNotification.ts +201 -0
- package/src/fcm/types.ts +57 -0
- package/src/index.ts +2 -0
- package/src/internal/fcmContract.d.ts +150 -0
- package/src/types/Module.ts +23 -0
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -135,10 +135,30 @@ useEffect(() => {
|
|
|
135
135
|
}, []);
|
|
136
136
|
```
|
|
137
137
|
|
|
138
|
+
## Notifee FCM Mode (NEW in 10.0.0)
|
|
139
|
+
|
|
140
|
+
**Use `react-native-notify-kit` as the sole FCM display layer on both Android and iOS** — one developer API, no duplicate notifications on Android, no silent-push drops on iOS. Ship a server SDK payload, let the client handle it in one line, and scaffold the iOS Notification Service Extension with a single CLI command:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# server: build the payload
|
|
144
|
+
import { buildNotifyKitPayload } from 'react-native-notify-kit/server';
|
|
145
|
+
await admin.messaging().send(buildNotifyKitPayload({ token, notification: { title, body, android, ios } }));
|
|
146
|
+
|
|
147
|
+
# client (Android + iOS): one line in setBackgroundMessageHandler / onMessage
|
|
148
|
+
await notifee.handleFcmMessage(remoteMessage);
|
|
149
|
+
|
|
150
|
+
# iOS NSE scaffold
|
|
151
|
+
npx react-native-notify-kit init-nse && cd ios && pod install
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
See the full guide: **[docs/fcm-mode.md](docs/fcm-mode.md)** — covers architecture, server SDK reference, client API, NSE setup, payload schema, migration, troubleshooting, and known limitations.
|
|
155
|
+
|
|
138
156
|
## Push Notifications (Firebase)
|
|
139
157
|
|
|
140
158
|
This library handles notification **display and management**. For receiving push notifications, pair it with [`@react-native-firebase/messaging`](https://rnfirebase.io/messaging/usage):
|
|
141
159
|
|
|
160
|
+
> **New in 10.0.0:** for a turnkey FCM integration that handles both platforms (no duplicate on Android, APNs-reliable on iOS), use **[Notifee FCM Mode](docs/fcm-mode.md)** instead of the manual pattern below. The sections that follow still apply for basic Firebase setup (google-services plugin, permissions, APNs capability).
|
|
161
|
+
|
|
142
162
|
### Android setup
|
|
143
163
|
|
|
144
164
|
1. Add Firebase dependencies to your app:
|
|
@@ -196,7 +216,22 @@ messaging().onMessage(async remoteMessage => {
|
|
|
196
216
|
|
|
197
217
|
## iOS Notification Service Extension
|
|
198
218
|
|
|
199
|
-
To modify push notification content before display (e.g., attach images), create a Notification Service Extension
|
|
219
|
+
To modify push notification content before display (e.g., attach images), create a Notification Service Extension.
|
|
220
|
+
|
|
221
|
+
### Automated setup (recommended)
|
|
222
|
+
|
|
223
|
+
From your project root, with `react-native-notify-kit` installed:
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
npx react-native-notify-kit init-nse
|
|
227
|
+
cd ios && pod install
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
The CLI scaffolds a Swift NSE target (default name: `NotifyKitNSE`), patches your Podfile, and wires `.pbxproj`. Open your `.xcworkspace` in Xcode, verify the NSE target's signing, and build. See [docs/fcm-mode.md#ios-nse-setup](docs/fcm-mode.md#ios-nse-setup) for the full CLI reference (target name, bundle suffix, `--dry-run`, `--force`).
|
|
231
|
+
|
|
232
|
+
### Manual setup
|
|
233
|
+
|
|
234
|
+
For Expo, monorepos with non-standard iOS paths, or heavily-customized Xcode configurations where the CLI can't patch the project cleanly:
|
|
200
235
|
|
|
201
236
|
1. In Xcode: **File > New > Target > Notification Service Extension**
|
|
202
237
|
2. Add to your Podfile:
|
|
@@ -234,6 +269,40 @@ To modify push notification content before display (e.g., attach images), create
|
|
|
234
269
|
|
|
235
270
|
5. Run `cd ios && pod install`
|
|
236
271
|
|
|
272
|
+
## Server SDK
|
|
273
|
+
|
|
274
|
+
`react-native-notify-kit` ships a **zero-dependency server SDK** under the `/server` subpath, for building FCM HTTP v1 payloads that the client `handleFcmMessage` handler consumes. Runs in Node.js 22+ and Firebase Cloud Functions.
|
|
275
|
+
|
|
276
|
+
```ts
|
|
277
|
+
import { buildNotifyKitPayload } from 'react-native-notify-kit/server';
|
|
278
|
+
import * as admin from 'firebase-admin';
|
|
279
|
+
|
|
280
|
+
const message = buildNotifyKitPayload({
|
|
281
|
+
token: '<device FCM token>',
|
|
282
|
+
notification: {
|
|
283
|
+
id: 'order-42',
|
|
284
|
+
title: 'Your order is on the way',
|
|
285
|
+
body: 'Tap to see live tracking',
|
|
286
|
+
data: { orderId: '42' },
|
|
287
|
+
android: { channelId: 'orders', smallIcon: 'ic_notification' },
|
|
288
|
+
ios: { sound: 'default', interruptionLevel: 'timeSensitive' },
|
|
289
|
+
},
|
|
290
|
+
options: { androidPriority: 'high', ttl: 3600 },
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
await admin.messaging().send(message);
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
Full reference: [docs/fcm-mode.md#server-sdk-reference](docs/fcm-mode.md#server-sdk-reference) (types, validation rules, payload shape, FCM 4 KB limit).
|
|
297
|
+
|
|
298
|
+
## CLI Tools
|
|
299
|
+
|
|
300
|
+
The library ships a small CLI at `npx react-native-notify-kit`. Currently one command is available:
|
|
301
|
+
|
|
302
|
+
- `npx react-native-notify-kit init-nse` — scaffolds an iOS Notification Service Extension (Swift), patches the Podfile, and wires `.pbxproj`. See [docs/fcm-mode.md#ios-nse-setup](docs/fcm-mode.md#ios-nse-setup) for options.
|
|
303
|
+
|
|
304
|
+
The CLI is prepacked into the main package at publish time, so `npx react-native-notify-kit` works immediately after `yarn add react-native-notify-kit` — no separate install.
|
|
305
|
+
|
|
237
306
|
## Jest Testing
|
|
238
307
|
|
|
239
308
|
Mock the native module in your Jest setup file:
|
|
@@ -688,7 +757,7 @@ The script runs the macrobenchmark test in `apps/smoke/android/baselineprofile/`
|
|
|
688
757
|
|
|
689
758
|
## Documentation
|
|
690
759
|
|
|
691
|
-
The
|
|
760
|
+
The full `react-native-notify-kit` documentation is hosted on docs.page and is kept in sync with this repo. It covers the public API, platform guides, FCM Mode, the server SDK, and the `init-nse` CLI.
|
|
692
761
|
|
|
693
762
|
- [Overview](https://docs.page/marcocrupi/react-native-notify-kit/react-native/overview)
|
|
694
763
|
- [Reference](https://docs.page/marcocrupi/react-native-notify-kit/react-native/reference)
|
package/RNNotifeeCore.podspec
CHANGED
|
@@ -16,6 +16,8 @@ Pod::Spec.new do |s|
|
|
|
16
16
|
|
|
17
17
|
s.cocoapods_version = '>= 1.10.0'
|
|
18
18
|
s.ios.deployment_target = '15.1'
|
|
19
|
+
s.module_name = 'RNNotifeeCore'
|
|
20
|
+
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
|
|
19
21
|
|
|
20
22
|
if defined?($NotifeeCoreFromSources) && $NotifeeCoreFromSources == true
|
|
21
23
|
# internal dev flag used by Notifee devs, ignore
|