expo-notifications 0.28.0 → 0.28.2

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 (68) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/android/build.gradle +2 -2
  3. package/android/src/main/java/expo/modules/notifications/NotificationsPackage.java +17 -1
  4. package/android/src/main/java/expo/modules/notifications/notifications/NotificationManager.java +22 -0
  5. package/android/src/main/java/expo/modules/notifications/notifications/NotificationSerializer.java +28 -5
  6. package/android/src/main/java/expo/modules/notifications/notifications/emitting/NotificationsEmitter.kt +9 -6
  7. package/android/src/main/java/expo/modules/notifications/notifications/interfaces/NotificationListener.java +10 -0
  8. package/android/src/main/java/expo/modules/notifications/service/delegates/ExpoNotificationLifecycleListener.java +76 -0
  9. package/build/BackgroundNotificationTasksModule.d.ts.map +1 -1
  10. package/build/BadgeModule.d.ts.map +1 -1
  11. package/build/BadgeModule.native.d.ts.map +1 -1
  12. package/build/BadgeModule.web.js.map +1 -1
  13. package/build/DevicePushTokenAutoRegistration.fx.js.map +1 -1
  14. package/build/NotificationChannelGroupManager.d.ts.map +1 -1
  15. package/build/NotificationChannelManager.d.ts.map +1 -1
  16. package/build/NotificationPermissions.js.map +1 -1
  17. package/build/NotificationPermissionsModule.d.ts.map +1 -1
  18. package/build/NotificationPermissionsModule.js.map +1 -1
  19. package/build/NotificationPresenterModule.d.ts.map +1 -1
  20. package/build/NotificationScheduler.d.ts.map +1 -1
  21. package/build/NotificationsEmitter.d.ts.map +1 -1
  22. package/build/NotificationsEmitter.js +15 -1
  23. package/build/NotificationsEmitter.js.map +1 -1
  24. package/build/NotificationsEmitterModule.d.ts.map +1 -1
  25. package/build/NotificationsEmitterModule.js.map +1 -1
  26. package/build/NotificationsHandler.js.map +1 -1
  27. package/build/NotificationsHandlerModule.d.ts.map +1 -1
  28. package/build/NotificationsHandlerModule.js.map +1 -1
  29. package/build/PushTokenManager.d.ts.map +1 -1
  30. package/build/PushTokenManager.js.map +1 -1
  31. package/build/ServerRegistrationModule.d.ts.map +1 -1
  32. package/build/ServerRegistrationModule.web.d.ts.map +1 -1
  33. package/build/ServerRegistrationModule.web.js.map +1 -1
  34. package/build/cancelAllScheduledNotificationsAsync.js.map +1 -1
  35. package/build/cancelScheduledNotificationAsync.js.map +1 -1
  36. package/build/deleteNotificationCategoryAsync.js.map +1 -1
  37. package/build/deleteNotificationChannelAsync.android.js.map +1 -1
  38. package/build/deleteNotificationChannelGroupAsync.android.js.map +1 -1
  39. package/build/dismissAllNotificationsAsync.js.map +1 -1
  40. package/build/dismissNotificationAsync.js.map +1 -1
  41. package/build/getAllScheduledNotificationsAsync.js.map +1 -1
  42. package/build/getBadgeCountAsync.js.map +1 -1
  43. package/build/getDevicePushTokenAsync.js.map +1 -1
  44. package/build/getDevicePushTokenAsync.web.js.map +1 -1
  45. package/build/getExpoPushTokenAsync.js.map +1 -1
  46. package/build/getNextTriggerDateAsync.js.map +1 -1
  47. package/build/getNotificationCategoriesAsync.js.map +1 -1
  48. package/build/getNotificationChannelAsync.android.js.map +1 -1
  49. package/build/getNotificationChannelGroupAsync.android.js.map +1 -1
  50. package/build/getNotificationChannelGroupsAsync.android.js.map +1 -1
  51. package/build/getNotificationChannelsAsync.android.js.map +1 -1
  52. package/build/getPresentedNotificationsAsync.js.map +1 -1
  53. package/build/presentNotificationAsync.js.map +1 -1
  54. package/build/registerTaskAsync.js.map +1 -1
  55. package/build/scheduleNotificationAsync.js +1 -1
  56. package/build/scheduleNotificationAsync.js.map +1 -1
  57. package/build/setBadgeCountAsync.js.map +1 -1
  58. package/build/setNotificationCategoryAsync.js.map +1 -1
  59. package/build/setNotificationChannelAsync.android.js.map +1 -1
  60. package/build/setNotificationChannelGroupAsync.android.js.map +1 -1
  61. package/build/unregisterForNotificationsAsync.js.map +1 -1
  62. package/build/unregisterTaskAsync.js.map +1 -1
  63. package/build/utils/updateDevicePushTokenAsync.js.map +1 -1
  64. package/package.json +2 -2
  65. package/plugin/build/withNotificationsAndroid.d.ts +2 -2
  66. package/plugin/build/withNotificationsAndroid.js +6 -6
  67. package/plugin/build/withNotificationsIOS.js +2 -2
  68. package/src/NotificationsEmitter.ts +16 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ServerRegistrationModule.d.ts","sourceRoot":"","sources":["../src/ServerRegistrationModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;wBAKvE,wBAAwB;AAH7B,wBAG8B"}
