@amazon-devices/expo-notifications 2.0.9000000000-rn-83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +2 -0
- package/CHANGELOG.md +478 -0
- package/LICENSE +7 -0
- package/README.kepler.md +3 -0
- package/README.md +2003 -0
- package/THIRD_PARTY_NOTICES.txt +4 -0
- package/android/build.gradle +125 -0
- package/android/src/main/AndroidManifest.xml +39 -0
- package/android/src/main/java/expo/modules/notifications/Exceptions.kt +22 -0
- package/android/src/main/java/expo/modules/notifications/NotificationsPackage.java +34 -0
- package/android/src/main/java/expo/modules/notifications/Utils.kt +19 -0
- package/android/src/main/java/expo/modules/notifications/badge/BadgeHelper.kt +24 -0
- package/android/src/main/java/expo/modules/notifications/badge/BadgeModule.kt +22 -0
- package/android/src/main/java/expo/modules/notifications/notifications/ArgumentsNotificationContentBuilder.java +149 -0
- package/android/src/main/java/expo/modules/notifications/notifications/JSONNotificationContentBuilder.java +203 -0
- package/android/src/main/java/expo/modules/notifications/notifications/NotificationManager.java +119 -0
- package/android/src/main/java/expo/modules/notifications/notifications/NotificationSerializer.java +202 -0
- package/android/src/main/java/expo/modules/notifications/notifications/RemoteMessageSerializer.java +104 -0
- package/android/src/main/java/expo/modules/notifications/notifications/SoundResolver.java +58 -0
- package/android/src/main/java/expo/modules/notifications/notifications/background/BackgroundRemoteNotificationTaskConsumer.java +123 -0
- package/android/src/main/java/expo/modules/notifications/notifications/background/ExpoBackgroundNotificationTasksModule.kt +33 -0
- package/android/src/main/java/expo/modules/notifications/notifications/categories/ExpoNotificationCategoriesModule.kt +149 -0
- package/android/src/main/java/expo/modules/notifications/notifications/categories/serializers/ExpoNotificationsCategoriesSerializer.java +67 -0
- package/android/src/main/java/expo/modules/notifications/notifications/categories/serializers/NotificationsCategoriesSerializer.java +11 -0
- package/android/src/main/java/expo/modules/notifications/notifications/channels/AbstractNotificationsChannelsProvider.java +81 -0
- package/android/src/main/java/expo/modules/notifications/notifications/channels/AndroidXNotificationsChannelsProvider.java +38 -0
- package/android/src/main/java/expo/modules/notifications/notifications/channels/InvalidVibrationPatternException.java +14 -0
- package/android/src/main/java/expo/modules/notifications/notifications/channels/NotificationChannelGroupManagerModule.kt +70 -0
- package/android/src/main/java/expo/modules/notifications/notifications/channels/NotificationChannelManagerModule.kt +83 -0
- package/android/src/main/java/expo/modules/notifications/notifications/channels/NotificationsChannelsProvider.java +13 -0
- package/android/src/main/java/expo/modules/notifications/notifications/channels/managers/AndroidXNotificationsChannelGroupManager.java +67 -0
- package/android/src/main/java/expo/modules/notifications/notifications/channels/managers/AndroidXNotificationsChannelManager.java +196 -0
- package/android/src/main/java/expo/modules/notifications/notifications/channels/managers/NotificationsChannelGroupManager.java +28 -0
- package/android/src/main/java/expo/modules/notifications/notifications/channels/managers/NotificationsChannelManager.java +28 -0
- package/android/src/main/java/expo/modules/notifications/notifications/channels/serializers/ExpoNotificationsChannelGroupSerializer.java +55 -0
- package/android/src/main/java/expo/modules/notifications/notifications/channels/serializers/ExpoNotificationsChannelSerializer.java +101 -0
- package/android/src/main/java/expo/modules/notifications/notifications/channels/serializers/NotificationsChannelGroupSerializer.java +20 -0
- package/android/src/main/java/expo/modules/notifications/notifications/channels/serializers/NotificationsChannelSerializer.java +35 -0
- package/android/src/main/java/expo/modules/notifications/notifications/emitting/NotificationsEmitter.kt +78 -0
- package/android/src/main/java/expo/modules/notifications/notifications/enums/AudioContentType.java +45 -0
- package/android/src/main/java/expo/modules/notifications/notifications/enums/AudioUsage.java +55 -0
- package/android/src/main/java/expo/modules/notifications/notifications/enums/NotificationImportance.java +48 -0
- package/android/src/main/java/expo/modules/notifications/notifications/enums/NotificationPriority.java +51 -0
- package/android/src/main/java/expo/modules/notifications/notifications/enums/NotificationVisibility.java +44 -0
- package/android/src/main/java/expo/modules/notifications/notifications/handling/NotificationsHandler.kt +127 -0
- package/android/src/main/java/expo/modules/notifications/notifications/handling/SingleNotificationHandlerTask.java +131 -0
- package/android/src/main/java/expo/modules/notifications/notifications/interfaces/NotificationBuilder.java +35 -0
- package/android/src/main/java/expo/modules/notifications/notifications/interfaces/NotificationListener.java +37 -0
- package/android/src/main/java/expo/modules/notifications/notifications/interfaces/NotificationManager.java +22 -0
- package/android/src/main/java/expo/modules/notifications/notifications/interfaces/NotificationPresentationEffect.java +11 -0
- package/android/src/main/java/expo/modules/notifications/notifications/interfaces/NotificationPresentationEffectsManager.java +7 -0
- package/android/src/main/java/expo/modules/notifications/notifications/interfaces/NotificationTrigger.java +19 -0
- package/android/src/main/java/expo/modules/notifications/notifications/interfaces/SchedulableNotificationTrigger.java +20 -0
- package/android/src/main/java/expo/modules/notifications/notifications/model/Notification.java +59 -0
- package/android/src/main/java/expo/modules/notifications/notifications/model/NotificationAction.java +63 -0
- package/android/src/main/java/expo/modules/notifications/notifications/model/NotificationBehavior.java +84 -0
- package/android/src/main/java/expo/modules/notifications/notifications/model/NotificationCategory.java +61 -0
- package/android/src/main/java/expo/modules/notifications/notifications/model/NotificationContent.java +356 -0
- package/android/src/main/java/expo/modules/notifications/notifications/model/NotificationRequest.java +66 -0
- package/android/src/main/java/expo/modules/notifications/notifications/model/NotificationResponse.java +60 -0
- package/android/src/main/java/expo/modules/notifications/notifications/model/TextInputNotificationAction.java +42 -0
- package/android/src/main/java/expo/modules/notifications/notifications/model/TextInputNotificationResponse.java +42 -0
- package/android/src/main/java/expo/modules/notifications/notifications/model/triggers/FirebaseNotificationTrigger.java +61 -0
- package/android/src/main/java/expo/modules/notifications/notifications/presentation/ExpoNotificationPresentationEffectsManager.java +63 -0
- package/android/src/main/java/expo/modules/notifications/notifications/presentation/ExpoNotificationPresentationModule.kt +113 -0
- package/android/src/main/java/expo/modules/notifications/notifications/presentation/builders/BaseNotificationBuilder.java +50 -0
- package/android/src/main/java/expo/modules/notifications/notifications/presentation/builders/CategoryAwareNotificationBuilder.java +80 -0
- package/android/src/main/java/expo/modules/notifications/notifications/presentation/builders/ChannelAwareNotificationBuilder.java +135 -0
- package/android/src/main/java/expo/modules/notifications/notifications/presentation/builders/ExpoNotificationBuilder.java +295 -0
- package/android/src/main/java/expo/modules/notifications/notifications/presentation/effects/BaseNotificationEffect.java +53 -0
- package/android/src/main/java/expo/modules/notifications/notifications/scheduling/NotificationScheduler.kt +235 -0
- package/android/src/main/java/expo/modules/notifications/notifications/triggers/ChannelAwareTrigger.java +49 -0
- package/android/src/main/java/expo/modules/notifications/notifications/triggers/DailyTrigger.java +76 -0
- package/android/src/main/java/expo/modules/notifications/notifications/triggers/DateTrigger.java +64 -0
- package/android/src/main/java/expo/modules/notifications/notifications/triggers/TimeIntervalTrigger.java +87 -0
- package/android/src/main/java/expo/modules/notifications/notifications/triggers/WeeklyTrigger.java +85 -0
- package/android/src/main/java/expo/modules/notifications/notifications/triggers/YearlyTrigger.java +94 -0
- package/android/src/main/java/expo/modules/notifications/permissions/NotificationPermissionsModule.kt +124 -0
- package/android/src/main/java/expo/modules/notifications/serverregistration/InstallationId.java +134 -0
- package/android/src/main/java/expo/modules/notifications/serverregistration/RegistrationInfo.kt +24 -0
- package/android/src/main/java/expo/modules/notifications/serverregistration/ServerRegistrationModule.kt +32 -0
- package/android/src/main/java/expo/modules/notifications/service/ExpoFirebaseMessagingService.kt +15 -0
- package/android/src/main/java/expo/modules/notifications/service/NotificationForwarderActivity.kt +33 -0
- package/android/src/main/java/expo/modules/notifications/service/NotificationsService.kt +780 -0
- package/android/src/main/java/expo/modules/notifications/service/delegates/Base64Serialization.kt +33 -0
- package/android/src/main/java/expo/modules/notifications/service/delegates/ExpoCategoriesDelegate.kt +21 -0
- package/android/src/main/java/expo/modules/notifications/service/delegates/ExpoHandlingDelegate.kt +146 -0
- package/android/src/main/java/expo/modules/notifications/service/delegates/ExpoPresentationDelegate.kt +193 -0
- package/android/src/main/java/expo/modules/notifications/service/delegates/ExpoSchedulingDelegate.kt +117 -0
- package/android/src/main/java/expo/modules/notifications/service/delegates/FirebaseMessagingDelegate.kt +126 -0
- package/android/src/main/java/expo/modules/notifications/service/delegates/SharedPreferencesNotificationCategoriesStore.kt +106 -0
- package/android/src/main/java/expo/modules/notifications/service/delegates/SharedPreferencesNotificationsStore.kt +119 -0
- package/android/src/main/java/expo/modules/notifications/service/interfaces/CategoriesDelegate.kt +14 -0
- package/android/src/main/java/expo/modules/notifications/service/interfaces/FirebaseMessagingDelegate.kt +20 -0
- package/android/src/main/java/expo/modules/notifications/service/interfaces/HandlingDelegate.kt +10 -0
- package/android/src/main/java/expo/modules/notifications/service/interfaces/PresentationDelegate.kt +11 -0
- package/android/src/main/java/expo/modules/notifications/service/interfaces/SchedulingDelegate.kt +13 -0
- package/android/src/main/java/expo/modules/notifications/tokens/PushTokenManager.java +88 -0
- package/android/src/main/java/expo/modules/notifications/tokens/PushTokenModule.kt +91 -0
- package/android/src/main/java/expo/modules/notifications/tokens/interfaces/FirebaseTokenListener.java +16 -0
- package/android/src/main/java/expo/modules/notifications/tokens/interfaces/PushTokenListener.java +14 -0
- package/android/src/main/java/expo/modules/notifications/tokens/interfaces/PushTokenManager.java +22 -0
- package/android/src/main/res/values/strings.xml +4 -0
- package/app.plugin.js +1 -0
- package/build/BackgroundNotificationTasksModule.d.ts +4 -0
- package/build/BackgroundNotificationTasksModule.d.ts.map +1 -0
- package/build/BackgroundNotificationTasksModule.js +7 -0
- package/build/BackgroundNotificationTasksModule.js.map +1 -0
- package/build/BackgroundNotificationTasksModule.kepler.d.ts +3 -0
- package/build/BackgroundNotificationTasksModule.kepler.d.ts.map +1 -0
- package/build/BackgroundNotificationTasksModule.kepler.js +9 -0
- package/build/BackgroundNotificationTasksModule.kepler.js.map +1 -0
- package/build/BackgroundNotificationTasksModule.native.d.ts +4 -0
- package/build/BackgroundNotificationTasksModule.native.d.ts.map +1 -0
- package/build/BackgroundNotificationTasksModule.native.js +3 -0
- package/build/BackgroundNotificationTasksModule.native.js.map +1 -0
- package/build/BackgroundNotificationTasksModule.types.d.ts +11 -0
- package/build/BackgroundNotificationTasksModule.types.d.ts.map +1 -0
- package/build/BackgroundNotificationTasksModule.types.js +7 -0
- package/build/BackgroundNotificationTasksModule.types.js.map +1 -0
- package/build/BackgroundNotificationTasksModule.web.d.ts +6 -0
- package/build/BackgroundNotificationTasksModule.web.d.ts.map +1 -0
- package/build/BackgroundNotificationTasksModule.web.js +9 -0
- package/build/BackgroundNotificationTasksModule.web.js.map +1 -0
- package/build/BadgeModule.d.ts +4 -0
- package/build/BadgeModule.d.ts.map +1 -0
- package/build/BadgeModule.js +5 -0
- package/build/BadgeModule.js.map +1 -0
- package/build/BadgeModule.kepler.d.ts +3 -0
- package/build/BadgeModule.kepler.d.ts.map +1 -0
- package/build/BadgeModule.kepler.js +9 -0
- package/build/BadgeModule.kepler.js.map +1 -0
- package/build/BadgeModule.native.d.ts +4 -0
- package/build/BadgeModule.native.d.ts.map +1 -0
- package/build/BadgeModule.native.js +12 -0
- package/build/BadgeModule.native.js.map +1 -0
- package/build/BadgeModule.types.d.ts +10 -0
- package/build/BadgeModule.types.d.ts.map +1 -0
- package/build/BadgeModule.types.js +2 -0
- package/build/BadgeModule.types.js.map +1 -0
- package/build/BadgeModule.web.d.ts +4 -0
- package/build/BadgeModule.web.d.ts.map +1 -0
- package/build/BadgeModule.web.js +26 -0
- package/build/BadgeModule.web.js.map +1 -0
- package/build/DevicePushTokenAutoRegistration.fx.d.ts +15 -0
- package/build/DevicePushTokenAutoRegistration.fx.d.ts.map +1 -0
- package/build/DevicePushTokenAutoRegistration.fx.js +87 -0
- package/build/DevicePushTokenAutoRegistration.fx.js.map +1 -0
- package/build/NotificationCategoriesModule.d.ts +4 -0
- package/build/NotificationCategoriesModule.d.ts.map +1 -0
- package/build/NotificationCategoriesModule.js +13 -0
- package/build/NotificationCategoriesModule.js.map +1 -0
- package/build/NotificationCategoriesModule.kepler.d.ts +3 -0
- package/build/NotificationCategoriesModule.kepler.d.ts.map +1 -0
- package/build/NotificationCategoriesModule.kepler.js +10 -0
- package/build/NotificationCategoriesModule.kepler.js.map +1 -0
- package/build/NotificationCategoriesModule.native.d.ts +4 -0
- package/build/NotificationCategoriesModule.native.d.ts.map +1 -0
- package/build/NotificationCategoriesModule.native.js +3 -0
- package/build/NotificationCategoriesModule.native.js.map +1 -0
- package/build/NotificationCategoriesModule.types.d.ts +17 -0
- package/build/NotificationCategoriesModule.types.d.ts.map +1 -0
- package/build/NotificationCategoriesModule.types.js +2 -0
- package/build/NotificationCategoriesModule.types.js.map +1 -0
- package/build/NotificationCategoriesModule.web.d.ts +8 -0
- package/build/NotificationCategoriesModule.web.d.ts.map +1 -0
- package/build/NotificationCategoriesModule.web.js +12 -0
- package/build/NotificationCategoriesModule.web.js.map +1 -0
- package/build/NotificationChannelGroupManager.d.ts +4 -0
- package/build/NotificationChannelGroupManager.d.ts.map +1 -0
- package/build/NotificationChannelGroupManager.js +5 -0
- package/build/NotificationChannelGroupManager.js.map +1 -0
- package/build/NotificationChannelGroupManager.kepler.d.ts +3 -0
- package/build/NotificationChannelGroupManager.kepler.d.ts.map +1 -0
- package/build/NotificationChannelGroupManager.kepler.js +9 -0
- package/build/NotificationChannelGroupManager.kepler.js.map +1 -0
- package/build/NotificationChannelGroupManager.native.d.ts +4 -0
- package/build/NotificationChannelGroupManager.native.d.ts.map +1 -0
- package/build/NotificationChannelGroupManager.native.js +3 -0
- package/build/NotificationChannelGroupManager.native.js.map +1 -0
- package/build/NotificationChannelGroupManager.types.d.ts +28 -0
- package/build/NotificationChannelGroupManager.types.d.ts.map +1 -0
- package/build/NotificationChannelGroupManager.types.js +2 -0
- package/build/NotificationChannelGroupManager.types.js.map +1 -0
- package/build/NotificationChannelManager.d.ts +4 -0
- package/build/NotificationChannelManager.d.ts.map +1 -0
- package/build/NotificationChannelManager.js +5 -0
- package/build/NotificationChannelManager.js.map +1 -0
- package/build/NotificationChannelManager.kepler.d.ts +3 -0
- package/build/NotificationChannelManager.kepler.d.ts.map +1 -0
- package/build/NotificationChannelManager.kepler.js +9 -0
- package/build/NotificationChannelManager.kepler.js.map +1 -0
- package/build/NotificationChannelManager.native.d.ts +4 -0
- package/build/NotificationChannelManager.native.d.ts.map +1 -0
- package/build/NotificationChannelManager.native.js +3 -0
- package/build/NotificationChannelManager.native.js.map +1 -0
- package/build/NotificationChannelManager.types.d.ts +91 -0
- package/build/NotificationChannelManager.types.d.ts.map +1 -0
- package/build/NotificationChannelManager.types.js +53 -0
- package/build/NotificationChannelManager.types.js.map +1 -0
- package/build/NotificationPermissions.d.ts +56 -0
- package/build/NotificationPermissions.d.ts.map +1 -0
- package/build/NotificationPermissions.js +79 -0
- package/build/NotificationPermissions.js.map +1 -0
- package/build/NotificationPermissions.types.d.ts +94 -0
- package/build/NotificationPermissions.types.d.ts.map +1 -0
- package/build/NotificationPermissions.types.js +21 -0
- package/build/NotificationPermissions.types.js.map +1 -0
- package/build/NotificationPermissionsModule.d.ts +4 -0
- package/build/NotificationPermissionsModule.d.ts.map +1 -0
- package/build/NotificationPermissionsModule.js +67 -0
- package/build/NotificationPermissionsModule.js.map +1 -0
- package/build/NotificationPermissionsModule.kepler.d.ts +3 -0
- package/build/NotificationPermissionsModule.kepler.d.ts.map +1 -0
- package/build/NotificationPermissionsModule.kepler.js +9 -0
- package/build/NotificationPermissionsModule.kepler.js.map +1 -0
- package/build/NotificationPermissionsModule.native.d.ts +4 -0
- package/build/NotificationPermissionsModule.native.d.ts.map +1 -0
- package/build/NotificationPermissionsModule.native.js +3 -0
- package/build/NotificationPermissionsModule.native.js.map +1 -0
- package/build/NotificationPermissionsModule.types.d.ts +7 -0
- package/build/NotificationPermissionsModule.types.d.ts.map +1 -0
- package/build/NotificationPermissionsModule.types.js +2 -0
- package/build/NotificationPermissionsModule.types.js.map +1 -0
- package/build/NotificationPresenterModule.d.ts +4 -0
- package/build/NotificationPresenterModule.d.ts.map +1 -0
- package/build/NotificationPresenterModule.js +5 -0
- package/build/NotificationPresenterModule.js.map +1 -0
- package/build/NotificationPresenterModule.kepler.d.ts +4 -0
- package/build/NotificationPresenterModule.kepler.d.ts.map +1 -0
- package/build/NotificationPresenterModule.kepler.js +55 -0
- package/build/NotificationPresenterModule.kepler.js.map +1 -0
- package/build/NotificationPresenterModule.native.d.ts +4 -0
- package/build/NotificationPresenterModule.native.d.ts.map +1 -0
- package/build/NotificationPresenterModule.native.js +3 -0
- package/build/NotificationPresenterModule.native.js.map +1 -0
- package/build/NotificationPresenterModule.types.d.ts +9 -0
- package/build/NotificationPresenterModule.types.d.ts.map +1 -0
- package/build/NotificationPresenterModule.types.js +2 -0
- package/build/NotificationPresenterModule.types.js.map +1 -0
- package/build/NotificationScheduler.d.ts +4 -0
- package/build/NotificationScheduler.d.ts.map +1 -0
- package/build/NotificationScheduler.js +5 -0
- package/build/NotificationScheduler.js.map +1 -0
- package/build/NotificationScheduler.kepler.d.ts +4 -0
- package/build/NotificationScheduler.kepler.d.ts.map +1 -0
- package/build/NotificationScheduler.kepler.js +50 -0
- package/build/NotificationScheduler.kepler.js.map +1 -0
- package/build/NotificationScheduler.native.d.ts +4 -0
- package/build/NotificationScheduler.native.d.ts.map +1 -0
- package/build/NotificationScheduler.native.js +3 -0
- package/build/NotificationScheduler.native.js.map +1 -0
- package/build/NotificationScheduler.types.d.ts +65 -0
- package/build/NotificationScheduler.types.d.ts.map +1 -0
- package/build/NotificationScheduler.types.js +2 -0
- package/build/NotificationScheduler.types.js.map +1 -0
- package/build/Notifications.types.d.ts +666 -0
- package/build/Notifications.types.d.ts.map +1 -0
- package/build/Notifications.types.js +12 -0
- package/build/Notifications.types.js.map +1 -0
- package/build/NotificationsEmitter.d.ts +75 -0
- package/build/NotificationsEmitter.d.ts.map +1 -0
- package/build/NotificationsEmitter.js +95 -0
- package/build/NotificationsEmitter.js.map +1 -0
- package/build/NotificationsEmitterModule.d.ts +4 -0
- package/build/NotificationsEmitterModule.d.ts.map +1 -0
- package/build/NotificationsEmitterModule.js +12 -0
- package/build/NotificationsEmitterModule.js.map +1 -0
- package/build/NotificationsEmitterModule.kepler.d.ts +3 -0
- package/build/NotificationsEmitterModule.kepler.d.ts.map +1 -0
- package/build/NotificationsEmitterModule.kepler.js +9 -0
- package/build/NotificationsEmitterModule.kepler.js.map +1 -0
- package/build/NotificationsEmitterModule.native.d.ts +4 -0
- package/build/NotificationsEmitterModule.native.d.ts.map +1 -0
- package/build/NotificationsEmitterModule.native.js +3 -0
- package/build/NotificationsEmitterModule.native.js.map +1 -0
- package/build/NotificationsEmitterModule.types.d.ts +6 -0
- package/build/NotificationsEmitterModule.types.d.ts.map +1 -0
- package/build/NotificationsEmitterModule.types.js +2 -0
- package/build/NotificationsEmitterModule.types.js.map +1 -0
- package/build/NotificationsHandler.d.ts +60 -0
- package/build/NotificationsHandler.d.ts.map +1 -0
- package/build/NotificationsHandler.js +72 -0
- package/build/NotificationsHandler.js.map +1 -0
- package/build/NotificationsHandlerModule.d.ts +4 -0
- package/build/NotificationsHandlerModule.d.ts.map +1 -0
- package/build/NotificationsHandlerModule.js +12 -0
- package/build/NotificationsHandlerModule.js.map +1 -0
- package/build/NotificationsHandlerModule.kepler.d.ts +3 -0
- package/build/NotificationsHandlerModule.kepler.d.ts.map +1 -0
- package/build/NotificationsHandlerModule.kepler.js +9 -0
- package/build/NotificationsHandlerModule.kepler.js.map +1 -0
- package/build/NotificationsHandlerModule.native.d.ts +4 -0
- package/build/NotificationsHandlerModule.native.d.ts.map +1 -0
- package/build/NotificationsHandlerModule.native.js +3 -0
- package/build/NotificationsHandlerModule.native.js.map +1 -0
- package/build/NotificationsHandlerModule.types.d.ts +6 -0
- package/build/NotificationsHandlerModule.types.d.ts.map +1 -0
- package/build/NotificationsHandlerModule.types.js +2 -0
- package/build/NotificationsHandlerModule.types.js.map +1 -0
- package/build/PushTokenManager.d.ts +4 -0
- package/build/PushTokenManager.d.ts.map +1 -0
- package/build/PushTokenManager.js +12 -0
- package/build/PushTokenManager.js.map +1 -0
- package/build/PushTokenManager.kepler.d.ts +3 -0
- package/build/PushTokenManager.kepler.d.ts.map +1 -0
- package/build/PushTokenManager.kepler.js +9 -0
- package/build/PushTokenManager.kepler.js.map +1 -0
- package/build/PushTokenManager.native.d.ts +4 -0
- package/build/PushTokenManager.native.d.ts.map +1 -0
- package/build/PushTokenManager.native.js +3 -0
- package/build/PushTokenManager.native.js.map +1 -0
- package/build/PushTokenManager.types.d.ts +6 -0
- package/build/PushTokenManager.types.d.ts.map +1 -0
- package/build/PushTokenManager.types.js +2 -0
- package/build/PushTokenManager.types.js.map +1 -0
- package/build/ServerRegistrationModule.d.ts +4 -0
- package/build/ServerRegistrationModule.d.ts.map +1 -0
- package/build/ServerRegistrationModule.js +5 -0
- package/build/ServerRegistrationModule.js.map +1 -0
- package/build/ServerRegistrationModule.kepler.d.ts +3 -0
- package/build/ServerRegistrationModule.kepler.d.ts.map +1 -0
- package/build/ServerRegistrationModule.kepler.js +9 -0
- package/build/ServerRegistrationModule.kepler.js.map +1 -0
- package/build/ServerRegistrationModule.native.d.ts +4 -0
- package/build/ServerRegistrationModule.native.d.ts.map +1 -0
- package/build/ServerRegistrationModule.native.js +3 -0
- package/build/ServerRegistrationModule.native.js.map +1 -0
- package/build/ServerRegistrationModule.types.d.ts +7 -0
- package/build/ServerRegistrationModule.types.d.ts.map +1 -0
- package/build/ServerRegistrationModule.types.js +2 -0
- package/build/ServerRegistrationModule.types.js.map +1 -0
- package/build/ServerRegistrationModule.web.d.ts +4 -0
- package/build/ServerRegistrationModule.web.d.ts.map +1 -0
- package/build/ServerRegistrationModule.web.js +50 -0
- package/build/ServerRegistrationModule.web.js.map +1 -0
- package/build/TokenEmitter.d.ts +42 -0
- package/build/TokenEmitter.d.ts.map +1 -0
- package/build/TokenEmitter.js +44 -0
- package/build/TokenEmitter.js.map +1 -0
- package/build/Tokens.types.d.ts +99 -0
- package/build/Tokens.types.d.ts.map +1 -0
- package/build/Tokens.types.js +2 -0
- package/build/Tokens.types.js.map +1 -0
- package/build/cancelAllScheduledNotificationsAsync.d.ts +7 -0
- package/build/cancelAllScheduledNotificationsAsync.d.ts.map +1 -0
- package/build/cancelAllScheduledNotificationsAsync.js +14 -0
- package/build/cancelAllScheduledNotificationsAsync.js.map +1 -0
- package/build/cancelScheduledNotificationAsync.d.ts +22 -0
- package/build/cancelScheduledNotificationAsync.d.ts.map +1 -0
- package/build/cancelScheduledNotificationAsync.js +29 -0
- package/build/cancelScheduledNotificationAsync.js.map +1 -0
- package/build/deleteNotificationCategoryAsync.d.ts +11 -0
- package/build/deleteNotificationCategoryAsync.d.ts.map +1 -0
- package/build/deleteNotificationCategoryAsync.js +19 -0
- package/build/deleteNotificationCategoryAsync.js.map +1 -0
- package/build/deleteNotificationChannelAsync.android.d.ts +2 -0
- package/build/deleteNotificationChannelAsync.android.d.ts.map +1 -0
- package/build/deleteNotificationChannelAsync.android.js +9 -0
- package/build/deleteNotificationChannelAsync.android.js.map +1 -0
- package/build/deleteNotificationChannelAsync.d.ts +9 -0
- package/build/deleteNotificationChannelAsync.d.ts.map +1 -0
- package/build/deleteNotificationChannelAsync.js +11 -0
- package/build/deleteNotificationChannelAsync.js.map +1 -0
- package/build/deleteNotificationChannelGroupAsync.android.d.ts +2 -0
- package/build/deleteNotificationChannelGroupAsync.android.d.ts.map +1 -0
- package/build/deleteNotificationChannelGroupAsync.android.js +9 -0
- package/build/deleteNotificationChannelGroupAsync.android.js.map +1 -0
- package/build/deleteNotificationChannelGroupAsync.d.ts +9 -0
- package/build/deleteNotificationChannelGroupAsync.d.ts.map +1 -0
- package/build/deleteNotificationChannelGroupAsync.js +11 -0
- package/build/deleteNotificationChannelGroupAsync.js.map +1 -0
- package/build/dismissAllNotificationsAsync.d.ts +7 -0
- package/build/dismissAllNotificationsAsync.d.ts.map +1 -0
- package/build/dismissAllNotificationsAsync.js +14 -0
- package/build/dismissAllNotificationsAsync.js.map +1 -0
- package/build/dismissNotificationAsync.d.ts +8 -0
- package/build/dismissNotificationAsync.d.ts.map +1 -0
- package/build/dismissNotificationAsync.js +15 -0
- package/build/dismissNotificationAsync.js.map +1 -0
- package/build/getAllScheduledNotificationsAsync.d.ts +8 -0
- package/build/getAllScheduledNotificationsAsync.d.ts.map +1 -0
- package/build/getAllScheduledNotificationsAsync.js +14 -0
- package/build/getAllScheduledNotificationsAsync.js.map +1 -0
- package/build/getBadgeCountAsync.d.ts +8 -0
- package/build/getBadgeCountAsync.d.ts.map +1 -0
- package/build/getBadgeCountAsync.js +15 -0
- package/build/getBadgeCountAsync.js.map +1 -0
- package/build/getDevicePushTokenAsync.d.ts +8 -0
- package/build/getDevicePushTokenAsync.d.ts.map +1 -0
- package/build/getDevicePushTokenAsync.js +27 -0
- package/build/getDevicePushTokenAsync.js.map +1 -0
- package/build/getDevicePushTokenAsync.web.d.ts +3 -0
- package/build/getDevicePushTokenAsync.web.d.ts.map +1 -0
- package/build/getDevicePushTokenAsync.web.js +84 -0
- package/build/getDevicePushTokenAsync.web.js.map +1 -0
- package/build/getExpoPushTokenAsync.d.ts +40 -0
- package/build/getExpoPushTokenAsync.d.ts.map +1 -0
- package/build/getExpoPushTokenAsync.js +177 -0
- package/build/getExpoPushTokenAsync.js.map +1 -0
- package/build/getNextTriggerDateAsync.d.ts +26 -0
- package/build/getNextTriggerDateAsync.d.ts.map +1 -0
- package/build/getNextTriggerDateAsync.js +33 -0
- package/build/getNextTriggerDateAsync.js.map +1 -0
- package/build/getNotificationCategoriesAsync.d.ts +11 -0
- package/build/getNotificationCategoriesAsync.d.ts.map +1 -0
- package/build/getNotificationCategoriesAsync.js +18 -0
- package/build/getNotificationCategoriesAsync.js.map +1 -0
- package/build/getNotificationChannelAsync.android.d.ts +3 -0
- package/build/getNotificationChannelAsync.android.d.ts.map +1 -0
- package/build/getNotificationChannelAsync.android.js +9 -0
- package/build/getNotificationChannelAsync.android.js.map +1 -0
- package/build/getNotificationChannelAsync.d.ts +11 -0
- package/build/getNotificationChannelAsync.d.ts.map +1 -0
- package/build/getNotificationChannelAsync.js +13 -0
- package/build/getNotificationChannelAsync.js.map +1 -0
- package/build/getNotificationChannelGroupAsync.android.d.ts +3 -0
- package/build/getNotificationChannelGroupAsync.android.d.ts.map +1 -0
- package/build/getNotificationChannelGroupAsync.android.js +9 -0
- package/build/getNotificationChannelGroupAsync.android.js.map +1 -0
- package/build/getNotificationChannelGroupAsync.d.ts +12 -0
- package/build/getNotificationChannelGroupAsync.d.ts.map +1 -0
- package/build/getNotificationChannelGroupAsync.js +14 -0
- package/build/getNotificationChannelGroupAsync.js.map +1 -0
- package/build/getNotificationChannelGroupsAsync.android.d.ts +3 -0
- package/build/getNotificationChannelGroupsAsync.android.d.ts.map +1 -0
- package/build/getNotificationChannelGroupsAsync.android.js +9 -0
- package/build/getNotificationChannelGroupsAsync.android.js.map +1 -0
- package/build/getNotificationChannelGroupsAsync.d.ts +10 -0
- package/build/getNotificationChannelGroupsAsync.d.ts.map +1 -0
- package/build/getNotificationChannelGroupsAsync.js +12 -0
- package/build/getNotificationChannelGroupsAsync.js.map +1 -0
- package/build/getNotificationChannelsAsync.android.d.ts +3 -0
- package/build/getNotificationChannelsAsync.android.d.ts.map +1 -0
- package/build/getNotificationChannelsAsync.android.js +9 -0
- package/build/getNotificationChannelsAsync.android.js.map +1 -0
- package/build/getNotificationChannelsAsync.d.ts +10 -0
- package/build/getNotificationChannelsAsync.d.ts.map +1 -0
- package/build/getNotificationChannelsAsync.js +12 -0
- package/build/getNotificationChannelsAsync.js.map +1 -0
- package/build/getPresentedNotificationsAsync.d.ts +9 -0
- package/build/getPresentedNotificationsAsync.d.ts.map +1 -0
- package/build/getPresentedNotificationsAsync.js +15 -0
- package/build/getPresentedNotificationsAsync.js.map +1 -0
- package/build/index.d.ts +39 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +39 -0
- package/build/index.js.map +1 -0
- package/build/kepler/NotificationContent.d.ts +43 -0
- package/build/kepler/NotificationContent.d.ts.map +1 -0
- package/build/kepler/NotificationContent.js +96 -0
- package/build/kepler/NotificationContent.js.map +1 -0
- package/build/kepler/index.d.ts +3 -0
- package/build/kepler/index.d.ts.map +1 -0
- package/build/kepler/index.js +15 -0
- package/build/kepler/index.js.map +1 -0
- package/build/kepler/native-notification-manager.d.ts +3 -0
- package/build/kepler/native-notification-manager.d.ts.map +1 -0
- package/build/kepler/native-notification-manager.js +10 -0
- package/build/kepler/native-notification-manager.js.map +1 -0
- package/build/kepler/types/NotificationManagerTypes.d.ts +373 -0
- package/build/kepler/types/NotificationManagerTypes.d.ts.map +1 -0
- package/build/kepler/types/NotificationManagerTypes.js +279 -0
- package/build/kepler/types/NotificationManagerTypes.js.map +1 -0
- package/build/kepler/types/index.d.ts +3 -0
- package/build/kepler/types/index.d.ts.map +1 -0
- package/build/kepler/types/index.js +15 -0
- package/build/kepler/types/index.js.map +1 -0
- package/build/presentNotificationAsync.d.ts +11 -0
- package/build/presentNotificationAsync.d.ts.map +1 -0
- package/build/presentNotificationAsync.js +22 -0
- package/build/presentNotificationAsync.js.map +1 -0
- package/build/registerTaskAsync.d.ts +29 -0
- package/build/registerTaskAsync.d.ts.map +1 -0
- package/build/registerTaskAsync.js +37 -0
- package/build/registerTaskAsync.js.map +1 -0
- package/build/scheduleNotificationAsync.d.ts +60 -0
- package/build/scheduleNotificationAsync.d.ts.map +1 -0
- package/build/scheduleNotificationAsync.js +261 -0
- package/build/scheduleNotificationAsync.js.map +1 -0
- package/build/setBadgeCountAsync.d.ts +19 -0
- package/build/setBadgeCountAsync.d.ts.map +1 -0
- package/build/setBadgeCountAsync.js +19 -0
- package/build/setBadgeCountAsync.js.map +1 -0
- package/build/setNotificationCategoryAsync.d.ts +15 -0
- package/build/setNotificationCategoryAsync.d.ts.map +1 -0
- package/build/setNotificationCategoryAsync.js +22 -0
- package/build/setNotificationCategoryAsync.js.map +1 -0
- package/build/setNotificationChannelAsync.android.d.ts +3 -0
- package/build/setNotificationChannelAsync.android.d.ts.map +1 -0
- package/build/setNotificationChannelAsync.android.js +9 -0
- package/build/setNotificationChannelAsync.android.js.map +1 -0
- package/build/setNotificationChannelAsync.d.ts +22 -0
- package/build/setNotificationChannelAsync.d.ts.map +1 -0
- package/build/setNotificationChannelAsync.js +24 -0
- package/build/setNotificationChannelAsync.js.map +1 -0
- package/build/setNotificationChannelGroupAsync.android.d.ts +3 -0
- package/build/setNotificationChannelGroupAsync.android.d.ts.map +1 -0
- package/build/setNotificationChannelGroupAsync.android.js +9 -0
- package/build/setNotificationChannelGroupAsync.android.js.map +1 -0
- package/build/setNotificationChannelGroupAsync.d.ts +12 -0
- package/build/setNotificationChannelGroupAsync.d.ts.map +1 -0
- package/build/setNotificationChannelGroupAsync.js +14 -0
- package/build/setNotificationChannelGroupAsync.js.map +1 -0
- package/build/unregisterForNotificationsAsync.d.ts +2 -0
- package/build/unregisterForNotificationsAsync.d.ts.map +1 -0
- package/build/unregisterForNotificationsAsync.js +10 -0
- package/build/unregisterForNotificationsAsync.js.map +1 -0
- package/build/unregisterTaskAsync.d.ts +7 -0
- package/build/unregisterTaskAsync.d.ts.map +1 -0
- package/build/unregisterTaskAsync.js +15 -0
- package/build/unregisterTaskAsync.js.map +1 -0
- package/build/useLastNotificationResponse.d.ts +38 -0
- package/build/useLastNotificationResponse.d.ts.map +1 -0
- package/build/useLastNotificationResponse.js +63 -0
- package/build/useLastNotificationResponse.js.map +1 -0
- package/build/utils/keplerUuidUtils.d.ts +5 -0
- package/build/utils/keplerUuidUtils.d.ts.map +1 -0
- package/build/utils/keplerUuidUtils.js +15 -0
- package/build/utils/keplerUuidUtils.js.map +1 -0
- package/build/utils/updateDevicePushTokenAsync.d.ts +3 -0
- package/build/utils/updateDevicePushTokenAsync.d.ts.map +1 -0
- package/build/utils/updateDevicePushTokenAsync.js +115 -0
- package/build/utils/updateDevicePushTokenAsync.js.map +1 -0
- package/expo-module.config.json +20 -0
- package/ios/EXNotifications/Building/EXNotificationBuilder.h +19 -0
- package/ios/EXNotifications/Building/EXNotificationBuilder.m +91 -0
- package/ios/EXNotifications/EXBadgeModule.h +11 -0
- package/ios/EXNotifications/EXBadgeModule.m +36 -0
- package/ios/EXNotifications/EXServerRegistrationModule.h +19 -0
- package/ios/EXNotifications/EXServerRegistrationModule.m +194 -0
- package/ios/EXNotifications/Notifications/Background/EXBackgroundNotificationTasksModule.h +16 -0
- package/ios/EXNotifications/Notifications/Background/EXBackgroundNotificationTasksModule.m +62 -0
- package/ios/EXNotifications/Notifications/Background/EXBackgroundRemoteNotificationConsumer.h +14 -0
- package/ios/EXNotifications/Notifications/Background/EXBackgroundRemoteNotificationConsumer.m +51 -0
- package/ios/EXNotifications/Notifications/Categories/EXNotificationCategoriesModule.h +25 -0
- package/ios/EXNotifications/Notifications/Categories/EXNotificationCategoriesModule.m +217 -0
- package/ios/EXNotifications/Notifications/EXNotificationCenterDelegate.h +29 -0
- package/ios/EXNotifications/Notifications/EXNotificationCenterDelegate.m +209 -0
- package/ios/EXNotifications/Notifications/EXNotificationSerializer.h +16 -0
- package/ios/EXNotifications/Notifications/EXNotificationSerializer.m +232 -0
- package/ios/EXNotifications/Notifications/EXNotificationsDelegate.h +27 -0
- package/ios/EXNotifications/Notifications/Emitter/EXNotificationsEmitter.h +17 -0
- package/ios/EXNotifications/Notifications/Emitter/EXNotificationsEmitter.m +114 -0
- package/ios/EXNotifications/Notifications/Handler/EXNotificationsHandlerModule.h +12 -0
- package/ios/EXNotifications/Notifications/Handler/EXNotificationsHandlerModule.m +109 -0
- package/ios/EXNotifications/Notifications/Handler/EXSingleNotificationHandlerTask.h +33 -0
- package/ios/EXNotifications/Notifications/Handler/EXSingleNotificationHandlerTask.m +124 -0
- package/ios/EXNotifications/Notifications/NSDictionary+EXNotificationsVerifyingClass.h +7 -0
- package/ios/EXNotifications/Notifications/NSDictionary+EXNotificationsVerifyingClass.m +19 -0
- package/ios/EXNotifications/Notifications/Presenting/EXNotificationPresentationModule.h +13 -0
- package/ios/EXNotifications/Notifications/Presenting/EXNotificationPresentationModule.m +124 -0
- package/ios/EXNotifications/Notifications/Scheduling/EXNotificationSchedulerModule.h +21 -0
- package/ios/EXNotifications/Notifications/Scheduling/EXNotificationSchedulerModule.m +263 -0
- package/ios/EXNotifications/Permissions/EXLegacyRemoteNotificationPermissionRequester.h +13 -0
- package/ios/EXNotifications/Permissions/EXLegacyRemoteNotificationPermissionRequester.m +135 -0
- package/ios/EXNotifications/Permissions/EXNotificationPermissionsModule.h +8 -0
- package/ios/EXNotifications/Permissions/EXNotificationPermissionsModule.m +67 -0
- package/ios/EXNotifications/Permissions/EXRemoteNotificationPermissionSingletonModule.h +29 -0
- package/ios/EXNotifications/Permissions/EXRemoteNotificationPermissionSingletonModule.m +68 -0
- package/ios/EXNotifications/Permissions/EXUserFacingNotificationsPermissionsRequester.h +15 -0
- package/ios/EXNotifications/Permissions/EXUserFacingNotificationsPermissionsRequester.m +202 -0
- package/ios/EXNotifications/PushToken/EXPushTokenListener.h +14 -0
- package/ios/EXNotifications/PushToken/EXPushTokenManager.h +24 -0
- package/ios/EXNotifications/PushToken/EXPushTokenManager.m +63 -0
- package/ios/EXNotifications/PushToken/EXPushTokenModule.h +9 -0
- package/ios/EXNotifications/PushToken/EXPushTokenModule.m +154 -0
- package/ios/EXNotifications.podspec +25 -0
- package/package.json +67 -0
- package/plugin/build/withNotifications.d.ts +28 -0
- package/plugin/build/withNotifications.js +12 -0
- package/plugin/build/withNotificationsAndroid.d.ts +42 -0
- package/plugin/build/withNotificationsAndroid.js +184 -0
- package/plugin/build/withNotificationsIOS.d.ts +14 -0
- package/plugin/build/withNotificationsIOS.js +58 -0
- package/plugin/jest.config.js +1 -0
- package/plugin/src/withNotifications.ts +40 -0
- package/plugin/src/withNotificationsAndroid.ts +239 -0
- package/plugin/src/withNotificationsIOS.ts +78 -0
- package/plugin/tsconfig.json +9 -0
- package/src/BackgroundNotificationTasksModule.kepler.ts +8 -0
- package/src/BackgroundNotificationTasksModule.native.ts +7 -0
- package/src/BackgroundNotificationTasksModule.ts +8 -0
- package/src/BackgroundNotificationTasksModule.types.ts +12 -0
- package/src/BackgroundNotificationTasksModule.web.ts +8 -0
- package/src/BadgeModule.kepler.ts +8 -0
- package/src/BadgeModule.native.ts +15 -0
- package/src/BadgeModule.ts +6 -0
- package/src/BadgeModule.types.ts +11 -0
- package/src/BadgeModule.web.ts +28 -0
- package/src/DevicePushTokenAutoRegistration.fx.ts +119 -0
- package/src/NotificationCategoriesModule.kepler.ts +10 -0
- package/src/NotificationCategoriesModule.native.ts +7 -0
- package/src/NotificationCategoriesModule.ts +15 -0
- package/src/NotificationCategoriesModule.types.ts +22 -0
- package/src/NotificationCategoriesModule.web.ts +17 -0
- package/src/NotificationChannelGroupManager.kepler.ts +8 -0
- package/src/NotificationChannelGroupManager.native.ts +7 -0
- package/src/NotificationChannelGroupManager.ts +6 -0
- package/src/NotificationChannelGroupManager.types.ts +34 -0
- package/src/NotificationChannelManager.kepler.ts +8 -0
- package/src/NotificationChannelManager.native.ts +5 -0
- package/src/NotificationChannelManager.ts +6 -0
- package/src/NotificationChannelManager.types.ts +115 -0
- package/src/NotificationPermissions.ts +91 -0
- package/src/NotificationPermissions.types.ts +102 -0
- package/src/NotificationPermissionsModule.kepler.ts +8 -0
- package/src/NotificationPermissionsModule.native.ts +7 -0
- package/src/NotificationPermissionsModule.ts +83 -0
- package/src/NotificationPermissionsModule.types.ts +13 -0
- package/src/NotificationPresenterModule.kepler.ts +67 -0
- package/src/NotificationPresenterModule.native.ts +5 -0
- package/src/NotificationPresenterModule.ts +6 -0
- package/src/NotificationPresenterModule.types.ts +13 -0
- package/src/NotificationScheduler.kepler.ts +63 -0
- package/src/NotificationScheduler.native.ts +5 -0
- package/src/NotificationScheduler.ts +6 -0
- package/src/NotificationScheduler.types.ts +89 -0
- package/src/Notifications.types.ts +722 -0
- package/src/NotificationsEmitter.ts +111 -0
- package/src/NotificationsEmitterModule.kepler.ts +8 -0
- package/src/NotificationsEmitterModule.native.ts +5 -0
- package/src/NotificationsEmitterModule.ts +17 -0
- package/src/NotificationsEmitterModule.types.ts +7 -0
- package/src/NotificationsHandler.ts +120 -0
- package/src/NotificationsHandlerModule.kepler.ts +8 -0
- package/src/NotificationsHandlerModule.native.ts +5 -0
- package/src/NotificationsHandlerModule.ts +17 -0
- package/src/NotificationsHandlerModule.types.ts +10 -0
- package/src/PushTokenManager.kepler.ts +8 -0
- package/src/PushTokenManager.native.ts +5 -0
- package/src/PushTokenManager.ts +17 -0
- package/src/PushTokenManager.types.ts +6 -0
- package/src/ServerRegistrationModule.kepler.ts +8 -0
- package/src/ServerRegistrationModule.native.ts +7 -0
- package/src/ServerRegistrationModule.ts +6 -0
- package/src/ServerRegistrationModule.types.ts +7 -0
- package/src/ServerRegistrationModule.web.ts +56 -0
- package/src/TokenEmitter.ts +56 -0
- package/src/Tokens.types.ts +110 -0
- package/src/cancelAllScheduledNotificationsAsync.ts +16 -0
- package/src/cancelScheduledNotificationAsync.ts +31 -0
- package/src/deleteNotificationCategoryAsync.ts +23 -0
- package/src/deleteNotificationChannelAsync.android.ts +11 -0
- package/src/deleteNotificationChannelAsync.ts +10 -0
- package/src/deleteNotificationChannelGroupAsync.android.ts +11 -0
- package/src/deleteNotificationChannelGroupAsync.ts +10 -0
- package/src/dismissAllNotificationsAsync.ts +16 -0
- package/src/dismissNotificationAsync.ts +19 -0
- package/src/getAllScheduledNotificationsAsync.ts +17 -0
- package/src/getBadgeCountAsync.ts +17 -0
- package/src/getDevicePushTokenAsync.ts +31 -0
- package/src/getDevicePushTokenAsync.web.ts +122 -0
- package/src/getExpoPushTokenAsync.ts +238 -0
- package/src/getNextTriggerDateAsync.ts +38 -0
- package/src/getNotificationCategoriesAsync.ts +21 -0
- package/src/getNotificationChannelAsync.android.ts +13 -0
- package/src/getNotificationChannelAsync.ts +16 -0
- package/src/getNotificationChannelGroupAsync.android.ts +14 -0
- package/src/getNotificationChannelGroupAsync.ts +17 -0
- package/src/getNotificationChannelGroupsAsync.android.ts +13 -0
- package/src/getNotificationChannelGroupsAsync.ts +15 -0
- package/src/getNotificationChannelsAsync.android.ts +11 -0
- package/src/getNotificationChannelsAsync.ts +13 -0
- package/src/getPresentedNotificationsAsync.ts +18 -0
- package/src/index.ts +38 -0
- package/src/kepler/NotificationContent.ts +119 -0
- package/src/kepler/index.ts +16 -0
- package/src/kepler/native-notification-manager.ts +10 -0
- package/src/kepler/types/NotificationManagerTypes.ts +508 -0
- package/src/kepler/types/index.ts +16 -0
- package/src/presentNotificationAsync.ts +32 -0
- package/src/registerTaskAsync.ts +39 -0
- package/src/scheduleNotificationAsync.ts +335 -0
- package/src/setBadgeCountAsync.ts +32 -0
- package/src/setNotificationCategoryAsync.ts +37 -0
- package/src/setNotificationChannelAsync.android.ts +15 -0
- package/src/setNotificationChannelAsync.ts +28 -0
- package/src/setNotificationChannelGroupAsync.android.ts +18 -0
- package/src/setNotificationChannelGroupAsync.ts +21 -0
- package/src/unregisterForNotificationsAsync.ts +11 -0
- package/src/unregisterTaskAsync.ts +17 -0
- package/src/useLastNotificationResponse.ts +70 -0
- package/src/utils/keplerUuidUtils.ts +29 -0
- package/src/utils/updateDevicePushTokenAsync.ts +147 -0
- package/tsconfig.json +9 -0
package/android/src/main/java/expo/modules/notifications/notifications/triggers/DailyTrigger.java
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
package expo.modules.notifications.notifications.triggers;
|
|
2
|
+
|
|
3
|
+
import android.os.Parcel;
|
|
4
|
+
|
|
5
|
+
import java.util.Calendar;
|
|
6
|
+
import java.util.Date;
|
|
7
|
+
|
|
8
|
+
import androidx.annotation.Nullable;
|
|
9
|
+
import expo.modules.notifications.notifications.interfaces.SchedulableNotificationTrigger;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A schedulable trigger representing a notification to be scheduled once per day.
|
|
13
|
+
*/
|
|
14
|
+
public class DailyTrigger extends ChannelAwareTrigger implements SchedulableNotificationTrigger {
|
|
15
|
+
private int mHour;
|
|
16
|
+
private int mMinute;
|
|
17
|
+
|
|
18
|
+
public DailyTrigger(int hour, int minute, @Nullable String channelId) {
|
|
19
|
+
super(channelId);
|
|
20
|
+
mHour = hour;
|
|
21
|
+
mMinute = minute;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
private DailyTrigger(Parcel in) {
|
|
25
|
+
super(in);
|
|
26
|
+
mHour = in.readInt();
|
|
27
|
+
mMinute = in.readInt();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public int getHour() {
|
|
31
|
+
return mHour;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public int getMinute() {
|
|
35
|
+
return mMinute;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@Nullable
|
|
39
|
+
@Override
|
|
40
|
+
public Date nextTriggerDate() {
|
|
41
|
+
Calendar nextTriggerDate = Calendar.getInstance();
|
|
42
|
+
nextTriggerDate.set(Calendar.HOUR_OF_DAY, mHour);
|
|
43
|
+
nextTriggerDate.set(Calendar.MINUTE, mMinute);
|
|
44
|
+
nextTriggerDate.set(Calendar.SECOND, 0);
|
|
45
|
+
nextTriggerDate.set(Calendar.MILLISECOND, 0);
|
|
46
|
+
Calendar rightNow = Calendar.getInstance();
|
|
47
|
+
if (nextTriggerDate.before(rightNow)) {
|
|
48
|
+
nextTriggerDate.add(Calendar.DATE, 1);
|
|
49
|
+
}
|
|
50
|
+
return nextTriggerDate.getTime();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@Override
|
|
54
|
+
public int describeContents() {
|
|
55
|
+
return 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@Override
|
|
59
|
+
public void writeToParcel(Parcel dest, int flags) {
|
|
60
|
+
super.writeToParcel(dest, flags);
|
|
61
|
+
dest.writeInt(mHour);
|
|
62
|
+
dest.writeInt(mMinute);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public static final Creator<DailyTrigger> CREATOR = new Creator<DailyTrigger>() {
|
|
66
|
+
@Override
|
|
67
|
+
public DailyTrigger createFromParcel(Parcel in) {
|
|
68
|
+
return new DailyTrigger(in);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@Override
|
|
72
|
+
public DailyTrigger[] newArray(int size) {
|
|
73
|
+
return new DailyTrigger[size];
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
package/android/src/main/java/expo/modules/notifications/notifications/triggers/DateTrigger.java
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
package expo.modules.notifications.notifications.triggers;
|
|
2
|
+
|
|
3
|
+
import android.os.Parcel;
|
|
4
|
+
|
|
5
|
+
import java.util.Date;
|
|
6
|
+
|
|
7
|
+
import androidx.annotation.Nullable;
|
|
8
|
+
import expo.modules.notifications.notifications.interfaces.SchedulableNotificationTrigger;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A schedulable trigger representing notification to be scheduled only once at a given moment of time.
|
|
12
|
+
*/
|
|
13
|
+
public class DateTrigger extends ChannelAwareTrigger implements SchedulableNotificationTrigger {
|
|
14
|
+
private Date mTriggerDate;
|
|
15
|
+
|
|
16
|
+
public DateTrigger(long timestamp, @Nullable String channelId) {
|
|
17
|
+
super(channelId);
|
|
18
|
+
mTriggerDate = new Date(timestamp);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
private DateTrigger(Parcel in) {
|
|
22
|
+
super(in);
|
|
23
|
+
mTriggerDate = new Date(in.readLong());
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public Date getTriggerDate() {
|
|
27
|
+
return mTriggerDate;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@Nullable
|
|
31
|
+
@Override
|
|
32
|
+
public Date nextTriggerDate() {
|
|
33
|
+
Date now = new Date();
|
|
34
|
+
|
|
35
|
+
if (mTriggerDate.before(now)) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return mTriggerDate;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@Override
|
|
43
|
+
public int describeContents() {
|
|
44
|
+
return 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@Override
|
|
48
|
+
public void writeToParcel(Parcel dest, int flags) {
|
|
49
|
+
super.writeToParcel(dest, flags);
|
|
50
|
+
dest.writeLong(mTriggerDate.getTime());
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public static final Creator<DateTrigger> CREATOR = new Creator<DateTrigger>() {
|
|
54
|
+
@Override
|
|
55
|
+
public DateTrigger createFromParcel(Parcel in) {
|
|
56
|
+
return new DateTrigger(in);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@Override
|
|
60
|
+
public DateTrigger[] newArray(int size) {
|
|
61
|
+
return new DateTrigger[size];
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
package expo.modules.notifications.notifications.triggers;
|
|
2
|
+
|
|
3
|
+
import android.os.Parcel;
|
|
4
|
+
|
|
5
|
+
import java.util.Date;
|
|
6
|
+
|
|
7
|
+
import androidx.annotation.Nullable;
|
|
8
|
+
import expo.modules.notifications.notifications.interfaces.SchedulableNotificationTrigger;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A schedulable trigger representing notification to be scheduled after X milliseconds,
|
|
12
|
+
* optionally repeating.
|
|
13
|
+
* <p>
|
|
14
|
+
* <i>Note: The implementation ensures that the trigger times do not drift away too much from the
|
|
15
|
+
* * initial time, so eg. a trigger started at 11111000 time repeated every 1000 ms should always
|
|
16
|
+
* * trigger around …000 timestamp.</i>
|
|
17
|
+
*/
|
|
18
|
+
public class TimeIntervalTrigger extends ChannelAwareTrigger implements SchedulableNotificationTrigger {
|
|
19
|
+
private Date mTriggerDate;
|
|
20
|
+
private long mTimeInterval;
|
|
21
|
+
private boolean mRepeats;
|
|
22
|
+
|
|
23
|
+
public TimeIntervalTrigger(long timeInterval, boolean repeats, @Nullable String channelId) {
|
|
24
|
+
super(channelId);
|
|
25
|
+
mTimeInterval = timeInterval;
|
|
26
|
+
mTriggerDate = new Date(new Date().getTime() + mTimeInterval * 1000);
|
|
27
|
+
mRepeats = repeats;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
private TimeIntervalTrigger(Parcel in) {
|
|
31
|
+
super(in);
|
|
32
|
+
mTriggerDate = new Date(in.readLong());
|
|
33
|
+
mTimeInterval = in.readLong();
|
|
34
|
+
mRepeats = in.readByte() == 1;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public boolean isRepeating() {
|
|
38
|
+
return mRepeats;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public long getTimeInterval() {
|
|
42
|
+
return mTimeInterval;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@Nullable
|
|
46
|
+
@Override
|
|
47
|
+
public Date nextTriggerDate() {
|
|
48
|
+
Date now = new Date();
|
|
49
|
+
|
|
50
|
+
if (mRepeats) {
|
|
51
|
+
while (mTriggerDate.before(now)) {
|
|
52
|
+
mTriggerDate.setTime(mTriggerDate.getTime() + mTimeInterval * 1000);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (mTriggerDate.before(now)) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return mTriggerDate;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@Override
|
|
64
|
+
public int describeContents() {
|
|
65
|
+
return 0;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@Override
|
|
69
|
+
public void writeToParcel(Parcel dest, int flags) {
|
|
70
|
+
super.writeToParcel(dest, flags);
|
|
71
|
+
dest.writeLong(mTriggerDate.getTime());
|
|
72
|
+
dest.writeLong(mTimeInterval);
|
|
73
|
+
dest.writeByte((byte) (mRepeats ? 1 : 0));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
public static final Creator<TimeIntervalTrigger> CREATOR = new Creator<TimeIntervalTrigger>() {
|
|
77
|
+
@Override
|
|
78
|
+
public TimeIntervalTrigger createFromParcel(Parcel in) {
|
|
79
|
+
return new TimeIntervalTrigger(in);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@Override
|
|
83
|
+
public TimeIntervalTrigger[] newArray(int size) {
|
|
84
|
+
return new TimeIntervalTrigger[size];
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
package/android/src/main/java/expo/modules/notifications/notifications/triggers/WeeklyTrigger.java
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
package expo.modules.notifications.notifications.triggers;
|
|
2
|
+
|
|
3
|
+
import android.os.Parcel;
|
|
4
|
+
|
|
5
|
+
import java.util.Calendar;
|
|
6
|
+
import java.util.Date;
|
|
7
|
+
|
|
8
|
+
import androidx.annotation.Nullable;
|
|
9
|
+
import expo.modules.notifications.notifications.interfaces.SchedulableNotificationTrigger;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A schedulable trigger representing a notification to be scheduled once per week.
|
|
13
|
+
*/
|
|
14
|
+
public class WeeklyTrigger extends ChannelAwareTrigger implements SchedulableNotificationTrigger {
|
|
15
|
+
private int mWeekday;
|
|
16
|
+
private int mHour;
|
|
17
|
+
private int mMinute;
|
|
18
|
+
|
|
19
|
+
public WeeklyTrigger(int weekday, int hour, int minute, @Nullable String channelId) {
|
|
20
|
+
super(channelId);
|
|
21
|
+
mWeekday = weekday;
|
|
22
|
+
mHour = hour;
|
|
23
|
+
mMinute = minute;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
private WeeklyTrigger(Parcel in) {
|
|
27
|
+
super(in);
|
|
28
|
+
mWeekday = in.readInt();
|
|
29
|
+
mHour = in.readInt();
|
|
30
|
+
mMinute = in.readInt();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public int getWeekday() {
|
|
34
|
+
return mWeekday;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public int getHour() {
|
|
38
|
+
return mHour;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public int getMinute() {
|
|
42
|
+
return mMinute;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@Nullable
|
|
46
|
+
@Override
|
|
47
|
+
public Date nextTriggerDate() {
|
|
48
|
+
Calendar nextTriggerDate = Calendar.getInstance();
|
|
49
|
+
nextTriggerDate.set(Calendar.DAY_OF_WEEK, mWeekday);
|
|
50
|
+
nextTriggerDate.set(Calendar.HOUR_OF_DAY, mHour);
|
|
51
|
+
nextTriggerDate.set(Calendar.MINUTE, mMinute);
|
|
52
|
+
nextTriggerDate.set(Calendar.SECOND, 0);
|
|
53
|
+
nextTriggerDate.set(Calendar.MILLISECOND, 0);
|
|
54
|
+
Calendar rightNow = Calendar.getInstance();
|
|
55
|
+
if (nextTriggerDate.before(rightNow)) {
|
|
56
|
+
nextTriggerDate.add(Calendar.DAY_OF_WEEK_IN_MONTH, 1);
|
|
57
|
+
}
|
|
58
|
+
return nextTriggerDate.getTime();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@Override
|
|
62
|
+
public int describeContents() {
|
|
63
|
+
return 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@Override
|
|
67
|
+
public void writeToParcel(Parcel dest, int flags) {
|
|
68
|
+
super.writeToParcel(dest, flags);
|
|
69
|
+
dest.writeInt(mWeekday);
|
|
70
|
+
dest.writeInt(mHour);
|
|
71
|
+
dest.writeInt(mMinute);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public static final Creator<WeeklyTrigger> CREATOR = new Creator<WeeklyTrigger>() {
|
|
75
|
+
@Override
|
|
76
|
+
public WeeklyTrigger createFromParcel(Parcel in) {
|
|
77
|
+
return new WeeklyTrigger(in);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@Override
|
|
81
|
+
public WeeklyTrigger[] newArray(int size) {
|
|
82
|
+
return new WeeklyTrigger[size];
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
package/android/src/main/java/expo/modules/notifications/notifications/triggers/YearlyTrigger.java
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
package expo.modules.notifications.notifications.triggers;
|
|
2
|
+
|
|
3
|
+
import android.os.Parcel;
|
|
4
|
+
|
|
5
|
+
import java.util.Calendar;
|
|
6
|
+
import java.util.Date;
|
|
7
|
+
|
|
8
|
+
import androidx.annotation.Nullable;
|
|
9
|
+
import expo.modules.notifications.notifications.interfaces.SchedulableNotificationTrigger;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A schedulable trigger representing a notification to be scheduled once per year.
|
|
13
|
+
*/
|
|
14
|
+
public class YearlyTrigger extends ChannelAwareTrigger implements SchedulableNotificationTrigger {
|
|
15
|
+
private int mDay;
|
|
16
|
+
private int mMonth;
|
|
17
|
+
private int mHour;
|
|
18
|
+
private int mMinute;
|
|
19
|
+
|
|
20
|
+
public YearlyTrigger(int day, int month, int hour, int minute, @Nullable String channelId) {
|
|
21
|
+
super(channelId);
|
|
22
|
+
mDay = day;
|
|
23
|
+
mMonth = month;
|
|
24
|
+
mHour = hour;
|
|
25
|
+
mMinute = minute;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
private YearlyTrigger(Parcel in) {
|
|
29
|
+
super(in);
|
|
30
|
+
mDay = in.readInt();
|
|
31
|
+
mMonth = in.readInt();
|
|
32
|
+
mHour = in.readInt();
|
|
33
|
+
mMinute = in.readInt();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public int getDay() {
|
|
37
|
+
return mDay;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public int getMonth() {
|
|
41
|
+
return mMonth;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public int getHour() {
|
|
45
|
+
return mHour;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public int getMinute() {
|
|
49
|
+
return mMinute;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@Nullable
|
|
53
|
+
@Override
|
|
54
|
+
public Date nextTriggerDate() {
|
|
55
|
+
Calendar nextTriggerDate = Calendar.getInstance();
|
|
56
|
+
nextTriggerDate.set(Calendar.DATE, mDay);
|
|
57
|
+
nextTriggerDate.set(Calendar.MONTH, mMonth);
|
|
58
|
+
nextTriggerDate.set(Calendar.HOUR_OF_DAY, mHour);
|
|
59
|
+
nextTriggerDate.set(Calendar.MINUTE, mMinute);
|
|
60
|
+
nextTriggerDate.set(Calendar.SECOND, 0);
|
|
61
|
+
nextTriggerDate.set(Calendar.MILLISECOND, 0);
|
|
62
|
+
Calendar rightNow = Calendar.getInstance();
|
|
63
|
+
if (nextTriggerDate.before(rightNow)) {
|
|
64
|
+
nextTriggerDate.add(Calendar.YEAR, 1);
|
|
65
|
+
}
|
|
66
|
+
return nextTriggerDate.getTime();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@Override
|
|
70
|
+
public int describeContents() {
|
|
71
|
+
return 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@Override
|
|
75
|
+
public void writeToParcel(Parcel dest, int flags) {
|
|
76
|
+
super.writeToParcel(dest, flags);
|
|
77
|
+
dest.writeInt(mDay);
|
|
78
|
+
dest.writeInt(mMonth);
|
|
79
|
+
dest.writeInt(mHour);
|
|
80
|
+
dest.writeInt(mMinute);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
public static final Creator<YearlyTrigger> CREATOR = new Creator<YearlyTrigger>() {
|
|
84
|
+
@Override
|
|
85
|
+
public YearlyTrigger createFromParcel(Parcel in) {
|
|
86
|
+
return new YearlyTrigger(in);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@Override
|
|
90
|
+
public YearlyTrigger[] newArray(int size) {
|
|
91
|
+
return new YearlyTrigger[size];
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
package expo.modules.notifications.permissions
|
|
2
|
+
|
|
3
|
+
import android.Manifest
|
|
4
|
+
import android.app.NotificationManager
|
|
5
|
+
import android.content.Context
|
|
6
|
+
import android.os.Build
|
|
7
|
+
import androidx.annotation.RequiresApi
|
|
8
|
+
import androidx.core.app.NotificationManagerCompat
|
|
9
|
+
import androidx.core.os.bundleOf
|
|
10
|
+
import expo.modules.core.arguments.ReadableArguments
|
|
11
|
+
import expo.modules.interfaces.permissions.Permissions
|
|
12
|
+
import expo.modules.interfaces.permissions.PermissionsResponse
|
|
13
|
+
import expo.modules.interfaces.permissions.PermissionsStatus
|
|
14
|
+
import expo.modules.kotlin.Promise
|
|
15
|
+
import expo.modules.kotlin.exception.Exceptions
|
|
16
|
+
import expo.modules.kotlin.modules.Module
|
|
17
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
18
|
+
import expo.modules.notifications.ModuleNotFoundException
|
|
19
|
+
|
|
20
|
+
private const val ANDROID_RESPONSE_KEY = "android"
|
|
21
|
+
private const val IMPORTANCE_KEY = "importance"
|
|
22
|
+
private const val INTERRUPTION_FILTER_KEY = "interruptionFilter"
|
|
23
|
+
private val PERMISSIONS: Array<String> = arrayOf(Manifest.permission.POST_NOTIFICATIONS)
|
|
24
|
+
|
|
25
|
+
class NotificationPermissionsModule : Module() {
|
|
26
|
+
private val permissions: Permissions
|
|
27
|
+
get() = appContext.permissions ?: throw ModuleNotFoundException(Permissions::class)
|
|
28
|
+
|
|
29
|
+
private val context: Context
|
|
30
|
+
get() = appContext.reactContext ?: throw Exceptions.ReactContextLost()
|
|
31
|
+
|
|
32
|
+
override fun definition() = ModuleDefinition {
|
|
33
|
+
Name("ExpoNotificationPermissionsModule")
|
|
34
|
+
|
|
35
|
+
AsyncFunction("getPermissionsAsync") { promise: Promise ->
|
|
36
|
+
if (context.applicationContext.applicationInfo.targetSdkVersion >= 33 && Build.VERSION.SDK_INT >= 33) {
|
|
37
|
+
getPermissionsWithPromiseImplApi33(promise)
|
|
38
|
+
} else {
|
|
39
|
+
getPermissionsWithPromiseImplClassic(promise)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
AsyncFunction("requestPermissionsAsync") { _: ReadableArguments?, promise: Promise ->
|
|
44
|
+
if (context.applicationContext.applicationInfo.targetSdkVersion >= 33 && Build.VERSION.SDK_INT >= 33) {
|
|
45
|
+
requestPermissionsWithPromiseImplApi33(promise)
|
|
46
|
+
} else {
|
|
47
|
+
getPermissionsWithPromiseImplClassic(promise)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@RequiresApi(33)
|
|
53
|
+
private fun getPermissionsWithPromiseImplApi33(promise: Promise) {
|
|
54
|
+
permissions.getPermissions(
|
|
55
|
+
{ permissionsMap: Map<String, PermissionsResponse> ->
|
|
56
|
+
val managerCompat = NotificationManagerCompat.from(context)
|
|
57
|
+
val areEnabled = managerCompat.areNotificationsEnabled()
|
|
58
|
+
val platformBundle = bundleOf(
|
|
59
|
+
IMPORTANCE_KEY to managerCompat.importance,
|
|
60
|
+
).apply {
|
|
61
|
+
val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as? NotificationManager
|
|
62
|
+
if (notificationManager != null) {
|
|
63
|
+
putInt(INTERRUPTION_FILTER_KEY, notificationManager.currentInterruptionFilter)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
val areAllGranted = permissionsMap.all { (_, response) -> response.status == PermissionsStatus.GRANTED }
|
|
68
|
+
val areAllDenied = permissionsMap.all { (_, response) -> response.status == PermissionsStatus.DENIED }
|
|
69
|
+
val canAskAgain = permissionsMap.all { (_, response) -> response.canAskAgain }
|
|
70
|
+
val status = when {
|
|
71
|
+
areAllDenied -> PermissionsStatus.DENIED.status
|
|
72
|
+
!areEnabled -> PermissionsStatus.DENIED.status
|
|
73
|
+
areAllGranted -> PermissionsStatus.GRANTED.status
|
|
74
|
+
else -> PermissionsStatus.UNDETERMINED.status
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
promise.resolve(
|
|
78
|
+
bundleOf(
|
|
79
|
+
PermissionsResponse.EXPIRES_KEY to PermissionsResponse.PERMISSION_EXPIRES_NEVER,
|
|
80
|
+
PermissionsResponse.STATUS_KEY to status,
|
|
81
|
+
PermissionsResponse.CAN_ASK_AGAIN_KEY to canAskAgain,
|
|
82
|
+
PermissionsResponse.GRANTED_KEY to areAllGranted,
|
|
83
|
+
ANDROID_RESPONSE_KEY to platformBundle,
|
|
84
|
+
)
|
|
85
|
+
)
|
|
86
|
+
},
|
|
87
|
+
*PERMISSIONS
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
private fun getPermissionsWithPromiseImplClassic(promise: Promise) {
|
|
92
|
+
val managerCompat = NotificationManagerCompat.from(context)
|
|
93
|
+
val areEnabled = managerCompat.areNotificationsEnabled()
|
|
94
|
+
val status = if (areEnabled) PermissionsStatus.GRANTED else PermissionsStatus.DENIED
|
|
95
|
+
val platformBundle = bundleOf(
|
|
96
|
+
IMPORTANCE_KEY to managerCompat.importance,
|
|
97
|
+
).apply {
|
|
98
|
+
val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as? NotificationManager
|
|
99
|
+
if (notificationManager != null) {
|
|
100
|
+
putInt(INTERRUPTION_FILTER_KEY, notificationManager.currentInterruptionFilter)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
promise.resolve(
|
|
105
|
+
bundleOf(
|
|
106
|
+
PermissionsResponse.EXPIRES_KEY to PermissionsResponse.PERMISSION_EXPIRES_NEVER,
|
|
107
|
+
PermissionsResponse.STATUS_KEY to status.status,
|
|
108
|
+
PermissionsResponse.CAN_ASK_AGAIN_KEY to areEnabled,
|
|
109
|
+
PermissionsResponse.GRANTED_KEY to (status == PermissionsStatus.GRANTED),
|
|
110
|
+
ANDROID_RESPONSE_KEY to platformBundle,
|
|
111
|
+
)
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@RequiresApi(33)
|
|
116
|
+
private fun requestPermissionsWithPromiseImplApi33(promise: Promise) {
|
|
117
|
+
permissions.askForPermissions(
|
|
118
|
+
{
|
|
119
|
+
getPermissionsWithPromiseImplApi33(promise)
|
|
120
|
+
},
|
|
121
|
+
*PERMISSIONS
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
}
|
package/android/src/main/java/expo/modules/notifications/serverregistration/InstallationId.java
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
package expo.modules.notifications.serverregistration;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.content.SharedPreferences;
|
|
5
|
+
import android.util.Log;
|
|
6
|
+
|
|
7
|
+
import java.io.BufferedReader;
|
|
8
|
+
import java.io.File;
|
|
9
|
+
import java.io.FileReader;
|
|
10
|
+
import java.io.FileWriter;
|
|
11
|
+
import java.io.IOException;
|
|
12
|
+
import java.util.UUID;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* An installation ID provider - it solves two purposes:
|
|
16
|
+
* - in installations that have a legacy UUID persisted
|
|
17
|
+
* in shared-across-expo-modules SharedPreferences or
|
|
18
|
+
* shared-across-expo-modules non-backed-up file,
|
|
19
|
+
* migrates the UUID from there to its own non-backed-up file,
|
|
20
|
+
* - provides/creates a UUID unique per an installation.
|
|
21
|
+
* <p>
|
|
22
|
+
* Similar class exists in expoview and expo-constants.
|
|
23
|
+
*/
|
|
24
|
+
public class InstallationId {
|
|
25
|
+
private static final String TAG = InstallationId.class.getSimpleName();
|
|
26
|
+
|
|
27
|
+
// Legacy storage
|
|
28
|
+
public static final String LEGACY_PREFERENCES_FILE_NAME = "host.exp.exponent.SharedPreferences";
|
|
29
|
+
public static final String LEGACY_PREFERENCES_UUID_KEY = "uuid";
|
|
30
|
+
|
|
31
|
+
public static final String LEGACY_UUID_FILE_NAME = "expo_installation_uuid.txt";
|
|
32
|
+
|
|
33
|
+
// Primary storage
|
|
34
|
+
public static final String UUID_FILE_NAME = "expo_notifications_installation_uuid.txt";
|
|
35
|
+
|
|
36
|
+
private String mUuid;
|
|
37
|
+
private Context mContext;
|
|
38
|
+
private SharedPreferences mLegacySharedPreferences;
|
|
39
|
+
|
|
40
|
+
public InstallationId(Context context) {
|
|
41
|
+
mContext = context;
|
|
42
|
+
mLegacySharedPreferences = context.getSharedPreferences(LEGACY_PREFERENCES_FILE_NAME, Context.MODE_PRIVATE);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public String getUUID() {
|
|
46
|
+
// If it has already been cached, return the value.
|
|
47
|
+
if (mUuid != null) {
|
|
48
|
+
return mUuid;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// 1. Read from primary storage
|
|
52
|
+
// If there already is a value it must have been migrated previously.
|
|
53
|
+
mUuid = readUUIDFromFile(new File(mContext.getNoBackupFilesDir(), UUID_FILE_NAME));
|
|
54
|
+
if (mUuid != null) {
|
|
55
|
+
return mUuid;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// 2. Read from legacy shared preferences
|
|
59
|
+
// If there is a value we should use it - it's been used by previous versions
|
|
60
|
+
// of expo-notifications, so in order not to rotate the ID we should migrate it
|
|
61
|
+
// to new storage.
|
|
62
|
+
mUuid = mLegacySharedPreferences.getString(LEGACY_PREFERENCES_UUID_KEY, null);
|
|
63
|
+
if (mUuid != null) {
|
|
64
|
+
try {
|
|
65
|
+
saveUUID(mUuid);
|
|
66
|
+
// We only remove the value from old storage once it's set and saved in the new storage.
|
|
67
|
+
mLegacySharedPreferences.edit().remove(LEGACY_PREFERENCES_UUID_KEY).apply();
|
|
68
|
+
} catch (IOException e) {
|
|
69
|
+
Log.e(TAG, "Error while migrating UUID from legacy storage. " + e);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return mUuid;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// 3. Migrate from legacy file
|
|
76
|
+
// If there is a value and we've made it up to here it means
|
|
77
|
+
// expo-notifications hasn't used *its own* ID in the past -
|
|
78
|
+
// - it used expo-constants' ID. Since it's now deprecated,
|
|
79
|
+
// let's copy the value to our own storage.
|
|
80
|
+
mUuid = readUUIDFromFile(new File(mContext.getNoBackupFilesDir(), LEGACY_UUID_FILE_NAME));
|
|
81
|
+
if (mUuid != null) {
|
|
82
|
+
try {
|
|
83
|
+
saveUUID(mUuid);
|
|
84
|
+
} catch (IOException e) {
|
|
85
|
+
Log.e(TAG, "Error while migrating UUID from legacy storage. " + e);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return mUuid;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
//noinspection ConstantConditions
|
|
92
|
+
return mUuid;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
public String getOrCreateUUID() {
|
|
96
|
+
String uuid = getUUID();
|
|
97
|
+
if (uuid != null) {
|
|
98
|
+
return uuid;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// We persist the new UUID in "session storage"
|
|
102
|
+
// so that if writing to persistent storage
|
|
103
|
+
// fails subsequent calls to get(orCreate)UUID
|
|
104
|
+
// return the same value.
|
|
105
|
+
mUuid = UUID.randomUUID().toString();
|
|
106
|
+
try {
|
|
107
|
+
saveUUID(mUuid);
|
|
108
|
+
} catch (IOException e) {
|
|
109
|
+
Log.e(TAG, "Error while writing new UUID. " + e);
|
|
110
|
+
}
|
|
111
|
+
return mUuid;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
protected String readUUIDFromFile(File file) {
|
|
115
|
+
try (FileReader fileReader = new FileReader(file);
|
|
116
|
+
BufferedReader bufferedReader = new BufferedReader(fileReader)) {
|
|
117
|
+
String line = bufferedReader.readLine();
|
|
118
|
+
// If line is not a UUID, it throws an IllegalArgumentException
|
|
119
|
+
return UUID.fromString(line).toString();
|
|
120
|
+
} catch (IOException | IllegalArgumentException e) {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
protected void saveUUID(String uuid) throws IOException {
|
|
126
|
+
try (FileWriter writer = new FileWriter(getNonBackedUpUuidFile())) {
|
|
127
|
+
writer.write(uuid);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
protected File getNonBackedUpUuidFile() {
|
|
132
|
+
return new File(mContext.getNoBackupFilesDir(), UUID_FILE_NAME);
|
|
133
|
+
}
|
|
134
|
+
}
|
package/android/src/main/java/expo/modules/notifications/serverregistration/RegistrationInfo.kt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
package expo.modules.notifications.serverregistration
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import java.io.File
|
|
5
|
+
|
|
6
|
+
open class RegistrationInfo(private val context: Context) {
|
|
7
|
+
companion object {
|
|
8
|
+
const val REGISTRATION_INFO_FILE_NAME = "expo_notifications_registration_info.txt"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
protected val nonBackedUpRegistrationInfoFile: File
|
|
12
|
+
get() = File(context.noBackupFilesDir, REGISTRATION_INFO_FILE_NAME)
|
|
13
|
+
|
|
14
|
+
fun get(): String? = if (nonBackedUpRegistrationInfoFile.exists()) {
|
|
15
|
+
nonBackedUpRegistrationInfoFile.readText()
|
|
16
|
+
} else null
|
|
17
|
+
|
|
18
|
+
fun set(registrationInfo: String?) {
|
|
19
|
+
nonBackedUpRegistrationInfoFile.delete()
|
|
20
|
+
registrationInfo?.let {
|
|
21
|
+
nonBackedUpRegistrationInfoFile.writeText(it)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|