react-native-notify-kit 9.1.8
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/LICENSE +44 -0
- package/README.md +212 -0
- package/RNNotifee.podspec +37 -0
- package/RNNotifeeCore.podspec +32 -0
- package/android/.editorconfig +10 -0
- package/android/build.gradle +117 -0
- package/android/gradle.properties +1 -0
- package/android/libs/app/notifee/core/202108261754/core-202108261754.aar +0 -0
- package/android/libs/app/notifee/core/202108261754/core-202108261754.aar.md5 +1 -0
- package/android/libs/app/notifee/core/202108261754/core-202108261754.aar.sha1 +1 -0
- package/android/libs/app/notifee/core/202108261754/core-202108261754.aar.sha256 +1 -0
- package/android/libs/app/notifee/core/202108261754/core-202108261754.aar.sha512 +1 -0
- package/android/libs/app/notifee/core/202108261754/core-202108261754.pom +9 -0
- package/android/libs/app/notifee/core/202108261754/core-202108261754.pom.md5 +1 -0
- package/android/libs/app/notifee/core/202108261754/core-202108261754.pom.sha1 +1 -0
- package/android/libs/app/notifee/core/202108261754/core-202108261754.pom.sha256 +1 -0
- package/android/libs/app/notifee/core/202108261754/core-202108261754.pom.sha512 +1 -0
- package/android/libs/app/notifee/core/maven-metadata.xml +13 -0
- package/android/libs/app/notifee/core/maven-metadata.xml.md5 +1 -0
- package/android/libs/app/notifee/core/maven-metadata.xml.sha1 +1 -0
- package/android/libs/app/notifee/core/maven-metadata.xml.sha256 +1 -0
- package/android/libs/app/notifee/core/maven-metadata.xml.sha512 +1 -0
- package/android/lint.xml +5 -0
- package/android/proguard-rules.pro +82 -0
- package/android/settings.gradle +1 -0
- package/android/src/main/AndroidManifest.xml +12 -0
- package/android/src/main/kotlin/io/invertase/notifee/HeadlessTask.kt +257 -0
- package/android/src/main/kotlin/io/invertase/notifee/NotifeeApiModule.kt +392 -0
- package/android/src/main/kotlin/io/invertase/notifee/NotifeeEventSubscriber.kt +117 -0
- package/android/src/main/kotlin/io/invertase/notifee/NotifeeInitProvider.kt +43 -0
- package/android/src/main/kotlin/io/invertase/notifee/NotifeePackage.kt +37 -0
- package/android/src/main/kotlin/io/invertase/notifee/NotifeeReactUtils.kt +118 -0
- package/dist/NotifeeApiModule.d.ts +53 -0
- package/dist/NotifeeApiModule.js +593 -0
- package/dist/NotifeeApiModule.js.map +1 -0
- package/dist/NotifeeJSEventEmitter.d.ts +3 -0
- package/dist/NotifeeJSEventEmitter.js +9 -0
- package/dist/NotifeeJSEventEmitter.js.map +1 -0
- package/dist/NotifeeNativeError.d.ts +15 -0
- package/dist/NotifeeNativeError.js +56 -0
- package/dist/NotifeeNativeError.js.map +1 -0
- package/dist/NotifeeNativeModule.d.ts +13 -0
- package/dist/NotifeeNativeModule.js +27 -0
- package/dist/NotifeeNativeModule.js.map +1 -0
- package/dist/NotifeeNativeModule.web.d.ts +12 -0
- package/dist/NotifeeNativeModule.web.js +15 -0
- package/dist/NotifeeNativeModule.web.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/specs/NativeNotifeeModule.d.ts +53 -0
- package/dist/specs/NativeNotifeeModule.js +6 -0
- package/dist/specs/NativeNotifeeModule.js.map +1 -0
- package/dist/types/Library.d.ts +21 -0
- package/dist/types/Library.js +5 -0
- package/dist/types/Library.js.map +1 -0
- package/dist/types/Module.d.ts +576 -0
- package/dist/types/Module.js +5 -0
- package/dist/types/Module.js.map +1 -0
- package/dist/types/Notification.d.ts +462 -0
- package/dist/types/Notification.js +108 -0
- package/dist/types/Notification.js.map +1 -0
- package/dist/types/NotificationAndroid.d.ts +1311 -0
- package/dist/types/NotificationAndroid.js +406 -0
- package/dist/types/NotificationAndroid.js.map +1 -0
- package/dist/types/NotificationIOS.d.ts +539 -0
- package/dist/types/NotificationIOS.js +89 -0
- package/dist/types/NotificationIOS.js.map +1 -0
- package/dist/types/NotificationWeb.d.ts +5 -0
- package/dist/types/NotificationWeb.js +5 -0
- package/dist/types/NotificationWeb.js.map +1 -0
- package/dist/types/PowerManagerInfo.d.ts +36 -0
- package/dist/types/PowerManagerInfo.js +5 -0
- package/dist/types/PowerManagerInfo.js.map +1 -0
- package/dist/types/Trigger.d.ts +124 -0
- package/dist/types/Trigger.js +48 -0
- package/dist/types/Trigger.js.map +1 -0
- package/dist/utils/id.d.ts +1 -0
- package/dist/utils/id.js +12 -0
- package/dist/utils/id.js.map +1 -0
- package/dist/utils/index.d.ts +16 -0
- package/dist/utils/index.js +31 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/validate.d.ts +15 -0
- package/dist/utils/validate.js +75 -0
- package/dist/utils/validate.js.map +1 -0
- package/dist/validators/iosCommunicationInfo/validateIOSCommunicationInfo.d.ts +2 -0
- package/dist/validators/iosCommunicationInfo/validateIOSCommunicationInfo.js +45 -0
- package/dist/validators/iosCommunicationInfo/validateIOSCommunicationInfo.js.map +1 -0
- package/dist/validators/iosCommunicationInfo/validateIOSCommunicationInfoPerson.d.ts +2 -0
- package/dist/validators/iosCommunicationInfo/validateIOSCommunicationInfoPerson.js +24 -0
- package/dist/validators/iosCommunicationInfo/validateIOSCommunicationInfoPerson.js.map +1 -0
- package/dist/validators/validate.d.ts +25 -0
- package/dist/validators/validate.js +68 -0
- package/dist/validators/validate.js.map +1 -0
- package/dist/validators/validateAndroidAction.d.ts +2 -0
- package/dist/validators/validateAndroidAction.js +46 -0
- package/dist/validators/validateAndroidAction.js.map +1 -0
- package/dist/validators/validateAndroidChannel.d.ts +2 -0
- package/dist/validators/validateAndroidChannel.js +152 -0
- package/dist/validators/validateAndroidChannel.js.map +1 -0
- package/dist/validators/validateAndroidChannelGroup.d.ts +2 -0
- package/dist/validators/validateAndroidChannelGroup.js +39 -0
- package/dist/validators/validateAndroidChannelGroup.js.map +1 -0
- package/dist/validators/validateAndroidFullScreenAction.d.ts +2 -0
- package/dist/validators/validateAndroidFullScreenAction.js +47 -0
- package/dist/validators/validateAndroidFullScreenAction.js.map +1 -0
- package/dist/validators/validateAndroidInput.d.ts +2 -0
- package/dist/validators/validateAndroidInput.js +51 -0
- package/dist/validators/validateAndroidInput.js.map +1 -0
- package/dist/validators/validateAndroidNotification.d.ts +2 -0
- package/dist/validators/validateAndroidNotification.js +541 -0
- package/dist/validators/validateAndroidNotification.js.map +1 -0
- package/dist/validators/validateAndroidPressAction.d.ts +2 -0
- package/dist/validators/validateAndroidPressAction.js +47 -0
- package/dist/validators/validateAndroidPressAction.js.map +1 -0
- package/dist/validators/validateAndroidStyle.d.ts +22 -0
- package/dist/validators/validateAndroidStyle.js +222 -0
- package/dist/validators/validateAndroidStyle.js.map +1 -0
- package/dist/validators/validateIOSAttachment.d.ts +6 -0
- package/dist/validators/validateIOSAttachment.js +96 -0
- package/dist/validators/validateIOSAttachment.js.map +1 -0
- package/dist/validators/validateIOSCategory.d.ts +2 -0
- package/dist/validators/validateIOSCategory.js +118 -0
- package/dist/validators/validateIOSCategory.js.map +1 -0
- package/dist/validators/validateIOSCategoryAction.d.ts +2 -0
- package/dist/validators/validateIOSCategoryAction.js +53 -0
- package/dist/validators/validateIOSCategoryAction.js.map +1 -0
- package/dist/validators/validateIOSInput.d.ts +2 -0
- package/dist/validators/validateIOSInput.js +29 -0
- package/dist/validators/validateIOSInput.js.map +1 -0
- package/dist/validators/validateIOSNotification.d.ts +2 -0
- package/dist/validators/validateIOSNotification.js +205 -0
- package/dist/validators/validateIOSNotification.js.map +1 -0
- package/dist/validators/validateIOSPermissions.d.ts +2 -0
- package/dist/validators/validateIOSPermissions.js +59 -0
- package/dist/validators/validateIOSPermissions.js.map +1 -0
- package/dist/validators/validateNotification.d.ts +11 -0
- package/dist/validators/validateNotification.js +121 -0
- package/dist/validators/validateNotification.js.map +1 -0
- package/dist/validators/validateTrigger.d.ts +2 -0
- package/dist/validators/validateTrigger.js +107 -0
- package/dist/validators/validateTrigger.js.map +1 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +3 -0
- package/dist/version.js.map +1 -0
- package/ios/NotifeeCore/Info.plist +22 -0
- package/ios/NotifeeCore/NotifeeCore+NSNotificationCenter.h +28 -0
- package/ios/NotifeeCore/NotifeeCore+NSNotificationCenter.m +76 -0
- package/ios/NotifeeCore/NotifeeCore+NSURLSession.h +25 -0
- package/ios/NotifeeCore/NotifeeCore+NSURLSession.m +55 -0
- package/ios/NotifeeCore/NotifeeCore+UNUserNotificationCenter.h +44 -0
- package/ios/NotifeeCore/NotifeeCore+UNUserNotificationCenter.m +270 -0
- package/ios/NotifeeCore/NotifeeCore.h +118 -0
- package/ios/NotifeeCore/NotifeeCore.m +843 -0
- package/ios/NotifeeCore/NotifeeCoreDelegateHolder.h +34 -0
- package/ios/NotifeeCore/NotifeeCoreDelegateHolder.m +70 -0
- package/ios/NotifeeCore/NotifeeCoreDownloadDelegate.h +39 -0
- package/ios/NotifeeCore/NotifeeCoreDownloadDelegate.m +68 -0
- package/ios/NotifeeCore/NotifeeCoreExtensionHelper.h +38 -0
- package/ios/NotifeeCore/NotifeeCoreExtensionHelper.m +224 -0
- package/ios/NotifeeCore/NotifeeCoreUtil.h +81 -0
- package/ios/NotifeeCore/NotifeeCoreUtil.m +834 -0
- package/ios/RNNotifee/NotifeeApiModule.h +25 -0
- package/ios/RNNotifee/NotifeeApiModule.mm +421 -0
- package/ios/RNNotifee/NotifeeExtensionHelper.h +37 -0
- package/ios/RNNotifee/NotifeeExtensionHelper.m +37 -0
- package/ios/RNNotifee.xcodeproj/project.pbxproj +318 -0
- package/ios/RNNotifee.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/RNNotifee.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/jest-mock.js +162 -0
- package/package.json +85 -0
- package/react-native.config.js +11 -0
- package/src/NotifeeApiModule.ts +823 -0
- package/src/NotifeeJSEventEmitter.ts +10 -0
- package/src/NotifeeNativeError.ts +68 -0
- package/src/NotifeeNativeModule.ts +39 -0
- package/src/NotifeeNativeModule.web.ts +25 -0
- package/src/index.ts +33 -0
- package/src/specs/NativeNotifeeModule.ts +71 -0
- package/src/types/Library.ts +28 -0
- package/src/types/Module.ts +629 -0
- package/src/types/Notification.ts +518 -0
- package/src/types/NotificationAndroid.ts +1478 -0
- package/src/types/NotificationIOS.ts +683 -0
- package/src/types/NotificationWeb.ts +5 -0
- package/src/types/PowerManagerInfo.ts +43 -0
- package/src/types/Trigger.ts +136 -0
- package/src/utils/id.ts +13 -0
- package/src/utils/index.ts +46 -0
- package/src/utils/validate.ts +90 -0
- package/src/validators/iosCommunicationInfo/validateIOSCommunicationInfo.ts +61 -0
- package/src/validators/iosCommunicationInfo/validateIOSCommunicationInfoPerson.ts +33 -0
- package/src/validators/validate.ts +85 -0
- package/src/validators/validateAndroidAction.ts +54 -0
- package/src/validators/validateAndroidChannel.ts +188 -0
- package/src/validators/validateAndroidChannelGroup.ts +49 -0
- package/src/validators/validateAndroidFullScreenAction.ts +65 -0
- package/src/validators/validateAndroidInput.ts +67 -0
- package/src/validators/validateAndroidNotification.ts +734 -0
- package/src/validators/validateAndroidPressAction.ts +65 -0
- package/src/validators/validateAndroidStyle.ts +315 -0
- package/src/validators/validateIOSAttachment.ts +135 -0
- package/src/validators/validateIOSCategory.ts +150 -0
- package/src/validators/validateIOSCategoryAction.ts +65 -0
- package/src/validators/validateIOSInput.ts +38 -0
- package/src/validators/validateIOSNotification.ts +296 -0
- package/src/validators/validateIOSPermissions.ts +78 -0
- package/src/validators/validateNotification.ts +156 -0
- package/src/validators/validateTrigger.ts +142 -0
- package/src/version.ts +2 -0
- package/tsconfig.json +27 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
Apache-2.0 License
|
|
2
|
+
------------------
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2016-present Invertase Limited <oss@invertase.io>
|
|
5
|
+
|
|
6
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
you may not use this library except in compliance with the License.
|
|
8
|
+
|
|
9
|
+
You may obtain a copy of the Apache-2.0 License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
Creative Commons Attribution 3.0 License
|
|
22
|
+
----------------------------------------
|
|
23
|
+
|
|
24
|
+
Copyright (c) 2016-present Invertase Limited <oss@invertase.io>
|
|
25
|
+
|
|
26
|
+
Documentation and other instructional materials provided for this project
|
|
27
|
+
(including on a separate documentation repository or it's documentation website) are
|
|
28
|
+
licensed under the Creative Commons Attribution 3.0 License. Code samples/blocks
|
|
29
|
+
contained therein are licensed under the Apache License, Version 2.0 (the "License"), as above.
|
|
30
|
+
|
|
31
|
+
You may obtain a copy of the Creative Commons Attribution 3.0 License at
|
|
32
|
+
|
|
33
|
+
https://creativecommons.org/licenses/by/3.0/
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
Notifee Core
|
|
38
|
+
------------
|
|
39
|
+
|
|
40
|
+
The Notifee "core" submodule on Android/iOS was originally distributed by
|
|
41
|
+
Invertase Limited in minified & obfuscated form under a proprietary license.
|
|
42
|
+
|
|
43
|
+
In this fork (react-native-notify-kit), the core source code is distributed
|
|
44
|
+
under the Apache License, Version 2.0, as part of the open-source project.
|
package/README.md
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# react-native-notify-kit
|
|
2
|
+
|
|
3
|
+
A feature-rich local and push notification library for React Native (Android & iOS).
|
|
4
|
+
|
|
5
|
+
Maintained fork of [Notifee](https://github.com/invertase/notifee) — New Architecture only (TurboModules).
|
|
6
|
+
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
- React Native >= 0.73 (New Architecture required)
|
|
10
|
+
- Android: minSdk 24, compileSdk 35
|
|
11
|
+
- iOS: deployment target 15.1+
|
|
12
|
+
- Node.js >= 22
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
yarn add react-native-notify-kit
|
|
18
|
+
# or
|
|
19
|
+
npm install react-native-notify-kit
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### iOS
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
cd ios && pod install
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Android
|
|
29
|
+
|
|
30
|
+
No additional steps — the library is auto-linked via React Native CLI.
|
|
31
|
+
|
|
32
|
+
## Quick Start
|
|
33
|
+
|
|
34
|
+
### 1. Request permission (required on Android 13+ and iOS)
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import notifee from 'react-native-notify-kit';
|
|
38
|
+
|
|
39
|
+
const settings = await notifee.requestPermission();
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 2. Create a channel (Android only, required for Android 8+)
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import notifee, { AndroidImportance } from 'react-native-notify-kit';
|
|
46
|
+
|
|
47
|
+
await notifee.createChannel({
|
|
48
|
+
id: 'default',
|
|
49
|
+
name: 'Default Channel',
|
|
50
|
+
importance: AndroidImportance.HIGH,
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 3. Display a notification
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
await notifee.displayNotification({
|
|
58
|
+
title: 'Hello',
|
|
59
|
+
body: 'This is a local notification',
|
|
60
|
+
android: { channelId: 'default' },
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 4. Handle events
|
|
65
|
+
|
|
66
|
+
In your `index.js` (before `AppRegistry.registerComponent`):
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
import notifee from 'react-native-notify-kit';
|
|
70
|
+
|
|
71
|
+
// Background/killed state events
|
|
72
|
+
notifee.onBackgroundEvent(async ({ type, detail }) => {
|
|
73
|
+
console.log('Background event:', type, detail.notification?.id);
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
In your React component:
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
import { useEffect } from 'react';
|
|
81
|
+
import notifee, { EventType } from 'react-native-notify-kit';
|
|
82
|
+
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
return notifee.onForegroundEvent(({ type, detail }) => {
|
|
85
|
+
if (type === EventType.PRESS) {
|
|
86
|
+
console.log('Notification pressed:', detail.notification?.id);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}, []);
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Push Notifications (Firebase)
|
|
93
|
+
|
|
94
|
+
This library handles notification **display and management**. For receiving push notifications, pair it with [`@react-native-firebase/messaging`](https://rnfirebase.io/messaging/usage):
|
|
95
|
+
|
|
96
|
+
### Android setup
|
|
97
|
+
|
|
98
|
+
1. Add Firebase dependencies to your app:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
yarn add @react-native-firebase/app @react-native-firebase/messaging
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
2. Add the google-services plugin to `android/build.gradle`:
|
|
105
|
+
|
|
106
|
+
```gradle
|
|
107
|
+
classpath("com.google.gms:google-services:4.4.2")
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
3. Apply the plugin in `android/app/build.gradle`:
|
|
111
|
+
|
|
112
|
+
```gradle
|
|
113
|
+
apply plugin: "com.google.gms.google-services"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
4. Download `google-services.json` from [Firebase Console](https://console.firebase.google.com/) and place it in `android/app/`.
|
|
117
|
+
|
|
118
|
+
5. Add `POST_NOTIFICATIONS` permission to `AndroidManifest.xml` (required for Android 13+):
|
|
119
|
+
|
|
120
|
+
```xml
|
|
121
|
+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### iOS setup
|
|
125
|
+
|
|
126
|
+
1. Download `GoogleService-Info.plist` from Firebase Console and add it to your Xcode project.
|
|
127
|
+
|
|
128
|
+
2. Enable **Push Notifications** capability in Xcode:
|
|
129
|
+
- Select your target > **Signing & Capabilities** > **+ Capability** > **Push Notifications**
|
|
130
|
+
|
|
131
|
+
3. Enable **Background Modes** > **Remote notifications**:
|
|
132
|
+
- Select your target > **Signing & Capabilities** > **+ Capability** > **Background Modes** > check **Remote notifications**
|
|
133
|
+
|
|
134
|
+
4. Configure APNs certificates or keys in Firebase Console > Project Settings > Cloud Messaging.
|
|
135
|
+
|
|
136
|
+
### Display a push notification
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
import messaging from '@react-native-firebase/messaging';
|
|
140
|
+
import notifee from 'react-native-notify-kit';
|
|
141
|
+
|
|
142
|
+
messaging().onMessage(async remoteMessage => {
|
|
143
|
+
await notifee.displayNotification({
|
|
144
|
+
title: remoteMessage.notification?.title,
|
|
145
|
+
body: remoteMessage.notification?.body,
|
|
146
|
+
android: { channelId: 'default' },
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## iOS Notification Service Extension
|
|
152
|
+
|
|
153
|
+
To modify push notification content before display (e.g., attach images), create a Notification Service Extension:
|
|
154
|
+
|
|
155
|
+
1. In Xcode: **File > New > Target > Notification Service Extension**
|
|
156
|
+
2. Add to your Podfile:
|
|
157
|
+
|
|
158
|
+
```ruby
|
|
159
|
+
target 'YourNSETarget' do
|
|
160
|
+
pod 'RNNotifeeCore', :path => '../node_modules/react-native-notify-kit'
|
|
161
|
+
end
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
3. Use `NotifeeExtensionHelper` in your `NotificationService.m`:
|
|
165
|
+
|
|
166
|
+
```objc
|
|
167
|
+
#import "NotifeeExtensionHelper.h"
|
|
168
|
+
|
|
169
|
+
- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request
|
|
170
|
+
withContentHandler:(void (^)(UNNotificationContent *))contentHandler {
|
|
171
|
+
self.contentHandler = contentHandler;
|
|
172
|
+
self.bestAttemptContent = [request.content mutableCopy];
|
|
173
|
+
[NotifeeExtensionHelper populateNotificationContent:request
|
|
174
|
+
withContent:self.bestAttemptContent
|
|
175
|
+
withContentHandler:contentHandler];
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
4. Run `cd ios && pod install`
|
|
180
|
+
|
|
181
|
+
## Jest Testing
|
|
182
|
+
|
|
183
|
+
Mock the native module in your Jest setup file:
|
|
184
|
+
|
|
185
|
+
```js
|
|
186
|
+
// jest.setup.js
|
|
187
|
+
jest.mock('react-native-notify-kit', () => require('react-native-notify-kit/jest-mock'));
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Add to your Jest config:
|
|
191
|
+
|
|
192
|
+
```js
|
|
193
|
+
setupFiles: ['<rootDir>/jest.setup.js'],
|
|
194
|
+
transformIgnorePatterns: [
|
|
195
|
+
'node_modules/(?!(jest-)?react-native|@react-native|react-native-notify-kit)'
|
|
196
|
+
],
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## Documentation
|
|
200
|
+
|
|
201
|
+
The upstream Notifee documentation remains a valid reference for the API:
|
|
202
|
+
|
|
203
|
+
- [Overview](https://docs.page/marcocrupi/react-native-notify-kit/react-native/overview)
|
|
204
|
+
- [API Reference](https://docs.page/marcocrupi/react-native-notify-kit/react-native/reference)
|
|
205
|
+
- [Android Guides](https://docs.page/marcocrupi/react-native-notify-kit/react-native/android/channels)
|
|
206
|
+
- [iOS Guides](https://docs.page/marcocrupi/react-native-notify-kit/react-native/ios/permissions)
|
|
207
|
+
|
|
208
|
+
## License
|
|
209
|
+
|
|
210
|
+
Apache-2.0 — see [LICENSE](/LICENSE).
|
|
211
|
+
|
|
212
|
+
Originally built by [Invertase](https://invertase.io). This fork is independently maintained by Marco Crupi.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
require 'json'
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "RNNotifee"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.description = package["description"]
|
|
9
|
+
s.summary = <<-DESC
|
|
10
|
+
A feature rich local notifications library for React Native Android & iOS.
|
|
11
|
+
DESC
|
|
12
|
+
s.homepage = "https://github.com/marcocrupi/react-native-notify-kit"
|
|
13
|
+
s.license = package['license']
|
|
14
|
+
s.authors = "Marco Crupi"
|
|
15
|
+
s.source = { :git => "https://github.com/marcocrupi/react-native-notify-kit", :tag => "react-native-notify-kit@#{s.version}" }
|
|
16
|
+
|
|
17
|
+
s.cocoapods_version = '>= 1.10.0'
|
|
18
|
+
s.platforms = { :ios => '15.1' }
|
|
19
|
+
|
|
20
|
+
install_modules_dependencies(s)
|
|
21
|
+
s.source_files = 'ios/RNNotifee/*.{h,m,mm,cpp}'
|
|
22
|
+
|
|
23
|
+
if defined?($NotifeeCoreFromSources) && $NotifeeCoreFromSources == true
|
|
24
|
+
# internal dev flag used by Notifee devs, ignore
|
|
25
|
+
Pod::UI.warn "RNNotifee: Using NotifeeCore from sources."
|
|
26
|
+
s.dependency 'NotifeeCore'
|
|
27
|
+
elsif defined?($NotifeeExtension) && $NotifeeExtension == true
|
|
28
|
+
# App uses Notification Service Extension
|
|
29
|
+
Pod::UI.warn "RNNotifee: using Notification Service Extension."
|
|
30
|
+
s.dependency 'RNNotifeeCore'
|
|
31
|
+
else
|
|
32
|
+
s.subspec "NotifeeCore" do |ss|
|
|
33
|
+
ss.source_files = "ios/NotifeeCore/*.{h,mm,m}"
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
require 'json'
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "RNNotifeeCore"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.description = package["description"]
|
|
9
|
+
s.summary = <<-DESC
|
|
10
|
+
A feature rich local notifications library for React Native Android & iOS.
|
|
11
|
+
DESC
|
|
12
|
+
s.homepage = "https://github.com/marcocrupi/react-native-notify-kit"
|
|
13
|
+
s.license = package['license']
|
|
14
|
+
s.authors = "Marco Crupi"
|
|
15
|
+
s.source = { :git => "https://github.com/marcocrupi/react-native-notify-kit", :tag => "react-native-notify-kit@#{s.version}" }
|
|
16
|
+
|
|
17
|
+
s.cocoapods_version = '>= 1.10.0'
|
|
18
|
+
s.ios.deployment_target = '15.1'
|
|
19
|
+
|
|
20
|
+
if defined?($NotifeeCoreFromSources) && $NotifeeCoreFromSources == true
|
|
21
|
+
# internal dev flag used by Notifee devs, ignore
|
|
22
|
+
Pod::UI.warn "RNNotifeeCore: Using NotifeeCore from sources."
|
|
23
|
+
s.dependency 'NotifeeCore'
|
|
24
|
+
else
|
|
25
|
+
s.subspec "NotifeeCore" do |ss|
|
|
26
|
+
ss.source_files = "ios/NotifeeCore/*.{h,mm,m}"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
s.source_files = ['ios/RNNotifee/NotifeeExtensionHelper.h', 'ios/RNNotifee/NotifeeExtensionHelper.m']
|
|
31
|
+
s.public_header_files = ['ios/RNNotifee/NotifeeExtensionHelper.h']
|
|
32
|
+
end
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import java.nio.file.Paths
|
|
2
|
+
|
|
3
|
+
buildscript {
|
|
4
|
+
// The Android Gradle plugin is only required when opening the android folder stand-alone.
|
|
5
|
+
// This avoids unnecessary downloads and potential conflicts when the library is included as a
|
|
6
|
+
// module dependency in an application project.
|
|
7
|
+
if (project == rootProject) {
|
|
8
|
+
repositories {
|
|
9
|
+
google()
|
|
10
|
+
mavenCentral()
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
dependencies {
|
|
14
|
+
classpath("com.android.tools.build:gradle:8.2.2")
|
|
15
|
+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.24")
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
plugins {
|
|
21
|
+
id "com.android.library"
|
|
22
|
+
id "com.facebook.react"
|
|
23
|
+
id "org.jetbrains.kotlin.android"
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// https://github.com/facebook/react-native/blob/a70354df12ef71aec08583cca4f1fed5fb77d874/ReactAndroid/build.gradle#L168-L201
|
|
27
|
+
def findNodeModulePath(baseDir, packageName) {
|
|
28
|
+
def basePath = baseDir.toPath().normalize()
|
|
29
|
+
// Node's module resolution algorithm searches up to the root directory,
|
|
30
|
+
// after which the base path will be null
|
|
31
|
+
while (basePath) {
|
|
32
|
+
def candidatePath = Paths.get(basePath.toString(), "node_modules", packageName)
|
|
33
|
+
if (candidatePath.toFile().exists()) {
|
|
34
|
+
return candidatePath.toString()
|
|
35
|
+
}
|
|
36
|
+
basePath = basePath.getParent()
|
|
37
|
+
}
|
|
38
|
+
return null
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
def notifeeDir = findNodeModulePath(projectDir, "react-native-notify-kit") ?: "$rootDir/../node_modules/react-native-notify-kit"
|
|
42
|
+
println ":${project.name} react-native-notify-kit found at $notifeeDir"
|
|
43
|
+
|
|
44
|
+
if (project.hasProperty('reactNativeProjects')) {
|
|
45
|
+
reactNativeProjects.each { dependent ->
|
|
46
|
+
project.evaluationDependsOn(dependent)
|
|
47
|
+
}
|
|
48
|
+
} else {
|
|
49
|
+
project.evaluationDependsOn(':app')
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
android {
|
|
53
|
+
namespace = "io.invertase.notifee"
|
|
54
|
+
compileSdk = 35
|
|
55
|
+
|
|
56
|
+
defaultConfig {
|
|
57
|
+
minSdk = 24
|
|
58
|
+
targetSdk = 35
|
|
59
|
+
multiDexEnabled true
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
lint {
|
|
63
|
+
disable 'GradleCompatible'
|
|
64
|
+
abortOnError false
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
compileOptions {
|
|
68
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
69
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
kotlinOptions {
|
|
73
|
+
jvmTarget = "17"
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
sourceSets {
|
|
77
|
+
main {
|
|
78
|
+
kotlin.srcDirs += 'src/main/kotlin'
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
buildTypes {
|
|
83
|
+
release {
|
|
84
|
+
consumerProguardFiles 'proguard-rules.pro'
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
repositories {
|
|
90
|
+
google()
|
|
91
|
+
mavenCentral()
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
dependencies {
|
|
95
|
+
if (findProject(':notifee_core')) {
|
|
96
|
+
implementation findProject(':notifee_core')
|
|
97
|
+
} else {
|
|
98
|
+
implementation(group: 'app.notifee', name:'core', version: '+')
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
implementation("com.google.guava:guava:33.3.1-android") // https://github.com/google/guava
|
|
102
|
+
implementation 'androidx.concurrent:concurrent-futures:1.1.0' // https://developer.android.com/jetpack/androidx/releases/concurrent
|
|
103
|
+
implementation 'androidx.work:work-runtime:2.8.0' // https://developer.android.com/jetpack/androidx/releases/work
|
|
104
|
+
implementation 'org.greenrobot:eventbus:3.3.1' // https://github.com/greenrobot/EventBus/releases
|
|
105
|
+
implementation 'androidx.lifecycle:lifecycle-process:2.3.1'
|
|
106
|
+
|
|
107
|
+
//noinspection GradleDynamicVersion
|
|
108
|
+
implementation 'com.facebook.react:react-android:+'
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
rootProject.allprojects {
|
|
112
|
+
repositories {
|
|
113
|
+
maven {
|
|
114
|
+
url "$notifeeDir/android/libs"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
NOTIFEE=1
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
f352cf9592f99de18ac58c980a8044d1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
fab0922062b4bb8449ee33b3a21ff4abd728ff5a
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
8e0fa882e60961a03635ef54c8ed8f5d69031fbcdf659d2ee93434a5ad12994a
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
4f5fb568dc9c197c6162d1acaa69dbfea44d785785f8aede60fe2c559451558740de092a1adce5cac54cd2f91394c3075667aa3023b8392926afb3a92debb528
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
|
3
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
|
4
|
+
<modelVersion>4.0.0</modelVersion>
|
|
5
|
+
<groupId>app.notifee</groupId>
|
|
6
|
+
<artifactId>core</artifactId>
|
|
7
|
+
<version>202108261754</version>
|
|
8
|
+
<packaging>aar</packaging>
|
|
9
|
+
</project>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
4f6e0cf891e903f91ee3093356815b7a
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
692dedb13cd922156e38dc5f6bcfba86e4141932
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
4f7ea80d7045abd14e8a836ec3a8299a245994b8bbcff7e30d2e3ae7f523c9ec
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
79244ae770a7c732e5eb33d72ca3e707398ae33d0db8e104d63690fecdb156d9cc040571f09baab30ffb19db3ac00b0283b74f581c1245069b4bf477c590732b
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<metadata>
|
|
3
|
+
<groupId>app.notifee</groupId>
|
|
4
|
+
<artifactId>core</artifactId>
|
|
5
|
+
<versioning>
|
|
6
|
+
<latest>202108261754</latest>
|
|
7
|
+
<release>202108261754</release>
|
|
8
|
+
<versions>
|
|
9
|
+
<version>202108261754</version>
|
|
10
|
+
</versions>
|
|
11
|
+
<lastUpdated>20260404125644</lastUpdated>
|
|
12
|
+
</versioning>
|
|
13
|
+
</metadata>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
5e530bbfa8e06f617c34dd000d0824e5
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
7326f2554939bcf65817328815b9504e22026ad1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cfb3bc703b70421c56b6a4b004d7b8bcada5647eaa2bcfd5dde5e31a46f66e99
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
c139bb9a938cdc3ca121e2fc7d42a7594cc748837d9dfec51023a0e42e831c69ad01084f3a9224489d5650811164df0dc70a7404398ff1ea2146781441d99d94
|
package/android/lint.xml
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
-keep class io.invertase.notifee.NotifeeEventSubscriber
|
|
2
|
+
-keep class io.invertase.notifee.NotifeeInitProvider
|
|
3
|
+
-keepnames class io.invertase.notifee.NotifeePackage
|
|
4
|
+
-keepnames class io.invertase.notifee.NotifeeApiModule
|
|
5
|
+
|
|
6
|
+
# We depend on certain classes to exist under their names for dynamic
|
|
7
|
+
# class-loading to work. We use this to handle new arch / old arch backwards
|
|
8
|
+
# compatibility despite the class names moving around
|
|
9
|
+
-keep class com.facebook.react.defaults.DefaultNewArchitectureEntryPoint { *; }
|
|
10
|
+
-keep class com.facebook.react.ReactApplication { *; }
|
|
11
|
+
-keep class com.facebook.react.ReactHost { *; }
|
|
12
|
+
-keep class * extends com.facebook.react.ReactHost { *; }
|
|
13
|
+
-keepnames class com.facebook.react.ReactActivity
|
|
14
|
+
|
|
15
|
+
# Preserve all annotations.
|
|
16
|
+
-keepattributes *Annotation*
|
|
17
|
+
|
|
18
|
+
# Keep the classes/members we need for client functionality.
|
|
19
|
+
-keep @interface androidx.annotation.Keep
|
|
20
|
+
-keep @androidx.annotation.Keep class *
|
|
21
|
+
-keepclasseswithmembers class * {
|
|
22
|
+
@androidx.annotation.Keep <fields>;
|
|
23
|
+
}
|
|
24
|
+
-keepclasseswithmembers class * {
|
|
25
|
+
@androidx.annotation.Keep <methods>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
# Keep the classes/members we need for client functionality.
|
|
29
|
+
-keep @interface app.notifee.core.KeepForSdk
|
|
30
|
+
-keep @app.notifee.core.KeepForSdk class *
|
|
31
|
+
-keepclasseswithmembers class * {
|
|
32
|
+
@app.notifee.core.KeepForSdk <fields>;
|
|
33
|
+
}
|
|
34
|
+
-keepclasseswithmembers class * {
|
|
35
|
+
@app.notifee.core.KeepForSdk <methods>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
# Preserve all .class method names.
|
|
39
|
+
-keepclassmembernames class * {
|
|
40
|
+
java.lang.Class class$(java.lang.String);
|
|
41
|
+
java.lang.Class class$(java.lang.String, boolean);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
# Preserve all native method names and the names of their classes.
|
|
45
|
+
-keepclasseswithmembernames class * {
|
|
46
|
+
native <methods>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
# Preserve the special static methods that are required in all enumeration
|
|
50
|
+
# classes.
|
|
51
|
+
-keepclassmembers class * extends java.lang.Enum {
|
|
52
|
+
public static **[] values();
|
|
53
|
+
public static ** valueOf(java.lang.String);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
# --------------------------------
|
|
57
|
+
# LIBRARIES
|
|
58
|
+
# --------------------------------
|
|
59
|
+
|
|
60
|
+
# Work Manager
|
|
61
|
+
-keepclassmembers class * extends androidx.work.ListenableWorker {
|
|
62
|
+
public <init>(android.content.Context,androidx.work.WorkerParameters);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
# EventBus
|
|
66
|
+
-keepclassmembers class * {
|
|
67
|
+
@org.greenrobot.eventbus.Subscribe <methods>;
|
|
68
|
+
}
|
|
69
|
+
-keep enum org.greenrobot.eventbus.ThreadMode { *; }
|
|
70
|
+
|
|
71
|
+
# Only required if you use AsyncExecutor
|
|
72
|
+
-keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {
|
|
73
|
+
<init>(java.lang.Throwable);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
# OkHttp3
|
|
77
|
+
-dontwarn okio.**
|
|
78
|
+
-dontwarn okhttp3.**
|
|
79
|
+
-dontwarn javax.annotation.**
|
|
80
|
+
-dontwarn org.conscrypt.**
|
|
81
|
+
# A resource is loaded with a relative path so the package of this class must be preserved.
|
|
82
|
+
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
rootProject.name = 'react-native-notify-kit'
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
package="io.invertase.notifee">
|
|
4
|
+
|
|
5
|
+
<application>
|
|
6
|
+
<provider
|
|
7
|
+
android:name=".NotifeeInitProvider"
|
|
8
|
+
android:authorities="${applicationId}.notifee-init-provider"
|
|
9
|
+
android:exported="false"
|
|
10
|
+
android:initOrder="-100" />
|
|
11
|
+
</application>
|
|
12
|
+
</manifest>
|