1
+ {"version":3,"file":"ServerRegistrationModule.d.ts","sourceRoot":"","sources":["../src/ServerRegistrationModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;;AAE5E,wBAG8B"}
@@ -1 +1 @@
1
- {"version":3,"file":"ServerRegistrationModule.web.d.ts","sourceRoot":"","sources":["../src/ServerRegistrationModule.web.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;wBAqDvE,wBAAwB;AA1C7B,wBA0C8B"}
1
+ {"version":3,"file":"ServerRegistrationModule.web.d.ts","sourceRoot":"","sources":["../src/ServerRegistrationModule.web.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;;AAW5E,wBA0C8B"}
@@ -1 +1 @@
1
- {"version":3,"file":"ServerRegistrationModule.web.js","sourceRoot":"","sources":["../src/ServerRegistrationModule.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAIrD,MAAM,mBAAmB,GAAG,oCAAoC,CAAC;AACjE,MAAM,qBAAqB,GAAG,sCAAsC,CAAC;AAErE,uDAAuD;AACvD,IAAI,yBAAyB,GAAG,GAAG,EAAE;IACnC,MAAM,qBAAqB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IACxC,yBAAyB,GAAG,GAAG,EAAE,CAAC,qBAAq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AAE,CAAC;CACE,CAAC","sourcesContent":["import { CodedError, uuid } from 'expo-modules-core';\n\nimport { ServerRegistrationModule } from './ServerRegistrationModule.types';\n\nconst INSTALLATION_ID_KEY = 'EXPO_NOTIFICATIONS_INSTALLATION_ID';\nconst REGISTRATION_INFO_KEY = 'EXPO_NOTIFICATIONS_REGISTRATION_INFO';\n\n// Lazy fallback installationId per session initializer\nlet getFallbackInstallationId = () => {\n const sessionInstallationId = uuid.v4();\n getFallbackInstallationId = () => sessionInstallationId;\n};\n\nexport default {\n getInstallationIdAsync: async () => {\n let installationId;\n\n try {\n installationId = localStorage.getItem(INSTALLATION_ID_KEY);\n if (!installationId || typeof installationId !== 'string') {\n installationId = uuid.v4();\n localStorage.setItem(INSTALLATION_ID_KEY, installationId);\n }\n } catch {\n installationId = getFallbackInstallationId();\n }\n\n return installationId;\n },\n getRegistrationInfoAsync: async () => {\n if (typeof localStorage === 'undefined') {\n return null;\n }\n return localStorage.getItem(REGISTRATION_INFO_KEY);\n },\n setRegistrationInfoAsync: async (registrationInfo: string | null) => {\n if (typeof localStorage === 'undefined') {\n return;\n }\n try {\n if (registrationInfo) {\n localStorage.setItem(REGISTRATION_INFO_KEY, registrationInfo);\n } else {\n localStorage.removeItem(REGISTRATION_INFO_KEY);\n }\n } catch (error) {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_STORAGE_ERROR',\n `Could not modify localStorage to persist auto-registration information: ${error}`\n );\n }\n },\n // mock implementations\n addListener: () => {},\n removeListeners: () => {},\n} as ServerRegistrationModule;\n"]}
1
+ {"version":3,"file":"ServerRegistrationModule.web.js","sourceRoot":"","sources":["../src/ServerRegistrationModule.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAIrD,MAAM,mBAAmB,GAAG,oCAAoC,CAAC;AACjE,MAAM,qBAAqB,GAAG,sCAAsC,CAAC;AAErE,uDAAuD;AACvD,IAAI,yBAAyB,GAAG,GA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GAAE,CAAC;CACE,CAAC","sourcesContent":["import { CodedError, uuid } from 'expo-modules-core';\n\nimport { ServerRegistrationModule } from './ServerRegistrationModule.types';\n\nconst INSTALLATION_ID_KEY = 'EXPO_NOTIFICATIONS_INSTALLATION_ID';\nconst REGISTRATION_INFO_KEY = 'EXPO_NOTIFICATIONS_REGISTRATION_INFO';\n\n// Lazy fallback installationId per session initializer\nlet getFallbackInstallationId = () => {\n const sessionInstallationId = uuid.v4();\n getFallbackInstallationId = () => sessionInstallationId;\n};\n\nexport default {\n getInstallationIdAsync: async () => {\n let installationId;\n\n try {\n installationId = localStorage.getItem(INSTALLATION_ID_KEY);\n if (!installationId || typeof installationId !== 'string') {\n installationId = uuid.v4();\n localStorage.setItem(INSTALLATION_ID_KEY, installationId);\n }\n } catch {\n installationId = getFallbackInstallationId();\n }\n\n return installationId;\n },\n getRegistrationInfoAsync: async () => {\n if (typeof localStorage === 'undefined') {\n return null;\n }\n return localStorage.getItem(REGISTRATION_INFO_KEY);\n },\n setRegistrationInfoAsync: async (registrationInfo: string | null) => {\n if (typeof localStorage === 'undefined') {\n return;\n }\n try {\n if (registrationInfo) {\n localStorage.setItem(REGISTRATION_INFO_KEY, registrationInfo);\n } else {\n localStorage.removeItem(REGISTRATION_INFO_KEY);\n }\n } catch (error) {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_STORAGE_ERROR',\n `Could not modify localStorage to persist auto-registration information: ${error}`\n );\n }\n },\n // mock implementations\n addListener: () => {},\n removeListeners: () => {},\n} as ServerRegistrationModule;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"cancelAllScheduledNotificationsAsync.js","sourceRoot":"","sources":["../src/cancelAllScheduledNotificationsAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAE5D;;;;GAIG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,oCAAoC;IAChE,IAAI,CAAC,qBAAqB,CAAC,oCAAoC,EAAE,CAAC;QAChE,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,sCAAsC,CAAC,CAAC;IACzF,CAAC;IAED,OAAO,MAAM,qBAAqB,CAAC,oCAAoC,EAAE,CAAC;AAC5E,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationScheduler from './NotificationScheduler';\n\n/**\n * Cancels all scheduled notifications.\n * @return A Promise that resolves once all the scheduled notifications are successfully canceled, or if there are no scheduled notifications.\n * @header schedule\n */\nexport default async function cancelAllScheduledNotificationsAsync(): Promise<void> {\n if (!NotificationScheduler.cancelAllScheduledNotificationsAsync) {\n throw new UnavailabilityError('Notifications', 'cancelAllScheduledNotificationsAsync');\n }\n\n return await NotificationScheduler.cancelAllScheduledNotificationsAsync();\n}\n"]}
1
+ {"version":3,"file":"cancelAllScheduledNotificationsAsync.js","sourceRoot":"","sources":["../src/cancelAllScheduledNotificationsAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAE5D;;;;GAIG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,oCAAoC;IAChE,IAAI,CAAC,qBAAqB,CAAC,oCAAoC,EAAE;QAC/D,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,sCAAsC,CAAC,CAAC;KACxF;IAED,OAAO,MAAM,qBAAqB,CAAC,oCAAoC,EAAE,CAAC;AAC5E,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationScheduler from './NotificationScheduler';\n\n/**\n * Cancels all scheduled notifications.\n * @return A Promise that resolves once all the scheduled notifications are successfully canceled, or if there are no scheduled notifications.\n * @header schedule\n */\nexport default async function cancelAllScheduledNotificationsAsync(): Promise<void> {\n if (!NotificationScheduler.cancelAllScheduledNotificationsAsync) {\n throw new UnavailabilityError('Notifications', 'cancelAllScheduledNotificationsAsync');\n }\n\n return await NotificationScheduler.cancelAllScheduledNotificationsAsync();\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"cancelScheduledNotificationAsync.js","sourceRoot":"","sources":["../src/cancelScheduledNotificationAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,gCAAgC,CAAC,UAAkB;IAC/E,IAAI,CAAC,qBAAqB,CAAC,gCAAgC,EAAE,CAAC;QAC5D,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,kCAAkC,CAAC,CAAC;IACrF,CAAC;IAED,OAAO,MAAM,qBAAqB,CAAC,gCAAgC,CAAC,UAAU,CAAC,CAAC;AAClF,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationScheduler from './NotificationScheduler';\n\n/**\n * Cancels a single scheduled notification. The scheduled notification of given ID will not trigger.\n * @param identifier The notification identifier with which `scheduleNotificationAsync` method resolved when the notification has been scheduled.\n * @return A Promise resolves once the scheduled notification is successfully canceled or if there is no scheduled notification for a given identifier.\n * @example Schedule and then cancel the notification:\n * ```ts\n * import * as Notifications from 'expo-notifications';\n *\n * async function scheduleAndCancel() {\n * const identifier = await Notifications.scheduleNotificationAsync({\n * content: {\n * title: 'Hey!',\n * },\n * trigger: { seconds: 60, repeats: true },\n * });\n * await Notifications.cancelScheduledNotificationAsync(identifier);\n * }\n * ```\n * @header schedule\n */\nexport default async function cancelScheduledNotificationAsync(identifier: string): Promise<void> {\n if (!NotificationScheduler.cancelScheduledNotificationAsync) {\n throw new UnavailabilityError('Notifications', 'cancelScheduledNotificationAsync');\n }\n\n return await NotificationScheduler.cancelScheduledNotificationAsync(identifier);\n}\n"]}
1
+ {"version":3,"file":"cancelScheduledNotificationAsync.js","sourceRoot":"","sources":["../src/cancelScheduledNotificationAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,gCAAgC,CAAC,UAAkB;IAC/E,IAAI,CAAC,qBAAqB,CAAC,gCAAgC,EAAE;QAC3D,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,kCAAkC,CAAC,CAAC;KACpF;IAED,OAAO,MAAM,qBAAqB,CAAC,gCAAgC,CAAC,UAAU,CAAC,CAAC;AAClF,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationScheduler from './NotificationScheduler';\n\n/**\n * Cancels a single scheduled notification. The scheduled notification of given ID will not trigger.\n * @param identifier The notification identifier with which `scheduleNotificationAsync` method resolved when the notification has been scheduled.\n * @return A Promise resolves once the scheduled notification is successfully canceled or if there is no scheduled notification for a given identifier.\n * @example Schedule and then cancel the notification:\n * ```ts\n * import * as Notifications from 'expo-notifications';\n *\n * async function scheduleAndCancel() {\n * const identifier = await Notifications.scheduleNotificationAsync({\n * content: {\n * title: 'Hey!',\n * },\n * trigger: { seconds: 60, repeats: true },\n * });\n * await Notifications.cancelScheduledNotificationAsync(identifier);\n * }\n * ```\n * @header schedule\n */\nexport default async function cancelScheduledNotificationAsync(identifier: string): Promise<void> {\n if (!NotificationScheduler.cancelScheduledNotificationAsync) {\n throw new UnavailabilityError('Notifications', 'cancelScheduledNotificationAsync');\n }\n\n return await NotificationScheduler.cancelScheduledNotificationAsync(identifier);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"deleteNotificationCategoryAsync.js","sourceRoot":"","sources":["../src/deleteNotificationCategoryAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,4BAA4B,MAAM,gCAAgC,CAAC;AAE1E;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,+BAA+B,CAC3D,UAAkB;IAElB,IAAI,CAAC,4BAA4B,CAAC,+BAA+B,EAAE,CAAC;QAClE,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,iCAAiC,CAAC,CAAC;IACpF,CAAC;IAED,OAAO,MAAM,4BAA4B,CAAC,+BAA+B,CAAC,UAAU,CAAC,CAAC;AACxF,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationCategoriesModule from './NotificationCategoriesModule';\n\n/**\n * Deletes the category associated with the provided identifier.\n * @param identifier Identifier initially provided to `setNotificationCategoryAsync` when creating the category.\n * @return A Promise which resolves to `true` if the category was successfully deleted, or `false` if it was not.\n * An example of when this method would return `false` is if you try to delete a category that doesn't exist.\n * @platform android\n * @platform ios\n * @header categories\n */\nexport default async function deleteNotificationCategoryAsync(\n identifier: string\n): Promise<boolean> {\n if (!NotificationCategoriesModule.deleteNotificationCategoryAsync) {\n throw new UnavailabilityError('Notifications', 'deleteNotificationCategoryAsync');\n }\n\n return await NotificationCategoriesModule.deleteNotificationCategoryAsync(identifier);\n}\n"]}
1
+ {"version":3,"file":"deleteNotificationCategoryAsync.js","sourceRoot":"","sources":["../src/deleteNotificationCategoryAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,4BAA4B,MAAM,gCAAgC,CAAC;AAE1E;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,+BAA+B,CAC3D,UAAkB;IAElB,IAAI,CAAC,4BAA4B,CAAC,+BAA+B,EAAE;QACjE,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,iCAAiC,CAAC,CAAC;KACnF;IAED,OAAO,MAAM,4BAA4B,CAAC,+BAA+B,CAAC,UAAU,CAAC,CAAC;AACxF,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationCategoriesModule from './NotificationCategoriesModule';\n\n/**\n * Deletes the category associated with the provided identifier.\n * @param identifier Identifier initially provided to `setNotificationCategoryAsync` when creating the category.\n * @return A Promise which resolves to `true` if the category was successfully deleted, or `false` if it was not.\n * An example of when this method would return `false` is if you try to delete a category that doesn't exist.\n * @platform android\n * @platform ios\n * @header categories\n */\nexport default async function deleteNotificationCategoryAsync(\n identifier: string\n): Promise<boolean> {\n if (!NotificationCategoriesModule.deleteNotificationCategoryAsync) {\n throw new UnavailabilityError('Notifications', 'deleteNotificationCategoryAsync');\n }\n\n return await NotificationCategoriesModule.deleteNotificationCategoryAsync(identifier);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"deleteNotificationChannelAsync.android.js","sourceRoot":"","sources":["../src/deleteNotificationChannelAsync.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,0BAA0B,MAAM,8BAA8B,CAAC;AAEtE,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,8BAA8B,CAAC,SAAiB;IAC5E,IAAI,CAAC,0BAA0B,CAAC,8BAA8B,EAAE,CAAC;QAC/D,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,gCAAgC,CAAC,CAAC;IACnF,CAAC;IAED,OAAO,MAAM,0BAA0B,CAAC,8BAA8B,CAAC,SAAS,CAAC,CAAC;AACpF,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationChannelManager from './NotificationChannelManager';\n\nexport default async function deleteNotificationChannelAsync(channelId: string): Promise<void> {\n if (!NotificationChannelManager.deleteNotificationChannelAsync) {\n throw new UnavailabilityError('Notifications', 'deleteNotificationChannelAsync');\n }\n\n return await NotificationChannelManager.deleteNotificationChannelAsync(channelId);\n}\n"]}
1
+ {"version":3,"file":"deleteNotificationChannelAsync.android.js","sourceRoot":"","sources":["../src/deleteNotificationChannelAsync.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,0BAA0B,MAAM,8BAA8B,CAAC;AAEtE,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,8BAA8B,CAAC,SAAiB;IAC5E,IAAI,CAAC,0BAA0B,CAAC,8BAA8B,EAAE;QAC9D,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,gCAAgC,CAAC,CAAC;KAClF;IAED,OAAO,MAAM,0BAA0B,CAAC,8BAA8B,CAAC,SAAS,CAAC,CAAC;AACpF,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationChannelManager from './NotificationChannelManager';\n\nexport default async function deleteNotificationChannelAsync(channelId: string): Promise<void> {\n if (!NotificationChannelManager.deleteNotificationChannelAsync) {\n throw new UnavailabilityError('Notifications', 'deleteNotificationChannelAsync');\n }\n\n return await NotificationChannelManager.deleteNotificationChannelAsync(channelId);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"deleteNotificationChannelGroupAsync.android.js","sourceRoot":"","sources":["../src/deleteNotificationChannelGroupAsync.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,+BAA+B,MAAM,mCAAmC,CAAC;AAEhF,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,8BAA8B,CAAC,OAAe;IAC1E,IAAI,CAAC,+BAA+B,CAAC,mCAAmC,EAAE,CAAC;QACzE,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,qCAAqC,CAAC,CAAC;IACxF,CAAC;IAED,OAAO,MAAM,+BAA+B,CAAC,mCAAmC,CAAC,OAAO,CAAC,CAAC;AAC5F,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationChannelGroupManager from './NotificationChannelGroupManager';\n\nexport default async function deleteNotificationChannelAsync(groupId: string): Promise<void> {\n if (!NotificationChannelGroupManager.deleteNotificationChannelGroupAsync) {\n throw new UnavailabilityError('Notifications', 'deleteNotificationChannelGroupAsync');\n }\n\n return await NotificationChannelGroupManager.deleteNotificationChannelGroupAsync(groupId);\n}\n"]}
1
+ {"version":3,"file":"deleteNotificationChannelGroupAsync.android.js","sourceRoot":"","sources":["../src/deleteNotificationChannelGroupAsync.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,+BAA+B,MAAM,mCAAmC,CAAC;AAEhF,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,8BAA8B,CAAC,OAAe;IAC1E,IAAI,CAAC,+BAA+B,CAAC,mCAAmC,EAAE;QACxE,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,qCAAqC,CAAC,CAAC;KACvF;IAED,OAAO,MAAM,+BAA+B,CAAC,mCAAmC,CAAC,OAAO,CAAC,CAAC;AAC5F,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationChannelGroupManager from './NotificationChannelGroupManager';\n\nexport default async function deleteNotificationChannelAsync(groupId: string): Promise<void> {\n if (!NotificationChannelGroupManager.deleteNotificationChannelGroupAsync) {\n throw new UnavailabilityError('Notifications', 'deleteNotificationChannelGroupAsync');\n }\n\n return await NotificationChannelGroupManager.deleteNotificationChannelGroupAsync(groupId);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"dismissAllNotificationsAsync.js","sourceRoot":"","sources":["../src/dismissAllNotificationsAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,qBAAqB,MAAM,+BAA+B,CAAC;AAElE;;;;GAIG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,4BAA4B;IACxD,IAAI,CAAC,qBAAqB,CAAC,4BAA4B,EAAE,CAAC;QACxD,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,8BAA8B,CAAC,CAAC;IACjF,CAAC;IAED,OAAO,MAAM,qBAAqB,CAAC,4BAA4B,EAAE,CAAC;AACpE,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationPresenter from './NotificationPresenterModule';\n\n/**\n * Removes all application's notifications displayed in the notification tray (Notification Center).\n * @return A Promise which resolves once the request to dismiss the notifications is successfully dispatched to the notifications manager.\n * @header dismiss\n */\nexport default async function dismissAllNotificationsAsync(): Promise<void> {\n if (!NotificationPresenter.dismissAllNotificationsAsync) {\n throw new UnavailabilityError('Notifications', 'dismissAllNotificationsAsync');\n }\n\n return await NotificationPresenter.dismissAllNotificationsAsync();\n}\n"]}
1
+ {"version":3,"file":"dismissAllNotificationsAsync.js","sourceRoot":"","sources":["../src/dismissAllNotificationsAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,qBAAqB,MAAM,+BAA+B,CAAC;AAElE;;;;GAIG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,4BAA4B;IACxD,IAAI,CAAC,qBAAqB,CAAC,4BAA4B,EAAE;QACvD,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,8BAA8B,CAAC,CAAC;KAChF;IAED,OAAO,MAAM,qBAAqB,CAAC,4BAA4B,EAAE,CAAC;AACpE,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationPresenter from './NotificationPresenterModule';\n\n/**\n * Removes all application's notifications displayed in the notification tray (Notification Center).\n * @return A Promise which resolves once the request to dismiss the notifications is successfully dispatched to the notifications manager.\n * @header dismiss\n */\nexport default async function dismissAllNotificationsAsync(): Promise<void> {\n if (!NotificationPresenter.dismissAllNotificationsAsync) {\n throw new UnavailabilityError('Notifications', 'dismissAllNotificationsAsync');\n }\n\n return await NotificationPresenter.dismissAllNotificationsAsync();\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"dismissNotificationAsync.js","sourceRoot":"","sources":["../src/dismissNotificationAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,qBAAqB,MAAM,+BAA+B,CAAC;AAElE;;;;;GAKG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,wBAAwB,CACpD,sBAA8B;IAE9B,IAAI,CAAC,qBAAqB,CAAC,wBAAwB,EAAE,CAAC;QACpD,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,0BAA0B,CAAC,CAAC;IAC7E,CAAC;IAED,OAAO,MAAM,qBAAqB,CAAC,wBAAwB,CAAC,sBAAsB,CAAC,CAAC;AACtF,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationPresenter from './NotificationPresenterModule';\n\n/**\n * Removes notification displayed in the notification tray (Notification Center).\n * @param notificationIdentifier The notification identifier, obtained either via `setNotificationHandler` method or in the listener added with `addNotificationReceivedListener`.\n * @return A Promise which resolves once the request to dismiss the notification is successfully dispatched to the notifications manager.\n * @header dismiss\n */\nexport default async function dismissNotificationAsync(\n notificationIdentifier: string\n): Promise<void> {\n if (!NotificationPresenter.dismissNotificationAsync) {\n throw new UnavailabilityError('Notifications', 'dismissNotificationAsync');\n }\n\n return await NotificationPresenter.dismissNotificationAsync(notificationIdentifier);\n}\n"]}
1
+ {"version":3,"file":"dismissNotificationAsync.js","sourceRoot":"","sources":["../src/dismissNotificationAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,qBAAqB,MAAM,+BAA+B,CAAC;AAElE;;;;;GAKG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,wBAAwB,CACpD,sBAA8B;IAE9B,IAAI,CAAC,qBAAqB,CAAC,wBAAwB,EAAE;QACnD,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,0BAA0B,CAAC,CAAC;KAC5E;IAED,OAAO,MAAM,qBAAqB,CAAC,wBAAwB,CAAC,sBAAsB,CAAC,CAAC;AACtF,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationPresenter from './NotificationPresenterModule';\n\n/**\n * Removes notification displayed in the notification tray (Notification Center).\n * @param notificationIdentifier The notification identifier, obtained either via `setNotificationHandler` method or in the listener added with `addNotificationReceivedListener`.\n * @return A Promise which resolves once the request to dismiss the notification is successfully dispatched to the notifications manager.\n * @header dismiss\n */\nexport default async function dismissNotificationAsync(\n notificationIdentifier: string\n): Promise<void> {\n if (!NotificationPresenter.dismissNotificationAsync) {\n throw new UnavailabilityError('Notifications', 'dismissNotificationAsync');\n }\n\n return await NotificationPresenter.dismissNotificationAsync(notificationIdentifier);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"getAllScheduledNotificationsAsync.js","sourceRoot":"","sources":["../src/getAllScheduledNotificationsAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAG5D;;;;GAIG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,iCAAiC;IAC7D,IAAI,CAAC,qBAAqB,CAAC,iCAAiC,EAAE,CAAC;QAC7D,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,mCAAmC,CAAC,CAAC;IACtF,CAAC;IAED,OAAO,MAAM,qBAAqB,CAAC,iCAAiC,EAAE,CAAC;AACzE,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationScheduler from './NotificationScheduler';\nimport { NotificationRequest } from './Notifications.types';\n\n/**\n * Fetches information about all scheduled notifications.\n * @return Returns a Promise resolving to an array of objects conforming to the [`Notification`](#notification) interface.\n * @header schedule\n */\nexport default async function getAllScheduledNotificationsAsync(): Promise<NotificationRequest[]> {\n if (!NotificationScheduler.getAllScheduledNotificationsAsync) {\n throw new UnavailabilityError('Notifications', 'getAllScheduledNotificationsAsync');\n }\n\n return await NotificationScheduler.getAllScheduledNotificationsAsync();\n}\n"]}
1
+ {"version":3,"file":"getAllScheduledNotificationsAsync.js","sourceRoot":"","sources":["../src/getAllScheduledNotificationsAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAG5D;;;;GAIG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,iCAAiC;IAC7D,IAAI,CAAC,qBAAqB,CAAC,iCAAiC,EAAE;QAC5D,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,mCAAmC,CAAC,CAAC;KACrF;IAED,OAAO,MAAM,qBAAqB,CAAC,iCAAiC,EAAE,CAAC;AACzE,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationScheduler from './NotificationScheduler';\nimport { NotificationRequest } from './Notifications.types';\n\n/**\n * Fetches information about all scheduled notifications.\n * @return Returns a Promise resolving to an array of objects conforming to the [`Notification`](#notification) interface.\n * @header schedule\n */\nexport default async function getAllScheduledNotificationsAsync(): Promise<NotificationRequest[]> {\n if (!NotificationScheduler.getAllScheduledNotificationsAsync) {\n throw new UnavailabilityError('Notifications', 'getAllScheduledNotificationsAsync');\n }\n\n return await NotificationScheduler.getAllScheduledNotificationsAsync();\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"getBadgeCountAsync.js","sourceRoot":"","sources":["../src/getBadgeCountAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,kBAAkB;IAC9C,IAAI,CAAC,WAAW,CAAC,kBAAkB,EAAE,CAAC;QACpC,MAAM,IAAI,mBAAmB,CAAC,mBAAmB,EAAE,oBAAoB,CAAC,CAAC;IAC3E,CAAC;IAED,OAAO,MAAM,WAAW,CAAC,kBAAkB,EAAE,CAAC;AAChD,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport BadgeModule from './BadgeModule';\n\n/**\n * Fetches the number currently set as the badge of the app icon on device's home screen. A `0` value means that the badge is not displayed.\n * > **Note:** Not all Android launchers support application badges. If the launcher does not support icon badges, the method will always resolve to `0`.\n * @return Returns a Promise resolving to a number that represents the current badge of the app icon.\n * @header badge\n */\nexport default async function getBadgeCountAsync(): Promise<number> {\n if (!BadgeModule.getBadgeCountAsync) {\n throw new UnavailabilityError('ExpoNotifications', 'getBadgeCountAsync');\n }\n\n return await BadgeModule.getBadgeCountAsync();\n}\n"]}
1
+ {"version":3,"file":"getBadgeCountAsync.js","sourceRoot":"","sources":["../src/getBadgeCountAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,kBAAkB;IAC9C,IAAI,CAAC,WAAW,CAAC,kBAAkB,EAAE;QACnC,MAAM,IAAI,mBAAmB,CAAC,mBAAmB,EAAE,oBAAoB,CAAC,CAAC;KAC1E;IAED,OAAO,MAAM,WAAW,CAAC,kBAAkB,EAAE,CAAC;AAChD,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport BadgeModule from './BadgeModule';\n\n/**\n * Fetches the number currently set as the badge of the app icon on device's home screen. A `0` value means that the badge is not displayed.\n * > **Note:** Not all Android launchers support application badges. If the launcher does not support icon badges, the method will always resolve to `0`.\n * @return Returns a Promise resolving to a number that represents the current badge of the app icon.\n * @header badge\n */\nexport default async function getBadgeCountAsync(): Promise<number> {\n if (!BadgeModule.getBadgeCountAsync) {\n throw new UnavailabilityError('ExpoNotifications', 'getBadgeCountAsync');\n }\n\n return await BadgeModule.getBadgeCountAsync();\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"getDevicePushTokenAsync.js","sourceRoot":"","sources":["../src/getDevicePushTokenAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElE,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAGlD,IAAI,kBAAkB,GAA2B,IAAI,CAAC;AAEtD;;;;GAIG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,uBAAuB;IACnD,IAAI,CAAC,gBAAgB,CAAC,uBAAuB,EAAE,CAAC;QAC9C,MAAM,IAAI,mBAAmB,CAAC,mBAAmB,EAAE,yBAAyB,CAAC,CAAC;IAChF,CAAC;IAED,IAAI,eAA8B,CAAC;IACnC,IAAI,kBAAkB,EAAE,CAAC;QACvB,yBAAyB;QACzB,eAAe,GAAG,MAAM,kBAAkB,CAAC;IAC7C,CAAC;SAAM,CAAC;QACN,+CAA+C;QAC/C,kBAAkB,GAAG,gBAAgB,CAAC,uBAAuB,EAAE,CAAC;QAChE,eAAe,GAAG,MAAM,kBAAkB,CAAC;QAC3C,kBAAkB,GAAG,IAAI,CAAC;IAC5B,CAAC;IAED,uFAAuF;IACvF,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;AACtD,CAAC","sourcesContent":["import { UnavailabilityError, Platform } from 'expo-modules-core';\n\nimport PushTokenManager from './PushTokenManager';\nimport { DevicePushToken } from './Tokens.types';\n\nlet nativeTokenPromise: Promise<string> | null = null;\n\n/**\n * Returns a native FCM, APNs token or a [`PushSubscription` data](https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription)\n * that can be used with another push notification service.\n * @header fetch\n */\nexport default async function getDevicePushTokenAsync(): Promise<DevicePushToken> {\n if (!PushTokenManager.getDevicePushTokenAsync) {\n throw new UnavailabilityError('ExpoNotifications', 'getDevicePushTokenAsync');\n }\n\n let devicePushToken: string | null;\n if (nativeTokenPromise) {\n // Reuse existing Promise\n devicePushToken = await nativeTokenPromise;\n } else {\n // Create a new Promise and clear it afterwards\n nativeTokenPromise = PushTokenManager.getDevicePushTokenAsync();\n devicePushToken = await nativeTokenPromise;\n nativeTokenPromise = null;\n }\n\n // @ts-ignore: TS thinks Platform.OS could be anything and can't decide what type is it\n return { type: Platform.OS, data: devicePushToken };\n}\n"]}
1
+ {"version":3,"file":"getDevicePushTokenAsync.js","sourceRoot":"","sources":["../src/getDevicePushTokenAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElE,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAGlD,IAAI,kBAAkB,GAA2B,IAAI,CAAC;AAEtD;;;;GAIG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,uBAAuB;IACnD,IAAI,CAAC,gBAAgB,CAAC,uBAAuB,EAAE;QAC7C,MAAM,IAAI,mBAAmB,CAAC,mBAAmB,EAAE,yBAAyB,CAAC,CAAC;KAC/E;IAED,IAAI,eAA8B,CAAC;IACnC,IAAI,kBAAkB,EAAE;QACtB,yBAAyB;QACzB,eAAe,GAAG,MAAM,kBAAkB,CAAC;KAC5C;SAAM;QACL,+CAA+C;QAC/C,kBAAkB,GAAG,gBAAgB,CAAC,uBAAuB,EAAE,CAAC;QAChE,eAAe,GAAG,MAAM,kBAAkB,CAAC;QAC3C,kBAAkB,GAAG,IAAI,CAAC;KAC3B;IAED,uFAAuF;IACvF,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;AACtD,CAAC","sourcesContent":["import { UnavailabilityError, Platform } from 'expo-modules-core';\n\nimport PushTokenManager from './PushTokenManager';\nimport { DevicePushToken } from './Tokens.types';\n\nlet nativeTokenPromise: Promise<string> | null = null;\n\n/**\n * Returns a native FCM, APNs token or a [`PushSubscription` data](https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription)\n * that can be used with another push notification service.\n * @header fetch\n */\nexport default async function getDevicePushTokenAsync(): Promise<DevicePushToken> {\n if (!PushTokenManager.getDevicePushTokenAsync) {\n throw new UnavailabilityError('ExpoNotifications', 'getDevicePushTokenAsync');\n }\n\n let devicePushToken: string | null;\n if (nativeTokenPromise) {\n // Reuse existing Promise\n devicePushToken = await nativeTokenPromise;\n } else {\n // Create a new Promise and clear it afterwards\n nativeTokenPromise = PushTokenManager.getDevicePushTokenAsync();\n devicePushToken = await nativeTokenPromise;\n nativeTokenPromise = null;\n }\n\n // @ts-ignore: TS thinks Platform.OS could be anything and can't decide what type is it\n return { type: Platform.OS, data: devicePushToken };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"getDevicePushTokenAsync.web.js","sourceRoot":"","sources":["../src/getDevicePushTokenAsync.web.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAI7E,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,uBAAuB;IACnD,MAAM,IAAI,GAAG,MAAM,wCAAwC,EAAE,CAAC;IAC9D,kBAAkB,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC;IACxE,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC;AACrC,CAAC;AAED,SAAS,eAAe;IACtB,IAAI,CAAC,CAAC,cAAc,IAAI,MAAM,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,UAAU,CAClB,iBAAiB,EACjB,4DAA4D,CAC7D,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,CAAC;QAC7B,MAAM,IA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MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpC,MAAM,WAAW,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAEnD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;QACxC,WAAW,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["import Constants from 'expo-constants';\nimport { CodedError, DeviceEventEmitter, Platform } from 'expo-modules-core';\n\nimport { DevicePushToken } from './Tokens.types';\n\nexport default async function getDevicePushTokenAsync(): Promise<DevicePushToken> {\n const data = await _subscribeDeviceToPushNotificationsAsync();\n DeviceEventEmitter.emit('onDevicePushToken', { devicePushToken: data });\n return { type: Platform.OS, data };\n}\n\nfunction guardPermission() {\n if (!('Notification' in window)) {\n throw new CodedError(\n 'ERR_UNAVAILABLE',\n 'The Web Notifications API is not available on this device.'\n );\n }\n if (!navigator.serviceWorker) {\n throw new CodedError(\n 'ERR_UNAVAILABLE',\n 'Notifications cannot be used because the service worker API is not supported on this device. This might also happen because your web page does not support HTTPS.'\n );\n }\n if (Notification.permission !== 'granted') {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_PERMISSION_DENIED',\n `Cannot use web notifications without permissions granted. Request permissions with \"expo-permissions\".`\n );\n }\n}\n\nasync function _subscribeDeviceToPushNotificationsAsync(): Promise<DevicePushToken['data']> {\n // @ts-expect-error: TODO: not on the schema\n const vapidPublicKey: string | null = Constants.expoConfig?.notification?.vapidPublicKey;\n if (!vapidPublicKey) {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_PUSH_WEB_MISSING_CONFIG',\n 'You must provide `notification.vapidPublicKey` in `app.json` to use push notifications on web. Learn more: https://docs.expo.dev/versions/latest/guides/using-vapid/.'\n );\n }\n\n // @ts-expect-error: TODO: not on the schema\n const serviceWorkerPath = Constants.expoConfig?.notification?.serviceWorkerPath;\n if (!serviceWorkerPath) {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_PUSH_MISSING_CONFIGURATION',\n 'You must specify `notification.serviceWorkerPath` in `app.json` to use push notifications on the web. Please provide the path to the service worker that will handle notifications.'\n );\n }\n guardPermission();\n\n let registration: ServiceWorkerRegistration | null = null;\n try {\n registration = await navigator.serviceWorker.register(serviceWorkerPath);\n } catch (error) {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_PUSH_REGISTRATION_FAILED',\n `Could not register this device for push notifications because the service worker (${serviceWorkerPath}) could not be registered: ${error}`\n );\n }\n await navigator.serviceWorker.ready;\n\n if (!registration.active) {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_PUSH_REGISTRATION_FAILED',\n 'Could not register this device for push notifications because the service worker is not active.'\n );\n }\n\n const subscribeOptions = {\n userVisibleOnly: true,\n applicationServerKey: _urlBase64ToUint8Array(vapidPublicKey),\n };\n let pushSubscription: PushSubscription | null = null;\n try {\n pushSubscription = await registration.pushManager.subscribe(subscribeOptions);\n } catch (error) {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_PUSH_REGISTRATION_FAILED',\n 'The device was unable to register for remote notifications with the browser endpoint. (' +\n error +\n ')'\n );\n }\n const pushSubscriptionJson = pushSubscription.toJSON();\n\n const subscriptionObject = {\n endpoint: pushSubscriptionJson.endpoint,\n keys: {\n p256dh: pushSubscriptionJson.keys!.p256dh,\n auth: pushSubscriptionJson.keys!.auth,\n },\n };\n\n // Store notification icon string in service worker.\n // This message is received by `/expo-service-worker.js`.\n // We wrap it with `fromExpoWebClient` to make sure other message\n // will not override content such as `notificationIcon`.\n // https://stackoverflow.com/a/35729334/2603230\n const notificationIcon = (Constants.expoConfig?.notification ?? {}).icon;\n await registration.active.postMessage(\n JSON.stringify({ fromExpoWebClient: { notificationIcon } })\n );\n\n return subscriptionObject;\n}\n\n// https://github.com/web-push-libs/web-push#using-vapid-key-for-applicationserverkey\nfunction _urlBase64ToUint8Array(base64String: string): Uint8Array {\n const padding = '='.repeat((4 - (base64String.length % 4)) % 4);\n const base64 = (base64String + padding).replace(/-/g, '+').replace(/_/g, '/');\n\n const rawData = window.atob(base64);\n const outputArray = new Uint8Array(rawData.length);\n\n for (let i = 0; i < rawData.length; ++i) {\n outputArray[i] = rawData.charCodeAt(i);\n }\n return outputArray;\n}\n"]}
1
+ {"version":3,"file":"getDevicePushTokenAsync.web.js","sourceRoot":"","sources":["../src/getDevicePushTokenAsync.web.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAI7E,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,uBAAuB;IACnD,MAAM,IAAI,GAAG,MAAM,wCAAwC,EAAE,CAAC;IAC9D,kBAAkB,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC;IACxE,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC;AACrC,CAAC;AAED,SAAS,eAAe;IACtB,IAAI,CAAC,CAAC,cAAc,IAAI,MAAM,CAAC,EAAE;QAC/B,MAAM,IAAI,UAAU,CAClB,iBAAiB,EACjB,4DAA4D,CAC7D,CAAC;KACH;IACD,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE;QAC5B,MAAM,IAAI,UAAU,CAClB,iBAAiB,EACjB,mKAAmK,CACpK,CAAC;KACH;IACD,IAAI,YAAY,CAAC,UAAU,KAAK,SAAS,EAAE;QACzC,MAAM,IAAI,UAAU,CAClB,qCAAqC,EACrC,wGAAwG,CACzG,CAAC;KACH;AACH,CAAC;AAED,KAAK,UAAU,wCAAwC;IACrD,4CAA4C;IAC5C,MAAM,cAAc,GAAkB,SAAS,CAAC,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ants';\nimport { CodedError, DeviceEventEmitter, Platform } from 'expo-modules-core';\n\nimport { DevicePushToken } from './Tokens.types';\n\nexport default async function getDevicePushTokenAsync(): Promise<DevicePushToken> {\n const data = await _subscribeDeviceToPushNotificationsAsync();\n DeviceEventEmitter.emit('onDevicePushToken', { devicePushToken: data });\n return { type: Platform.OS, data };\n}\n\nfunction guardPermission() {\n if (!('Notification' in window)) {\n throw new CodedError(\n 'ERR_UNAVAILABLE',\n 'The Web Notifications API is not available on this device.'\n );\n }\n if (!navigator.serviceWorker) {\n throw new CodedError(\n 'ERR_UNAVAILABLE',\n 'Notifications cannot be used because the service worker API is not supported on this device. This might also happen because your web page does not support HTTPS.'\n );\n }\n if (Notification.permission !== 'granted') {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_PERMISSION_DENIED',\n `Cannot use web notifications without permissions granted. Request permissions with \"expo-permissions\".`\n );\n }\n}\n\nasync function _subscribeDeviceToPushNotificationsAsync(): Promise<DevicePushToken['data']> {\n // @ts-expect-error: TODO: not on the schema\n const vapidPublicKey: string | null = Constants.expoConfig?.notification?.vapidPublicKey;\n if (!vapidPublicKey) {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_PUSH_WEB_MISSING_CONFIG',\n 'You must provide `notification.vapidPublicKey` in `app.json` to use push notifications on web. Learn more: https://docs.expo.dev/versions/latest/guides/using-vapid/.'\n );\n }\n\n // @ts-expect-error: TODO: not on the schema\n const serviceWorkerPath = Constants.expoConfig?.notification?.serviceWorkerPath;\n if (!serviceWorkerPath) {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_PUSH_MISSING_CONFIGURATION',\n 'You must specify `notification.serviceWorkerPath` in `app.json` to use push notifications on the web. Please provide the path to the service worker that will handle notifications.'\n );\n }\n guardPermission();\n\n let registration: ServiceWorkerRegistration | null = null;\n try {\n registration = await navigator.serviceWorker.register(serviceWorkerPath);\n } catch (error) {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_PUSH_REGISTRATION_FAILED',\n `Could not register this device for push notifications because the service worker (${serviceWorkerPath}) could not be registered: ${error}`\n );\n }\n await navigator.serviceWorker.ready;\n\n if (!registration.active) {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_PUSH_REGISTRATION_FAILED',\n 'Could not register this device for push notifications because the service worker is not active.'\n );\n }\n\n const subscribeOptions = {\n userVisibleOnly: true,\n applicationServerKey: _urlBase64ToUint8Array(vapidPublicKey),\n };\n let pushSubscription: PushSubscription | null = null;\n try {\n pushSubscription = await registration.pushManager.subscribe(subscribeOptions);\n } catch (error) {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_PUSH_REGISTRATION_FAILED',\n 'The device was unable to register for remote notifications with the browser endpoint. (' +\n error +\n ')'\n );\n }\n const pushSubscriptionJson = pushSubscription.toJSON();\n\n const subscriptionObject = {\n endpoint: pushSubscriptionJson.endpoint,\n keys: {\n p256dh: pushSubscriptionJson.keys!.p256dh,\n auth: pushSubscriptionJson.keys!.auth,\n },\n };\n\n // Store notification icon string in service worker.\n // This message is received by `/expo-service-worker.js`.\n // We wrap it with `fromExpoWebClient` to make sure other message\n // will not override content such as `notificationIcon`.\n // https://stackoverflow.com/a/35729334/2603230\n const notificationIcon = (Constants.expoConfig?.notification ?? {}).icon;\n await registration.active.postMessage(\n JSON.stringify({ fromExpoWebClient: { notificationIcon } })\n );\n\n return subscriptionObject;\n}\n\n// https://github.com/web-push-libs/web-push#using-vapid-key-for-applicationserverkey\nfunction _urlBase64ToUint8Array(base64String: string): Uint8Array {\n const padding = '='.repeat((4 - (base64String.length % 4)) % 4);\n const base64 = (base64String + padding).replace(/-/g, '+').replace(/_/g, '/');\n\n const rawData = window.atob(base64);\n const outputArray = new Uint8Array(rawData.length);\n\n for (let i = 0; i < rawData.length; ++i) {\n outputArray[i] = rawData.charCodeAt(i);\n }\n return outputArray;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"getExpoPushTokenAsync.js","sourceRoot":"","sources":["../src/getExpoPushTokenAsync.ts"],"names":[],"mappings":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ACf,gFAAgF;QAChF;YACE,OAAO,eAAe,CAAC,IAAI,CAAC;IAChC,CAAC;AACH,CAAC","sourcesContent":["import * as Application from 'expo-application';\nimport Constants from 'expo-constants';\nimport { Platform, CodedError, UnavailabilityError } from 'expo-modules-core';\n\nimport { setAutoServerRegistrationEnabledAsync } from './DevicePushTokenAutoRegistration.fx';\nimport ServerRegistrationModule from './ServerRegistrationModule';\nimport { DevicePushToken, ExpoPushToken, ExpoPushTokenOptions } from './Tokens.types';\nimport getDevicePushTokenAsync from './getDevicePushTokenAsync';\n\nconst productionBaseUrl = 'https://exp.host/--/api/v2/';\n\n/**\n * Returns an Expo token that can be used to send a push notification to the device using Expo's push notifications service.\n *\n * This method makes requests to the Expo's servers. It can get rejected in cases where the request itself fails\n * (for example, due to the device being offline, experiencing a network timeout, or other HTTPS request failures).\n * To provide offline support to your users, you should `try/catch` this method and implement retry logic to attempt\n * to get the push token later, once the device is back online.\n *\n * > For Expo's backend to be able to send notifications to your app, you will need to provide it with push notification keys.\n * For more information, see [credentials](/push-notifications/push-notifications-setup/#get-credentials-for-development-builds) in the push notifications setup.\n *\n * @param options Object allowing you to pass in push notification configuration.\n * @return Returns a `Promise` that resolves to an object representing acquired push token.\n * @header fetch\n *\n * @example\n * ```ts\n * import * as Notifications from 'expo-notifications';\n *\n * export async function registerForPushNotificationsAsync(userId: string) {\n * const expoPushToken = await Notifications.getExpoPushTokenAsync({\n * projectId: 'your-project-id',\n * });\n *\n * await fetch('https://example.com/', {\n * method: 'POST',\n * headers: {\n * 'Content-Type': 'application/json',\n * },\n * body: JSON.stringify({\n * userId,\n * expoPushToken,\n * }),\n * });\n * }\n * ```\n */\nexport default async function getExpoPushTokenAsync(\n options: ExpoPushTokenOptions = {}\n): Promise<ExpoPushToken> {\n const devicePushToken = options.devicePushToken || (await getDevicePushTokenAsync());\n\n const deviceId = options.deviceId || (await getDeviceIdAsync());\n const projectId = options.projectId || Constants.easConfig?.projectId;\n\n if (!projectId) {\n console.warn(\n 'Calling getExpoPushTokenAsync without specifying a projectId is deprecated and will no longer be supported in SDK 49+'\n );\n }\n\n if (!projectId) {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_NO_EXPERIENCE_ID',\n \"No 'projectId' found. If 'projectId' can't be inferred from the manifest (eg. in bare workflow), you have to pass it in yourself.\"\n );\n }\n\n const applicationId = options.applicationId || Application.applicationId;\n if (!applicationId) {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_NO_APPLICATION_ID',\n \"No applicationId found. If it can't be inferred from native configuration by expo-application, you have to pass it in yourself.\"\n );\n }\n const type = options.type || getTypeOfToken(devicePushToken);\n const development = options.development || (await shouldUseDevelopmentNotificationService());\n\n const baseUrl = options.baseUrl ?? productionBaseUrl;\n const url = options.url ?? `${baseUrl}push/getExpoPushToken`;\n\n const body = {\n type,\n deviceId: deviceId.toLowerCase(),\n development,\n appId: applicationId,\n deviceToken: getDeviceToken(devicePushToken),\n projectId,\n };\n\n const response = await fetch(url, {\n method: 'POST',\n headers: {\n 'content-type': 'application/json',\n },\n body: JSON.stringify(body),\n }).catch((error) => {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_NETWORK_ERROR',\n `Error encountered while fetching Expo token: ${error}.`\n );\n });\n\n if (!response.ok) {\n const statusInfo = response.statusText || response.status;\n let body: string | undefined = undefined;\n try {\n body = await response.text();\n } catch {\n // do nothing\n }\n throw new CodedError(\n 'ERR_NOTIFICATIONS_SERVER_ERROR',\n `Error encountered while fetching Expo token, expected an OK response, received: ${statusInfo} (body: \"${body}\").`\n );\n }\n\n const expoPushToken = getExpoPushToken(await parseResponse(response));\n\n try {\n if (options.url || options.baseUrl) {\n console.debug(\n `[expo-notifications] Since the URL endpoint to register in has been customized in the options, expo-notifications won't try to auto-update the device push token on the server.`\n );\n } else {\n await setAutoServerRegistrationEnabledAsync(true);\n }\n } catch (e) {\n console.warn(\n '[expo-notifications] Could not enable automatically registering new device tokens with the Expo notification service',\n e\n );\n }\n\n return {\n type: 'expo',\n data: expoPushToken,\n };\n}\n\nasync function parseResponse(response: Response) {\n try {\n return await response.json();\n } catch {\n try {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_SERVER_ERROR',\n `Expected a JSON response from server when fetching Expo token, received body: ${JSON.stringify(\n await response.text()\n )}.`\n );\n } catch {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_SERVER_ERROR',\n `Expected a JSON response from server when fetching Expo token, received response: ${JSON.stringify(\n response\n )}.`\n );\n }\n }\n}\n\nfunction getExpoPushToken(data: any) {\n if (\n !data ||\n !(typeof data === 'object') ||\n !data.data ||\n !(typeof data.data === 'object') ||\n !data.data.expoPushToken ||\n !(typeof data.data.expoPushToken === 'string')\n ) {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_SERVER_ERROR',\n `Malformed response from server, expected \"{ data: { expoPushToken: string } }\", received: ${JSON.stringify(\n data,\n null,\n 2\n )}.`\n );\n }\n\n return data.data.expoPushToken as string;\n}\n\n// Same as in DevicePushTokenAutoRegistration\nasync function getDeviceIdAsync() {\n try {\n if (!ServerRegistrationModule.getInstallationIdAsync) {\n throw new UnavailabilityError('ExpoServerRegistrationModule', 'getInstallationIdAsync');\n }\n\n return await ServerRegistrationModule.getInstallationIdAsync();\n } catch (e) {\n throw new CodedError(\n 'ERR_NOTIF_DEVICE_ID',\n `Could not have fetched installation ID of the application: ${e}.`\n );\n }\n}\n\nfunction getDeviceToken(devicePushToken: DevicePushToken) {\n if (typeof devicePushToken.data === 'string') {\n return devicePushToken.data;\n }\n\n return JSON.stringify(devicePushToken.data);\n}\n\n// Same as in DevicePushTokenAutoRegistration\nasync function shouldUseDevelopmentNotificationService() {\n if (Platform.OS === 'ios') {\n try {\n const notificationServiceEnvironment =\n await Application.getIosPushNotificationServiceEnvironmentAsync();\n if (notificationServiceEnvironment === 'development') {\n return true;\n }\n } catch {\n // We can't do anything here, we'll fallback to false then.\n }\n }\n\n return false;\n}\n\n// Same as in DevicePushTokenAutoRegistration\nfunction getTypeOfToken(devicePushToken: DevicePushToken) {\n switch (devicePushToken.type) {\n case 'ios':\n return 'apns';\n case 'android':\n return 'fcm';\n // This probably will error on server, but let's make this function future-safe.\n default:\n return devicePushToken.type;\n }\n}\n"]}
1
+ {"version":3,"file":"getExpoPushTokenAsync.js","sourceRoot":"","sources":["../src/getExpoPushTokenAsync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAChD,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE9E,OAAO,EAAE,qCAAqC,EAAE,MAAM,sCAAsC,CAAC;AAC7F,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAElE,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAEhE,MAAM,iBAAiB,GAAG,6BAA6B,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,qBAAqB,CACjD,UAAgC,EAAE;IAElC,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,IAAI,CAAC,MAAM,uBAAuB,EAAE,CAAC,CAAC;IAErF,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,CAAC,MAAM,gBAAgB,EAAE,CAAC,CAAC;IAChE,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC;IAEtE,IAAI,CAAC,SAAS,EAAE;QACd,OAAO,CAAC,IAAI,CACV,uHAAuH,CACxH,CAAC;KACH;IAED,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,IAAI,UAAU,CAClB,oCAAoC,EACpC,mIAAmI,CACpI,CAAC;KACH;IAED,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,WAAW,CAAC,aAAa,CAAC;IACzE,IAAI,CAAC,aAAa,EAAE;QAClB,MAA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as Application from 'expo-application';\nimport Constants from 'expo-constants';\nimport { Platform, CodedError, UnavailabilityError } from 'expo-modules-core';\n\nimport { setAutoServerRegistrationEnabledAsync } from './DevicePushTokenAutoRegistration.fx';\nimport ServerRegistrationModule from './ServerRegistrationModule';\nimport { DevicePushToken, ExpoPushToken, ExpoPushTokenOptions } from './Tokens.types';\nimport getDevicePushTokenAsync from './getDevicePushTokenAsync';\n\nconst productionBaseUrl = 'https://exp.host/--/api/v2/';\n\n/**\n * Returns an Expo token that can be used to send a push notification to the device using Expo's push notifications service.\n *\n * This method makes requests to the Expo's servers. It can get rejected in cases where the request itself fails\n * (for example, due to the device being offline, experiencing a network timeout, or other HTTPS request failures).\n * To provide offline support to your users, you should `try/catch` this method and implement retry logic to attempt\n * to get the push token later, once the device is back online.\n *\n * > For Expo's backend to be able to send notifications to your app, you will need to provide it with push notification keys.\n * For more information, see [credentials](/push-notifications/push-notifications-setup/#get-credentials-for-development-builds) in the push notifications setup.\n *\n * @param options Object allowing you to pass in push notification configuration.\n * @return Returns a `Promise` that resolves to an object representing acquired push token.\n * @header fetch\n *\n * @example\n * ```ts\n * import * as Notifications from 'expo-notifications';\n *\n * export async function registerForPushNotificationsAsync(userId: string) {\n * const expoPushToken = await Notifications.getExpoPushTokenAsync({\n * projectId: 'your-project-id',\n * });\n *\n * await fetch('https://example.com/', {\n * method: 'POST',\n * headers: {\n * 'Content-Type': 'application/json',\n * },\n * body: JSON.stringify({\n * userId,\n * expoPushToken,\n * }),\n * });\n * }\n * ```\n */\nexport default async function getExpoPushTokenAsync(\n options: ExpoPushTokenOptions = {}\n): Promise<ExpoPushToken> {\n const devicePushToken = options.devicePushToken || (await getDevicePushTokenAsync());\n\n const deviceId = options.deviceId || (await getDeviceIdAsync());\n const projectId = options.projectId || Constants.easConfig?.projectId;\n\n if (!projectId) {\n console.warn(\n 'Calling getExpoPushTokenAsync without specifying a projectId is deprecated and will no longer be supported in SDK 49+'\n );\n }\n\n if (!projectId) {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_NO_EXPERIENCE_ID',\n \"No 'projectId' found. If 'projectId' can't be inferred from the manifest (eg. in bare workflow), you have to pass it in yourself.\"\n );\n }\n\n const applicationId = options.applicationId || Application.applicationId;\n if (!applicationId) {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_NO_APPLICATION_ID',\n \"No applicationId found. If it can't be inferred from native configuration by expo-application, you have to pass it in yourself.\"\n );\n }\n const type = options.type || getTypeOfToken(devicePushToken);\n const development = options.development || (await shouldUseDevelopmentNotificationService());\n\n const baseUrl = options.baseUrl ?? productionBaseUrl;\n const url = options.url ?? `${baseUrl}push/getExpoPushToken`;\n\n const body = {\n type,\n deviceId: deviceId.toLowerCase(),\n development,\n appId: applicationId,\n deviceToken: getDeviceToken(devicePushToken),\n projectId,\n };\n\n const response = await fetch(url, {\n method: 'POST',\n headers: {\n 'content-type': 'application/json',\n },\n body: JSON.stringify(body),\n }).catch((error) => {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_NETWORK_ERROR',\n `Error encountered while fetching Expo token: ${error}.`\n );\n });\n\n if (!response.ok) {\n const statusInfo = response.statusText || response.status;\n let body: string | undefined = undefined;\n try {\n body = await response.text();\n } catch {\n // do nothing\n }\n throw new CodedError(\n 'ERR_NOTIFICATIONS_SERVER_ERROR',\n `Error encountered while fetching Expo token, expected an OK response, received: ${statusInfo} (body: \"${body}\").`\n );\n }\n\n const expoPushToken = getExpoPushToken(await parseResponse(response));\n\n try {\n if (options.url || options.baseUrl) {\n console.debug(\n `[expo-notifications] Since the URL endpoint to register in has been customized in the options, expo-notifications won't try to auto-update the device push token on the server.`\n );\n } else {\n await setAutoServerRegistrationEnabledAsync(true);\n }\n } catch (e) {\n console.warn(\n '[expo-notifications] Could not enable automatically registering new device tokens with the Expo notification service',\n e\n );\n }\n\n return {\n type: 'expo',\n data: expoPushToken,\n };\n}\n\nasync function parseResponse(response: Response) {\n try {\n return await response.json();\n } catch {\n try {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_SERVER_ERROR',\n `Expected a JSON response from server when fetching Expo token, received body: ${JSON.stringify(\n await response.text()\n )}.`\n );\n } catch {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_SERVER_ERROR',\n `Expected a JSON response from server when fetching Expo token, received response: ${JSON.stringify(\n response\n )}.`\n );\n }\n }\n}\n\nfunction getExpoPushToken(data: any) {\n if (\n !data ||\n !(typeof data === 'object') ||\n !data.data ||\n !(typeof data.data === 'object') ||\n !data.data.expoPushToken ||\n !(typeof data.data.expoPushToken === 'string')\n ) {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_SERVER_ERROR',\n `Malformed response from server, expected \"{ data: { expoPushToken: string } }\", received: ${JSON.stringify(\n data,\n null,\n 2\n )}.`\n );\n }\n\n return data.data.expoPushToken as string;\n}\n\n// Same as in DevicePushTokenAutoRegistration\nasync function getDeviceIdAsync() {\n try {\n if (!ServerRegistrationModule.getInstallationIdAsync) {\n throw new UnavailabilityError('ExpoServerRegistrationModule', 'getInstallationIdAsync');\n }\n\n return await ServerRegistrationModule.getInstallationIdAsync();\n } catch (e) {\n throw new CodedError(\n 'ERR_NOTIF_DEVICE_ID',\n `Could not have fetched installation ID of the application: ${e}.`\n );\n }\n}\n\nfunction getDeviceToken(devicePushToken: DevicePushToken) {\n if (typeof devicePushToken.data === 'string') {\n return devicePushToken.data;\n }\n\n return JSON.stringify(devicePushToken.data);\n}\n\n// Same as in DevicePushTokenAutoRegistration\nasync function shouldUseDevelopmentNotificationService() {\n if (Platform.OS === 'ios') {\n try {\n const notificationServiceEnvironment =\n await Application.getIosPushNotificationServiceEnvironmentAsync();\n if (notificationServiceEnvironment === 'development') {\n return true;\n }\n } catch {\n // We can't do anything here, we'll fallback to false then.\n }\n }\n\n return false;\n}\n\n// Same as in DevicePushTokenAutoRegistration\nfunction getTypeOfToken(devicePushToken: DevicePushToken) {\n switch (devicePushToken.type) {\n case 'ios':\n return 'apns';\n case 'android':\n return 'fcm';\n // This probably will error on server, but let's make this function future-safe.\n default:\n return devicePushToken.type;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"getNextTriggerDateAsync.js","sourceRoot":"","sources":["../src/getNextTriggerDateAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,uBAAuB,CACnD,OAA4C;IAE5C,IAAI,CAAC,qBAAqB,CAAC,uBAAuB,EAAE,CAAC;QACnD,MAAM,IAAI,mBAAmB,CAAC,mBAAmB,EAAE,yBAAyB,CAAC,CAAC;IAChF,CAAC;IAED,OAAO,MAAM,qBAAqB,CAAC,uBAAuB,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;AACpF,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationScheduler from './NotificationScheduler';\nimport { SchedulableNotificationTriggerInput } from './Notifications.types';\nimport { parseTrigger } from './scheduleNotificationAsync';\n\n/**\n * Allows you to check what will be the next trigger date for given notification trigger input.\n * @param trigger The schedulable notification trigger you would like to check next trigger date for (of type [`SchedulableNotificationTriggerInput`](#schedulablenotificationtriggerinput)).\n * @return If the return value is `null`, the notification won't be triggered. Otherwise, the return value is the Unix timestamp in milliseconds\n * at which the notification will be triggered.\n * @example Calculate next trigger date for a notification trigger:\n * ```ts\n * import * as Notifications from 'expo-notifications';\n *\n * async function logNextTriggerDate() {\n * try {\n * const nextTriggerDate = await Notifications.getNextTriggerDateAsync({\n * hour: 9,\n * minute: 0,\n * });\n * console.log(nextTriggerDate === null ? 'No next trigger date' : new Date(nextTriggerDate));\n * } catch (e) {\n * console.warn(`Couldn't have calculated next trigger date: ${e}`);\n * }\n * }\n * ```\n * @header schedule\n */\nexport default async function getNextTriggerDateAsync(\n trigger: SchedulableNotificationTriggerInput\n): Promise<number | null> {\n if (!NotificationScheduler.getNextTriggerDateAsync) {\n throw new UnavailabilityError('ExpoNotifications', 'getNextTriggerDateAsync');\n }\n\n return await NotificationScheduler.getNextTriggerDateAsync(parseTrigger(trigger));\n}\n"]}
1
+ {"version":3,"file":"getNextTriggerDateAsync.js","sourceRoot":"","sources":["../src/getNextTriggerDateAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,uBAAuB,CACnD,OAA4C;IAE5C,IAAI,CAAC,qBAAqB,CAAC,uBAAuB,EAAE;QAClD,MAAM,IAAI,mBAAmB,CAAC,mBAAmB,EAAE,yBAAyB,CAAC,CAAC;KAC/E;IAED,OAAO,MAAM,qBAAqB,CAAC,uBAAuB,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;AACpF,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationScheduler from './NotificationScheduler';\nimport { SchedulableNotificationTriggerInput } from './Notifications.types';\nimport { parseTrigger } from './scheduleNotificationAsync';\n\n/**\n * Allows you to check what will be the next trigger date for given notification trigger input.\n * @param trigger The schedulable notification trigger you would like to check next trigger date for (of type [`SchedulableNotificationTriggerInput`](#schedulablenotificationtriggerinput)).\n * @return If the return value is `null`, the notification won't be triggered. Otherwise, the return value is the Unix timestamp in milliseconds\n * at which the notification will be triggered.\n * @example Calculate next trigger date for a notification trigger:\n * ```ts\n * import * as Notifications from 'expo-notifications';\n *\n * async function logNextTriggerDate() {\n * try {\n * const nextTriggerDate = await Notifications.getNextTriggerDateAsync({\n * hour: 9,\n * minute: 0,\n * });\n * console.log(nextTriggerDate === null ? 'No next trigger date' : new Date(nextTriggerDate));\n * } catch (e) {\n * console.warn(`Couldn't have calculated next trigger date: ${e}`);\n * }\n * }\n * ```\n * @header schedule\n */\nexport default async function getNextTriggerDateAsync(\n trigger: SchedulableNotificationTriggerInput\n): Promise<number | null> {\n if (!NotificationScheduler.getNextTriggerDateAsync) {\n throw new UnavailabilityError('ExpoNotifications', 'getNextTriggerDateAsync');\n }\n\n return await NotificationScheduler.getNextTriggerDateAsync(parseTrigger(trigger));\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"getNotificationCategoriesAsync.js","sourceRoot":"","sources":["../src/getNotificationCategoriesAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,4BAA4B,MAAM,gCAAgC,CAAC;AAG1E;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,8BAA8B;IAC1D,IAAI,CAAC,4BAA4B,CAAC,8BAA8B,EAAE,CAAC;QACjE,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,gCAAgC,CAAC,CAAC;IACnF,CAAC;IAED,OAAO,MAAM,4BAA4B,CAAC,8BAA8B,EAAE,CAAC;AAC7E,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationCategoriesModule from './NotificationCategoriesModule';\nimport { NotificationCategory } from './Notifications.types';\n\n/**\n * Fetches information about all known notification categories.\n * @return A Promise which resolves to an array of `NotificationCategory`s. On platforms that do not support notification channels,\n * it will always resolve to an empty array.\n * @platform android\n * @platform ios\n * @header categories\n */\nexport default async function getNotificationCategoriesAsync(): Promise<NotificationCategory[]> {\n if (!NotificationCategoriesModule.getNotificationCategoriesAsync) {\n throw new UnavailabilityError('Notifications', 'getNotificationCategoriesAsync');\n }\n\n return await NotificationCategoriesModule.getNotificationCategoriesAsync();\n}\n"]}
1
+ {"version":3,"file":"getNotificationCategoriesAsync.js","sourceRoot":"","sources":["../src/getNotificationCategoriesAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,4BAA4B,MAAM,gCAAgC,CAAC;AAG1E;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,8BAA8B;IAC1D,IAAI,CAAC,4BAA4B,CAAC,8BAA8B,EAAE;QAChE,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,gCAAgC,CAAC,CAAC;KAClF;IAED,OAAO,MAAM,4BAA4B,CAAC,8BAA8B,EAAE,CAAC;AAC7E,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationCategoriesModule from './NotificationCategoriesModule';\nimport { NotificationCategory } from './Notifications.types';\n\n/**\n * Fetches information about all known notification categories.\n * @return A Promise which resolves to an array of `NotificationCategory`s. On platforms that do not support notification channels,\n * it will always resolve to an empty array.\n * @platform android\n * @platform ios\n * @header categories\n */\nexport default async function getNotificationCategoriesAsync(): Promise<NotificationCategory[]> {\n if (!NotificationCategoriesModule.getNotificationCategoriesAsync) {\n throw new UnavailabilityError('Notifications', 'getNotificationCategoriesAsync');\n }\n\n return await NotificationCategoriesModule.getNotificationCategoriesAsync();\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"getNotificationChannelAsync.android.js","sourceRoot":"","sources":["../src/getNotificationChannelAsync.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,0BAA0B,MAAM,8BAA8B,CAAC;AAGtE,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,2BAA2B,CACvD,SAAiB;IAEjB,IAAI,CAAC,0BAA0B,CAAC,2BAA2B,EAAE,CAAC;QAC5D,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,6BAA6B,CAAC,CAAC;IAChF,CAAC;IACD,OAAO,MAAM,0BAA0B,CAAC,2BAA2B,CAAC,SAAS,CAAC,CAAC;AACjF,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationChannelManager from './NotificationChannelManager';\nimport { NotificationChannel } from './NotificationChannelManager.types';\n\nexport default async function getNotificationChannelAsync(\n channelId: string\n): Promise<NotificationChannel | null> {\n if (!NotificationChannelManager.getNotificationChannelAsync) {\n throw new UnavailabilityError('Notifications', 'getNotificationChannelAsync');\n }\n return await NotificationChannelManager.getNotificationChannelAsync(channelId);\n}\n"]}
1
+ {"version":3,"file":"getNotificationChannelAsync.android.js","sourceRoot":"","sources":["../src/getNotificationChannelAsync.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,0BAA0B,MAAM,8BAA8B,CAAC;AAGtE,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,2BAA2B,CACvD,SAAiB;IAEjB,IAAI,CAAC,0BAA0B,CAAC,2BAA2B,EAAE;QAC3D,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,6BAA6B,CAAC,CAAC;KAC/E;IACD,OAAO,MAAM,0BAA0B,CAAC,2BAA2B,CAAC,SAAS,CAAC,CAAC;AACjF,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationChannelManager from './NotificationChannelManager';\nimport { NotificationChannel } from './NotificationChannelManager.types';\n\nexport default async function getNotificationChannelAsync(\n channelId: string\n): Promise<NotificationChannel | null> {\n if (!NotificationChannelManager.getNotificationChannelAsync) {\n throw new UnavailabilityError('Notifications', 'getNotificationChannelAsync');\n }\n return await NotificationChannelManager.getNotificationChannelAsync(channelId);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"getNotificationChannelGroupAsync.android.js","sourceRoot":"","sources":["../src/getNotificationChannelGroupAsync.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,+BAA+B,MAAM,mCAAmC,CAAC;AAGhF,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,gCAAgC,CAC5D,OAAe;IAEf,IAAI,CAAC,+BAA+B,CAAC,gCAAgC,EAAE,CAAC;QACtE,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,kCAAkC,CAAC,CAAC;IACrF,CAAC;IAED,OAAO,MAAM,+BAA+B,CAAC,gCAAgC,CAAC,OAAO,CAAC,CAAC;AACzF,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationChannelGroupManager from './NotificationChannelGroupManager';\nimport { NotificationChannelGroup } from './NotificationChannelGroupManager.types';\n\nexport default async function getNotificationChannelGroupAsync(\n groupId: string\n): Promise<NotificationChannelGroup | null> {\n if (!NotificationChannelGroupManager.getNotificationChannelGroupAsync) {\n throw new UnavailabilityError('Notifications', 'getNotificationChannelGroupAsync');\n }\n\n return await NotificationChannelGroupManager.getNotificationChannelGroupAsync(groupId);\n}\n"]}
1
+ {"version":3,"file":"getNotificationChannelGroupAsync.android.js","sourceRoot":"","sources":["../src/getNotificationChannelGroupAsync.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,+BAA+B,MAAM,mCAAmC,CAAC;AAGhF,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,gCAAgC,CAC5D,OAAe;IAEf,IAAI,CAAC,+BAA+B,CAAC,gCAAgC,EAAE;QACrE,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,kCAAkC,CAAC,CAAC;KACpF;IAED,OAAO,MAAM,+BAA+B,CAAC,gCAAgC,CAAC,OAAO,CAAC,CAAC;AACzF,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationChannelGroupManager from './NotificationChannelGroupManager';\nimport { NotificationChannelGroup } from './NotificationChannelGroupManager.types';\n\nexport default async function getNotificationChannelGroupAsync(\n groupId: string\n): Promise<NotificationChannelGroup | null> {\n if (!NotificationChannelGroupManager.getNotificationChannelGroupAsync) {\n throw new UnavailabilityError('Notifications', 'getNotificationChannelGroupAsync');\n }\n\n return await NotificationChannelGroupManager.getNotificationChannelGroupAsync(groupId);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"getNotificationChannelGroupsAsync.android.js","sourceRoot":"","sources":["../src/getNotificationChannelGroupsAsync.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,+BAA+B,MAAM,mCAAmC,CAAC;AAGhF,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,iCAAiC;IAG7D,IAAI,CAAC,+BAA+B,CAAC,iCAAiC,EAAE,CAAC;QACvE,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,mCAAmC,CAAC,CAAC;IACtF,CAAC;IACD,OAAO,MAAM,+BAA+B,CAAC,iCAAiC,EAAE,CAAC;AACnF,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationChannelGroupManager from './NotificationChannelGroupManager';\nimport { NotificationChannelGroup } from './NotificationChannelGroupManager.types';\n\nexport default async function getNotificationChannelGroupsAsync(): Promise<\n NotificationChannelGroup[]\n> {\n if (!NotificationChannelGroupManager.getNotificationChannelGroupsAsync) {\n throw new UnavailabilityError('Notifications', 'getNotificationChannelGroupsAsync');\n }\n return await NotificationChannelGroupManager.getNotificationChannelGroupsAsync();\n}\n"]}
1
+ {"version":3,"file":"getNotificationChannelGroupsAsync.android.js","sourceRoot":"","sources":["../src/getNotificationChannelGroupsAsync.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,+BAA+B,MAAM,mCAAmC,CAAC;AAGhF,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,iCAAiC;IAG7D,IAAI,CAAC,+BAA+B,CAAC,iCAAiC,EAAE;QACtE,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,mCAAmC,CAAC,CAAC;KACrF;IACD,OAAO,MAAM,+BAA+B,CAAC,iCAAiC,EAAE,CAAC;AACnF,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationChannelGroupManager from './NotificationChannelGroupManager';\nimport { NotificationChannelGroup } from './NotificationChannelGroupManager.types';\n\nexport default async function getNotificationChannelGroupsAsync(): Promise<\n NotificationChannelGroup[]\n> {\n if (!NotificationChannelGroupManager.getNotificationChannelGroupsAsync) {\n throw new UnavailabilityError('Notifications', 'getNotificationChannelGroupsAsync');\n }\n return await NotificationChannelGroupManager.getNotificationChannelGroupsAsync();\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"getNotificationChannelsAsync.android.js","sourceRoot":"","sources":["../src/getNotificationChannelsAsync.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,0BAA0B,MAAM,8BAA8B,CAAC;AAGtE,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,4BAA4B;IACxD,IAAI,CAAC,0BAA0B,CAAC,4BAA4B,EAAE,CAAC;QAC7D,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,8BAA8B,CAAC,CAAC;IACjF,CAAC;IACD,OAAO,CAAC,MAAM,0BAA0B,CAAC,4BAA4B,EAAE,CAAC,IAAI,EAAE,CAAC;AACjF,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationChannelManager from './NotificationChannelManager';\nimport { NotificationChannel } from './NotificationChannelManager.types';\n\nexport default async function getNotificationChannelsAsync(): Promise<NotificationChannel[]> {\n if (!NotificationChannelManager.getNotificationChannelsAsync) {\n throw new UnavailabilityError('Notifications', 'getNotificationChannelsAsync');\n }\n return (await NotificationChannelManager.getNotificationChannelsAsync()) ?? [];\n}\n"]}
1
+ {"version":3,"file":"getNotificationChannelsAsync.android.js","sourceRoot":"","sources":["../src/getNotificationChannelsAsync.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,0BAA0B,MAAM,8BAA8B,CAAC;AAGtE,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,4BAA4B;IACxD,IAAI,CAAC,0BAA0B,CAAC,4BAA4B,EAAE;QAC5D,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,8BAA8B,CAAC,CAAC;KAChF;IACD,OAAO,CAAC,MAAM,0BAA0B,CAAC,4BAA4B,EAAE,CAAC,IAAI,EAAE,CAAC;AACjF,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationChannelManager from './NotificationChannelManager';\nimport { NotificationChannel } from './NotificationChannelManager.types';\n\nexport default async function getNotificationChannelsAsync(): Promise<NotificationChannel[]> {\n if (!NotificationChannelManager.getNotificationChannelsAsync) {\n throw new UnavailabilityError('Notifications', 'getNotificationChannelsAsync');\n }\n return (await NotificationChannelManager.getNotificationChannelsAsync()) ?? [];\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"getPresentedNotificationsAsync.js","sourceRoot":"","sources":["../src/getPresentedNotificationsAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,qBAAqB,MAAM,+BAA+B,CAAC;AAGlE;;;;;GAKG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,8BAA8B;IAC1D,IAAI,CAAC,qBAAqB,CAAC,8BAA8B,EAAE,CAAC;QAC1D,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,gCAAgC,CAAC,CAAC;IACnF,CAAC;IAED,OAAO,MAAM,qBAAqB,CAAC,8BAA8B,EAAE,CAAC;AACtE,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationPresenter from './NotificationPresenterModule';\nimport { Notification } from './Notifications.types';\n\n/**\n * Fetches information about all notifications present in the notification tray (Notification Center).\n * > This method is not supported on Android below 6.0 (API level 23) – on these devices it will resolve to an empty array.\n * @return A Promise which resolves with a list of notifications ([`Notification`](#notification)) currently present in the notification tray (Notification Center).\n * @header dismiss\n */\nexport default async function getPresentedNotificationsAsync(): Promise<Notification[]> {\n if (!NotificationPresenter.getPresentedNotificationsAsync) {\n throw new UnavailabilityError('Notifications', 'getPresentedNotificationsAsync');\n }\n\n return await NotificationPresenter.getPresentedNotificationsAsync();\n}\n"]}
1
+ {"version":3,"file":"getPresentedNotificationsAsync.js","sourceRoot":"","sources":["../src/getPresentedNotificationsAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,qBAAqB,MAAM,+BAA+B,CAAC;AAGlE;;;;;GAKG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,8BAA8B;IAC1D,IAAI,CAAC,qBAAqB,CAAC,8BAA8B,EAAE;QACzD,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,gCAAgC,CAAC,CAAC;KAClF;IAED,OAAO,MAAM,qBAAqB,CAAC,8BAA8B,EAAE,CAAC;AACtE,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationPresenter from './NotificationPresenterModule';\nimport { Notification } from './Notifications.types';\n\n/**\n * Fetches information about all notifications present in the notification tray (Notification Center).\n * > This method is not supported on Android below 6.0 (API level 23) – on these devices it will resolve to an empty array.\n * @return A Promise which resolves with a list of notifications ([`Notification`](#notification)) currently present in the notification tray (Notification Center).\n * @header dismiss\n */\nexport default async function getPresentedNotificationsAsync(): Promise<Notification[]> {\n if (!NotificationPresenter.getPresentedNotificationsAsync) {\n throw new UnavailabilityError('Notifications', 'getPresentedNotificationsAsync');\n }\n\n return await NotificationPresenter.getPresentedNotificationsAsync();\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"presentNotificationAsync.js","sourceRoot":"","sources":["../src/presentNotificationAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,qBAAqB,MAAM,+BAA+B,CAAC;AAGlE,IAAI,mBAAmB,GAAG,KAAK,CAAC;AAEhC;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,wBAAwB,CACpD,OAAiC,EACjC,aAAqB,IAAI,CAAC,EAAE,EAAE;IAE9B,IAAI,OAAO,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACpC,OAAO,CAAC,IAAI,CACV,qMAAqM,CACtM,CAAC;QACF,mBAAmB,GAAG,IAAI,CAAC;IAC7B,CAAC;IAED,IAAI,CAAC,qBAAqB,CAAC,wBAAwB,EAAE,CAAC;QACpD,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,0BAA0B,CAAC,CAAC;IAC7E,CAAC;IAED,OAAO,MAAM,qBAAqB,CAAC,wBAAwB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AACnF,CAAC","sourcesContent":["import { UnavailabilityError, uuid } from 'expo-modules-core';\n\nimport NotificationPresenter from './NotificationPresenterModule';\nimport { NotificationContentInput } from './Notifications.types';\n\nlet warningMessageShown = false;\n\n/**\n * Schedules a notification for immediate trigger.\n * @param content An object representing the notification content.\n * @param identifier\n * @return It returns a Promise resolving with the notification's identifier once the notification is successfully scheduled for immediate display.\n * @header schedule\n * @deprecated This method has been deprecated in favor of using an explicit `NotificationHandler` and the [`scheduleNotificationAsync`](#notificationsschedulenotificationasyncrequest) method. More information can be found in our [FYI document](https://expo.fyi/presenting-notifications-deprecated).\n */\nexport default async function presentNotificationAsync(\n content: NotificationContentInput,\n identifier: string = uuid.v4()\n): Promise<string> {\n if (__DEV__ && !warningMessageShown) {\n console.warn(\n '`presentNotificationAsync` has been deprecated in favor of using `scheduleNotificationAsync` + an explicit notification handler. Read more at https://expo.fyi/presenting-notifications-deprecated.'\n );\n warningMessageShown = true;\n }\n\n if (!NotificationPresenter.presentNotificationAsync) {\n throw new UnavailabilityError('Notifications', 'presentNotificationAsync');\n }\n\n return await NotificationPresenter.presentNotificationAsync(identifier, content);\n}\n"]}
1
+ {"version":3,"file":"presentNotificationAsync.js","sourceRoot":"","sources":["../src/presentNotificationAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,qBAAqB,MAAM,+BAA+B,CAAC;AAGlE,IAAI,mBAAmB,GAAG,KAAK,CAAC;AAEhC;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,wBAAwB,CACpD,OAAiC,EACjC,aAAqB,IAAI,CAAC,EAAE,EAAE;IAE9B,IAAI,OAAO,IAAI,CAAC,mBAAmB,EAAE;QACnC,OAAO,CAAC,IAAI,CACV,qMAAqM,CACtM,CAAC;QACF,mBAAmB,GAAG,IAAI,CAAC;KAC5B;IAED,IAAI,CAAC,qBAAqB,CAAC,wBAAwB,EAAE;QACnD,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,0BAA0B,CAAC,CAAC;KAC5E;IAED,OAAO,MAAM,qBAAqB,CAAC,wBAAwB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AACnF,CAAC","sourcesContent":["import { UnavailabilityError, uuid } from 'expo-modules-core';\n\nimport NotificationPresenter from './NotificationPresenterModule';\nimport { NotificationContentInput } from './Notifications.types';\n\nlet warningMessageShown = false;\n\n/**\n * Schedules a notification for immediate trigger.\n * @param content An object representing the notification content.\n * @param identifier\n * @return It returns a Promise resolving with the notification's identifier once the notification is successfully scheduled for immediate display.\n * @header schedule\n * @deprecated This method has been deprecated in favor of using an explicit `NotificationHandler` and the [`scheduleNotificationAsync`](#notificationsschedulenotificationasyncrequest) method. More information can be found in our [FYI document](https://expo.fyi/presenting-notifications-deprecated).\n */\nexport default async function presentNotificationAsync(\n content: NotificationContentInput,\n identifier: string = uuid.v4()\n): Promise<string> {\n if (__DEV__ && !warningMessageShown) {\n console.warn(\n '`presentNotificationAsync` has been deprecated in favor of using `scheduleNotificationAsync` + an explicit notification handler. Read more at https://expo.fyi/presenting-notifications-deprecated.'\n );\n warningMessageShown = true;\n }\n\n if (!NotificationPresenter.presentNotificationAsync) {\n throw new UnavailabilityError('Notifications', 'presentNotificationAsync');\n }\n\n return await NotificationPresenter.presentNotificationAsync(identifier, content);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"registerTaskAsync.js","sourceRoot":"","sources":["../src/registerTaskAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,iCAAiC,MAAM,qCAAqC,CAAC;AAEpF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,iBAAiB,CAAC,QAAgB;IAC9D,IAAI,CAAC,iCAAiC,CAAC,iBAAiB,EAAE,CAAC;QACzD,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,mBAAmB,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,MAAM,iCAAiC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport BackgroundNotificationTasksModule from './BackgroundNotificationTasksModule';\n\n/**\n * When a notification is received while the app is backgrounded, using this function you can set a callback that will be run in response to that notification.\n * Under the hood, this function is run using `expo-task-manager`. You **must** define the task first, with [`TaskManager.defineTask`](./task-manager#taskmanagerdefinetasktaskname-taskexecutor).\n * Make sure you define it in the global scope.\n *\n * The callback function you define with `TaskManager.defineTask` will receive an object with the following fields:\n * - `data`: The remote payload delivered by either FCM (Android) or APNs (iOS). See [`PushNotificationTrigger`](#pushnotificationtrigger) for details.\n * - `error`: The error (if any) that occurred during execution of the task.\n * - `executionInfo`: JSON object of additional info related to the task, including the `taskName`.\n * @param taskName The string you passed to `TaskManager.defineTask` as the `taskName` parameter.\n *\n * @example\n * ```ts\n * import * as TaskManager from 'expo-task-manager';\n * import * as Notifications from 'expo-notifications';\n *\n * const BACKGROUND_NOTIFICATION_TASK = 'BACKGROUND-NOTIFICATION-TASK';\n *\n * TaskManager.defineTask(BACKGROUND_NOTIFICATION_TASK, ({ data, error, executionInfo }) => {\n * console.log('Received a notification in the background!');\n * // Do something with the notification data\n * });\n *\n * Notifications.registerTaskAsync(BACKGROUND_NOTIFICATION_TASK);\n * ```\n * @header inBackground\n */\nexport default async function registerTaskAsync(taskName: string): Promise<null> {\n if (!BackgroundNotificationTasksModule.registerTaskAsync) {\n throw new UnavailabilityError('Notifications', 'registerTaskAsync');\n }\n\n return await BackgroundNotificationTasksModule.registerTaskAsync(taskName);\n}\n"]}
1
+ {"version":3,"file":"registerTaskAsync.js","sourceRoot":"","sources":["../src/registerTaskAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,iCAAiC,MAAM,qCAAqC,CAAC;AAEpF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,iBAAiB,CAAC,QAAgB;IAC9D,IAAI,CAAC,iCAAiC,CAAC,iBAAiB,EAAE;QACxD,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,mBAAmB,CAAC,CAAC;KACrE;IAED,OAAO,MAAM,iCAAiC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport BackgroundNotificationTasksModule from './BackgroundNotificationTasksModule';\n\n/**\n * When a notification is received while the app is backgrounded, using this function you can set a callback that will be run in response to that notification.\n * Under the hood, this function is run using `expo-task-manager`. You **must** define the task first, with [`TaskManager.defineTask`](./task-manager#taskmanagerdefinetasktaskname-taskexecutor).\n * Make sure you define it in the global scope.\n *\n * The callback function you define with `TaskManager.defineTask` will receive an object with the following fields:\n * - `data`: The remote payload delivered by either FCM (Android) or APNs (iOS). See [`PushNotificationTrigger`](#pushnotificationtrigger) for details.\n * - `error`: The error (if any) that occurred during execution of the task.\n * - `executionInfo`: JSON object of additional info related to the task, including the `taskName`.\n * @param taskName The string you passed to `TaskManager.defineTask` as the `taskName` parameter.\n *\n * @example\n * ```ts\n * import * as TaskManager from 'expo-task-manager';\n * import * as Notifications from 'expo-notifications';\n *\n * const BACKGROUND_NOTIFICATION_TASK = 'BACKGROUND-NOTIFICATION-TASK';\n *\n * TaskManager.defineTask(BACKGROUND_NOTIFICATION_TASK, ({ data, error, executionInfo }) => {\n * console.log('Received a notification in the background!');\n * // Do something with the notification data\n * });\n *\n * Notifications.registerTaskAsync(BACKGROUND_NOTIFICATION_TASK);\n * ```\n * @header inBackground\n */\nexport default async function registerTaskAsync(taskName: string): Promise<null> {\n if (!BackgroundNotificationTasksModule.registerTaskAsync) {\n throw new UnavailabilityError('Notifications', 'registerTaskAsync');\n }\n\n return await BackgroundNotificationTasksModule.registerTaskAsync(taskName);\n}\n"]}
@@ -133,7 +133,7 @@ export function parseTrigger(userFacingTrigger) {
133
133
  }
134
134
  else {
135
135
  return Platform.select({
136
- default: null, // There's no notion of channels on platforms other than Android.
136
+ default: null,
137
137
  android: { type: 'channel', channelId: userFacingTrigger.channelId },
138
138
  });
139
139
  }
@@ -1 +1 @@
1
- {"version":3,"file":"scheduleNotificationAsync.js","sourceRoot":"","sources":["../src/scheduleNotificationAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAExE,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAe5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,yBAAyB,CACrD,O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cesContent":["import { Platform, UnavailabilityError, uuid } from 'expo-modules-core';\n\nimport NotificationScheduler from './NotificationScheduler';\nimport { NotificationTriggerInput as NativeNotificationTriggerInput } from './NotificationScheduler.types';\nimport {\n NotificationRequestInput,\n NotificationTriggerInput,\n DailyTriggerInput,\n WeeklyTriggerInput,\n YearlyTriggerInput,\n CalendarTriggerInput,\n TimeIntervalTriggerInput,\n DateTriggerInput,\n ChannelAwareTriggerInput,\n SchedulableNotificationTriggerInput,\n} from './Notifications.types';\n\n/**\n * Schedules a notification to be triggered in the future.\n * > **Note:** Please note that this does not mean that the notification will be presented when it is triggered.\n * For the notification to be presented you have to set a notification handler with [`setNotificationHandler`](#notificationssetnotificationhandlerhandler)\n * that will return an appropriate notification behavior. For more information see the example below.\n * @param request An object describing the notification to be triggered.\n * @return Returns a Promise resolving to a string which is a notification identifier you can later use to cancel the notification or to identify an incoming notification.\n * @example\n * # Schedule the notification that will trigger once, in one minute from now\n * ```ts\n * import * as Notifications from 'expo-notifications';\n *\n * Notifications.scheduleNotificationAsync({\n * content: {\n * title: \"Time's up!\",\n * body: 'Change sides!',\n * },\n * trigger: {\n * seconds: 60,\n * },\n * });\n * ```\n *\n * # Schedule the notification that will trigger repeatedly, every 20 minutes\n * ```ts\n * import * as Notifications from 'expo-notifications';\n *\n * Notifications.scheduleNotificationAsync({\n * content: {\n * title: 'Remember to drink water!',\n * },\n * trigger: {\n * seconds: 60 * 20,\n * repeats: true,\n * },\n * });\n * ```\n *\n * # Schedule the notification that will trigger once, at the beginning of next hour\n * ```ts\n * import * as Notifications from 'expo-notifications';\n *\n * const trigger = new Date(Date.now() + 60 * 60 * 1000);\n * trigger.setMinutes(0);\n * trigger.setSeconds(0);\n *\n * Notifications.scheduleNotificationAsync({\n * content: {\n * title: 'Happy new hour!',\n * },\n * trigger,\n * });\n * ```\n * @header schedule\n */\nexport default async function scheduleNotificationAsync(\n request: NotificationRequestInput\n): Promise<string> {\n if (!NotificationScheduler.scheduleNotificationAsync) {\n throw new UnavailabilityError('Notifications', 'scheduleNotificationAsync');\n }\n\n return await NotificationScheduler.scheduleNotificationAsync(\n request.identifier ?? uuid.v4(),\n request.content,\n parseTrigger(request.trigger)\n );\n}\n\ntype ValidTriggerDateComponents = 'month' | 'day' | 'weekday' | 'hour' | 'minute';\n\nconst DAILY_TRIGGER_EXPECTED_DATE_COMPONENTS: readonly ValidTriggerDateComponents[] = [\n 'hour',\n 'minute',\n];\nconst WEEKLY_TRIGGER_EXPECTED_DATE_COMPONENTS: readonly ValidTriggerDateComponents[] = [\n 'weekday',\n 'hour',\n 'minute',\n];\nconst YEARLY_TRIGGER_EXPECTED_DATE_COMPONENTS: readonly ValidTriggerDateComponents[] = [\n 'day',\n 'month',\n 'hour',\n 'minute',\n];\n\nexport function parseTrigger(\n userFacingTrigger: NotificationTriggerInput\n): NativeNotificationTriggerInput {\n if (userFacingTrigger === null) {\n return null;\n }\n\n if (userFacingTrigger === undefined) {\n throw new TypeError(\n 'Encountered an `undefined` notification trigger. If you want to trigger the notification immediately, pass in an explicit `null` value.'\n );\n }\n\n if (isDateTrigger(userFacingTrigger)) {\n return parseDateTrigger(userFacingTrigger);\n } else if (isDailyTriggerInput(userFacingTrigger)) {\n validateDateComponentsInTrigger(userFacingTrigger, DAILY_TRIGGER_EXPECTED_DATE_COMPONENTS);\n return {\n type: 'daily',\n channelId: userFacingTrigger.channelId,\n hour: userFacingTrigger.hour,\n minute: userFacingTrigger.minute,\n };\n } else if (isWeeklyTriggerInput(userFacingTrigger)) {\n validateDateComponentsInTrigger(userFacingTrigger, WEEKLY_TRIGGER_EXPECTED_DATE_COMPONENTS);\n return {\n type: 'weekly',\n channelId: userFacingTrigger.channelId,\n weekday: userFacingTrigger.weekday,\n hour: userFacingTrigger.hour,\n minute: userFacingTrigger.minute,\n };\n } else if (isYearlyTriggerInput(userFacingTrigger)) {\n validateDateComponentsInTrigger(userFacingTrigger, YEARLY_TRIGGER_EXPECTED_DATE_COMPONENTS);\n return {\n type: 'yearly',\n channelId: userFacingTrigger.channelId,\n day: userFacingTrigger.day,\n month: userFacingTrigger.month,\n hour: userFacingTrigger.hour,\n minute: userFacingTrigger.minute,\n };\n } else if (isSecondsPropertyMisusedInCalendarTriggerInput(userFacingTrigger)) {\n throw new TypeError(\n 'Could not have inferred the notification trigger type: if you want to use a time interval trigger, pass in only `seconds` with or without `repeats` property; if you want to use calendar-based trigger, pass in `second`.'\n );\n } else if ('seconds' in userFacingTrigger) {\n return {\n type: 'timeInterval',\n channelId: userFacingTrigger.channelId,\n seconds: userFacingTrigger.seconds,\n repeats: userFacingTrigger.repeats ?? false,\n };\n } else if (isCalendarTrigger(userFacingTrigger)) {\n const { repeats, ...calendarTrigger } = userFacingTrigger;\n return { type: 'calendar', value: calendarTrigger, repeats };\n } else {\n return Platform.select({\n default: null, // There's no notion of channels on platforms other than Android.\n android: { type: 'channel', channelId: userFacingTrigger.channelId },\n });\n }\n}\n\nfunction isCalendarTrigger(\n trigger: CalendarTriggerInput | ChannelAwareTriggerInput\n): trigger is CalendarTriggerInput {\n const { channelId, ...triggerWithoutChannelId } = trigger;\n return Object.keys(triggerWithoutChannelId).length > 0;\n}\n\nfunction isDateTrigger(\n trigger:\n | DateTriggerInput\n | WeeklyTriggerInput\n | DailyTriggerInput\n | CalendarTriggerInput\n | TimeIntervalTriggerInput\n): trigger is DateTriggerInput {\n return (\n trigger instanceof Date ||\n typeof trigger === 'number' ||\n (typeof trigger === 'object' && 'date' in trigger)\n );\n}\n\nfunction parseDateTrigger(trigger: DateTriggerInput): NativeNotificationTriggerInput {\n if (trigger instanceof Date || typeof trigger === 'number') {\n return { type: 'date', timestamp: toTimestamp(trigger) };\n }\n return { type: 'date', timestamp: toTimestamp(trigger.date), channelId: trigger.channelId };\n}\n\nfunction toTimestamp(date: number | Date) {\n if (date instanceof Date) {\n return date.getTime();\n }\n return date;\n}\n\nfunction isDailyTriggerInput(\n trigger: SchedulableNotificationTriggerInput\n): trigger is DailyTriggerInput {\n if (typeof trigger !== 'object') return false;\n const { channelId, ...triggerWithoutChannelId } = trigger as DailyTriggerInput;\n return (\n Object.keys(triggerWithoutChannelId).length ===\n DAILY_TRIGGER_EXPECTED_DATE_COMPONENTS.length + 1 &&\n DAILY_TRIGGER_EXPECTED_DATE_COMPONENTS.every(\n (component) => component in triggerWithoutChannelId\n ) &&\n 'repeats' in triggerWithoutChannelId &&\n triggerWithoutChannelId.repeats === true\n );\n}\n\nfunction isWeeklyTriggerInput(\n trigger: SchedulableNotificationTriggerInput\n): trigger is WeeklyTriggerInput {\n if (typeof trigger !== 'object') return false;\n const { channelId, ...triggerWithoutChannelId } = trigger as WeeklyTriggerInput;\n return (\n Object.keys(triggerWithoutChannelId).length ===\n WEEKLY_TRIGGER_EXPECTED_DATE_COMPONENTS.length + 1 &&\n WEEKLY_TRIGGER_EXPECTED_DATE_COMPONENTS.every(\n (component) => component in triggerWithoutChannelId\n ) &&\n 'repeats' in triggerWithoutChannelId &&\n triggerWithoutChannelId.repeats === true\n );\n}\n\nfunction isYearlyTriggerInput(\n trigger: SchedulableNotificationTriggerInput\n): trigger is YearlyTriggerInput {\n if (typeof trigger !== 'object') return false;\n const { channelId, ...triggerWithoutChannelId } = trigger as YearlyTriggerInput;\n return (\n Object.keys(triggerWithoutChannelId).length ===\n YEARLY_TRIGGER_EXPECTED_DATE_COMPONENTS.length + 1 &&\n YEARLY_TRIGGER_EXPECTED_DATE_COMPONENTS.every(\n (component) => component in triggerWithoutChannelId\n ) &&\n 'repeats' in triggerWithoutChannelId &&\n triggerWithoutChannelId.repeats === true\n );\n}\n\nfunction isSecondsPropertyMisusedInCalendarTriggerInput(\n trigger: TimeIntervalTriggerInput | CalendarTriggerInput\n) {\n const { channelId, ...triggerWithoutChannelId } = trigger;\n return (\n // eg. { seconds: ..., repeats: ..., hour: ... }\n ('seconds' in triggerWithoutChannelId &&\n 'repeats' in triggerWithoutChannelId &&\n Object.keys(triggerWithoutChannelId).length > 2) ||\n // eg. { seconds: ..., hour: ... }\n ('seconds' in triggerWithoutChannelId &&\n !('repeats' in triggerWithoutChannelId) &&\n Object.keys(triggerWithoutChannelId).length > 1)\n );\n}\n\nfunction validateDateComponentsInTrigger(\n trigger: NonNullable<NotificationTriggerInput>,\n components: readonly ValidTriggerDateComponents[]\n) {\n const anyTriggerType = trigger as any;\n components.forEach((component) => {\n if (!(component in anyTriggerType)) {\n throw new TypeError(`The ${component} parameter needs to be present`);\n }\n if (typeof anyTriggerType[component] !== 'number') {\n throw new TypeError(`The ${component} parameter should be a number`);\n }\n switch (component) {\n case 'month': {\n const { month } = anyTriggerType;\n if (month < 0 || month > 11) {\n throw new RangeError(`The month parameter needs to be between 0 and 11. Found: ${month}`);\n }\n break;\n }\n case 'day': {\n const { day, month } = anyTriggerType;\n const daysInGivenMonth = daysInMonth(month);\n if (day < 1 || day > daysInGivenMonth) {\n throw new RangeError(\n `The day parameter for month ${month} must be between 1 and ${daysInGivenMonth}. Found: ${day}`\n );\n }\n break;\n }\n case 'weekday': {\n const { weekday } = anyTriggerType;\n if (weekday < 1 || weekday > 7) {\n throw new RangeError(\n `The weekday parameter needs to be between 1 and 7. Found: ${weekday}`\n );\n }\n break;\n }\n case 'hour': {\n const { hour } = anyTriggerType;\n if (hour < 0 || hour > 23) {\n throw new RangeError(`The hour parameter needs to be between 0 and 23. Found: ${hour}`);\n }\n break;\n }\n case 'minute': {\n const { minute } = anyTriggerType;\n if (minute < 0 || minute > 59) {\n throw new RangeError(\n `The minute parameter needs to be between 0 and 59. Found: ${minute}`\n );\n }\n break;\n }\n }\n });\n}\n\n/**\n * Determines the number of days in the given month (or January if omitted).\n * If year is specified, it will include leap year logic, else it will always assume a leap year\n */\nfunction daysInMonth(month: number = 0, year?: number) {\n return new Date(year ?? 2000, month + 1, 0).getDate();\n}\n"]}
1
+ {"version":3,"file":"scheduleNotificationAsync.js","sourceRoot":"","sources":["../src/scheduleNotificationAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,mBAAmB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KAAK,CAAC,CAAC;gBAC5C,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,gBAAgB,EAAE;oBACrC,MAAM,IAAI,UAAU,CAClB,+BAA+B,KAAK,0BAA0B,gBAAgB,YAAY,GAAG,EAAE,CAChG,CAAC;iBACH;gBACD,MAAM;aACP;YACD,KAAK,SAAS,CAAC,CAAC;gBACd,MAAM,EAAE,OAAO,EAAE,GAAG,cAAc,CAAC;gBACnC,IAAI,OAAO,GAAG,CAAC,IAAI,OAAO,GAAG,CAAC,EAAE;oBAC9B,MAAM,IAAI,UAAU,CAClB,6DAA6D,OAAO,EAAE,CACvE,CAAC;iBACH;gBACD,MAAM;aACP;YACD,KAAK,MAAM,CAAC,CAAC;gBACX,MAAM,EAAE,IAAI,EAAE,GAAG,cAAc,CAAC;gBAChC,IAAI,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,EAAE,EAAE;oBACzB,MAAM,IAAI,UAAU,CAAC,2DAA2D,IAAI,EAAE,CAAC,CAAC;iBACzF;gBACD,MAAM;aACP;YACD,KAAK,QAAQ,CAAC,CAAC;gBACb,MAAM,EAAE,MAAM,EAAE,GAAG,cAAc,CAAC;gBAClC,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,GAAG,EAAE,EAAE;oBAC7B,MAAM,IAAI,UAAU,CAClB,6DAA6D,MAAM,EAAE,CACtE,CAAC;iBACH;gBACD,MAAM;aACP;SACF;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,SAAS,WAAW,CAAC,QAAgB,CAAC,EAAE,IAAa;IACnD,OAAO,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;AACxD,CAAC","sourcesContent":["import { Platform, UnavailabilityError, uuid } from 'expo-modules-core';\n\nimport NotificationScheduler from './NotificationScheduler';\nimport { NotificationTriggerInput as NativeNotificationTriggerInput } from './NotificationScheduler.types';\nimport {\n NotificationRequestInput,\n NotificationTriggerInput,\n DailyTriggerInput,\n WeeklyTriggerInput,\n YearlyTriggerInput,\n CalendarTriggerInput,\n TimeIntervalTriggerInput,\n DateTriggerInput,\n ChannelAwareTriggerInput,\n SchedulableNotificationTriggerInput,\n} from './Notifications.types';\n\n/**\n * Schedules a notification to be triggered in the future.\n * > **Note:** Please note that this does not mean that the notification will be presented when it is triggered.\n * For the notification to be presented you have to set a notification handler with [`setNotificationHandler`](#notificationssetnotificationhandlerhandler)\n * that will return an appropriate notification behavior. For more information see the example below.\n * @param request An object describing the notification to be triggered.\n * @return Returns a Promise resolving to a string which is a notification identifier you can later use to cancel the notification or to identify an incoming notification.\n * @example\n * # Schedule the notification that will trigger once, in one minute from now\n * ```ts\n * import * as Notifications from 'expo-notifications';\n *\n * Notifications.scheduleNotificationAsync({\n * content: {\n * title: \"Time's up!\",\n * body: 'Change sides!',\n * },\n * trigger: {\n * seconds: 60,\n * },\n * });\n * ```\n *\n * # Schedule the notification that will trigger repeatedly, every 20 minutes\n * ```ts\n * import * as Notifications from 'expo-notifications';\n *\n * Notifications.scheduleNotificationAsync({\n * content: {\n * title: 'Remember to drink water!',\n * },\n * trigger: {\n * seconds: 60 * 20,\n * repeats: true,\n * },\n * });\n * ```\n *\n * # Schedule the notification that will trigger once, at the beginning of next hour\n * ```ts\n * import * as Notifications from 'expo-notifications';\n *\n * const trigger = new Date(Date.now() + 60 * 60 * 1000);\n * trigger.setMinutes(0);\n * trigger.setSeconds(0);\n *\n * Notifications.scheduleNotificationAsync({\n * content: {\n * title: 'Happy new hour!',\n * },\n * trigger,\n * });\n * ```\n * @header schedule\n */\nexport default async function scheduleNotificationAsync(\n request: NotificationRequestInput\n): Promise<string> {\n if (!NotificationScheduler.scheduleNotificationAsync) {\n throw new UnavailabilityError('Notifications', 'scheduleNotificationAsync');\n }\n\n return await NotificationScheduler.scheduleNotificationAsync(\n request.identifier ?? uuid.v4(),\n request.content,\n parseTrigger(request.trigger)\n );\n}\n\ntype ValidTriggerDateComponents = 'month' | 'day' | 'weekday' | 'hour' | 'minute';\n\nconst DAILY_TRIGGER_EXPECTED_DATE_COMPONENTS: readonly ValidTriggerDateComponents[] = [\n 'hour',\n 'minute',\n];\nconst WEEKLY_TRIGGER_EXPECTED_DATE_COMPONENTS: readonly ValidTriggerDateComponents[] = [\n 'weekday',\n 'hour',\n 'minute',\n];\nconst YEARLY_TRIGGER_EXPECTED_DATE_COMPONENTS: readonly ValidTriggerDateComponents[] = [\n 'day',\n 'month',\n 'hour',\n 'minute',\n];\n\nexport function parseTrigger(\n userFacingTrigger: NotificationTriggerInput\n): NativeNotificationTriggerInput {\n if (userFacingTrigger === null) {\n return null;\n }\n\n if (userFacingTrigger === undefined) {\n throw new TypeError(\n 'Encountered an `undefined` notification trigger. If you want to trigger the notification immediately, pass in an explicit `null` value.'\n );\n }\n\n if (isDateTrigger(userFacingTrigger)) {\n return parseDateTrigger(userFacingTrigger);\n } else if (isDailyTriggerInput(userFacingTrigger)) {\n validateDateComponentsInTrigger(userFacingTrigger, DAILY_TRIGGER_EXPECTED_DATE_COMPONENTS);\n return {\n type: 'daily',\n channelId: userFacingTrigger.channelId,\n hour: userFacingTrigger.hour,\n minute: userFacingTrigger.minute,\n };\n } else if (isWeeklyTriggerInput(userFacingTrigger)) {\n validateDateComponentsInTrigger(userFacingTrigger, WEEKLY_TRIGGER_EXPECTED_DATE_COMPONENTS);\n return {\n type: 'weekly',\n channelId: userFacingTrigger.channelId,\n weekday: userFacingTrigger.weekday,\n hour: userFacingTrigger.hour,\n minute: userFacingTrigger.minute,\n };\n } else if (isYearlyTriggerInput(userFacingTrigger)) {\n validateDateComponentsInTrigger(userFacingTrigger, YEARLY_TRIGGER_EXPECTED_DATE_COMPONENTS);\n return {\n type: 'yearly',\n channelId: userFacingTrigger.channelId,\n day: userFacingTrigger.day,\n month: userFacingTrigger.month,\n hour: userFacingTrigger.hour,\n minute: userFacingTrigger.minute,\n };\n } else if (isSecondsPropertyMisusedInCalendarTriggerInput(userFacingTrigger)) {\n throw new TypeError(\n 'Could not have inferred the notification trigger type: if you want to use a time interval trigger, pass in only `seconds` with or without `repeats` property; if you want to use calendar-based trigger, pass in `second`.'\n );\n } else if ('seconds' in userFacingTrigger) {\n return {\n type: 'timeInterval',\n channelId: userFacingTrigger.channelId,\n seconds: userFacingTrigger.seconds,\n repeats: userFacingTrigger.repeats ?? false,\n };\n } else if (isCalendarTrigger(userFacingTrigger)) {\n const { repeats, ...calendarTrigger } = userFacingTrigger;\n return { type: 'calendar', value: calendarTrigger, repeats };\n } else {\n return Platform.select({\n default: null, // There's no notion of channels on platforms other than Android.\n android: { type: 'channel', channelId: userFacingTrigger.channelId },\n });\n }\n}\n\nfunction isCalendarTrigger(\n trigger: CalendarTriggerInput | ChannelAwareTriggerInput\n): trigger is CalendarTriggerInput {\n const { channelId, ...triggerWithoutChannelId } = trigger;\n return Object.keys(triggerWithoutChannelId).length > 0;\n}\n\nfunction isDateTrigger(\n trigger:\n | DateTriggerInput\n | WeeklyTriggerInput\n | DailyTriggerInput\n | CalendarTriggerInput\n | TimeIntervalTriggerInput\n): trigger is DateTriggerInput {\n return (\n trigger instanceof Date ||\n typeof trigger === 'number' ||\n (typeof trigger === 'object' && 'date' in trigger)\n );\n}\n\nfunction parseDateTrigger(trigger: DateTriggerInput): NativeNotificationTriggerInput {\n if (trigger instanceof Date || typeof trigger === 'number') {\n return { type: 'date', timestamp: toTimestamp(trigger) };\n }\n return { type: 'date', timestamp: toTimestamp(trigger.date), channelId: trigger.channelId };\n}\n\nfunction toTimestamp(date: number | Date) {\n if (date instanceof Date) {\n return date.getTime();\n }\n return date;\n}\n\nfunction isDailyTriggerInput(\n trigger: SchedulableNotificationTriggerInput\n): trigger is DailyTriggerInput {\n if (typeof trigger !== 'object') return false;\n const { channelId, ...triggerWithoutChannelId } = trigger as DailyTriggerInput;\n return (\n Object.keys(triggerWithoutChannelId).length ===\n DAILY_TRIGGER_EXPECTED_DATE_COMPONENTS.length + 1 &&\n DAILY_TRIGGER_EXPECTED_DATE_COMPONENTS.every(\n (component) => component in triggerWithoutChannelId\n ) &&\n 'repeats' in triggerWithoutChannelId &&\n triggerWithoutChannelId.repeats === true\n );\n}\n\nfunction isWeeklyTriggerInput(\n trigger: SchedulableNotificationTriggerInput\n): trigger is WeeklyTriggerInput {\n if (typeof trigger !== 'object') return false;\n const { channelId, ...triggerWithoutChannelId } = trigger as WeeklyTriggerInput;\n return (\n Object.keys(triggerWithoutChannelId).length ===\n WEEKLY_TRIGGER_EXPECTED_DATE_COMPONENTS.length + 1 &&\n WEEKLY_TRIGGER_EXPECTED_DATE_COMPONENTS.every(\n (component) => component in triggerWithoutChannelId\n ) &&\n 'repeats' in triggerWithoutChannelId &&\n triggerWithoutChannelId.repeats === true\n );\n}\n\nfunction isYearlyTriggerInput(\n trigger: SchedulableNotificationTriggerInput\n): trigger is YearlyTriggerInput {\n if (typeof trigger !== 'object') return false;\n const { channelId, ...triggerWithoutChannelId } = trigger as YearlyTriggerInput;\n return (\n Object.keys(triggerWithoutChannelId).length ===\n YEARLY_TRIGGER_EXPECTED_DATE_COMPONENTS.length + 1 &&\n YEARLY_TRIGGER_EXPECTED_DATE_COMPONENTS.every(\n (component) => component in triggerWithoutChannelId\n ) &&\n 'repeats' in triggerWithoutChannelId &&\n triggerWithoutChannelId.repeats === true\n );\n}\n\nfunction isSecondsPropertyMisusedInCalendarTriggerInput(\n trigger: TimeIntervalTriggerInput | CalendarTriggerInput\n) {\n const { channelId, ...triggerWithoutChannelId } = trigger;\n return (\n // eg. { seconds: ..., repeats: ..., hour: ... }\n ('seconds' in triggerWithoutChannelId &&\n 'repeats' in triggerWithoutChannelId &&\n Object.keys(triggerWithoutChannelId).length > 2) ||\n // eg. { seconds: ..., hour: ... }\n ('seconds' in triggerWithoutChannelId &&\n !('repeats' in triggerWithoutChannelId) &&\n Object.keys(triggerWithoutChannelId).length > 1)\n );\n}\n\nfunction validateDateComponentsInTrigger(\n trigger: NonNullable<NotificationTriggerInput>,\n components: readonly ValidTriggerDateComponents[]\n) {\n const anyTriggerType = trigger as any;\n components.forEach((component) => {\n if (!(component in anyTriggerType)) {\n throw new TypeError(`The ${component} parameter needs to be present`);\n }\n if (typeof anyTriggerType[component] !== 'number') {\n throw new TypeError(`The ${component} parameter should be a number`);\n }\n switch (component) {\n case 'month': {\n const { month } = anyTriggerType;\n if (month < 0 || month > 11) {\n throw new RangeError(`The month parameter needs to be between 0 and 11. Found: ${month}`);\n }\n break;\n }\n case 'day': {\n const { day, month } = anyTriggerType;\n const daysInGivenMonth = daysInMonth(month);\n if (day < 1 || day > daysInGivenMonth) {\n throw new RangeError(\n `The day parameter for month ${month} must be between 1 and ${daysInGivenMonth}. Found: ${day}`\n );\n }\n break;\n }\n case 'weekday': {\n const { weekday } = anyTriggerType;\n if (weekday < 1 || weekday > 7) {\n throw new RangeError(\n `The weekday parameter needs to be between 1 and 7. Found: ${weekday}`\n );\n }\n break;\n }\n case 'hour': {\n const { hour } = anyTriggerType;\n if (hour < 0 || hour > 23) {\n throw new RangeError(`The hour parameter needs to be between 0 and 23. Found: ${hour}`);\n }\n break;\n }\n case 'minute': {\n const { minute } = anyTriggerType;\n if (minute < 0 || minute > 59) {\n throw new RangeError(\n `The minute parameter needs to be between 0 and 59. Found: ${minute}`\n );\n }\n break;\n }\n }\n });\n}\n\n/**\n * Determines the number of days in the given month (or January if omitted).\n * If year is specified, it will include leap year logic, else it will always assume a leap year\n */\nfunction daysInMonth(month: number = 0, year?: number) {\n return new Date(year ?? 2000, month + 1, 0).getDate();\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"setBadgeCountAsync.js","sourceRoot":"","sources":["../src/setBadgeCountAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElE,OAAO,WAAW,MAAM,eAAe,CAAC;AAUxC;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,kBAAkB,CAC9C,UAAkB,EAClB,OAA8B;IAE9B,IAAI,CAAC,WAAW,CAAC,kBAAkB,EAAE,CAAC;QACpC,MAAM,IAAI,mBAAmB,CAAC,mBAAmB,EAAE,oBAAoB,CAAC,CAAC;IAC3E,CAAC;IAED,OAAO,MAAM,WAAW,CAAC,kBAAkB,CAAC,UAAU,EAAE,OAAO,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;AAClF,CAAC","sourcesContent":["import { UnavailabilityError, Platform } from 'expo-modules-core';\n\nimport BadgeModule from './BadgeModule';\nimport { WebSetBadgeCountOptions } from './BadgeModule.types';\n\nexport interface SetBadgeCountOptions {\n /**\n * A configuration object described [in the `badgin` documentation](https://github.com/jaulz/badgin#options).\n */\n web?: WebSetBadgeCountOptions;\n}\n\n/**\n * Sets the badge of the app's icon to the specified number. Setting it to `0` clears the badge. On iOS, this method requires that you have requested\n * the user's permission for `allowBadge` via [`requestPermissionsAsync`](#notificationsrequestpermissionsasyncpermissions),\n * otherwise it will automatically return `false`.\n * > **Note:** Not all Android launchers support application badges. If the launcher does not support icon badges, the method will resolve to `false`.\n * @param badgeCount The count which should appear on the badge. A value of `0` will clear the badge.\n * @param options An object of options configuring behavior applied in Web environment.\n * @return It returns a Promise resolving to a boolean representing whether the setting of the badge succeeded.\n * @header badge\n */\nexport default async function setBadgeCountAsync(\n badgeCount: number,\n options?: SetBadgeCountOptions\n): Promise<boolean> {\n if (!BadgeModule.setBadgeCountAsync) {\n throw new UnavailabilityError('ExpoNotifications', 'setBadgeCountAsync');\n }\n\n return await BadgeModule.setBadgeCountAsync(badgeCount, options?.[Platform.OS]);\n}\n"]}
1
+ {"version":3,"file":"setBadgeCountAsync.js","sourceRoot":"","sources":["../src/setBadgeCountAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElE,OAAO,WAAW,MAAM,eAAe,CAAC;AAUxC;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,kBAAkB,CAC9C,UAAkB,EAClB,OAA8B;IAE9B,IAAI,CAAC,WAAW,CAAC,kBAAkB,EAAE;QACnC,MAAM,IAAI,mBAAmB,CAAC,mBAAmB,EAAE,oBAAoB,CAAC,CAAC;KAC1E;IAED,OAAO,MAAM,WAAW,CAAC,kBAAkB,CAAC,UAAU,EAAE,OAAO,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;AAClF,CAAC","sourcesContent":["import { UnavailabilityError, Platform } from 'expo-modules-core';\n\nimport BadgeModule from './BadgeModule';\nimport { WebSetBadgeCountOptions } from './BadgeModule.types';\n\nexport interface SetBadgeCountOptions {\n /**\n * A configuration object described [in the `badgin` documentation](https://github.com/jaulz/badgin#options).\n */\n web?: WebSetBadgeCountOptions;\n}\n\n/**\n * Sets the badge of the app's icon to the specified number. Setting it to `0` clears the badge. On iOS, this method requires that you have requested\n * the user's permission for `allowBadge` via [`requestPermissionsAsync`](#notificationsrequestpermissionsasyncpermissions),\n * otherwise it will automatically return `false`.\n * > **Note:** Not all Android launchers support application badges. If the launcher does not support icon badges, the method will resolve to `false`.\n * @param badgeCount The count which should appear on the badge. A value of `0` will clear the badge.\n * @param options An object of options configuring behavior applied in Web environment.\n * @return It returns a Promise resolving to a boolean representing whether the setting of the badge succeeded.\n * @header badge\n */\nexport default async function setBadgeCountAsync(\n badgeCount: number,\n options?: SetBadgeCountOptions\n): Promise<boolean> {\n if (!BadgeModule.setBadgeCountAsync) {\n throw new UnavailabilityError('ExpoNotifications', 'setBadgeCountAsync');\n }\n\n return await BadgeModule.setBadgeCountAsync(badgeCount, options?.[Platform.OS]);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"setNotificationCategoryAsync.js","sourceRoot":"","sources":["../src/setNotificationCategoryAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,4BAA4B,MAAM,gCAAgC,CAAC;AAO1E;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,4BAA4B,CACxD,UAAkB,EAClB,OAA6B,EAC7B,OAAqC;IAErC,IAAI,CAAC,4BAA4B,CAAC,4BAA4B,EAAE,CAAC;QAC/D,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,8BAA8B,CAAC,CAAC;IACjF,CAAC;IAED,OAAO,MAAM,4BAA4B,CAAC,4BAA4B,CACpE,UAAU,EACV,OAAO,EACP,OAAO,CACR,CAAC;AACJ,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationCategoriesModule from './NotificationCategoriesModule';\nimport {\n NotificationCategory,\n NotificationAction,\n NotificationCategoryOptions,\n} from './Notifications.types';\n\n/**\n * Sets the new notification category.\n * @param identifier A string to associate as the ID of this category. You will pass this string in as the `categoryIdentifier`\n * in your [`NotificationContent`](#notificationcontent) to associate a notification with this category.\n * > Don't use the characters `:` or `-` in your category identifier. If you do, categories might not work as expected.\n * @param actions An array of [`NotificationAction`s](#notificationaction), which describe the actions associated with this category.\n * @param options An optional object of additional configuration options for your category.\n * @return A Promise which resolves to the category you just have created, or null on web\n * @platform android\n * @platform ios\n * @platform web\n * @header categories\n */\nexport default async function setNotificationCategoryAsync(\n identifier: string,\n actions: NotificationAction[],\n options?: NotificationCategoryOptions\n): Promise<NotificationCategory> {\n if (!NotificationCategoriesModule.setNotificationCategoryAsync) {\n throw new UnavailabilityError('Notifications', 'setNotificationCategoryAsync');\n }\n\n return await NotificationCategoriesModule.setNotificationCategoryAsync(\n identifier,\n actions,\n options\n );\n}\n"]}
1
+ {"version":3,"file":"setNotificationCategoryAsync.js","sourceRoot":"","sources":["../src/setNotificationCategoryAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,4BAA4B,MAAM,gCAAgC,CAAC;AAO1E;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,4BAA4B,CACxD,UAAkB,EAClB,OAA6B,EAC7B,OAAqC;IAErC,IAAI,CAAC,4BAA4B,CAAC,4BAA4B,EAAE;QAC9D,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,8BAA8B,CAAC,CAAC;KAChF;IAED,OAAO,MAAM,4BAA4B,CAAC,4BAA4B,CACpE,UAAU,EACV,OAAO,EACP,OAAO,CACR,CAAC;AACJ,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationCategoriesModule from './NotificationCategoriesModule';\nimport {\n NotificationCategory,\n NotificationAction,\n NotificationCategoryOptions,\n} from './Notifications.types';\n\n/**\n * Sets the new notification category.\n * @param identifier A string to associate as the ID of this category. You will pass this string in as the `categoryIdentifier`\n * in your [`NotificationContent`](#notificationcontent) to associate a notification with this category.\n * > Don't use the characters `:` or `-` in your category identifier. If you do, categories might not work as expected.\n * @param actions An array of [`NotificationAction`s](#notificationaction), which describe the actions associated with this category.\n * @param options An optional object of additional configuration options for your category.\n * @return A Promise which resolves to the category you just have created, or null on web\n * @platform android\n * @platform ios\n * @platform web\n * @header categories\n */\nexport default async function setNotificationCategoryAsync(\n identifier: string,\n actions: NotificationAction[],\n options?: NotificationCategoryOptions\n): Promise<NotificationCategory> {\n if (!NotificationCategoriesModule.setNotificationCategoryAsync) {\n throw new UnavailabilityError('Notifications', 'setNotificationCategoryAsync');\n }\n\n return await NotificationCategoriesModule.setNotificationCategoryAsync(\n identifier,\n actions,\n options\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"setNotificationChannelAsync.android.js","sourceRoot":"","sources":["../src/setNotificationChannelAsync.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,0BAA0B,MAAM,8BAA8B,CAAC;AAGtE,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,2BAA2B,CACvD,SAAiB,EACjB,OAAiC;IAEjC,IAAI,CAAC,0BAA0B,CAAC,2BAA2B,EAAE,CAAC;QAC5D,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,6BAA6B,CAAC,CAAC;IAChF,CAAC;IAED,OAAO,MAAM,0BAA0B,CAAC,2BAA2B,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAC1F,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationChannelManager from './NotificationChannelManager';\nimport { NotificationChannelInput, NotificationChannel } from './NotificationChannelManager.types';\n\nexport default async function setNotificationChannelAsync(\n channelId: string,\n channel: NotificationChannelInput\n): Promise<NotificationChannel | null> {\n if (!NotificationChannelManager.setNotificationChannelAsync) {\n throw new UnavailabilityError('Notifications', 'setNotificationChannelAsync');\n }\n\n return await NotificationChannelManager.setNotificationChannelAsync(channelId, channel);\n}\n"]}
1
+ {"version":3,"file":"setNotificationChannelAsync.android.js","sourceRoot":"","sources":["../src/setNotificationChannelAsync.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,0BAA0B,MAAM,8BAA8B,CAAC;AAGtE,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,2BAA2B,CACvD,SAAiB,EACjB,OAAiC;IAEjC,IAAI,CAAC,0BAA0B,CAAC,2BAA2B,EAAE;QAC3D,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,6BAA6B,CAAC,CAAC;KAC/E;IAED,OAAO,MAAM,0BAA0B,CAAC,2BAA2B,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAC1F,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationChannelManager from './NotificationChannelManager';\nimport { NotificationChannelInput, NotificationChannel } from './NotificationChannelManager.types';\n\nexport default async function setNotificationChannelAsync(\n channelId: string,\n channel: NotificationChannelInput\n): Promise<NotificationChannel | null> {\n if (!NotificationChannelManager.setNotificationChannelAsync) {\n throw new UnavailabilityError('Notifications', 'setNotificationChannelAsync');\n }\n\n return await NotificationChannelManager.setNotificationChannelAsync(channelId, channel);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"setNotificationChannelGroupAsync.android.js","sourceRoot":"","sources":["../src/setNotificationChannelGroupAsync.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,+BAA+B,MAAM,mCAAmC,CAAC;AAMhF,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,gCAAgC,CAC5D,OAAe,EACf,KAAoC;IAEpC,IAAI,CAAC,+BAA+B,CAAC,gCAAgC,EAAE,CAAC;QACtE,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,kCAAkC,CAAC,CAAC;IACrF,CAAC;IAED,OAAO,MAAM,+BAA+B,CAAC,gCAAgC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAChG,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationChannelGroupManager from './NotificationChannelGroupManager';\nimport {\n NotificationChannelGroup,\n NotificationChannelGroupInput,\n} from './NotificationChannelGroupManager.types';\n\nexport default async function setNotificationChannelGroupAsync(\n groupId: string,\n group: NotificationChannelGroupInput\n): Promise<NotificationChannelGroup | null> {\n if (!NotificationChannelGroupManager.setNotificationChannelGroupAsync) {\n throw new UnavailabilityError('Notifications', 'setNotificationChannelGroupAsync');\n }\n\n return await NotificationChannelGroupManager.setNotificationChannelGroupAsync(groupId, group);\n}\n"]}
1
+ {"version":3,"file":"setNotificationChannelGroupAsync.android.js","sourceRoot":"","sources":["../src/setNotificationChannelGroupAsync.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,+BAA+B,MAAM,mCAAmC,CAAC;AAMhF,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,gCAAgC,CAC5D,OAAe,EACf,KAAoC;IAEpC,IAAI,CAAC,+BAA+B,CAAC,gCAAgC,EAAE;QACrE,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,kCAAkC,CAAC,CAAC;KACpF;IAED,OAAO,MAAM,+BAA+B,CAAC,gCAAgC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAChG,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationChannelGroupManager from './NotificationChannelGroupManager';\nimport {\n NotificationChannelGroup,\n NotificationChannelGroupInput,\n} from './NotificationChannelGroupManager.types';\n\nexport default async function setNotificationChannelGroupAsync(\n groupId: string,\n group: NotificationChannelGroupInput\n): Promise<NotificationChannelGroup | null> {\n if (!NotificationChannelGroupManager.setNotificationChannelGroupAsync) {\n throw new UnavailabilityError('Notifications', 'setNotificationChannelGroupAsync');\n }\n\n return await NotificationChannelGroupManager.setNotificationChannelGroupAsync(groupId, group);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"unregisterForNotificationsAsync.js","sourceRoot":"","sources":["../src/unregisterForNotificationsAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD,eAAe;AACf,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,+BAA+B;IAC3D,IAAI,CAAC,gBAAgB,CAAC,+BAA+B,EAAE,CAAC;QACtD,MAAM,IAAI,mBAAmB,CAAC,mBAAmB,EAAE,iCAAiC,CAAC,CAAC;IACxF,CAAC;IACD,OAAO,gBAAgB,CAAC,+BAA+B,EAAE,CAAC;AAC5D,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport PushTokenManager from './PushTokenManager';\n\n// @docsMissing\nexport default async function unregisterForNotificationsAsync(): Promise<void> {\n if (!PushTokenManager.unregisterForNotificationsAsync) {\n throw new UnavailabilityError('ExpoNotifications', 'unregisterForNotificationsAsync');\n }\n return PushTokenManager.unregisterForNotificationsAsync();\n}\n"]}
1
+ {"version":3,"file":"unregisterForNotificationsAsync.js","sourceRoot":"","sources":["../src/unregisterForNotificationsAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD,eAAe;AACf,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,+BAA+B;IAC3D,IAAI,CAAC,gBAAgB,CAAC,+BAA+B,EAAE;QACrD,MAAM,IAAI,mBAAmB,CAAC,mBAAmB,EAAE,iCAAiC,CAAC,CAAC;KACvF;IACD,OAAO,gBAAgB,CAAC,+BAA+B,EAAE,CAAC;AAC5D,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport PushTokenManager from './PushTokenManager';\n\n// @docsMissing\nexport default async function unregisterForNotificationsAsync(): Promise<void> {\n if (!PushTokenManager.unregisterForNotificationsAsync) {\n throw new UnavailabilityError('ExpoNotifications', 'unregisterForNotificationsAsync');\n }\n return PushTokenManager.unregisterForNotificationsAsync();\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"unregisterTaskAsync.js","sourceRoot":"","sources":["../src/unregisterTaskAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,iCAAiC,MAAM,qCAAqC,CAAC;AAEpF;;;;GAIG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,mBAAmB,CAAC,QAAgB;IAChE,IAAI,CAAC,iCAAiC,CAAC,mBAAmB,EAAE,CAAC;QAC3D,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,qBAAqB,CAAC,CAAC;IACxE,CAAC;IAED,OAAO,MAAM,iCAAiC,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;AAC/E,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport BackgroundNotificationTasksModule from './BackgroundNotificationTasksModule';\n\n/**\n * Used to unregister tasks registered with `registerTaskAsync` method.\n * @param taskName The string you passed to `registerTaskAsync` as the `taskName` parameter.\n * @header inBackground\n */\nexport default async function unregisterTaskAsync(taskName: string): Promise<null> {\n if (!BackgroundNotificationTasksModule.unregisterTaskAsync) {\n throw new UnavailabilityError('Notifications', 'unregisterTaskAsync');\n }\n\n return await BackgroundNotificationTasksModule.unregisterTaskAsync(taskName);\n}\n"]}
1
+ {"version":3,"file":"unregisterTaskAsync.js","sourceRoot":"","sources":["../src/unregisterTaskAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,iCAAiC,MAAM,qCAAqC,CAAC;AAEpF;;;;GAIG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,mBAAmB,CAAC,QAAgB;IAChE,IAAI,CAAC,iCAAiC,CAAC,mBAAmB,EAAE;QAC1D,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,qBAAqB,CAAC,CAAC;KACvE;IAED,OAAO,MAAM,iCAAiC,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;AAC/E,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport BackgroundNotificationTasksModule from './BackgroundNotificationTasksModule';\n\n/**\n * Used to unregister tasks registered with `registerTaskAsync` method.\n * @param taskName The string you passed to `registerTaskAsync` as the `taskName` parameter.\n * @header inBackground\n */\nexport default async function unregisterTaskAsync(taskName: string): Promise<null> {\n if (!BackgroundNotificationTasksModule.unregisterTaskAsync) {\n throw new UnavailabilityError('Notifications', 'unregisterTaskAsync');\n }\n\n return await BackgroundNotificationTasksModule.unregisterTaskAsync(taskName);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"updateDevicePushTokenAsync.js","sourceRoot":"","sources":["../../src/utils/updateDevicePushTokenA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AAC;AAED,mCAAmC;AACnC,KAAK,UAAU,gBAAgB;IAC7B,IAAI,CAAC;QACH,IAAI,CAAC,wBAAwB,CAAC,sBAAsB,EAAE,CAAC;YACrD,MAAM,IAAI,mBAAmB,CAAC,8BAA8B,EAAE,wBAAwB,CAAC,CAAC;QAC1F,CAAC;QAED,OAAO,MAAM,wBAAwB,CAAC,sBAAsB,EAAE,CAAC;IACjE,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,IAAI,UAAU,CAClB,6BAA6B,EAC7B,2DAA2D,CAAC,GAAG,CAChE,CAAC;IACJ,CAAC;AACH,CAAC;AAED,mCAAmC;AACnC,SAAS,cAAc,CAAC,eAAgC;IACtD,QAAQ,eAAe,CAAC,IAAI,EAAE,CAAC;QAC7B,KAAK,KAAK;YACR,OAAO,MAAM,CAAC;QAChB,KAAK,SAAS;YACZ,OAAO,KAAK,CAAC;QACf,gFAAgF;QAChF;YACE,OAAO,eAAe,CAAC,IAAI,CAAC;IAChC,CAAC;AACH,CAAC;AAED,mCAAmC;AACnC,KAAK,UAAU,uCAAuC;IACpD,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;QAC1B,IAAI,CAAC;YACH,MAAM,8BAA8B,GAClC,MAAM,WAAW,CAAC,6CAA6C,EAAE,CAAC;YACpE,IAAI,8BAA8B,KAAK,aAAa,EAAE,CAAC;gBACrD,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,2DAA2D;QAC7D,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { computeNextBackoffInterval } from '@ide/backoff';\nimport * as Application from 'expo-application';\nimport { CodedError, Platform, UnavailabilityError } from 'expo-modules-core';\n\nimport ServerRegistrationModule from '../ServerRegistrationModule';\nimport { DevicePushToken } from '../Tokens.types';\n\nconst updateDevicePushTokenUrl = 'https://exp.host/--/api/v2/push/updateDeviceToken';\n\nexport async function updateDevicePushTokenAsync(signal: AbortSignal, token: DevicePushToken) {\n const doUpdateDevicePushTokenAsync = async (retry: () => void) => {\n const [development, deviceId] = await Promise.all([\n shouldUseDevelopmentNotificationService(),\n getDeviceIdAsync(),\n ]);\n const body = {\n deviceId: deviceId.toLowerCase(),\n development,\n deviceToken: token.data,\n appId: Application.applicationId,\n type: getTypeOfToken(token),\n };\n\n try {\n const response = await fetch(updateDevicePushTokenUrl, {\n method: 'POST',\n headers: {\n 'content-type': 'application/json',\n },\n body: JSON.stringify(body),\n signal,\n });\n\n // Help debug erroring servers\n if (!response.ok) {\n console.debug(\n '[expo-notifications] Error encountered while updating the device push token with the server:',\n await response.text()\n );\n }\n\n // Retry if request failed\n if (!response.ok) {\n retry();\n }\n } catch (e) {\n // Error returned if the request is aborted should be an 'AbortError'. In\n // React Native fetch is polyfilled using `whatwg-fetch` which:\n // - creates `AbortError`s like this\n // https://github.com/github/fetch/blob/75d9455d380f365701151f3ac85c5bda4bbbde76/fetch.js#L505\n // - which creates exceptions like\n // https://github.com/github/fetch/blob/75d9455d380f365701151f3ac85c5bda4bbbde76/fetch.js#L490-L494\n if (e.name === 'AbortError') {\n // We don't consider AbortError a failure, it's a sign somewhere else the\n // request is expected to succeed and we don't need this one, so let's\n // just return.\n return;\n }\n\n console.warn(\n '[expo-notifications] Error thrown while updating the device push token with the server:',\n e\n );\n\n retry();\n }\n };\n\n let shouldTry = true;\n const retry = () => {\n shouldTry = true;\n };\n\n let retriesCount = 0;\n const initialBackoff = 500; // 0.5 s\n const backoffOptions = {\n maxBackoff: 2 * 60 * 1000, // 2 minutes\n };\n let nextBackoffInterval = computeNextBackoffInterval(\n initialBackoff,\n retriesCount,\n backoffOptions\n );\n\n while (shouldTry && !signal.aborted) {\n // Will be set to true by `retry` if it's called\n shouldTry = false;\n await doUpdateDevicePushTokenAsync(retry);\n\n // Do not wait if we won't retry\n if (shouldTry && !signal.aborted) {\n nextBackoffInterval = computeNextBackoffInterval(\n initialBackoff,\n retriesCount,\n backoffOptions\n );\n retriesCount += 1;\n await new Promise((resolve) => setTimeout(resolve, nextBackoffInterval));\n }\n }\n}\n\n// Same as in getExpoPushTokenAsync\nasync function getDeviceIdAsync() {\n try {\n if (!ServerRegistrationModule.getInstallationIdAsync) {\n throw new UnavailabilityError('ExpoServerRegistrationModule', 'getInstallationIdAsync');\n }\n\n return await ServerRegistrationModule.getInstallationIdAsync();\n } catch (e) {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_DEVICE_ID',\n `Could not fetch the installation ID of the application: ${e}.`\n );\n }\n}\n\n// Same as in getExpoPushTokenAsync\nfunction getTypeOfToken(devicePushToken: DevicePushToken) {\n switch (devicePushToken.type) {\n case 'ios':\n return 'apns';\n case 'android':\n return 'fcm';\n // This probably will error on server, but let's make this function future-safe.\n default:\n return devicePushToken.type;\n }\n}\n\n// Same as in getExpoPushTokenAsync\nasync function shouldUseDevelopmentNotificationService() {\n if (Platform.OS === 'ios') {\n try {\n const notificationServiceEnvironment =\n await Application.getIosPushNotificationServiceEnvironmentAsync();\n if (notificationServiceEnvironment === 'development') {\n return true;\n }\n } catch {\n // We can't do anything here, we'll fallback to false then.\n }\n }\n\n return false;\n}\n"]}
1
+ {"version":3,"file":"updateDevicePushTokenAsync.js","sourceRoot":"","sources":["../../src/utils/updateDevicePushTokenAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE9E,OAAO,wBAAwB,MAAM,6BAA6B,CAAC;AAGnE,MAAM,wBAAwB,GAAG,mDAAmD,CAAC;AAErF,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAC,MAAmB,EAAE,KAAsB;IAC1F,MAAM,4BAA4B,GAAG,KAAK,EAAE,KAAiB,EAAE,EAAE;QAC/D,MAAM,CA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KAAK,CAAC;QACf,gFAAgF;QAChF;YACE,OAAO,eAAe,CAAC,IAAI,CAAC;KAC/B;AACH,CAAC;AAED,mCAAmC;AACnC,KAAK,UAAU,uCAAuC;IACpD,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;QACzB,IAAI;YACF,MAAM,8BAA8B,GAClC,MAAM,WAAW,CAAC,6CAA6C,EAAE,CAAC;YACpE,IAAI,8BAA8B,KAAK,aAAa,EAAE;gBACpD,OAAO,IAAI,CAAC;aACb;SACF;QAAC,MAAM;YACN,2DAA2D;SAC5D;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { computeNextBackoffInterval } from '@ide/backoff';\nimport * as Application from 'expo-application';\nimport { CodedError, Platform, UnavailabilityError } from 'expo-modules-core';\n\nimport ServerRegistrationModule from '../ServerRegistrationModule';\nimport { DevicePushToken } from '../Tokens.types';\n\nconst updateDevicePushTokenUrl = 'https://exp.host/--/api/v2/push/updateDeviceToken';\n\nexport async function updateDevicePushTokenAsync(signal: AbortSignal, token: DevicePushToken) {\n const doUpdateDevicePushTokenAsync = async (retry: () => void) => {\n const [development, deviceId] = await Promise.all([\n shouldUseDevelopmentNotificationService(),\n getDeviceIdAsync(),\n ]);\n const body = {\n deviceId: deviceId.toLowerCase(),\n development,\n deviceToken: token.data,\n appId: Application.applicationId,\n type: getTypeOfToken(token),\n };\n\n try {\n const response = await fetch(updateDevicePushTokenUrl, {\n method: 'POST',\n headers: {\n 'content-type': 'application/json',\n },\n body: JSON.stringify(body),\n signal,\n });\n\n // Help debug erroring servers\n if (!response.ok) {\n console.debug(\n '[expo-notifications] Error encountered while updating the device push token with the server:',\n await response.text()\n );\n }\n\n // Retry if request failed\n if (!response.ok) {\n retry();\n }\n } catch (e) {\n // Error returned if the request is aborted should be an 'AbortError'. In\n // React Native fetch is polyfilled using `whatwg-fetch` which:\n // - creates `AbortError`s like this\n // https://github.com/github/fetch/blob/75d9455d380f365701151f3ac85c5bda4bbbde76/fetch.js#L505\n // - which creates exceptions like\n // https://github.com/github/fetch/blob/75d9455d380f365701151f3ac85c5bda4bbbde76/fetch.js#L490-L494\n if (e.name === 'AbortError') {\n // We don't consider AbortError a failure, it's a sign somewhere else the\n // request is expected to succeed and we don't need this one, so let's\n // just return.\n return;\n }\n\n console.warn(\n '[expo-notifications] Error thrown while updating the device push token with the server:',\n e\n );\n\n retry();\n }\n };\n\n let shouldTry = true;\n const retry = () => {\n shouldTry = true;\n };\n\n let retriesCount = 0;\n const initialBackoff = 500; // 0.5 s\n const backoffOptions = {\n maxBackoff: 2 * 60 * 1000, // 2 minutes\n };\n let nextBackoffInterval = computeNextBackoffInterval(\n initialBackoff,\n retriesCount,\n backoffOptions\n );\n\n while (shouldTry && !signal.aborted) {\n // Will be set to true by `retry` if it's called\n shouldTry = false;\n await doUpdateDevicePushTokenAsync(retry);\n\n // Do not wait if we won't retry\n if (shouldTry && !signal.aborted) {\n nextBackoffInterval = computeNextBackoffInterval(\n initialBackoff,\n retriesCount,\n backoffOptions\n );\n retriesCount += 1;\n await new Promise((resolve) => setTimeout(resolve, nextBackoffInterval));\n }\n }\n}\n\n// Same as in getExpoPushTokenAsync\nasync function getDeviceIdAsync() {\n try {\n if (!ServerRegistrationModule.getInstallationIdAsync) {\n throw new UnavailabilityError('ExpoServerRegistrationModule', 'getInstallationIdAsync');\n }\n\n return await ServerRegistrationModule.getInstallationIdAsync();\n } catch (e) {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_DEVICE_ID',\n `Could not fetch the installation ID of the application: ${e}.`\n );\n }\n}\n\n// Same as in getExpoPushTokenAsync\nfunction getTypeOfToken(devicePushToken: DevicePushToken) {\n switch (devicePushToken.type) {\n case 'ios':\n return 'apns';\n case 'android':\n return 'fcm';\n // This probably will error on server, but let's make this function future-safe.\n default:\n return devicePushToken.type;\n }\n}\n\n// Same as in getExpoPushTokenAsync\nasync function shouldUseDevelopmentNotificationService() {\n if (Platform.OS === 'ios') {\n try {\n const notificationServiceEnvironment =\n await Application.getIosPushNotificationServiceEnvironmentAsync();\n if (notificationServiceEnvironment === 'development') {\n return true;\n }\n } catch {\n // We can't do anything here, we'll fallback to false then.\n }\n }\n\n return false;\n}\n"]}