expo-notifications 0.16.1 → 0.18.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 (215) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +1 -1
  3. package/android/build.gradle +4 -4
  4. package/android/src/main/AndroidManifest.xml +1 -0
  5. package/android/src/main/java/expo/modules/notifications/permissions/NotificationPermissionsModule.kt +144 -0
  6. package/android/src/main/java/expo/modules/notifications/service/NotificationsService.kt +1 -1
  7. package/build/BadgeModule.types.d.ts +2 -2
  8. package/build/BadgeModule.types.d.ts.map +1 -1
  9. package/build/DevicePushTokenAutoRegistration.fx.d.ts +2 -5
  10. package/build/DevicePushTokenAutoRegistration.fx.d.ts.map +1 -1
  11. package/build/DevicePushTokenAutoRegistration.fx.js +2 -4
  12. package/build/DevicePushTokenAutoRegistration.fx.js.map +1 -1
  13. package/build/NotificationCategoriesModule.web.d.ts +1 -1
  14. package/build/NotificationCategoriesModule.web.d.ts.map +1 -1
  15. package/build/NotificationChannelGroupManager.types.d.ts +8 -0
  16. package/build/NotificationChannelGroupManager.types.d.ts.map +1 -1
  17. package/build/NotificationChannelGroupManager.types.js.map +1 -1
  18. package/build/NotificationChannelManager.types.d.ts +14 -4
  19. package/build/NotificationChannelManager.types.d.ts.map +1 -1
  20. package/build/NotificationChannelManager.types.js +7 -1
  21. package/build/NotificationChannelManager.types.js.map +1 -1
  22. package/build/NotificationPermissions.d.ts +44 -2
  23. package/build/NotificationPermissions.d.ts.map +1 -1
  24. package/build/NotificationPermissions.js +44 -2
  25. package/build/NotificationPermissions.js.map +1 -1
  26. package/build/NotificationPermissions.types.d.ts +41 -4
  27. package/build/NotificationPermissions.types.d.ts.map +1 -1
  28. package/build/NotificationPermissions.types.js.map +1 -1
  29. package/build/NotificationScheduler.types.d.ts +1 -1
  30. package/build/NotificationScheduler.types.d.ts.map +1 -1
  31. package/build/Notifications.types.d.ts +420 -90
  32. package/build/Notifications.types.d.ts.map +1 -1
  33. package/build/Notifications.types.js +3 -0
  34. package/build/Notifications.types.js.map +1 -1
  35. package/build/NotificationsEmitter.d.ts +66 -0
  36. package/build/NotificationsEmitter.d.ts.map +1 -1
  37. package/build/NotificationsEmitter.js +68 -0
  38. package/build/NotificationsEmitter.js.map +1 -1
  39. package/build/NotificationsHandler.d.ts +44 -1
  40. package/build/NotificationsHandler.d.ts.map +1 -1
  41. package/build/NotificationsHandler.js +29 -0
  42. package/build/NotificationsHandler.js.map +1 -1
  43. package/build/TokenEmitter.d.ts +37 -1
  44. package/build/TokenEmitter.d.ts.map +1 -1
  45. package/build/TokenEmitter.js +32 -3
  46. package/build/TokenEmitter.js.map +1 -1
  47. package/build/Tokens.types.d.ts +31 -3
  48. package/build/Tokens.types.d.ts.map +1 -1
  49. package/build/Tokens.types.js.map +1 -1
  50. package/build/cancelAllScheduledNotificationsAsync.d.ts +5 -0
  51. package/build/cancelAllScheduledNotificationsAsync.d.ts.map +1 -1
  52. package/build/cancelAllScheduledNotificationsAsync.js +5 -0
  53. package/build/cancelAllScheduledNotificationsAsync.js.map +1 -1
  54. package/build/cancelScheduledNotificationAsync.d.ts +20 -0
  55. package/build/cancelScheduledNotificationAsync.d.ts.map +1 -1
  56. package/build/cancelScheduledNotificationAsync.js +20 -0
  57. package/build/cancelScheduledNotificationAsync.js.map +1 -1
  58. package/build/deleteNotificationCategoryAsync.d.ts +9 -0
  59. package/build/deleteNotificationCategoryAsync.d.ts.map +1 -1
  60. package/build/deleteNotificationCategoryAsync.js +9 -0
  61. package/build/deleteNotificationCategoryAsync.js.map +1 -1
  62. package/build/deleteNotificationChannelAsync.d.ts +7 -0
  63. package/build/deleteNotificationChannelAsync.d.ts.map +1 -1
  64. package/build/deleteNotificationChannelAsync.js +7 -0
  65. package/build/deleteNotificationChannelAsync.js.map +1 -1
  66. package/build/deleteNotificationChannelGroupAsync.d.ts +7 -0
  67. package/build/deleteNotificationChannelGroupAsync.d.ts.map +1 -1
  68. package/build/deleteNotificationChannelGroupAsync.js +7 -0
  69. package/build/deleteNotificationChannelGroupAsync.js.map +1 -1
  70. package/build/dismissAllNotificationsAsync.d.ts +5 -0
  71. package/build/dismissAllNotificationsAsync.d.ts.map +1 -1
  72. package/build/dismissAllNotificationsAsync.js +5 -0
  73. package/build/dismissAllNotificationsAsync.js.map +1 -1
  74. package/build/dismissNotificationAsync.d.ts +6 -0
  75. package/build/dismissNotificationAsync.d.ts.map +1 -1
  76. package/build/dismissNotificationAsync.js +6 -0
  77. package/build/dismissNotificationAsync.js.map +1 -1
  78. package/build/getAllScheduledNotificationsAsync.d.ts +5 -0
  79. package/build/getAllScheduledNotificationsAsync.d.ts.map +1 -1
  80. package/build/getAllScheduledNotificationsAsync.js +5 -0
  81. package/build/getAllScheduledNotificationsAsync.js.map +1 -1
  82. package/build/getBadgeCountAsync.d.ts +6 -0
  83. package/build/getBadgeCountAsync.d.ts.map +1 -1
  84. package/build/getBadgeCountAsync.js +6 -0
  85. package/build/getBadgeCountAsync.js.map +1 -1
  86. package/build/getDevicePushTokenAsync.d.ts +5 -0
  87. package/build/getDevicePushTokenAsync.d.ts.map +1 -1
  88. package/build/getDevicePushTokenAsync.js +6 -1
  89. package/build/getDevicePushTokenAsync.js.map +1 -1
  90. package/build/getExpoPushTokenAsync.d.ts +74 -0
  91. package/build/getExpoPushTokenAsync.d.ts.map +1 -1
  92. package/build/getExpoPushTokenAsync.js +41 -1
  93. package/build/getExpoPushTokenAsync.js.map +1 -1
  94. package/build/getNextTriggerDateAsync.d.ts +23 -0
  95. package/build/getNextTriggerDateAsync.d.ts.map +1 -1
  96. package/build/getNextTriggerDateAsync.js +23 -0
  97. package/build/getNextTriggerDateAsync.js.map +1 -1
  98. package/build/getNotificationCategoriesAsync.d.ts +8 -0
  99. package/build/getNotificationCategoriesAsync.d.ts.map +1 -1
  100. package/build/getNotificationCategoriesAsync.js +8 -0
  101. package/build/getNotificationCategoriesAsync.js.map +1 -1
  102. package/build/getNotificationChannelAsync.d.ts +8 -0
  103. package/build/getNotificationChannelAsync.d.ts.map +1 -1
  104. package/build/getNotificationChannelAsync.js +8 -0
  105. package/build/getNotificationChannelAsync.js.map +1 -1
  106. package/build/getNotificationChannelGroupAsync.d.ts +9 -0
  107. package/build/getNotificationChannelGroupAsync.d.ts.map +1 -1
  108. package/build/getNotificationChannelGroupAsync.js +9 -0
  109. package/build/getNotificationChannelGroupAsync.js.map +1 -1
  110. package/build/getNotificationChannelGroupsAsync.d.ts +7 -0
  111. package/build/getNotificationChannelGroupsAsync.d.ts.map +1 -1
  112. package/build/getNotificationChannelGroupsAsync.js +7 -0
  113. package/build/getNotificationChannelGroupsAsync.js.map +1 -1
  114. package/build/getNotificationChannelsAsync.d.ts +7 -0
  115. package/build/getNotificationChannelsAsync.d.ts.map +1 -1
  116. package/build/getNotificationChannelsAsync.js +7 -0
  117. package/build/getNotificationChannelsAsync.js.map +1 -1
  118. package/build/getPresentedNotificationsAsync.d.ts +6 -0
  119. package/build/getPresentedNotificationsAsync.d.ts.map +1 -1
  120. package/build/getPresentedNotificationsAsync.js +6 -0
  121. package/build/getPresentedNotificationsAsync.js.map +1 -1
  122. package/build/presentNotificationAsync.d.ts +6 -2
  123. package/build/presentNotificationAsync.d.ts.map +1 -1
  124. package/build/presentNotificationAsync.js +6 -2
  125. package/build/presentNotificationAsync.js.map +1 -1
  126. package/build/registerTaskAsync.d.ts +27 -0
  127. package/build/registerTaskAsync.d.ts.map +1 -1
  128. package/build/registerTaskAsync.js +27 -0
  129. package/build/registerTaskAsync.js.map +1 -1
  130. package/build/scheduleNotificationAsync.d.ts +55 -0
  131. package/build/scheduleNotificationAsync.d.ts.map +1 -1
  132. package/build/scheduleNotificationAsync.js +55 -0
  133. package/build/scheduleNotificationAsync.js.map +1 -1
  134. package/build/setBadgeCountAsync.d.ts +13 -0
  135. package/build/setBadgeCountAsync.d.ts.map +1 -1
  136. package/build/setBadgeCountAsync.js +10 -0
  137. package/build/setBadgeCountAsync.js.map +1 -1
  138. package/build/setNotificationCategoryAsync.d.ts +14 -11
  139. package/build/setNotificationCategoryAsync.d.ts.map +1 -1
  140. package/build/setNotificationCategoryAsync.js +12 -0
  141. package/build/setNotificationCategoryAsync.js.map +1 -1
  142. package/build/setNotificationChannelAsync.d.ts +19 -0
  143. package/build/setNotificationChannelAsync.d.ts.map +1 -1
  144. package/build/setNotificationChannelAsync.js +19 -0
  145. package/build/setNotificationChannelAsync.js.map +1 -1
  146. package/build/setNotificationChannelGroupAsync.d.ts +9 -0
  147. package/build/setNotificationChannelGroupAsync.d.ts.map +1 -1
  148. package/build/setNotificationChannelGroupAsync.js +9 -0
  149. package/build/setNotificationChannelGroupAsync.js.map +1 -1
  150. package/build/unregisterForNotificationsAsync.d.ts.map +1 -1
  151. package/build/unregisterForNotificationsAsync.js +1 -0
  152. package/build/unregisterForNotificationsAsync.js.map +1 -1
  153. package/build/unregisterTaskAsync.d.ts +5 -0
  154. package/build/unregisterTaskAsync.d.ts.map +1 -1
  155. package/build/unregisterTaskAsync.js +5 -0
  156. package/build/unregisterTaskAsync.js.map +1 -1
  157. package/build/useLastNotificationResponse.d.ts +33 -5
  158. package/build/useLastNotificationResponse.d.ts.map +1 -1
  159. package/build/useLastNotificationResponse.js +33 -5
  160. package/build/useLastNotificationResponse.js.map +1 -1
  161. package/ios/EXNotifications.podspec +1 -1
  162. package/package.json +5 -6
  163. package/plugin/build/withNotifications.d.ts +2 -2
  164. package/plugin/build/withNotifications.js +1 -1
  165. package/plugin/build/withNotificationsAndroid.d.ts +4 -4
  166. package/plugin/build/withNotificationsAndroid.js +3 -5
  167. package/plugin/build/withNotificationsIOS.d.ts +1 -1
  168. package/plugin/build/withNotificationsIOS.js +1 -1
  169. package/plugin/src/withNotifications.ts +1 -1
  170. package/plugin/src/withNotificationsAndroid.ts +3 -3
  171. package/plugin/src/withNotificationsIOS.ts +1 -1
  172. package/src/DevicePushTokenAutoRegistration.fx.ts +2 -4
  173. package/src/NotificationChannelGroupManager.types.ts +8 -0
  174. package/src/NotificationChannelManager.types.ts +16 -1
  175. package/src/NotificationPermissions.ts +44 -2
  176. package/src/NotificationPermissions.types.ts +42 -6
  177. package/src/Notifications.types.ts +441 -90
  178. package/src/NotificationsEmitter.ts +68 -0
  179. package/src/NotificationsHandler.ts +44 -0
  180. package/src/TokenEmitter.ts +36 -1
  181. package/src/Tokens.types.ts +31 -0
  182. package/src/cancelAllScheduledNotificationsAsync.ts +5 -0
  183. package/src/cancelScheduledNotificationAsync.ts +20 -0
  184. package/src/deleteNotificationCategoryAsync.ts +9 -0
  185. package/src/deleteNotificationChannelAsync.ts +7 -0
  186. package/src/deleteNotificationChannelGroupAsync.ts +7 -0
  187. package/src/dismissAllNotificationsAsync.ts +5 -0
  188. package/src/dismissNotificationAsync.ts +6 -0
  189. package/src/getAllScheduledNotificationsAsync.ts +5 -0
  190. package/src/getBadgeCountAsync.ts +6 -0
  191. package/src/getDevicePushTokenAsync.ts +6 -1
  192. package/src/getExpoPushTokenAsync.ts +82 -6
  193. package/src/getNextTriggerDateAsync.ts +23 -0
  194. package/src/getNotificationCategoriesAsync.ts +8 -0
  195. package/src/getNotificationChannelAsync.ts +8 -0
  196. package/src/getNotificationChannelGroupAsync.ts +9 -0
  197. package/src/getNotificationChannelGroupsAsync.ts +7 -0
  198. package/src/getNotificationChannelsAsync.ts +7 -0
  199. package/src/getPresentedNotificationsAsync.ts +6 -0
  200. package/src/presentNotificationAsync.ts +6 -2
  201. package/src/registerTaskAsync.ts +27 -0
  202. package/src/scheduleNotificationAsync.ts +55 -0
  203. package/src/setBadgeCountAsync.ts +13 -0
  204. package/src/setNotificationCategoryAsync.ts +18 -11
  205. package/src/setNotificationChannelAsync.ts +19 -0
  206. package/src/setNotificationChannelGroupAsync.ts +9 -0
  207. package/src/unregisterForNotificationsAsync.ts +1 -0
  208. package/src/unregisterTaskAsync.ts +5 -0
  209. package/src/useLastNotificationResponse.ts +33 -5
  210. package/android/src/main/java/expo/modules/notifications/permissions/NotificationPermissionsModule.java +0 -74
  211. package/ios/EXNotifications.xcframework/Info.plist +0 -40
  212. package/ios/EXNotifications.xcframework/ios-arm64/EXNotifications.framework/EXNotifications +0 -0
  213. package/ios/EXNotifications.xcframework/ios-arm64/EXNotifications.framework/Info.plist +0 -0
  214. package/ios/EXNotifications.xcframework/ios-arm64_x86_64-simulator/EXNotifications.framework/EXNotifications +0 -0
  215. package/ios/EXNotifications.xcframework/ios-arm64_x86_64-simulator/EXNotifications.framework/Info.plist +0 -0
