@ammarahmed/notifee-react-native 7.3.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/.gitattributes +3 -0
- package/LICENSE +44 -0
- package/README.md +131 -0
- package/RNNotifee.podspec +39 -0
- package/RNNotifeeCore.podspec +33 -0
- package/android/build.gradle +116 -0
- package/android/gradle.properties +1 -0
- package/android/libs/app/notifee/core/202108261756/core-202108261756.aar +0 -0
- package/android/libs/app/notifee/core/202108261756/core-202108261756.aar.md5 +1 -0
- package/android/libs/app/notifee/core/202108261756/core-202108261756.aar.sha1 +1 -0
- package/android/libs/app/notifee/core/202108261756/core-202108261756.aar.sha256 +1 -0
- package/android/libs/app/notifee/core/202108261756/core-202108261756.aar.sha512 +1 -0
- package/android/libs/app/notifee/core/202108261756/core-202108261756.pom +9 -0
- package/android/libs/app/notifee/core/202108261756/core-202108261756.pom.md5 +1 -0
- package/android/libs/app/notifee/core/202108261756/core-202108261756.pom.sha1 +1 -0
- package/android/libs/app/notifee/core/202108261756/core-202108261756.pom.sha256 +1 -0
- package/android/libs/app/notifee/core/202108261756/core-202108261756.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 +74 -0
- package/android/settings.gradle +1 -0
- package/android/src/main/AndroidManifest.xml +12 -0
- package/android/src/main/java/io/invertase/notifee/NotifeeApiModule.java +349 -0
- package/android/src/main/java/io/invertase/notifee/NotifeeEventSubscriber.java +118 -0
- package/android/src/main/java/io/invertase/notifee/NotifeeInitProvider.java +55 -0
- package/android/src/main/java/io/invertase/notifee/NotifeePackage.java +30 -0
- package/android/src/main/java/io/invertase/notifee/NotifeeReactUtils.java +244 -0
- package/app.plugin.js +1 -0
- package/dist/NotifeeApiModule.d.ts +53 -0
- package/dist/NotifeeApiModule.js +607 -0
- package/dist/NotifeeApiModule.js.map +1 -0
- package/dist/NotifeeJSEventEmitter.d.ts +3 -0
- package/dist/NotifeeJSEventEmitter.js +14 -0
- package/dist/NotifeeJSEventEmitter.js.map +1 -0
- package/dist/NotifeeNativeError.d.ts +15 -0
- package/dist/NotifeeNativeError.js +61 -0
- package/dist/NotifeeNativeError.js.map +1 -0
- package/dist/NotifeeNativeModule.d.ts +14 -0
- package/dist/NotifeeNativeModule.js +43 -0
- package/dist/NotifeeNativeModule.js.map +1 -0
- package/dist/NotifeeNativeModule.web.d.ts +12 -0
- package/dist/NotifeeNativeModule.web.js +19 -0
- package/dist/NotifeeNativeModule.web.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/types/Library.d.ts +21 -0
- package/dist/types/Library.js +6 -0
- package/dist/types/Library.js.map +1 -0
- package/dist/types/Module.d.ts +572 -0
- package/dist/types/Module.js +6 -0
- package/dist/types/Module.js.map +1 -0
- package/dist/types/Notification.d.ts +450 -0
- package/dist/types/Notification.js +105 -0
- package/dist/types/Notification.js.map +1 -0
- package/dist/types/NotificationAndroid.d.ts +1276 -0
- package/dist/types/NotificationAndroid.js +380 -0
- package/dist/types/NotificationAndroid.js.map +1 -0
- package/dist/types/NotificationIOS.d.ts +537 -0
- package/dist/types/NotificationIOS.js +92 -0
- package/dist/types/NotificationIOS.js.map +1 -0
- package/dist/types/NotificationWeb.d.ts +5 -0
- package/dist/types/NotificationWeb.js +3 -0
- package/dist/types/NotificationWeb.js.map +1 -0
- package/dist/types/PowerManagerInfo.d.ts +36 -0
- package/dist/types/PowerManagerInfo.js +6 -0
- package/dist/types/PowerManagerInfo.js.map +1 -0
- package/dist/types/Trigger.d.ts +108 -0
- package/dist/types/Trigger.js +39 -0
- package/dist/types/Trigger.js.map +1 -0
- package/dist/utils/id.d.ts +1 -0
- package/dist/utils/id.js +16 -0
- package/dist/utils/id.js.map +1 -0
- package/dist/utils/index.d.ts +16 -0
- package/dist/utils/index.js +52 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/validate.d.ts +15 -0
- package/dist/utils/validate.js +93 -0
- package/dist/utils/validate.js.map +1 -0
- package/dist/validators/iosCommunicationInfo/validateIOSCommunicationInfo.d.ts +2 -0
- package/dist/validators/iosCommunicationInfo/validateIOSCommunicationInfo.js +39 -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 +27 -0
- package/dist/validators/iosCommunicationInfo/validateIOSCommunicationInfoPerson.js.map +1 -0
- package/dist/validators/validate.d.ts +25 -0
- package/dist/validators/validate.js +75 -0
- package/dist/validators/validate.js.map +1 -0
- package/dist/validators/validateAndroidAction.d.ts +2 -0
- package/dist/validators/validateAndroidAction.js +52 -0
- package/dist/validators/validateAndroidAction.js.map +1 -0
- package/dist/validators/validateAndroidChannel.d.ts +2 -0
- package/dist/validators/validateAndroidChannel.js +155 -0
- package/dist/validators/validateAndroidChannel.js.map +1 -0
- package/dist/validators/validateAndroidChannelGroup.d.ts +2 -0
- package/dist/validators/validateAndroidChannelGroup.js +42 -0
- package/dist/validators/validateAndroidChannelGroup.js.map +1 -0
- package/dist/validators/validateAndroidFullScreenAction.d.ts +2 -0
- package/dist/validators/validateAndroidFullScreenAction.js +50 -0
- package/dist/validators/validateAndroidFullScreenAction.js.map +1 -0
- package/dist/validators/validateAndroidInput.d.ts +2 -0
- package/dist/validators/validateAndroidInput.js +54 -0
- package/dist/validators/validateAndroidInput.js.map +1 -0
- package/dist/validators/validateAndroidNotification.d.ts +2 -0
- package/dist/validators/validateAndroidNotification.js +529 -0
- package/dist/validators/validateAndroidNotification.js.map +1 -0
- package/dist/validators/validateAndroidPressAction.d.ts +2 -0
- package/dist/validators/validateAndroidPressAction.js +50 -0
- package/dist/validators/validateAndroidPressAction.js.map +1 -0
- package/dist/validators/validateAndroidStyle.d.ts +22 -0
- package/dist/validators/validateAndroidStyle.js +231 -0
- package/dist/validators/validateAndroidStyle.js.map +1 -0
- package/dist/validators/validateIOSAttachment.d.ts +6 -0
- package/dist/validators/validateIOSAttachment.js +102 -0
- package/dist/validators/validateIOSAttachment.js.map +1 -0
- package/dist/validators/validateIOSCategory.d.ts +2 -0
- package/dist/validators/validateIOSCategory.js +124 -0
- package/dist/validators/validateIOSCategory.js.map +1 -0
- package/dist/validators/validateIOSCategoryAction.d.ts +2 -0
- package/dist/validators/validateIOSCategoryAction.js +59 -0
- package/dist/validators/validateIOSCategoryAction.js.map +1 -0
- package/dist/validators/validateIOSInput.d.ts +2 -0
- package/dist/validators/validateIOSInput.js +32 -0
- package/dist/validators/validateIOSInput.js.map +1 -0
- package/dist/validators/validateIOSNotification.d.ts +2 -0
- package/dist/validators/validateIOSNotification.js +211 -0
- package/dist/validators/validateIOSNotification.js.map +1 -0
- package/dist/validators/validateIOSPermissions.d.ts +2 -0
- package/dist/validators/validateIOSPermissions.js +62 -0
- package/dist/validators/validateIOSPermissions.js.map +1 -0
- package/dist/validators/validateNotification.d.ts +11 -0
- package/dist/validators/validateNotification.js +129 -0
- package/dist/validators/validateNotification.js.map +1 -0
- package/dist/validators/validateTrigger.d.ts +2 -0
- package/dist/validators/validateTrigger.js +104 -0
- package/dist/validators/validateTrigger.js.map +1 -0
- package/dist/version.d.ts +1 -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 +72 -0
- package/ios/NotifeeCore/NotifeeCore+NSURLSession.h +25 -0
- package/ios/NotifeeCore/NotifeeCore+NSURLSession.m +55 -0
- package/ios/NotifeeCore/NotifeeCore+UNUserNotificationCenter.h +37 -0
- package/ios/NotifeeCore/NotifeeCore+UNUserNotificationCenter.m +242 -0
- package/ios/NotifeeCore/NotifeeCore.h +118 -0
- package/ios/NotifeeCore/NotifeeCore.m +784 -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 +82 -0
- package/ios/NotifeeCore/NotifeeCoreUtil.m +793 -0
- package/ios/RNNotifee/NotifeeApiModule.h +25 -0
- package/ios/RNNotifee/NotifeeApiModule.m +371 -0
- package/ios/RNNotifee/NotifeeExtensionHelper.h +37 -0
- package/ios/RNNotifee/NotifeeExtensionHelper.m +37 -0
- package/ios/RNNotifee.xcodeproj/project.pbxproj +318 -0
- package/jest-mock.js +158 -0
- package/package.json +59 -0
- package/plugin/build/index.d.ts +3 -0
- package/plugin/build/index.js +12 -0
- package/plugin/build/index.js.map +1 -0
- package/plugin/build/withNotifeeProjectGradlePlugin.d.ts +5 -0
- package/plugin/build/withNotifeeProjectGradlePlugin.js +24 -0
- package/plugin/build/withNotifeeProjectGradlePlugin.js.map +1 -0
- package/plugin/src/index.ts +9 -0
- package/plugin/src/withNotifeeProjectGradlePlugin.ts +27 -0
- package/plugin/tsconfig.json +9 -0
- package/react-native.config.js +11 -0
- package/refresh-example.sh +71 -0
- package/src/NotifeeApiModule.ts +825 -0
- package/src/NotifeeJSEventEmitter.ts +11 -0
- package/src/NotifeeNativeError.ts +70 -0
- package/src/NotifeeNativeModule.ts +55 -0
- package/src/NotifeeNativeModule.web.ts +25 -0
- package/src/index.ts +33 -0
- package/src/types/Library.ts +28 -0
- package/src/types/Module.ts +625 -0
- package/src/types/Notification.ts +505 -0
- package/src/types/NotificationAndroid.ts +1443 -0
- package/src/types/NotificationIOS.ts +681 -0
- package/src/types/NotificationWeb.ts +5 -0
- package/src/types/PowerManagerInfo.ts +43 -0
- package/src/types/Trigger.ts +118 -0
- package/src/utils/id.ts +13 -0
- package/src/utils/index.ts +47 -0
- package/src/utils/validate.ts +92 -0
- package/src/validators/iosCommunicationInfo/validateIOSCommunicationInfo.ts +45 -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 +704 -0
- package/src/validators/validateAndroidPressAction.ts +65 -0
- package/src/validators/validateAndroidStyle.ts +315 -0
- package/src/validators/validateIOSAttachment.ts +136 -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 +134 -0
- package/src/version.ts +2 -0
- package/tsconfig.json +23 -0
|
@@ -0,0 +1,625 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { Event, ForegroundServiceTask, InitialNotification, Notification } from './Notification';
|
|
6
|
+
import { Trigger } from './Trigger';
|
|
7
|
+
import {
|
|
8
|
+
AndroidChannel,
|
|
9
|
+
AndroidChannelGroup,
|
|
10
|
+
NativeAndroidChannel,
|
|
11
|
+
NativeAndroidChannelGroup,
|
|
12
|
+
} from './NotificationAndroid';
|
|
13
|
+
import { IOSNotificationCategory, IOSNotificationPermissions } from './NotificationIOS';
|
|
14
|
+
import { PowerManagerInfo } from './PowerManagerInfo';
|
|
15
|
+
import { DisplayedNotification, NotificationSettings, TriggerNotification } from '..';
|
|
16
|
+
|
|
17
|
+
export interface Module {
|
|
18
|
+
/**
|
|
19
|
+
* API used to cancel all notifications.
|
|
20
|
+
*
|
|
21
|
+
* The `cancelAllNotifications` API removes any displayed notifications from the users device and
|
|
22
|
+
* any pending trigger notifications.
|
|
23
|
+
*
|
|
24
|
+
* This method does not cancel Android [Foreground Service](/react-native/docs/android/foreground-service)
|
|
25
|
+
* notifications.
|
|
26
|
+
*/
|
|
27
|
+
cancelAllNotifications(notificationIds?: string[]): Promise<void>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* API used to cancel any displayed notifications.
|
|
31
|
+
*
|
|
32
|
+
* This method does not cancel Android [Foreground Service](/react-native/docs/android/foreground-service)
|
|
33
|
+
* notifications.
|
|
34
|
+
*/
|
|
35
|
+
cancelDisplayedNotifications(notificationIds?: string[]): Promise<void>;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* API used to cancel any trigger notifications.
|
|
39
|
+
*/
|
|
40
|
+
cancelTriggerNotifications(notificationIds?: string[]): Promise<void>;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* API used to cancel a single notification.
|
|
44
|
+
*
|
|
45
|
+
* The `cancelNotification` API removes any displayed notifications or ones with triggers
|
|
46
|
+
* set for the specified ID.
|
|
47
|
+
*
|
|
48
|
+
* This method does not cancel [Foreground Service](/react-native/docs/android/foreground-service)
|
|
49
|
+
* notifications.
|
|
50
|
+
*
|
|
51
|
+
* @param notificationId The unique notification ID. This is automatically generated and returned
|
|
52
|
+
* when creating a notification, or has been set manually via the `id` property.
|
|
53
|
+
*
|
|
54
|
+
* @param tag The tag set when creating the notification. This is only relative to Android.
|
|
55
|
+
*/
|
|
56
|
+
cancelNotification(notificationId: string, tag?: string): Promise<void>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* API used to cancel a single displayed notification.
|
|
60
|
+
*
|
|
61
|
+
*
|
|
62
|
+
* This method does not cancel [Foreground Service](/react-native/docs/android/foreground-service)
|
|
63
|
+
* notifications.
|
|
64
|
+
*
|
|
65
|
+
* @param notificationId The unique notification ID. This is automatically generated and returned
|
|
66
|
+
* when creating a notification, or has been set manually via the `id` property.
|
|
67
|
+
*
|
|
68
|
+
* @param tag The tag set when creating the notification. This is only relative to Android.
|
|
69
|
+
*/
|
|
70
|
+
cancelDisplayedNotification(notificationId: string, tag?: string): Promise<void>;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* API used to cancel a single trigger notification.
|
|
74
|
+
*
|
|
75
|
+
*
|
|
76
|
+
* @param notificationId The unique notification ID. This is automatically generated and returned
|
|
77
|
+
* when creating a notification, or has been set manually via the `id` property.
|
|
78
|
+
*/
|
|
79
|
+
cancelTriggerNotification(notificationId: string): Promise<void>;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* API to create and update channels on supported Android devices.
|
|
83
|
+
*
|
|
84
|
+
* Creates a new Android channel. Channels are used to collectively assign notifications to
|
|
85
|
+
* a single responsible channel. Users can manage settings for channels, e.g. disabling sound or vibration.
|
|
86
|
+
* Channels can be further organized into groups (see `createChannelGroup`).
|
|
87
|
+
*
|
|
88
|
+
* By providing a `groupId` property, channels can be assigned to groups created with
|
|
89
|
+
* [`createChannelGroup`](/react-native/reference/createchannelgroup).
|
|
90
|
+
*
|
|
91
|
+
* The channel ID is returned once the operation has completed.
|
|
92
|
+
*
|
|
93
|
+
* View the [Channels & Groups](/react-native/docs/android/channels) documentation for more information.
|
|
94
|
+
*
|
|
95
|
+
* @platform android
|
|
96
|
+
* @param channel The [`AndroidChannel`](/react-native/reference/androidchannel) interface used to create/update a group.
|
|
97
|
+
*/
|
|
98
|
+
createChannel(channel: AndroidChannel): Promise<string>;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* API to create and update multiple channels on supported Android devices.
|
|
102
|
+
*
|
|
103
|
+
* This API is used to perform a single operation to create or update channels. See the
|
|
104
|
+
* [`createChannel`](/react-native/reference/createchannel) documentation for more information.
|
|
105
|
+
*
|
|
106
|
+
* @platform android
|
|
107
|
+
* @param channels An array of [`AndroidChannel`](/react-native/reference/androidchannel) interfaces.
|
|
108
|
+
*/
|
|
109
|
+
createChannels(channels: AndroidChannel[]): Promise<void>;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* API to create or update a channel group on supported Android devices.
|
|
113
|
+
*
|
|
114
|
+
* Creates a new Android channel group. Groups are used to further organize the appearance of your
|
|
115
|
+
* channels in the settings UI. Groups allow users to easily identify and control multiple
|
|
116
|
+
* notification channels.
|
|
117
|
+
*
|
|
118
|
+
* Channels can be assigned to groups during creation using the
|
|
119
|
+
* [`createChannel`](/react-native/reference/createchannel) method.
|
|
120
|
+
*
|
|
121
|
+
* The channel group ID is returned once the operation has completed.
|
|
122
|
+
*
|
|
123
|
+
* View the [Channels & Groups](/react-native/docs/android/channels) documentation for more information.
|
|
124
|
+
*
|
|
125
|
+
* @platform android
|
|
126
|
+
* @param channelGroup The [`AndroidChannelGroup`](/react-native/reference/androidchannelgroup)
|
|
127
|
+
* interface used to create/update a group.
|
|
128
|
+
*/
|
|
129
|
+
createChannelGroup(channelGroup: AndroidChannelGroup): Promise<string>;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* API to create and update multiple channel groups on supported Android devices.
|
|
133
|
+
*
|
|
134
|
+
* This API is used to perform a single operation to create or update channel groups. See the
|
|
135
|
+
* [`createChannelGroup`](/react-native/reference/createchannelgroup) documentation for more information.
|
|
136
|
+
*
|
|
137
|
+
* @platform android
|
|
138
|
+
* @param channelGroups An array of [`AndroidChannelGroup`](/react-native/reference/androidchannelgroup) interfaces.
|
|
139
|
+
*/
|
|
140
|
+
createChannelGroups(channelGroups: AndroidChannelGroup[]): Promise<void>;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* API used to delete a channel by ID on supported Android devices.
|
|
144
|
+
*
|
|
145
|
+
* Channels can be deleted using this API by providing the channel ID. Channel information (including
|
|
146
|
+
* the ID) can be retrieved from the [`getChannels`](/react-native/reference/getchannels) API.
|
|
147
|
+
*
|
|
148
|
+
* > When a channel is deleted, notifications assigned to that channel will fail to display.
|
|
149
|
+
*
|
|
150
|
+
* View the [Channels & Groups](/react-native/docs/android/channels) documentation for more information.
|
|
151
|
+
*
|
|
152
|
+
* @platform android
|
|
153
|
+
* @param channelId The unique channel ID to delete.
|
|
154
|
+
*/
|
|
155
|
+
deleteChannel(channelId: string): Promise<void>;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* API used to delete a channel group by ID on supported Android devices.
|
|
159
|
+
*
|
|
160
|
+
* Channel groups can be deleted using this API by providing the channel ID. Channel information (including
|
|
161
|
+
* the ID) can be retrieved from the [`getChannels`](/react-native/reference/getchannels) API.
|
|
162
|
+
*
|
|
163
|
+
* Deleting a group does not delete channels which are assigned to the group, they will instead be
|
|
164
|
+
* unassigned the group and continue to function as expected.
|
|
165
|
+
*
|
|
166
|
+
* View the [Channels & Groups](/react-native/docs/android/channels) documentation for more information.
|
|
167
|
+
*
|
|
168
|
+
* @platform android
|
|
169
|
+
* @param channelGroupId The unique channel group ID to delete.
|
|
170
|
+
*/
|
|
171
|
+
deleteChannelGroup(channelGroupId: string): Promise<void>;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* API used to immediately display or update a notification on the users device.
|
|
175
|
+
*
|
|
176
|
+
* This API is used to display a notification on the users device. All
|
|
177
|
+
* channels/categories should be created before triggering this method during the apps lifecycle.
|
|
178
|
+
*
|
|
179
|
+
* View the [Displaying a Notification](/react-native/docs/displaying-a-notification)
|
|
180
|
+
* documentation for more information.
|
|
181
|
+
*
|
|
182
|
+
* @param notification The [`Notification`](/react-native/reference/notification) interface used
|
|
183
|
+
* to create a notification for both Android & iOS.
|
|
184
|
+
*/
|
|
185
|
+
displayNotification(notification: Notification): Promise<string>;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* API used to open the Android Alarm special access settings for the application.
|
|
189
|
+
*
|
|
190
|
+
* On Android >= 12 / API >= 31, the alarm special access settings screen is displayed, otherwise,
|
|
191
|
+
* this is a no-op & instantly resolves.
|
|
192
|
+
*
|
|
193
|
+
* View the [Trigger](/react-native/docs/android/triggers#android-12-limitations) documentation for more information.
|
|
194
|
+
*
|
|
195
|
+
* @platform android
|
|
196
|
+
*/
|
|
197
|
+
openAlarmPermissionSettings(): Promise<void>;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* API used to create a trigger notification.
|
|
201
|
+
*
|
|
202
|
+
* All channels/categories should be created before calling this method during the apps lifecycle.
|
|
203
|
+
*
|
|
204
|
+
* View the [Triggers](/react-native/docs/triggers) documentation for more information.
|
|
205
|
+
*
|
|
206
|
+
* @param notification The [`Notification`](/react-native/reference/notification) interface used
|
|
207
|
+
* to create a notification.
|
|
208
|
+
*
|
|
209
|
+
* @param trigger The [`Trigger`](/react-native/reference/trigger) interface used
|
|
210
|
+
* to create a trigger.
|
|
211
|
+
*/
|
|
212
|
+
createTriggerNotification(notification: Notification, trigger: Trigger): Promise<string>;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* API used to return the ids of trigger notifications that are pending.
|
|
216
|
+
*
|
|
217
|
+
* View the [Triggers](/react-native/docs/triggers) documentation for more information.
|
|
218
|
+
*/
|
|
219
|
+
getTriggerNotificationIds(): Promise<string[]>;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* API used to return the notifications that are displayed.
|
|
223
|
+
*/
|
|
224
|
+
getDisplayedNotifications(): Promise<DisplayedNotification[]>;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* API used to return the trigger notifications that are pending.
|
|
228
|
+
*/
|
|
229
|
+
getTriggerNotifications(): Promise<TriggerNotification[]>;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* API used to return a channel on supported Android devices.
|
|
233
|
+
*
|
|
234
|
+
* This API is used to return a `NativeAndroidChannel`. Returns `null` if no channel could be matched to
|
|
235
|
+
* the given ID.
|
|
236
|
+
*
|
|
237
|
+
* A "native channel" also includes additional properties about the channel at the time it's
|
|
238
|
+
* retrieved from the device. View the [`NativeAndroidChannel`](/react-native/reference/nativeandroidchannel)
|
|
239
|
+
* documentation for more information.
|
|
240
|
+
*
|
|
241
|
+
* View the [Channels & Groups](/react-native/docs/android/channels) documentation for more information.
|
|
242
|
+
*
|
|
243
|
+
* @platform android
|
|
244
|
+
* @param channelId The channel ID created with [`createChannel`](/react-native/reference/createchannel). If
|
|
245
|
+
* a unknown channel ID is provided, `null` is returned.
|
|
246
|
+
*/
|
|
247
|
+
getChannel(channelId: string): Promise<NativeAndroidChannel | null>;
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* API used to check if a channel is created.
|
|
251
|
+
*
|
|
252
|
+
* On iOS, this will default to true
|
|
253
|
+
*
|
|
254
|
+
* @platform android
|
|
255
|
+
*/
|
|
256
|
+
isChannelCreated(channelId: string): Promise<boolean>;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* API used to check if a channel is blocked.
|
|
260
|
+
*
|
|
261
|
+
* On iOS, this will default to false
|
|
262
|
+
*
|
|
263
|
+
* @platform android
|
|
264
|
+
*/
|
|
265
|
+
isChannelBlocked(channelId: string): Promise<boolean>;
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* API used to return all channels on supported Android devices.
|
|
269
|
+
*
|
|
270
|
+
* This API is used to return a `NativeAndroidChannel`. Returns an empty array if no channels
|
|
271
|
+
* exist.
|
|
272
|
+
*
|
|
273
|
+
* A "native channel" also includes additional properties about the channel at the time it's
|
|
274
|
+
* retrieved from the device. View the [`NativeAndroidChannel`](/react-native/reference/nativeandroidchannel)
|
|
275
|
+
* documentation for more information.
|
|
276
|
+
*
|
|
277
|
+
* View the [Channels & Groups](/react-native/docs/android/channels) documentation for more information.
|
|
278
|
+
*
|
|
279
|
+
* @platform android
|
|
280
|
+
*/
|
|
281
|
+
getChannels(): Promise<NativeAndroidChannel[]>;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* API used to return a channel group on supported Android devices.
|
|
285
|
+
*
|
|
286
|
+
* This API is used to return an `NativeAndroidChannelGroup`. Returns `null` if no channel could be matched to
|
|
287
|
+
* the given ID.
|
|
288
|
+
*
|
|
289
|
+
* A "native channel group" also includes additional properties about the channel group at the time it's
|
|
290
|
+
* retrieved from the device. View the [`NativeAndroidChannelGroup`](/react-native/reference/nativeandroidchannelgroup)
|
|
291
|
+
* documentation for more information.
|
|
292
|
+
*
|
|
293
|
+
* View the [Channels & Groups](/react-native/docs/android/channels) documentation for more information.
|
|
294
|
+
*
|
|
295
|
+
* @platform android
|
|
296
|
+
* @param channelGroupId The channel ID created with [`createChannelGroup`](/react-native/reference/createchannelgroup). If
|
|
297
|
+
* a unknown channel group ID is provided, `null` is returned.
|
|
298
|
+
*/
|
|
299
|
+
getChannelGroup(channelGroupId: string): Promise<NativeAndroidChannelGroup | null>;
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* API used to return all channel groups on supported Android devices.
|
|
303
|
+
*
|
|
304
|
+
* This API is used to return a `NativeAndroidChannelGroup`. Returns an empty array if no channel
|
|
305
|
+
* groups exist.
|
|
306
|
+
*
|
|
307
|
+
* A "native channel group" also includes additional properties about the channel group at the time it's
|
|
308
|
+
* retrieved from the device. View the [`NativeAndroidChannelGroup`](/react-native/reference/nativeandroidchannelgroup)
|
|
309
|
+
* documentation for more information.
|
|
310
|
+
*
|
|
311
|
+
* View the [Channels & Groups](/react-native/docs/android/channels) documentation for more information.
|
|
312
|
+
*
|
|
313
|
+
* @platform android
|
|
314
|
+
*/
|
|
315
|
+
getChannelGroups(): Promise<NativeAndroidChannelGroup[]>;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* API used to fetch the notification which causes the application to open.
|
|
319
|
+
*
|
|
320
|
+
* This API can be used to fetch which notification & press action has caused the application to
|
|
321
|
+
* open. The call returns a `null` value when the application wasn't launched by a notification.
|
|
322
|
+
*
|
|
323
|
+
* Once the initial notification has been consumed by this API, it is removed and will no longer
|
|
324
|
+
* be available. It will also be removed if the user relaunches the application.
|
|
325
|
+
*
|
|
326
|
+
* View the [App open events](/react-native/docs/events#app-open-events) documentation for more
|
|
327
|
+
* information and example usage.
|
|
328
|
+
*
|
|
329
|
+
* Deprecated for iOS in favour of `onForegroundEvent` - you can still use this method on iOS
|
|
330
|
+
* but you will also receive a `onForegroundEvent`
|
|
331
|
+
*/
|
|
332
|
+
getInitialNotification(): Promise<InitialNotification | null>;
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* API used to handle events when the application is in a background state.
|
|
336
|
+
*
|
|
337
|
+
* Applications in a background state will use an event handler registered by this API method
|
|
338
|
+
* to send events. The handler must return a Promise once complete and only a single event handler
|
|
339
|
+
* can be registered for the application.
|
|
340
|
+
*
|
|
341
|
+
* View the [Background events](/react-native/docs/events#background-events) documentation for more
|
|
342
|
+
* information and example usage.
|
|
343
|
+
*
|
|
344
|
+
* To listen to foreground events, see the [`onForegroundEvent`](/react-native/reference/onforegroundevent) documentation.
|
|
345
|
+
*
|
|
346
|
+
* @param observer A Function which returns a Promise, called on a new event when the application
|
|
347
|
+
* is in a background state.
|
|
348
|
+
*/
|
|
349
|
+
onBackgroundEvent(observer: (event: Event) => Promise<void>): void;
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* API used to handle events when the application is in a foreground state.
|
|
353
|
+
*
|
|
354
|
+
* Applications in a foreground state will use an event handler registered by this API method
|
|
355
|
+
* to send events. Multiple foreground observers can be registered throughout the applications
|
|
356
|
+
* lifecycle. The method returns a function, used to unsubscribe from further events,
|
|
357
|
+
*
|
|
358
|
+
* View the [Foreground events](/react-native/docs/events#foreground-events) documentation for more
|
|
359
|
+
* information and example usage.
|
|
360
|
+
*
|
|
361
|
+
* To listen to background events, see the [`onBackgroundEvent`](/react-native/reference/onbackgroundevent) documentation.
|
|
362
|
+
*
|
|
363
|
+
* @param observer A Function which returns a Promise, called on a new event when the application
|
|
364
|
+
* is in a foreground state.
|
|
365
|
+
*/
|
|
366
|
+
onForegroundEvent(observer: (event: Event) => void): () => void;
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* API used to open the Android System settings for the application.
|
|
370
|
+
*
|
|
371
|
+
* If the API version is >= 26:
|
|
372
|
+
* - With no `channelId`, the notification settings screen is displayed.
|
|
373
|
+
* - With a `channelId`, the notification settings screen for the specific channel is displayed.
|
|
374
|
+
*
|
|
375
|
+
* If the API version is < 26, the application settings screen is displayed. The `channelId`
|
|
376
|
+
* is ignored.
|
|
377
|
+
*
|
|
378
|
+
* If an invalid `channelId` is provided (e.g. does not exist), the settings screen will redirect
|
|
379
|
+
* back to your application.
|
|
380
|
+
*
|
|
381
|
+
* On iOS, this is a no-op & instantly resolves.
|
|
382
|
+
*
|
|
383
|
+
* @platform android
|
|
384
|
+
* @param channelId The ID of the channel which will be opened. Can be ignored/omitted to display the
|
|
385
|
+
* overall notification settings.
|
|
386
|
+
*/
|
|
387
|
+
openNotificationSettings(channelId?: string): Promise<void>;
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* API used to register a foreground service on Android devices.
|
|
391
|
+
*
|
|
392
|
+
* This method is used to register a long running task which can be used with Foreground Service
|
|
393
|
+
* notifications.
|
|
394
|
+
*
|
|
395
|
+
* Only a single foreground service can exist for the application, and calling this method more
|
|
396
|
+
* than once will update the existing task runner.
|
|
397
|
+
*
|
|
398
|
+
* View the [Foreground Service](/react-native/docs/android/foreground-service) documentation for
|
|
399
|
+
* more information.
|
|
400
|
+
*
|
|
401
|
+
* @platform android
|
|
402
|
+
* @param task The runner function which runs for the duration of the service's lifetime.
|
|
403
|
+
*/
|
|
404
|
+
registerForegroundService(task: ForegroundServiceTask): void;
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Call this to stop the foreground service that is running
|
|
408
|
+
*
|
|
409
|
+
* @platform android
|
|
410
|
+
*
|
|
411
|
+
*/
|
|
412
|
+
stopForegroundService(): Promise<void>;
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Request specific notification permissions for your application on the current device.
|
|
416
|
+
*
|
|
417
|
+
* Both iOS & Android return an `NotificationSettings` interface. To check whether overall
|
|
418
|
+
* permission was granted, check the `authorizationStatus` property in the response:
|
|
419
|
+
*
|
|
420
|
+
* ```js
|
|
421
|
+
* import notifee, { AuthorizationStatus } from '@notifee/react-native';
|
|
422
|
+
*
|
|
423
|
+
* const settings = await notifee.requestPermission(...);
|
|
424
|
+
*
|
|
425
|
+
* if (settings.authorizationStatus === AuthorizationStatus.DENIED) {
|
|
426
|
+
* console.log('User denied permissions request');
|
|
427
|
+
* } else if (settings.authorizationStatus === AuthorizationStatus.AUTHORIZED) {
|
|
428
|
+
* console.log('User granted permissions request');
|
|
429
|
+
* } else if (settings.authorizationStatus === AuthorizationStatus.PROVISIONAL) {
|
|
430
|
+
* console.log('User provisionally granted permissions request');
|
|
431
|
+
* }
|
|
432
|
+
* ```
|
|
433
|
+
*
|
|
434
|
+
* For iOS specific settings, use the `ios` properties to view which specific permissions were
|
|
435
|
+
* authorized.
|
|
436
|
+
*
|
|
437
|
+
* On Android, `authorizationStatus` will return only either `AuthorizationStatus.DENIED` or `AuthorizationStatus.AUTHORIZED`
|
|
438
|
+
* and all of the properties on the `ios` interface response return as `AUTHORIZED`.
|
|
439
|
+
*
|
|
440
|
+
* @param permissions
|
|
441
|
+
*/
|
|
442
|
+
requestPermission(permissions?: IOSNotificationPermissions): Promise<NotificationSettings>;
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* Set the notification categories to be used on this Apple device.
|
|
446
|
+
*
|
|
447
|
+
* @platform ios
|
|
448
|
+
*
|
|
449
|
+
* @param categories
|
|
450
|
+
*/
|
|
451
|
+
setNotificationCategories(categories: IOSNotificationCategory[]): Promise<void>;
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Gets the currently set notification categories on this Apple device.
|
|
455
|
+
*
|
|
456
|
+
* Returns an empty array on Android.
|
|
457
|
+
*
|
|
458
|
+
*@platform ios
|
|
459
|
+
*/
|
|
460
|
+
getNotificationCategories(): Promise<IOSNotificationCategory[]>;
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* Get the current notification settings for this application on the current device.
|
|
464
|
+
* On Android, `authorizationStatus` will return only either `AuthorizationStatus.DENIED` or `AuthorizationStatus.AUTHORIZED`
|
|
465
|
+
* and all of the properties on the `IOSNotificationSettings` interface response return as `AUTHORIZED`.
|
|
466
|
+
*/
|
|
467
|
+
getNotificationSettings(): Promise<NotificationSettings>;
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Get the current badge count value for this application on the current device.
|
|
471
|
+
*
|
|
472
|
+
* Returns `0` on Android.
|
|
473
|
+
*
|
|
474
|
+
* @platform ios
|
|
475
|
+
*/
|
|
476
|
+
getBadgeCount(): Promise<number>;
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* Set the badge count value for this application on the current device.
|
|
480
|
+
*
|
|
481
|
+
* If set to zero, the badge count is removed from the device. The count must also
|
|
482
|
+
* be a positive number.
|
|
483
|
+
*
|
|
484
|
+
* @platform ios
|
|
485
|
+
*
|
|
486
|
+
* @param count The number value to set as the badge count.
|
|
487
|
+
*/
|
|
488
|
+
setBadgeCount(count: number): Promise<void>;
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Increments the badge count for this application on the current device by a specified
|
|
492
|
+
* value.
|
|
493
|
+
*
|
|
494
|
+
* Defaults to an increment of `1`.
|
|
495
|
+
*
|
|
496
|
+
* @platform ios
|
|
497
|
+
*
|
|
498
|
+
* @param incrementBy The value to increment the badge count by.
|
|
499
|
+
*/
|
|
500
|
+
incrementBadgeCount(incrementBy?: number): Promise<void>;
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* Decrements the badge count for this application on the current device by a specified
|
|
504
|
+
* value.
|
|
505
|
+
*
|
|
506
|
+
* Defaults to an decrement of `1`.
|
|
507
|
+
*
|
|
508
|
+
* @platform ios
|
|
509
|
+
*/
|
|
510
|
+
decrementBadgeCount(decrementBy?: number): Promise<void>;
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* API used to open the Android System settings for the application.
|
|
514
|
+
*
|
|
515
|
+
* If the API version is >= 23, the battery optimization settings screen is displayed, otherwise,
|
|
516
|
+
* this is a no-op & instantly resolves.
|
|
517
|
+
*
|
|
518
|
+
* View the [Background Restrictions](/react-native/docs/android/behaviour#background-restrictions) documentation for more information.
|
|
519
|
+
*
|
|
520
|
+
* @platform android
|
|
521
|
+
*/
|
|
522
|
+
openBatteryOptimizationSettings(): Promise<void>;
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* API used to check if battery optimization is enabled for your application.
|
|
526
|
+
*
|
|
527
|
+
* Supports API versions >= 23.
|
|
528
|
+
*
|
|
529
|
+
* View the [Background Restrictions](/react-native/docs/android/behaviour#background-restrictions) documentation for more information.
|
|
530
|
+
*
|
|
531
|
+
* @platform android
|
|
532
|
+
*/
|
|
533
|
+
isBatteryOptimizationEnabled(): Promise<boolean>;
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* API used to get information about the device and its power manager settings, including manufacturer, model, version and activity.
|
|
537
|
+
*
|
|
538
|
+
* If `activity` is `null`, `openPowerManagerSettings()` will be noop.
|
|
539
|
+
*
|
|
540
|
+
* On iOS, an instance of `PowerManagerInfo` will be returned with `activity` set to `null`.
|
|
541
|
+
*
|
|
542
|
+
* View the [Background Restrictions](/react-native/docs/android/background-restrictions) documentation for more information.
|
|
543
|
+
*
|
|
544
|
+
* ```js
|
|
545
|
+
* import notifee from `@notifee/react-native`;
|
|
546
|
+
*
|
|
547
|
+
* const powerManagerInfo = await notifee.getPowerManagerInfo();
|
|
548
|
+
*
|
|
549
|
+
* if (powerManagerInfo.activity) {
|
|
550
|
+
* // 1. ask the user to adjust their Power Manager settings
|
|
551
|
+
* // ...
|
|
552
|
+
*
|
|
553
|
+
* // 2. open settings
|
|
554
|
+
* await notifee.openPowerManagerSettings();
|
|
555
|
+
* }
|
|
556
|
+
* ```
|
|
557
|
+
*
|
|
558
|
+
* @platform android
|
|
559
|
+
*/
|
|
560
|
+
getPowerManagerInfo(): Promise<PowerManagerInfo>;
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* API used to navigate to the appropriate Android System settings for the device.
|
|
564
|
+
*
|
|
565
|
+
* Call `getPowerManagerInfo()` first to find out if the user's device is supported.
|
|
566
|
+
*
|
|
567
|
+
* View the [Background Restrictions](/react-native/docs/android/background-restrictions) documentation for more information.
|
|
568
|
+
*
|
|
569
|
+
* ```js
|
|
570
|
+
* import notifee from `@notifee/react-native`;
|
|
571
|
+
*
|
|
572
|
+
* const powerManagerInfo = await notifee.getPowerManagerInfo
|
|
573
|
+
*
|
|
574
|
+
* if (powerManagerInfo.activity) {
|
|
575
|
+
* // 1. ask the user to adjust their Power Manager settings
|
|
576
|
+
* // ...
|
|
577
|
+
*
|
|
578
|
+
* // 2. if yes, navigate them to settings
|
|
579
|
+
* await notifee.openPowerManagerSettings();
|
|
580
|
+
* }
|
|
581
|
+
* ```
|
|
582
|
+
*
|
|
583
|
+
* @platform android
|
|
584
|
+
*/
|
|
585
|
+
openPowerManagerSettings(): Promise<void>;
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* API used to hide the notification drawer, for example,
|
|
589
|
+
* when the user presses one of the quick actions on the notification, you may wish to hide the drawer.
|
|
590
|
+
*
|
|
591
|
+
* Please use this functionality carefully as it could potentially be quite intrusive to the user.
|
|
592
|
+
*
|
|
593
|
+
* Requires the following permission to be added to your `AndroidManifest.xml`:
|
|
594
|
+
* ```xml
|
|
595
|
+
* <uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />
|
|
596
|
+
* ```
|
|
597
|
+
*
|
|
598
|
+
* ```js
|
|
599
|
+
* import notifee from `@notifee/react-native`;
|
|
600
|
+
*
|
|
601
|
+
* notifee.hideNotificationDrawer();
|
|
602
|
+
* ```
|
|
603
|
+
*
|
|
604
|
+
* @platform android
|
|
605
|
+
*/
|
|
606
|
+
hideNotificationDrawer(): void;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* Interface describing the static properties available on the default `@notifee/react-native` export.
|
|
611
|
+
*
|
|
612
|
+
* ```js
|
|
613
|
+
* import notifee from `@notifee/react-native`;
|
|
614
|
+
*
|
|
615
|
+
* console.log(notifee.SDK_VERSION);
|
|
616
|
+
* ```
|
|
617
|
+
*/
|
|
618
|
+
export interface ModuleStatics {
|
|
619
|
+
/**
|
|
620
|
+
* Returns the current Notifee SDK version in use.
|
|
621
|
+
*/
|
|
622
|
+
SDK_VERSION: string;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
export interface ModuleWithStatics extends Module, ModuleStatics {}
|