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