package/CHANGELOG.md CHANGED
@@ -10,6 +10,32 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 0.18.0 — 2023-02-03
14
+
15
+ ### 💡 Others
16
+
17
+ - Update `getExpoPushTokenAsync` to make `projectId` required. ([#20833](https://github.com/expo/expo/pull/20833) by [@gabrieldonadel](https://github.com/gabrieldonadel))
18
+ - On Android bump `compileSdkVersion` and `targetSdkVersion` to `33`. ([#20721](https://github.com/expo/expo/pull/20721) by [@lukmccall](https://github.com/lukmccall))
19
+ - Add JSDoc comments, perform type changes related to documentation autogeneration. ([#21002](https://github.com/expo/expo/pull/21002) by [@Simek](https://github.com/Simek))
20
+
21
+ ## 0.17.0 — 2022-10-25
22
+
23
+ ### 🛠 Breaking changes
24
+
25
+ - [plugin] Upgrade minimum runtime requirement to Node 14 (LTS). ([#18204](https://github.com/expo/expo/pull/18204) by [@EvanBacon](https://github.com/EvanBacon))
26
+ - Bumped iOS deployment target to 13.0 and deprecated support for iOS 12. ([#18873](https://github.com/expo/expo/pull/18873) by [@tsapeta](https://github.com/tsapeta))
27
+
28
+ ### 🐛 Bug fixes
29
+
30
+ - Fixed build error for setting `compileSdkVersion` to 33. ([#19432](https://github.com/expo/expo/pull/19432) by [@kudo](https://github.com/kudo))
31
+ - Fixed the `POST_NOTIFICATIONS` runtime permission integration when `targerSdkVersion` is set to 33. ([#19672](https://github.com/expo/expo/pull/19672) by [@kudo](https://github.com/kudo), [@kudo](https://github.com/kudo))
32
+ - Fixed `projectId` variable not found reference error when using development builds. ([#20276](https://github.com/expo/expo/pull/20276) by [@amandeepmittal](https://github.com/amandeepmittal))
33
+
34
+ ### 💡 Others
35
+
36
+ - [plugin] Migrate import from @expo/config-plugins to expo/config-plugins and @expo/config-types to expo/config. ([#18855](https://github.com/expo/expo/pull/18855) by [@brentvatne](https://github.com/brentvatne))
37
+ - Drop `@expo/config-plugins` dependency in favor of peer dependency on `expo`. ([#18595](https://github.com/expo/expo/pull/18595) by [@EvanBacon](https://github.com/EvanBacon))
38
+
13
39
  ## 0.16.1 — 2022-07-16
14
40
 
15
41
  _This version does not introduce any user-facing changes._
package/README.md CHANGED
@@ -181,7 +181,7 @@ Here are a few ways people claim to have solved this problem, maybe one of these
181
181
  Go read the Apple's [Technical Note on troubleshooting push notifications](https://developer.apple.com/library/archive/technotes/tn2265/_index.html)! This the single most reliable source of information on this problem. To help you grasp what they're suggesting:
182
182
 
183
183
  - Make sure the device has a reliable connection to the Internet (try turning off Wi-Fi or switching to another network, and disabling firewall block on port 5223, as suggested in [this SO answer](https://stackoverflow.com/a/34332047/1123156)).
184
- - Make sure your app configuration is set properly for registering for push notifications (for bare workflow check out [this guide](https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/AddingCapabilities/AddingCapabilities.html#//apple_ref/doc/uid/TP40012582-CH26-SW6), for managed workflow this is done automatically for you by `expo-cli`) as also suggested by [this StackOverflow answer](https://stackoverflow.com/a/10791240/1123156).
184
+ - Make sure your app configuration is set properly for registering for push notifications (for bare workflow check out [this guide](https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/AddingCapabilities/AddingCapabilities.html), for managed workflow this is done automatically for you by `expo-cli`) as also suggested by [this StackOverflow answer](https://stackoverflow.com/a/10791240/1123156).
185
185
  - If you're in bare workflow you may want to try to debug this even further by logging persistent connection debug information as outlined by [this StackOverflow answer](https://stackoverflow.com/a/8036052/1123156).
186
186
 
187
187
  </p>
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven-publish'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '0.16.1'
6
+ version = '0.18.0'
7
7
 
8
8
  buildscript {
9
9
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
@@ -59,7 +59,7 @@ afterEvaluate {
59
59
  }
60
60
 
61
61
  android {
62
- compileSdkVersion safeExtGet("compileSdkVersion", 31)
62
+ compileSdkVersion safeExtGet("compileSdkVersion", 33)
63
63
 
64
64
  compileOptions {
65
65
  sourceCompatibility JavaVersion.VERSION_11
@@ -72,9 +72,9 @@ android {
72
72
 
73
73
  defaultConfig {
74
74
  minSdkVersion safeExtGet("minSdkVersion", 21)
75
- targetSdkVersion safeExtGet("targetSdkVersion", 31)
75
+ targetSdkVersion safeExtGet("targetSdkVersion", 33)
76
76
  versionCode 21
77
- versionName '0.16.1'
77
+ versionName '0.18.0'
78
78
  }
79
79
 
80
80
  lintOptions {
@@ -2,6 +2,7 @@
2
2
  package="expo.modules.notifications">
3
3
 
4
4
  <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
5
+ <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
5
6
 
6
7
  <application>
7
8
  <service
@@ -0,0 +1,144 @@
1
+ package expo.modules.notifications.permissions
2
+
3
+ import android.app.NotificationManager
4
+ import android.content.Context
5
+ import android.os.Build
6
+ import androidx.annotation.RequiresApi
7
+ import androidx.core.app.NotificationManagerCompat
8
+ import androidx.core.os.bundleOf
9
+ import expo.modules.core.ExportedModule
10
+ import expo.modules.core.ModuleRegistry
11
+ import expo.modules.core.Promise
12
+ import expo.modules.core.arguments.ReadableArguments
13
+ import expo.modules.core.interfaces.ExpoMethod
14
+ import expo.modules.interfaces.permissions.Permissions
15
+ import expo.modules.interfaces.permissions.PermissionsResponse
16
+ import expo.modules.interfaces.permissions.PermissionsStatus
17
+
18
+ class NotificationPermissionsModule(context: Context?) : ExportedModule(context) {
19
+ private lateinit var moduleRegistry: ModuleRegistry
20
+
21
+ override fun onCreate(moduleRegistry: ModuleRegistry) {
22
+ this.moduleRegistry = moduleRegistry
23
+ }
24
+
25
+ override fun getName(): String {
26
+ return EXPORTED_NAME
27
+ }
28
+
29
+ @ExpoMethod
30
+ fun getPermissionsAsync(promise: Promise) {
31
+ if (context.applicationContext.applicationInfo.targetSdkVersion >= 33 && Build.VERSION.SDK_INT >= 33) {
32
+ getPermissionsWithPromiseImplApi33(promise)
33
+ } else {
34
+ getPermissionsWithPromiseImplClassic(promise)
35
+ }
36
+ }
37
+
38
+ @ExpoMethod
39
+ fun requestPermissionsAsync(permissionsTypes: ReadableArguments?, promise: Promise) {
40
+ if (context.applicationContext.applicationInfo.targetSdkVersion >= 33 && Build.VERSION.SDK_INT >= 33) {
41
+ requestPermissionsWithPromiseImplApi33(promise)
42
+ } else {
43
+ getPermissionsWithPromiseImplClassic(promise)
44
+ }
45
+ }
46
+
47
+ @RequiresApi(33)
48
+ private fun getPermissionsWithPromiseImplApi33(promise: Promise) {
49
+ val permissionManager = moduleRegistry.getModule(Permissions::class.java)
50
+ if (permissionManager == null) {
51
+ promise.reject("E_NO_PERMISSIONS", "Permissions module is null. Are you sure all the installed Expo modules are properly linked?")
52
+ return
53
+ }
54
+
55
+ permissionManager.getPermissions(
56
+ { permissionsMap: Map<String, PermissionsResponse> ->
57
+ val managerCompat = NotificationManagerCompat.from(context)
58
+ val areEnabled = managerCompat.areNotificationsEnabled()
59
+ val platformBundle = bundleOf(
60
+ IMPORTANCE_KEY to managerCompat.importance,
61
+ ).apply {
62
+ val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
63
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && notificationManager != null) {
64
+ putInt(INTERRUPTION_FILTER_KEY, notificationManager.currentInterruptionFilter)
65
+ }
66
+ }
67
+
68
+ val areAllGranted = permissionsMap.all { (_, response) -> response.status == PermissionsStatus.GRANTED }
69
+ val areAllDenied = permissionsMap.all { (_, response) -> response.status == PermissionsStatus.DENIED }
70
+ val canAskAgain = permissionsMap.all { (_, response) -> response.canAskAgain }
71
+ val status = when {
72
+ areAllDenied -> PermissionsStatus.DENIED.status
73
+ !areEnabled -> PermissionsStatus.DENIED.status
74
+ areAllGranted -> PermissionsStatus.GRANTED.status
75
+ else -> PermissionsStatus.UNDETERMINED.status
76
+ }
77
+
78
+ promise.resolve(
79
+ bundleOf(
80
+ PermissionsResponse.EXPIRES_KEY to PermissionsResponse.PERMISSION_EXPIRES_NEVER,
81
+ PermissionsResponse.STATUS_KEY to status,
82
+ PermissionsResponse.CAN_ASK_AGAIN_KEY to canAskAgain,
83
+ PermissionsResponse.GRANTED_KEY to areAllGranted,
84
+ ANDROID_RESPONSE_KEY to platformBundle,
85
+ )
86
+ )
87
+ },
88
+ *PERMISSIONS
89
+ )
90
+ }
91
+
92
+ private fun getPermissionsWithPromiseImplClassic(promise: Promise) {
93
+ val managerCompat = NotificationManagerCompat.from(context)
94
+ val areEnabled = managerCompat.areNotificationsEnabled()
95
+ val status = if (areEnabled) PermissionsStatus.GRANTED else PermissionsStatus.DENIED
96
+ val platformBundle = bundleOf(
97
+ IMPORTANCE_KEY to managerCompat.importance,
98
+ ).apply {
99
+ val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
100
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && notificationManager != null) {
101
+ putInt(INTERRUPTION_FILTER_KEY, notificationManager.currentInterruptionFilter)
102
+ }
103
+ }
104
+
105
+ promise.resolve(
106
+ bundleOf(
107
+ PermissionsResponse.EXPIRES_KEY to PermissionsResponse.PERMISSION_EXPIRES_NEVER,
108
+ PermissionsResponse.STATUS_KEY to status.status,
109
+ PermissionsResponse.CAN_ASK_AGAIN_KEY to areEnabled,
110
+ PermissionsResponse.GRANTED_KEY to (status == PermissionsStatus.GRANTED),
111
+ ANDROID_RESPONSE_KEY to platformBundle,
112
+ )
113
+ )
114
+ }
115
+
116
+ @RequiresApi(33)
117
+ private fun requestPermissionsWithPromiseImplApi33(promise: Promise) {
118
+ val permissionManager = moduleRegistry.getModule(Permissions::class.java)
119
+ if (permissionManager == null) {
120
+ promise.reject("E_NO_PERMISSIONS", "Permissions module is null. Are you sure all the installed Expo modules are properly linked?")
121
+ return
122
+ }
123
+
124
+ permissionManager.askForPermissions(
125
+ {
126
+ getPermissionsWithPromiseImplApi33(promise)
127
+ },
128
+ *PERMISSIONS
129
+ )
130
+ }
131
+
132
+ companion object {
133
+ private const val EXPORTED_NAME = "ExpoNotificationPermissionsModule"
134
+ private const val ANDROID_RESPONSE_KEY = "android"
135
+ private const val IMPORTANCE_KEY = "importance"
136
+ private const val INTERRUPTION_FILTER_KEY = "interruptionFilter"
137
+
138
+ private val PERMISSIONS: Array<String>
139
+ /**
140
+ * TODO: Use {@link Android.Manifest.permission.POST_NOTIFICATIONS} when we support compileSdkVersion 33
141
+ */
142
+ get() = arrayOf("android.permission.POST_NOTIFICATIONS")
143
+ }
144
+ }
@@ -502,7 +502,7 @@ open class NotificationsService : BroadcastReceiver() {
502
502
  val notification = intent.getParcelableExtra<Notification>(NOTIFICATION_KEY) ?: throw IllegalArgumentException("$NOTIFICATION_KEY not found in the intent extras.")
503
503
  val action = intent.getParcelableExtra<NotificationAction>(NOTIFICATION_ACTION_KEY) ?: throw IllegalArgumentException("$NOTIFICATION_ACTION_KEY not found in the intent extras.")
504
504
  val response = if (action is TextInputNotificationAction) {
505
- val userText = action.placeholder ?: RemoteInput.getResultsFromIntent(intent).getString(USER_TEXT_RESPONSE_KEY)
505
+ val userText = action.placeholder ?: RemoteInput.getResultsFromIntent(intent)?.getString(USER_TEXT_RESPONSE_KEY) ?: ""
506
506
  TextInputNotificationResponse(action, notification, userText)
507
507
  } else {
508
508
  NotificationResponse(action, notification)
@@ -1,7 +1,7 @@
1
1
  import { Options as BadginOptions } from 'badgin';
2
2
  import { ProxyNativeModule } from 'expo-modules-core';
3
- export declare type WebSetBadgeCountOptions = BadginOptions;
4
- declare type SetBadgeCountOptions = WebSetBadgeCountOptions | undefined;
3
+ export type WebSetBadgeCountOptions = BadginOptions;
4
+ type SetBadgeCountOptions = WebSetBadgeCountOptions | undefined;
5
5
  export interface BadgeModule extends ProxyNativeModule {
6
6
  getBadgeCountAsync?: () => Promise<number>;
7
7
  setBadgeCountAsync?: (badgeCount: number, options: SetBadgeCountOptions) => Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"BadgeModule.types.d.ts","sourceRoot":"","sources":["../src/BadgeModule.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,oBAAY,uBAAuB,GAAG,aAAa,CAAC;AACpD,aAAK,oBAAoB,GAAG,uBAAuB,GAAG,SAAS,CAAC;AAEhE,MAAM,WAAW,WAAY,SAAQ,iBAAiB;IACpD,kBAAkB,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3C,kBAAkB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC9F"}
1
+ {"version":3,"file":"BadgeModule.types.d.ts","sourceRoot":"","sources":["../src/BadgeModule.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,MAAM,uBAAuB,GAAG,aAAa,CAAC;AACpD,KAAK,oBAAoB,GAAG,uBAAuB,GAAG,SAAS,CAAC;AAEhE,MAAM,WAAW,WAAY,SAAQ,iBAAiB;IACpD,kBAAkB,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3C,kBAAkB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC9F"}
@@ -2,17 +2,14 @@ import 'abort-controller/polyfill';
2
2
  /**
3
3
  * Encapsulates device server registration data
4
4
  */
5
- export declare type DevicePushTokenRegistration = {
5
+ export type DevicePushTokenRegistration = {
6
6
  isEnabled: boolean;
7
7
  };
8
8
  /**
9
9
  * Sets the registration information so that the device push token gets pushed
10
10
  * to the given registration endpoint
11
- * @param registration Registration endpoint to inform of new tokens
11
+ * @param enabled
12
12
  */
13
13
  export declare function setAutoServerRegistrationEnabledAsync(enabled: boolean): Promise<void>;
14
- /**
15
- * This function is exported only for testing purposes.
16
- */
17
14
  export declare function __handlePersistedRegistrationInfoAsync(registrationInfo: string | null | undefined): Promise<void>;
18
15
  //# sourceMappingURL=DevicePushTokenAutoRegistration.fx.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DevicePushTokenAutoRegistration.fx.d.ts","sourceRoot":"","sources":["../src/DevicePushTokenAutoRegistration.fx.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC;AAiBnC;;GAEG;AACH,oBAAY,2BAA2B,GAAG;IACxC,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,qCAAqC,CAAC,OAAO,EAAE,OAAO,iBAY3E;AAED;;GAEG;AACH,wBAAsB,sCAAsC,CAC1D,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,iBAiC5C"}
1
+ {"version":3,"file":"DevicePushTokenAutoRegistration.fx.d.ts","sourceRoot":"","sources":["../src/DevicePushTokenAutoRegistration.fx.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC;AAiBnC;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,qCAAqC,CAAC,OAAO,EAAE,OAAO,iBAY3E;AAGD,wBAAsB,sCAAsC,CAC1D,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,iBAiC5C"}
@@ -14,7 +14,7 @@ async function updatePushTokenAsync(token) {
14
14
  /**
15
15
  * Sets the registration information so that the device push token gets pushed
16
16
  * to the given registration endpoint
17
- * @param registration Registration endpoint to inform of new tokens
17
+ * @param enabled
18
18
  */
19
19
  export async function setAutoServerRegistrationEnabledAsync(enabled) {
20
20
  // We are overwriting registration, so we shouldn't let
@@ -25,9 +25,7 @@ export async function setAutoServerRegistrationEnabledAsync(enabled) {
25
25
  }
26
26
  await ServerRegistrationModule.setRegistrationInfoAsync(enabled ? JSON.stringify({ isEnabled: enabled }) : null);
27
27
  }
28
- /**
29
- * This function is exported only for testing purposes.
30
- */
28
+ // note(Chmiela): This function is exported only for testing purposes.
31
29
  export async function __handlePersistedRegistrationInfoAsync(registrationInfo) {
32
30
  if (!registrationInfo) {
33
31
  // No registration info, nothing to do
@@ -1 +1 @@
1
- {"version":3,"file":"DevicePushTokenAutoRegistration.fx.js","sourceRoot":"","sources":["../src/DevicePushTokenAutoRegistration.fx.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,0BAA0B,IAAI,oCAAoC,EAAE,MAAM,oCAAoC,CAAC;AAExH,IAAI,mBAAmB,GAA2B,IAAI,CAAC;AACvD,KAAK,UAAU,oBAAoB,CAAC,KAAsB;IACxD,+BAA+B;IAC/B,mBAAmB,EAAE,KAAK,EAAE,CAAC;IAC7B,mBAAmB,GAAG,IAAI,eAAe,EAAE,CAAC;IAC5C,OAAO,MAAM,oCAAoC,CAAC,mBAAmB,CAAC,MA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,EAAE,EAAE;QACnC,IAAI;YACF,wEAAwE;YACxE,yEAAyE;YACzE,2BAA2B;YAC3B,MAAM,gBAAgB,GAAG,MAAM,wBAAwB,CAAC,wBAAyB,EAAE,CAAC;YAEpF,IAAI,CAAC,gBAAgB,EAAE;gBACrB,8BAA8B;gBAC9B,OAAO;aACR;YAED,MAAM,YAAY,GAAuC,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACtF,IAAI,YAAY,EAAE,SAAS,EAAE;gBAC3B,uCAAuC;gBACvC,+BAA+B;gBAC/B,MAAM,oBAAoB,CAAC,KAAK,CAAC,CAAC;aACnC;SACF;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,IAAI,CACV,0GAA0G,EAC1G,CAAC,CACF,CAAC;SACH;IACH,CAAC,CAAC,CAAC;IAEH,mCAAmC;IACnC,uCAAuC;IACvC,oCAAoC;IACpC,wBAAwB,CAAC,wBAAwB,EAAE,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;CAClG;KAAM;IACL,OAAO,CAAC,IAAI,CACV,2IAA2I,EAC3I,IAAI,mBAAmB,CAAC,0BAA0B,EAAE,0BAA0B,CAAC,CAChF,CAAC;CACH","sourcesContent":["import 'abort-controller/polyfill';\nimport { UnavailabilityError } from 'expo-modules-core';\n\nimport ServerRegistrationModule from './ServerRegistrationModule';\nimport { addPushTokenListener } from './TokenEmitter';\nimport { DevicePushToken } from './Tokens.types';\nimport getDevicePushTokenAsync from './getDevicePushTokenAsync';\nimport { updateDevicePushTokenAsync as updateDevicePushTokenAsyncWithSignal } from './utils/updateDevicePushTokenAsync';\n\nlet lastAbortController: AbortController | null = null;\nasync function updatePushTokenAsync(token: DevicePushToken) {\n // Abort current update process\n lastAbortController?.abort();\n lastAbortController = new AbortController();\n return await updateDevicePushTokenAsyncWithSignal(lastAbortController.signal, token);\n}\n\n/**\n * Encapsulates device server registration data\n */\nexport type DevicePushTokenRegistration = {\n isEnabled: boolean;\n};\n\n/**\n * Sets the registration information so that the device push token gets pushed\n * to the given registration endpoint\n * @param registration Registration endpoint to inform of new tokens\n */\nexport async function setAutoServerRegistrationEnabledAsync(enabled: boolean) {\n // We are overwriting registration, so we shouldn't let\n // any pending request complete.\n lastAbortController?.abort();\n\n if (!ServerRegistrationModule.setRegistrationInfoAsync) {\n throw new UnavailabilityError('ServerRegistrationModule', 'setRegistrationInfoAsync');\n }\n\n await ServerRegistrationModule.setRegistrationInfoAsync(\n enabled ? JSON.stringify({ isEnabled: enabled }) : null\n );\n}\n\n/**\n * This function is exported only for testing purposes.\n */\nexport async function __handlePersistedRegistrationInfoAsync(\n registrationInfo: string | null | undefined\n) {\n if (!registrationInfo) {\n // No registration info, nothing to do\n return;\n }\n\n let registration: DevicePushTokenRegistration | null = null;\n try {\n registration = JSON.parse(registrationInfo);\n } catch (e) {\n console.warn(\n '[expo-notifications] Error encountered while fetching registration information for auto token updates.',\n e\n );\n }\n\n if (!registration?.isEnabled) {\n // Registration is invalid or not enabled, nothing more to do\n return;\n }\n\n try {\n // Since the registration is enabled, fetching a \"new\" device token\n // shouldn't be a problem.\n const latestDevicePushToken = await getDevicePushTokenAsync();\n await updatePushTokenAsync(latestDevicePushToken);\n } catch (e) {\n console.warn(\n '[expo-notifications] Error encountered while updating server registration with latest device push token.',\n e\n );\n }\n}\n\nif (ServerRegistrationModule.getRegistrationInfoAsync) {\n // A global scope (to get all the updates) device push token\n // subscription, never cleared.\n addPushTokenListener(async (token) => {\n try {\n // Before updating the push token on server we always check if we should\n // Since modules can't change their method availability while running, we\n // can assert it's defined.\n const registrationInfo = await ServerRegistrationModule.getRegistrationInfoAsync!();\n\n if (!registrationInfo) {\n // Registration is not enabled\n return;\n }\n\n const registration: DevicePushTokenRegistration | null = JSON.parse(registrationInfo);\n if (registration?.isEnabled) {\n // Dispatch an abortable task to update\n // registration with new token.\n await updatePushTokenAsync(token);\n }\n } catch (e) {\n console.warn(\n '[expo-notifications] Error encountered while updating server registration with latest device push token.',\n e\n );\n }\n });\n\n // Verify if persisted registration\n // has successfully uploaded last known\n // device push token. If not, retry.\n ServerRegistrationModule.getRegistrationInfoAsync().then(__handlePersistedRegistrationInfoAsync);\n} else {\n console.warn(\n `[expo-notifications] Error encountered while fetching auto-registration state, new tokens will not be automatically registered on server.`,\n new UnavailabilityError('ServerRegistrationModule', 'getRegistrationInfoAsync')\n );\n}\n"]}
1
+ {"version":3,"file":"DevicePushTokenAutoRegistration.fx.js","sourceRoot":"","sources":["../src/DevicePushTokenAutoRegistration.fx.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,0BAA0B,IAAI,oCAAoC,EAAE,MAAM,oCAAoC,CAAC;AAExH,IAAI,mBAAmB,GAA2B,IAAI,CAAC;AACvD,KAAK,UAAU,oBAAoB,CAAC,KAAsB;IACxD,+BAA+B;IAC/B,mBAAmB,EAAE,KAAK,EAAE,CAAC;IAC7B,mBAAmB,GAAG,IAAI,eAAe,EAAE,CAAC;IAC5C,OAAO,MAAM,oCAAoC,CAAC,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACvF,CAAC;AASD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,qCAAqC,CAAC,OAAgB;IAC1E,uDAAuD;IACvD,gCAAgC;IAChC,mBAAmB,EAAE,KAAK,EAAE,CAAC;IAE7B,IAAI,CAAC,wBAAwB,CAAC,wBAAwB,EAAE;QACtD,MAAM,IAAI,mBAAmB,CAAC,0BAA0B,EAAE,0BAA0B,CAAC,CAAC;KACvF;IAED,MAAM,wBAAwB,CAAC,wBAAwB,CACrD,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CA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CAAC,CAAC;aACnC;SACF;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,IAAI,CACV,0GAA0G,EAC1G,CAAC,CACF,CAAC;SACH;IACH,CAAC,CAAC,CAAC;IAEH,mCAAmC;IACnC,uCAAuC;IACvC,oCAAoC;IACpC,wBAAwB,CAAC,wBAAwB,EAAE,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;CAClG;KAAM;IACL,OAAO,CAAC,IAAI,CACV,2IAA2I,EAC3I,IAAI,mBAAmB,CAAC,0BAA0B,EAAE,0BAA0B,CAAC,CAChF,CAAC;CACH","sourcesContent":["import 'abort-controller/polyfill';\nimport { UnavailabilityError } from 'expo-modules-core';\n\nimport ServerRegistrationModule from './ServerRegistrationModule';\nimport { addPushTokenListener } from './TokenEmitter';\nimport { DevicePushToken } from './Tokens.types';\nimport getDevicePushTokenAsync from './getDevicePushTokenAsync';\nimport { updateDevicePushTokenAsync as updateDevicePushTokenAsyncWithSignal } from './utils/updateDevicePushTokenAsync';\n\nlet lastAbortController: AbortController | null = null;\nasync function updatePushTokenAsync(token: DevicePushToken) {\n // Abort current update process\n lastAbortController?.abort();\n lastAbortController = new AbortController();\n return await updateDevicePushTokenAsyncWithSignal(lastAbortController.signal, token);\n}\n\n/**\n * Encapsulates device server registration data\n */\nexport type DevicePushTokenRegistration = {\n isEnabled: boolean;\n};\n\n/**\n * Sets the registration information so that the device push token gets pushed\n * to the given registration endpoint\n * @param enabled\n */\nexport async function setAutoServerRegistrationEnabledAsync(enabled: boolean) {\n // We are overwriting registration, so we shouldn't let\n // any pending request complete.\n lastAbortController?.abort();\n\n if (!ServerRegistrationModule.setRegistrationInfoAsync) {\n throw new UnavailabilityError('ServerRegistrationModule', 'setRegistrationInfoAsync');\n }\n\n await ServerRegistrationModule.setRegistrationInfoAsync(\n enabled ? JSON.stringify({ isEnabled: enabled }) : null\n );\n}\n\n// note(Chmiela): This function is exported only for testing purposes.\nexport async function __handlePersistedRegistrationInfoAsync(\n registrationInfo: string | null | undefined\n) {\n if (!registrationInfo) {\n // No registration info, nothing to do\n return;\n }\n\n let registration: DevicePushTokenRegistration | null = null;\n try {\n registration = JSON.parse(registrationInfo);\n } catch (e) {\n console.warn(\n '[expo-notifications] Error encountered while fetching registration information for auto token updates.',\n e\n );\n }\n\n if (!registration?.isEnabled) {\n // Registration is invalid or not enabled, nothing more to do\n return;\n }\n\n try {\n // Since the registration is enabled, fetching a \"new\" device token\n // shouldn't be a problem.\n const latestDevicePushToken = await getDevicePushTokenAsync();\n await updatePushTokenAsync(latestDevicePushToken);\n } catch (e) {\n console.warn(\n '[expo-notifications] Error encountered while updating server registration with latest device push token.',\n e\n );\n }\n}\n\nif (ServerRegistrationModule.getRegistrationInfoAsync) {\n // A global scope (to get all the updates) device push token\n // subscription, never cleared.\n addPushTokenListener(async (token) => {\n try {\n // Before updating the push token on server we always check if we should\n // Since modules can't change their method availability while running, we\n // can assert it's defined.\n const registrationInfo = await ServerRegistrationModule.getRegistrationInfoAsync!();\n\n if (!registrationInfo) {\n // Registration is not enabled\n return;\n }\n\n const registration: DevicePushTokenRegistration | null = JSON.parse(registrationInfo);\n if (registration?.isEnabled) {\n // Dispatch an abortable task to update\n // registration with new token.\n await updatePushTokenAsync(token);\n }\n } catch (e) {\n console.warn(\n '[expo-notifications] Error encountered while updating server registration with latest device push token.',\n e\n );\n }\n });\n\n // Verify if persisted registration\n // has successfully uploaded last known\n // device push token. If not, retry.\n ServerRegistrationModule.getRegistrationInfoAsync().then(__handlePersistedRegistrationInfoAsync);\n} else {\n console.warn(\n `[expo-notifications] Error encountered while fetching auto-registration state, new tokens will not be automatically registered on server.`,\n new UnavailabilityError('ServerRegistrationModule', 'getRegistrationInfoAsync')\n );\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import { NotificationAction } from './Notifications.types';
2
2
  declare const _default: {
3
3
  getNotificationCategoriesAsync(): Promise<null>;
4
- setNotificationCategoryAsync(identifier: string, actions: NotificationAction[], options?: object | undefined): Promise<null>;
4
+ setNotificationCategoryAsync(identifier: string, actions: NotificationAction[], options?: object): Promise<null>;
5
5
  deleteNotificationCategoryAsync(identifier: string): Promise<null>;
6
6
  };
7
7
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationCategoriesModule.web.d.ts","sourceRoot":"","sources":["../src/NotificationCategoriesModule.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;;sCAGjB,QAAQ,IAAI,CAAC;6CAIvC,MAAM,WACT,kBAAkB,EAAE,iCAE5B,QAAQ,IAAI,CAAC;gDAGkC,MAAM,GAAG,QAAQ,IAAI,CAAC;;AAX1E,wBAcE"}
1
+ {"version":3,"file":"NotificationCategoriesModule.web.d.ts","sourceRoot":"","sources":["../src/NotificationCategoriesModule.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;;sCAGjB,QAAQ,IAAI,CAAC;6CAIvC,MAAM,WACT,kBAAkB,EAAE,YACnB,MAAM,GACf,QAAQ,IAAI,CAAC;gDAGkC,MAAM,GAAG,QAAQ,IAAI,CAAC;;AAX1E,wBAcE"}
@@ -1,5 +1,9 @@
1
1
  import { ProxyNativeModule } from 'expo-modules-core';
2
2
  import { NotificationChannel } from './NotificationChannelManager.types';
3
+ /**
4
+ * An object represents a notification channel group.
5
+ * @platform android
6
+ */
3
7
  export interface NotificationChannelGroup {
4
8
  id: string;
5
9
  name: string | null;
@@ -7,6 +11,10 @@ export interface NotificationChannelGroup {
7
11
  isBlocked?: boolean;
8
12
  channels: NotificationChannel[];
9
13
  }
14
+ /**
15
+ * An object represents a notification channel group to be set.
16
+ * @platform android
17
+ */
10
18
  export interface NotificationChannelGroupInput {
11
19
  name: string | null;
12
20
  description?: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationChannelGroupManager.types.d.ts","sourceRoot":"","sources":["../src/NotificationChannelGroupManager.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,mBAAmB,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,6BAA6B;IAC5C,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,MAAM,WAAW,+BAAgC,SAAQ,iBAAiB;IACxE,iCAAiC,CAAC,EAAE,MAAM,OAAO,CAAC,wBAAwB,EAAE,CAAC,CAAC;IAC9E,gCAAgC,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC,CAAC;IACjG,gCAAgC,CAAC,EAAE,CACjC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,6BAA6B,KACjC,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC,CAAC;IAC9C,mCAAmC,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1E"}
1
+ {"version":3,"file":"NotificationChannelGroupManager.types.d.ts","sourceRoot":"","sources":["../src/NotificationChannelGroupManager.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,mBAAmB,EAAE,CAAC;CACjC;AAED;;;GAGG;AACH,MAAM,WAAW,6BAA6B;IAC5C,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,MAAM,WAAW,+BAAgC,SAAQ,iBAAiB;IACxE,iCAAiC,CAAC,EAAE,MAAM,OAAO,CAAC,wBAAwB,EAAE,CAAC,CAAC;IAC9E,gCAAgC,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC,CAAC;IACjG,gCAAgC,CAAC,EAAE,CACjC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,6BAA6B,KACjC,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC,CAAC;IAC9C,mCAAmC,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1E"}
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationChannelGroupManager.types.js","sourceRoot":"","sources":["../src/NotificationChannelGroupManager.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ProxyNativeModule } from 'expo-modules-core';\n\nimport { NotificationChannel } from './NotificationChannelManager.types';\n\nexport interface NotificationChannelGroup {\n id: string;\n name: string | null;\n description?: string | null;\n isBlocked?: boolean;\n channels: NotificationChannel[];\n}\n\nexport interface NotificationChannelGroupInput {\n name: string | null;\n description?: string | null;\n}\n\nexport interface NotificationChannelGroupManager extends ProxyNativeModule {\n getNotificationChannelGroupsAsync?: () => Promise<NotificationChannelGroup[]>;\n getNotificationChannelGroupAsync?: (groupId: string) => Promise<NotificationChannelGroup | null>;\n setNotificationChannelGroupAsync?: (\n groupId: string,\n group: NotificationChannelGroupInput\n ) => Promise<NotificationChannelGroup | null>;\n deleteNotificationChannelGroupAsync?: (groupId: string) => Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"NotificationChannelGroupManager.types.js","sourceRoot":"","sources":["../src/NotificationChannelGroupManager.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ProxyNativeModule } from 'expo-modules-core';\n\nimport { NotificationChannel } from './NotificationChannelManager.types';\n\n/**\n * An object represents a notification channel group.\n * @platform android\n */\nexport interface NotificationChannelGroup {\n id: string;\n name: string | null;\n description?: string | null;\n isBlocked?: boolean;\n channels: NotificationChannel[];\n}\n\n/**\n * An object represents a notification channel group to be set.\n * @platform android\n */\nexport interface NotificationChannelGroupInput {\n name: string | null;\n description?: string | null;\n}\n\nexport interface NotificationChannelGroupManager extends ProxyNativeModule {\n getNotificationChannelGroupsAsync?: () => Promise<NotificationChannelGroup[]>;\n getNotificationChannelGroupAsync?: (groupId: string) => Promise<NotificationChannelGroup | null>;\n setNotificationChannelGroupAsync?: (\n groupId: string,\n group: NotificationChannelGroupInput\n ) => Promise<NotificationChannelGroup | null>;\n deleteNotificationChannelGroupAsync?: (groupId: string) => Promise<void>;\n}\n"]}
@@ -19,7 +19,9 @@ export declare enum AndroidImportance {
19
19
  MIN = 3,
20
20
  LOW = 4,
21
21
  DEFAULT = 5,
22
- /** @deprecated use `DEFAULT` instead */
22
+ /**
23
+ * @deprecated Use `DEFAULT` instead.
24
+ */
23
25
  DEEFAULT = 5,
24
26
  HIGH = 6,
25
27
  MAX = 7
@@ -49,7 +51,11 @@ export interface AudioAttributes {
49
51
  requestHardwareAudioVideoSynchronization: boolean;
50
52
  };
51
53
  }
52
- export declare type AudioAttributesInput = Partial<AudioAttributes>;
54
+ export type AudioAttributesInput = Partial<AudioAttributes>;
55
+ /**
56
+ * An object represents a notification channel.
57
+ * @platform android
58
+ */
53
59
  export interface NotificationChannel {
54
60
  id: string;
55
61
  name: string | null;
@@ -66,8 +72,12 @@ export interface NotificationChannel {
66
72
  enableLights: boolean;
67
73
  enableVibrate: boolean;
68
74
  }
69
- declare type RequiredBy<T, K extends keyof T> = Partial<Omit<T, K>> & Required<Pick<T, K>>;
70
- export declare type NotificationChannelInput = RequiredBy<Omit<NotificationChannel, 'id' | 'audioAttributes' | 'sound'> & {
75
+ type RequiredBy<T, K extends keyof T> = Partial<Omit<T, K>> & Required<Pick<T, K>>;
76
+ /**
77
+ * An object represents a notification channel to be set.
78
+ * @platform android
79
+ */
80
+ export type NotificationChannelInput = RequiredBy<Omit<NotificationChannel, 'id' | 'audioAttributes' | 'sound'> & {
71
81
  audioAttributes?: AudioAttributesInput;
72
82
  sound?: string | null;
73
83
  }, 'name' | 'importance'>;
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationChannelManager.types.d.ts","sourceRoot":"","sources":["../src/NotificationChannelManager.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,oBAAY,6BAA6B;IACvC,OAAO,IAAI;IACX,MAAM,IAAI;IACV,OAAO,IAAI;IACX,MAAM,IAAI;CACX;AAED,oBAAY,uBAAuB;IACjC,OAAO,IAAI;IACX,MAAM,IAAI;IACV,KAAK,IAAI;IACT,KAAK,IAAI;IACT,YAAY,IAAI;CACjB;AAED,oBAAY,iBAAiB;IAC3B,OAAO,IAAI;IACX,WAAW,IAAI;IACf,IAAI,IAAI;IACR,GAAG,IAAI;IACP,GAAG,IAAI;IACP,OAAO,IAAI;IACX,wCAAwC;IACxC,QAAQ,IAAI;IACZ,IAAI,IAAI;IACR,GAAG,IAAI;CACR;AAED,oBAAY,iBAAiB;IAC3B,OAAO,IAAI;IACX,KAAK,IAAI;IACT,mBAAmB,IAAI;IACvB,8BAA8B,IAAI;IAClC,KAAK,IAAI;IACT,YAAY,IAAI;IAChB,qBAAqB,IAAI;IACzB,kCAAkC,IAAI;IACtC,kCAAkC,IAAI;IACtC,kCAAkC,IAAI;IACtC,kBAAkB,KAAK;IACvB,wBAAwB,KAAK;IAC7B,8BAA8B,KAAK;IACnC,uBAAuB,KA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,YAAY,CACtB,CAAC;AAEF,MAAM,WAAW,0BAA2B,SAAQ,iBAAiB;IACnE,4BAA4B,CAAC,EAAE,MAAM,OAAO,CAAC,mBAAmB,EAAE,GAAG,IAAI,CAAC,CAAC;IAC3E,2BAA2B,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;IACzF,2BAA2B,CAAC,EAAE,CAC5B,SAAS,EAAE,MAAM,EACjB,oBAAoB,EAAE,wBAAwB,KAC3C,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;IACzC,8BAA8B,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACvE"}
1
+ {"version":3,"file":"NotificationChannelManager.types.d.ts","sourceRoot":"","sources":["../src/NotificationChannelManager.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGtD,oBAAY,6BAA6B;IACvC,OAAO,IAAI;IACX,MAAM,IAAI;IACV,OAAO,IAAI;IACX,MAAM,IAAI;CACX;AAGD,oBAAY,uBAAuB;IACjC,OAAO,IAAI;IACX,MAAM,IAAI;IACV,KAAK,IAAI;IACT,KAAK,IAAI;IACT,YAAY,IAAI;CACjB;AAGD,oBAAY,iBAAiB;IAC3B,OAAO,IAAI;IACX,WAAW,IAAI;IACf,IAAI,IAAI;IACR,GAAG,IAAI;IACP,GAAG,IAAI;IACP,OAAO,IAAI;IACX;;OAEG;IACH,QAAQ,IAAI;IACZ,IAAI,IAAI;IACR,GAAG,IAAI;CACR;AAGD,oBAAY,iBAAiB;IAC3B,OAAO,IAAI;IACX,KAAK,IAAI;IACT,mBAAmB,IAAI;IACvB,8BAA8B,IAAI;IAClC,KAAK,IAAI;IACT,YAAY,IAAI;IAChB,qBAAqB,IAAI;IACzB,kCAAkC,IAAI;IACtC,kCAAkC,IAAI;IACtC,kCAAkC,IAA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ACV,GAAG;IAAE,eAAe,CAAC,EAAE,oBAAoB,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,EACrE,MAAM,GAAG,YAAY,CACtB,CAAC;AAEF,MAAM,WAAW,0BAA2B,SAAQ,iBAAiB;IACnE,4BAA4B,CAAC,EAAE,MAAM,OAAO,CAAC,mBAAmB,EAAE,GAAG,IAAI,CAAC,CAAC;IAC3E,2BAA2B,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;IACzF,2BAA2B,CAAC,EAAE,CAC5B,SAAS,EAAE,MAAM,EACjB,oBAAoB,EAAE,wBAAwB,KAC3C,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;IACzC,8BAA8B,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACvE"}
@@ -1,3 +1,4 @@
1
+ // @docsMissing
1
2
  export var AndroidNotificationVisibility;
2
3
  (function (AndroidNotificationVisibility) {
3
4
  AndroidNotificationVisibility[AndroidNotificationVisibility["UNKNOWN"] = 0] = "UNKNOWN";
@@ -5,6 +6,7 @@ export var AndroidNotificationVisibility;
5
6
  AndroidNotificationVisibility[AndroidNotificationVisibility["PRIVATE"] = 2] = "PRIVATE";
6
7
  AndroidNotificationVisibility[AndroidNotificationVisibility["SECRET"] = 3] = "SECRET";
7
8
  })(AndroidNotificationVisibility || (AndroidNotificationVisibility = {}));
9
+ // @docsMissing
8
10
  export var AndroidAudioContentType;
9
11
  (function (AndroidAudioContentType) {
10
12
  AndroidAudioContentType[AndroidAudioContentType["UNKNOWN"] = 0] = "UNKNOWN";
@@ -13,6 +15,7 @@ export var AndroidAudioContentType;
13
15
  AndroidAudioContentType[AndroidAudioContentType["MOVIE"] = 3] = "MOVIE";
14
16
  AndroidAudioContentType[AndroidAudioContentType["SONIFICATION"] = 4] = "SONIFICATION";
15
17
  })(AndroidAudioContentType || (AndroidAudioContentType = {}));
18
+ // @docsMissing
16
19
  export var AndroidImportance;
17
20
  (function (AndroidImportance) {
18
21
  AndroidImportance[AndroidImportance["UNKNOWN"] = 0] = "UNKNOWN";
@@ -21,11 +24,14 @@ export var AndroidImportance;
21
24
  AndroidImportance[AndroidImportance["MIN"] = 3] = "MIN";
22
25
  AndroidImportance[AndroidImportance["LOW"] = 4] = "LOW";
23
26
  AndroidImportance[AndroidImportance["DEFAULT"] = 5] = "DEFAULT";
24
- /** @deprecated use `DEFAULT` instead */
27
+ /**
28
+ * @deprecated Use `DEFAULT` instead.
29
+ */
25
30
  AndroidImportance[AndroidImportance["DEEFAULT"] = 5] = "DEEFAULT";
26
31
  AndroidImportance[AndroidImportance["HIGH"] = 6] = "HIGH";
27
32
  AndroidImportance[AndroidImportance["MAX"] = 7] = "MAX";
28
33
  })(AndroidImportance || (AndroidImportance = {}));
34
+ // @docsMissing
29
35
  export var AndroidAudioUsage;
30
36
  (function (AndroidAudioUsage) {
31
37
  AndroidAudioUsage[AndroidAudioUsage["UNKNOWN"] = 0] = "UNKNOWN";
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationChannelManager.types.js","sourceRoot":"","sources":["../src/NotificationChannelManager.types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,6BAKX;AALD,WAAY,6BAA6B;IACvC,uFAAW,CAAA;IACX,qFAAU,CAAA;IACV,uFAAW,CAAA;IACX,qFAAU,CAAA;AACZ,CAAC,EALW,6BAA6B,KAA7B,6BAA6B,QAKxC;AAED,MAAM,CAAN,IAAY,uBAMX;AAND,WAAY,uBAAuB;IACjC,2EAAW,CAAA;IACX,yEAAU,CAAA;IACV,uEAAS,CAAA;IACT,uEAAS,CAAA;IACT,qFAAgB,CAAA;AAClB,CAAC,EANW,uBAAuB,KAAvB,uBAAuB,QAMlC;AAED,MAAM,CAAN,IAAY,iBAWX;AAXD,WAAY,iBAAiB;IAC3B,+DAAW,CAAA;IACX,uEAAe,CAAA;IACf,yDAAQ,CAAA;IACR,uDAAO,CAAA;IACP,uDAAO,CAAA;IACP,+DAAW,CAAA;IACX,wCAAwC;IACxC,iEAAY,CAAA;IACZ,yDAAQ,CAAA;IACR,uDAAO,CAAA;AACT,CAAC,EAXW,iBAAiB,KAAjB,iBAAiB,QAW5B;AAED,MAAM,CAAN,IAAY,iBAgBX;AAhBD,WAAY,iBAAiB;IAC3B,+DAAW,CAAA;IACX,2DAAS,CAAA;IACT,uFAAuB,CAAA;IACvB,6GAAkC,CAAA;IAClC,2DAAS,CAAA;IACT,yEAAgB,CAAA;IAChB,2FAAyB,CAAA;IACzB,qHAAsC,CAAA;IACtC,qHAAsC,CAAA;IACtC,qHAAsC,CAAA;IACtC,sFAAuB,CAAA;IACvB,kGAA6B,CAAA;IAC7B,8GAAmC,CAAA;IACnC,gGAA4B,CAAA;IAC5B,0DAAS,CAAA;AACX,CAAC,EAhBW,iBAAiB,KAAjB,iBAAiB,QAgB5B","sourcesContent":["import { ProxyNativeModule } from 'expo-modules-core';\n\nexport enum AndroidNotificationVisibility {\n UNKNOWN = 0,\n PUBLIC = 1,\n PRIVATE = 2,\n SECRET = 3,\n}\n\nexport enum AndroidAudioContentType {\n UNKNOWN = 0,\n SPEECH = 1,\n MUSIC = 2,\n MOVIE = 3,\n SONIFICATION = 4,\n}\n\nexport enum AndroidImportance {\n UNKNOWN = 0,\n UNSPECIFIED = 1,\n NONE = 2,\n MIN = 3,\n LOW = 4,\n DEFAULT = 5,\n /** @deprecated use `DEFAULT` instead */\n DEEFAULT = 5,\n HIGH = 6,\n MAX = 7,\n}\n\nexport enum AndroidAudioUsage {\n UNKNOWN = 0,\n MEDIA = 1,\n VOICE_COMMUNICATION = 2,\n VOICE_COMMUNICATION_SIGNALLING = 3,\n ALARM = 4,\n NOTIFICATION = 5,\n NOTIFICATION_RINGTONE = 6,\n NOTIFICATION_COMMUNICATION_REQUEST = 7,\n NOTIFICATION_COMMUNICATION_INSTANT = 8,\n NOTIFICATION_COMMUNICATION_DELAYED = 9,\n NOTIFICATION_EVENT = 10,\n ASSISTANCE_ACCESSIBILITY = 11,\n ASSISTANCE_NAVIGATION_GUIDANCE = 12,\n ASSISTANCE_SONIFICATION = 13,\n GAME = 14,\n}\n\nexport interface AudioAttributes {\n usage: AndroidAudioUsage;\n contentType: AndroidAudioContentType;\n flags: {\n enforceAudibility: boolean;\n requestHardwareAudioVideoSynchronization: boolean;\n };\n}\n\n// We're making inner flags required to set intentionally.\n// Not providing `true` for a flag makes it false, it doesn't make sense\n// to let it be left undefined.\nexport type AudioAttributesInput = Partial<AudioAttributes>;\n\nexport interface NotificationChannel {\n id: string;\n name: string | null;\n importance: AndroidImportance;\n bypassDnd: boolean;\n description: string | null;\n groupId?: string | null;\n lightColor: string;\n lockscreenVisibility: AndroidNotificationVisibility;\n showBadge: boolean;\n sound: 'default' | 'custom' | null;\n audioAttributes: AudioAttributes;\n vibrationPattern: number[] | null;\n enableLights: boolean;\n enableVibrate: boolean;\n}\n\ntype RequiredBy<T, K extends keyof T> = Partial<Omit<T, K>> & Required<Pick<T, K>>;\n\nexport type NotificationChannelInput = RequiredBy<\n Omit<\n NotificationChannel,\n | 'id' // id is handled separately as a function argument\n | 'audioAttributes' // need to make it AudioAttributesInput\n | 'sound'\n > & { audioAttributes?: AudioAttributesInput; sound?: string | null },\n 'name' | 'importance'\n>;\n\nexport interface NotificationChannelManager extends ProxyNativeModule {\n getNotificationChannelsAsync?: () => Promise<NotificationChannel[] | null>;\n getNotificationChannelAsync?: (channelId: string) => Promise<NotificationChannel | null>;\n setNotificationChannelAsync?: (\n channelId: string,\n channelConfiguration: NotificationChannelInput\n ) => Promise<NotificationChannel | null>;\n deleteNotificationChannelAsync?: (channelId: string) => Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"NotificationChannelManager.types.js","sourceRoot":"","sources":["../src/NotificationChannelManager.types.ts"],"names":[],"mappings":"AAEA,eAAe;AACf,MAAM,CAAN,IAAY,6BAKX;AALD,WAAY,6BAA6B;IACvC,uFAAW,CAAA;IACX,qFAAU,CAAA;IACV,uFAAW,CAAA;IACX,qFAAU,CAAA;AACZ,CAAC,EALW,6BAA6B,KAA7B,6BAA6B,QAKxC;AAED,eAAe;AACf,MAAM,CAAN,IAAY,uBAMX;AAND,WAAY,uBAAuB;IACjC,2EAAW,CAAA;IACX,yEAAU,CAAA;IACV,uEAAS,CAAA;IACT,uEAAS,CAAA;IACT,qFAAgB,CAAA;AAClB,CAAC,EANW,uBAAuB,KAAvB,uBAAuB,QAMlC;AAED,eAAe;AACf,MAAM,CAAN,IAAY,iBAaX;AAbD,WAAY,iBAAiB;IAC3B,+DAAW,CAAA;IACX,uEAAe,CAAA;IACf,yDAAQ,CAAA;IACR,uDAAO,CAAA;IACP,uDAAO,CAAA;IACP,+DAAW,CAAA;IACX;;OAEG;IACH,iEAAY,CAAA;IACZ,yDAAQ,CAAA;IACR,uDAAO,CAAA;AACT,CAAC,EAbW,iBAAiB,KAAjB,iBAAiB,QAa5B;AAED,eAAe;AACf,MAAM,CAAN,IAAY,iBAgBX;AAhBD,WAAY,iBAAiB;IAC3B,+DAAW,CAAA;IACX,2DAAS,CAAA;IACT,uFAAuB,CAAA;IACvB,6GAAkC,CAAA;IAClC,2DAAS,CAAA;IACT,yEAAgB,CAAA;IAChB,2FAAyB,CAAA;IACzB,qHAAsC,CAAA;IACtC,qHAAsC,CAAA;IACtC,qHAAsC,CAAA;IACtC,sFAAuB,CAAA;IACvB,kGAA6B,CAAA;IAC7B,8GAAmC,CAAA;IACnC,gGAA4B,CAAA;IAC5B,0DAAS,CAAA;AACX,CAAC,EAhBW,iBAAiB,KAAjB,iBAAiB,QAgB5B","sourcesContent":["import { ProxyNativeModule } from 'expo-modules-core';\n\n// @docsMissing\nexport enum AndroidNotificationVisibility {\n UNKNOWN = 0,\n PUBLIC = 1,\n PRIVATE = 2,\n SECRET = 3,\n}\n\n// @docsMissing\nexport enum AndroidAudioContentType {\n UNKNOWN = 0,\n SPEECH = 1,\n MUSIC = 2,\n MOVIE = 3,\n SONIFICATION = 4,\n}\n\n// @docsMissing\nexport enum AndroidImportance {\n UNKNOWN = 0,\n UNSPECIFIED = 1,\n NONE = 2,\n MIN = 3,\n LOW = 4,\n DEFAULT = 5,\n /**\n * @deprecated Use `DEFAULT` instead.\n */\n DEEFAULT = 5,\n HIGH = 6,\n MAX = 7,\n}\n\n// @docsMissing\nexport enum AndroidAudioUsage {\n UNKNOWN = 0,\n MEDIA = 1,\n VOICE_COMMUNICATION = 2,\n VOICE_COMMUNICATION_SIGNALLING = 3,\n ALARM = 4,\n NOTIFICATION = 5,\n NOTIFICATION_RINGTONE = 6,\n NOTIFICATION_COMMUNICATION_REQUEST = 7,\n NOTIFICATION_COMMUNICATION_INSTANT = 8,\n NOTIFICATION_COMMUNICATION_DELAYED = 9,\n NOTIFICATION_EVENT = 10,\n ASSISTANCE_ACCESSIBILITY = 11,\n ASSISTANCE_NAVIGATION_GUIDANCE = 12,\n ASSISTANCE_SONIFICATION = 13,\n GAME = 14,\n}\n\n// @docsMissing\nexport interface AudioAttributes {\n usage: AndroidAudioUsage;\n contentType: AndroidAudioContentType;\n flags: {\n enforceAudibility: boolean;\n requestHardwareAudioVideoSynchronization: boolean;\n };\n}\n\n// We're making inner flags required to set intentionally.\n// Not providing `true` for a flag makes it false, it doesn't make sense\n// to let it be left undefined.\nexport type AudioAttributesInput = Partial<AudioAttributes>;\n\n/**\n * An object represents a notification channel.\n * @platform android\n */\nexport interface NotificationChannel {\n id: string;\n name: string | null;\n importance: AndroidImportance;\n bypassDnd: boolean;\n description: string | null;\n groupId?: string | null;\n lightColor: string;\n lockscreenVisibility: AndroidNotificationVisibility;\n showBadge: boolean;\n sound: 'default' | 'custom' | null;\n audioAttributes: AudioAttributes;\n vibrationPattern: number[] | null;\n enableLights: boolean;\n enableVibrate: boolean;\n}\n\ntype RequiredBy<T, K extends keyof T> = Partial<Omit<T, K>> & Required<Pick<T, K>>;\n\n/**\n * An object represents a notification channel to be set.\n * @platform android\n */\nexport type NotificationChannelInput = RequiredBy<\n Omit<\n NotificationChannel,\n | 'id' // id is handled separately as a function argument\n | 'audioAttributes' // need to make it AudioAttributesInput\n | 'sound'\n > & { audioAttributes?: AudioAttributesInput; sound?: string | null },\n 'name' | 'importance'\n>;\n\nexport interface NotificationChannelManager extends ProxyNativeModule {\n getNotificationChannelsAsync?: () => Promise<NotificationChannel[] | null>;\n getNotificationChannelAsync?: (channelId: string) => Promise<NotificationChannel | null>;\n setNotificationChannelAsync?: (\n channelId: string,\n channelConfiguration: NotificationChannelInput\n ) => Promise<NotificationChannel | null>;\n deleteNotificationChannelAsync?: (channelId: string) => Promise<void>;\n}\n"]}
@@ -1,14 +1,56 @@
1
1
  import { NotificationPermissionsRequest, NotificationPermissionsStatus } from './NotificationPermissions.types';
2
+ /**
3
+ * Calling this function checks current permissions settings related to notifications.
4
+ * It lets you verify whether the app is currently allowed to display alerts, play sounds, etc.
5
+ * There is no user-facing effect of calling this.
6
+ * @return It returns a `Promise` resolving to an object represents permission settings ([`NotificationPermissionsStatus`](#notificationpermissionsstatus)).
7
+ * On iOS, make sure you [properly interpret the permissions response](#interpreting-the-ios-permissions-response).
8
+ * @example Check if the app is allowed to send any type of notifications (interrupting and non-interrupting–provisional on iOS).
9
+ * ```ts
10
+ * import * as Notifications from 'expo-notifications';
11
+ *
12
+ * export async function allowsNotificationsAsync() {
13
+ * const settings = await Notifications.getPermissionsAsync();
14
+ * return (
15
+ * settings.granted || settings.ios?.status === Notifications.IosAuthorizationStatus.PROVISIONAL
16
+ * );
17
+ * }
18
+ * ```
19
+ * @header permissions
20
+ */
2
21
  export declare function getPermissionsAsync(): Promise<NotificationPermissionsStatus>;
22
+ /**
23
+ * Prompts the user for notification permissions according to request. **Request defaults to asking the user to allow displaying alerts,
24
+ * setting badge count and playing sounds**.
25
+ * @param permissions An object representing configuration for the request scope.
26
+ * @return It returns a Promise resolving to an object represents permission settings ([`NotificationPermissionsStatus`](#notificationpermissionsstatus)).
27
+ * On iOS, make sure you [properly interpret the permissions response](#interpreting-the-ios-permissions-response).
28
+ * @example Prompts the user to allow the app to show alerts, play sounds, set badge count and let Siri read out messages through AirPods.
29
+ * ```ts
30
+ * import * as Notifications from 'expo-notifications';
31
+ *
32
+ * export function requestPermissionsAsync() {
33
+ * return await Notifications.requestPermissionsAsync({
34
+ * ios: {
35
+ * allowAlert: true,
36
+ * allowBadge: true,
37
+ * allowSound: true,
38
+ * allowAnnouncements: true,
39
+ * },
40
+ * });
41
+ * }
42
+ * ```
43
+ * @header permissions
44
+ */
3
45
  export declare function requestPermissionsAsync(permissions?: NotificationPermissionsRequest): Promise<NotificationPermissionsStatus>;
4
46
  /**
5
47
  * Check or request permissions to send and receive push notifications.
6
48
  * This uses both `requestPermissionsAsync` and `getPermissionsAsync` to interact with the permissions.
7
- *
8
49
  * @example
9
50
  * ```ts
10
- * const [status, requestPermission] = Notifications.usePermissions();
51
+ * const [permissionResponse, requestPermission] = Notifications.usePermissions();
11
52
  * ```
53
+ * @header permission
12
54
  */
13
55
  export declare const usePermissions: (options?: import("expo-modules-core").PermissionHookOptions<NotificationPermissionsRequest> | undefined) => [NotificationPermissionsStatus | null, () => Promise<NotificationPermissionsStatus>, () => Promise<NotificationPermissionsStatus>];
14
56
  //# sourceMappingURL=NotificationPermissions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationPermissions.d.ts","sourceRoot":"","sources":["../src/NotificationPermissions.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,8BAA8B,EAC9B,6BAA6B,EAC9B,MAAM,iCAAiC,CAAC;AAGzC,wBAAsB,mBAAmB,2CAMxC;AAED,wBAAsB,uBAAuB,CAAC,WAAW,CAAC,EAAE,8BAA8B,0CAczF;AAGD;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,iPAMzB,CAAC"}
1
+ {"version":3,"file":"NotificationPermissions.d.ts","sourceRoot":"","sources":["../src/NotificationPermissions.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,8BAA8B,EAC9B,6BAA6B,EAC9B,MAAM,iCAAiC,CAAC;AAGzC;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,mBAAmB,2CAMxC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,uBAAuB,CAAC,WAAW,CAAC,EAAE,8BAA8B,0CAczF;AAGD;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,iPAMzB,CAAC"}