expo-notifications 0.30.0 → 0.30.1-canary-20250408-7f0ab53

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 (85) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +2 -20
  3. package/android/build.gradle +2 -2
  4. package/android/src/main/java/expo/modules/notifications/NotificationsPackage.java +0 -2
  5. package/android/src/main/java/expo/modules/notifications/Utils.kt +1 -1
  6. package/android/src/main/java/expo/modules/notifications/notifications/NotificationSerializer.java +9 -16
  7. package/android/src/main/java/expo/modules/notifications/notifications/RemoteMessageSerializer.java +1 -9
  8. package/android/src/main/java/expo/modules/notifications/notifications/channels/serializers/ExpoNotificationsChannelSerializer.java +1 -14
  9. package/android/src/main/java/expo/modules/notifications/notifications/presentation/ExpoNotificationPresentationModule.kt +0 -33
  10. package/android/src/main/java/expo/modules/notifications/notifications/presentation/builders/ExpoNotificationBuilder.kt +1 -1
  11. package/android/src/main/java/expo/modules/notifications/service/delegates/FirebaseMessagingDelegate.kt +2 -2
  12. package/android/src/main/java/expo/modules/notifications/tokens/PushTokenModule.kt +22 -36
  13. package/android/src/main/java/expo/modules/notifications/tokens/interfaces/FirebaseTokenListener.kt +14 -0
  14. package/build/NotificationPresenterModule.types.d.ts +1 -2
  15. package/build/NotificationPresenterModule.types.d.ts.map +1 -1
  16. package/build/NotificationPresenterModule.types.js.map +1 -1
  17. package/build/NotificationScheduler.types.d.ts +11 -15
  18. package/build/NotificationScheduler.types.d.ts.map +1 -1
  19. package/build/NotificationScheduler.types.js.map +1 -1
  20. package/build/Notifications.types.d.ts +1 -1
  21. package/build/Notifications.types.js.map +1 -1
  22. package/build/PushTokenManager.d.ts.map +1 -1
  23. package/build/PushTokenManager.js +7 -1
  24. package/build/PushTokenManager.js.map +1 -1
  25. package/build/PushTokenManager.types.d.ts +7 -2
  26. package/build/PushTokenManager.types.d.ts.map +1 -1
  27. package/build/PushTokenManager.types.js +5 -1
  28. package/build/PushTokenManager.types.js.map +1 -1
  29. package/build/TokenEmitter.d.ts.map +1 -1
  30. package/build/TokenEmitter.js +2 -3
  31. package/build/TokenEmitter.js.map +1 -1
  32. package/build/presentNotificationAsync.d.ts +2 -0
  33. package/build/presentNotificationAsync.d.ts.map +1 -1
  34. package/build/presentNotificationAsync.js +4 -11
  35. package/build/presentNotificationAsync.js.map +1 -1
  36. package/build/scheduleNotificationAsync.d.ts +7 -4
  37. package/build/scheduleNotificationAsync.d.ts.map +1 -1
  38. package/build/scheduleNotificationAsync.js +8 -5
  39. package/build/scheduleNotificationAsync.js.map +1 -1
  40. package/build/utils/mapNotificationResponse.d.ts +52 -12
  41. package/build/utils/mapNotificationResponse.d.ts.map +1 -1
  42. package/build/utils/mapNotificationResponse.js +16 -5
  43. package/build/utils/mapNotificationResponse.js.map +1 -1
  44. package/expo-module.config.json +7 -1
  45. package/ios/EXNotifications/Notifications/Presenting/PresentationModule.swift +1 -46
  46. package/ios/EXNotifications/Notifications/Records.swift +7 -7
  47. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.1-canary-20250408-7f0ab53/expo.modules.notifications-0.30.1-canary-20250408-7f0ab53-sources.jar +0 -0
  48. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.1-canary-20250408-7f0ab53/expo.modules.notifications-0.30.1-canary-20250408-7f0ab53-sources.jar.md5 +1 -0
  49. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.1-canary-20250408-7f0ab53/expo.modules.notifications-0.30.1-canary-20250408-7f0ab53-sources.jar.sha1 +1 -0
  50. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.1-canary-20250408-7f0ab53/expo.modules.notifications-0.30.1-canary-20250408-7f0ab53-sources.jar.sha256 +1 -0
  51. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.1-canary-20250408-7f0ab53/expo.modules.notifications-0.30.1-canary-20250408-7f0ab53-sources.jar.sha512 +1 -0
  52. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.1-canary-20250408-7f0ab53/expo.modules.notifications-0.30.1-canary-20250408-7f0ab53.aar +0 -0
  53. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.1-canary-20250408-7f0ab53/expo.modules.notifications-0.30.1-canary-20250408-7f0ab53.aar.md5 +1 -0
  54. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.1-canary-20250408-7f0ab53/expo.modules.notifications-0.30.1-canary-20250408-7f0ab53.aar.sha1 +1 -0
  55. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.1-canary-20250408-7f0ab53/expo.modules.notifications-0.30.1-canary-20250408-7f0ab53.aar.sha256 +1 -0
  56. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.1-canary-20250408-7f0ab53/expo.modules.notifications-0.30.1-canary-20250408-7f0ab53.aar.sha512 +1 -0
  57. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.1-canary-20250408-7f0ab53/expo.modules.notifications-0.30.1-canary-20250408-7f0ab53.module +156 -0
  58. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.1-canary-20250408-7f0ab53/expo.modules.notifications-0.30.1-canary-20250408-7f0ab53.module.md5 +1 -0
  59. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.1-canary-20250408-7f0ab53/expo.modules.notifications-0.30.1-canary-20250408-7f0ab53.module.sha1 +1 -0
  60. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.1-canary-20250408-7f0ab53/expo.modules.notifications-0.30.1-canary-20250408-7f0ab53.module.sha256 +1 -0
  61. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.1-canary-20250408-7f0ab53/expo.modules.notifications-0.30.1-canary-20250408-7f0ab53.module.sha512 +1 -0
  62. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.1-canary-20250408-7f0ab53/expo.modules.notifications-0.30.1-canary-20250408-7f0ab53.pom +90 -0
  63. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.1-canary-20250408-7f0ab53/expo.modules.notifications-0.30.1-canary-20250408-7f0ab53.pom.md5 +1 -0
  64. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.1-canary-20250408-7f0ab53/expo.modules.notifications-0.30.1-canary-20250408-7f0ab53.pom.sha1 +1 -0
  65. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.1-canary-20250408-7f0ab53/expo.modules.notifications-0.30.1-canary-20250408-7f0ab53.pom.sha256 +1 -0
  66. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.1-canary-20250408-7f0ab53/expo.modules.notifications-0.30.1-canary-20250408-7f0ab53.pom.sha512 +1 -0
  67. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/maven-metadata.xml +13 -0
  68. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/maven-metadata.xml.md5 +1 -0
  69. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/maven-metadata.xml.sha1 +1 -0
  70. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/maven-metadata.xml.sha256 +1 -0
  71. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/maven-metadata.xml.sha512 +1 -0
  72. package/package.json +7 -8
  73. package/src/NotificationPresenterModule.types.ts +1 -5
  74. package/src/NotificationScheduler.types.ts +11 -15
  75. package/src/Notifications.types.ts +1 -1
  76. package/src/PushTokenManager.ts +7 -1
  77. package/src/PushTokenManager.types.ts +6 -2
  78. package/src/TokenEmitter.ts +2 -3
  79. package/src/presentNotificationAsync.ts +6 -16
  80. package/src/scheduleNotificationAsync.ts +8 -5
  81. package/src/utils/mapNotificationResponse.ts +16 -5
  82. package/android/src/main/java/expo/modules/notifications/tokens/PushTokenManager.java +0 -88
  83. package/android/src/main/java/expo/modules/notifications/tokens/interfaces/FirebaseTokenListener.java +0 -16
  84. package/android/src/main/java/expo/modules/notifications/tokens/interfaces/PushTokenListener.java +0 -14
  85. package/android/src/main/java/expo/modules/notifications/tokens/interfaces/PushTokenManager.java +0 -22
package/CHANGELOG.md CHANGED
@@ -14,6 +14,12 @@
14
14
 
15
15
  ### 🐛 Bug fixes
16
16
 
17
+ - remove unneeded Long conversions on Android ([#35976](https://github.com/expo/expo/pull/35976) by [@vonovak](https://github.com/vonovak))
18
+ - [post-swift-conversion] fix data serialization ([#35975](https://github.com/expo/expo/pull/35975) by [@vonovak](https://github.com/vonovak))
19
+ - simplify push token event management ([#35944](https://github.com/expo/expo/pull/35944) by [@vonovak](https://github.com/vonovak))
20
+ - fix Android `NotificationContent` not containing JSON data object ([#35942](https://github.com/expo/expo/pull/35942) by [@vonovak](https://github.com/vonovak))
21
+ - [post-swift-conversion] fix regressions in `CalendarTriggerRecord` ([#35937](https://github.com/expo/expo/pull/35937) by [@vonovak](https://github.com/vonovak))
22
+ - remove deprecated `presentNotificationAsync` ([#35900](https://github.com/expo/expo/pull/35900) by [@vonovak](https://github.com/vonovak))
17
23
  - [post-swift-conversion] UNTextInputNotificationAction wasn't provided with options ([#35903](https://github.com/expo/expo/pull/35903) by [@vonovak](https://github.com/vonovak))
18
24
  - [post-swift-conversion] event emitter should not influence notification presentation ([#35858](https://github.com/expo/expo/pull/35858) by [@vonovak](https://github.com/vonovak))
19
25
  - correctly serialize `null` trigger on iOS ([#35672](https://github.com/expo/expo/pull/35672) by [@vonovak](https://github.com/vonovak))
package/README.md CHANGED
@@ -350,7 +350,6 @@ The following methods are exported by the `expo-notifications` module:
350
350
  - [`setBadgeCountAsync`](#setbadgecountasyncbadgecount-number-options-setbadgecountoptions-promiseboolean) -- sets the application badge number value
351
351
  - **scheduling notifications**
352
352
  - [`getAllScheduledNotificationsAsync`](#getallschedulednotificationsasync-promisenotification) -- fetches information about all scheduled notifications
353
- - [`presentNotificationAsync`](#presentnotificationasynccontent-notificationcontentinput-identifier-string-promisestring) -- schedules a notification for immediate trigger
354
353
  - [`scheduleNotificationAsync`](#schedulenotificationasyncnotificationrequest-notificationrequestinput-promisestring) -- schedules a notification to be triggered in the future
355
354
  - [`cancelScheduledNotificationAsync`](#cancelschedulednotificationasyncidentifier-string-promisevoid) -- removes a specific scheduled notification
356
355
  - [`cancelAllScheduledNotificationsAsync`](#cancelallschedulednotificationsasync-promisevoid) -- removes all scheduled notifications
@@ -901,12 +900,6 @@ Fetches information about all scheduled notifications.
901
900
 
902
901
  It returns a `Promise` resolving to an array of objects conforming to the [`Notification`](#notification) interface.
903
902
 
904
- ### `presentNotificationAsync(content: NotificationContentInput, identifier?: string): Promise<string>`
905
-
906
- Schedules a notification for immediate trigger.
907
-
908
- > **Note:** This method has been deprecated in favor of using an explicit `NotificationHandler` and the `scheduleNotificationAsync` method. More info may be found at https://expo.fyi/presenting-notifications-deprecated.
909
-
910
903
  #### Arguments
911
904
 
912
905
  The only argument to this function is a [`NotificationContentInput`](#notificationcontentinput).
@@ -917,18 +910,7 @@ It returns a `Promise` resolving with the notification's identifier once the not
917
910
 
918
911
  #### Examples
919
912
 
920
- ##### Presenting the notification to the user (deprecated way)
921
-
922
- ```ts
923
- import * as Notifications from 'expo-notifications';
924
-
925
- Notifications.presentNotificationAsync({
926
- title: 'Look at that notification',
927
- body: "I'm so proud of myself!",
928
- });
929
- ```
930
-
931
- ##### Presenting the notification to the user (recommended way)
913
+ ##### Presenting the notification to the user
932
914
 
933
915
  ```ts
934
916
  import * as Notifications from 'expo-notifications';
@@ -1415,7 +1397,7 @@ export type NotificationContent = {
1415
1397
 
1416
1398
  ### `NotificationContentInput`
1417
1399
 
1418
- An object representing notification content that you pass in to `presentNotificationAsync` or as a part of `NotificationRequestInput`.
1400
+ An object representing notification content that you pass as a part of `NotificationRequestInput`.
1419
1401
 
1420
1402
  ```ts
1421
1403
  export interface NotificationContentInput {
@@ -5,13 +5,13 @@ plugins {
5
5
  }
6
6
 
7
7
  group = 'host.exp.exponent'
8
- version = '0.30.0'
8
+ version = '0.30.1-canary-20250408-7f0ab53'
9
9
 
10
10
  android {
11
11
  namespace "expo.modules.notifications"
12
12
  defaultConfig {
13
13
  versionCode 21
14
- versionName '0.30.0'
14
+ versionName '0.30.1-canary-20250408-7f0ab53'
15
15
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
16
16
  }
17
17
 
@@ -14,7 +14,6 @@ import expo.modules.notifications.notifications.NotificationManager;
14
14
  import expo.modules.notifications.notifications.categories.serializers.ExpoNotificationsCategoriesSerializer;
15
15
  import expo.modules.notifications.notifications.channels.AndroidXNotificationsChannelsProvider;
16
16
  import expo.modules.notifications.service.delegates.ExpoNotificationLifecycleListener;
17
- import expo.modules.notifications.tokens.PushTokenManager;
18
17
 
19
18
  public class NotificationsPackage extends BasePackage {
20
19
 
@@ -27,7 +26,6 @@ public class NotificationsPackage extends BasePackage {
27
26
  @Override
28
27
  public List<SingletonModule> createSingletonModules(Context context) {
29
28
  return Arrays.asList(
30
- new PushTokenManager(),
31
29
  mNotificationManager
32
30
  );
33
31
  }
@@ -86,7 +86,7 @@ internal val isBundleConvertibleToJSValue: BundleConversionTester = { bundle: Bu
86
86
  /**
87
87
  * Returns true if the argument is a valid JSON string, false otherwise
88
88
  */
89
- internal fun isValidJSONString(test: Any?): Boolean {
89
+ internal fun isValidJSONString(test: String?): Boolean {
90
90
  when (test is String) {
91
91
  true -> {
92
92
  try {
@@ -2,6 +2,7 @@ package expo.modules.notifications.notifications;
2
2
 
3
3
  import static expo.modules.notifications.UtilsKt.filteredBundleForJSTypeConverter;
4
4
  import static expo.modules.notifications.UtilsKt.isValidJSONString;
5
+ import static expo.modules.notifications.notifications.model.NotificationResponse.DEFAULT_ACTION_IDENTIFIER;
5
6
 
6
7
  import android.os.Bundle;
7
8
 
@@ -31,12 +32,6 @@ import expo.modules.notifications.notifications.model.TextInputNotificationRespo
31
32
  import expo.modules.notifications.notifications.model.triggers.FirebaseNotificationTrigger;
32
33
 
33
34
  import expo.modules.notifications.notifications.triggers.ChannelAwareTrigger;
34
- import expo.modules.notifications.notifications.triggers.DailyTrigger;
35
- import expo.modules.notifications.notifications.triggers.DateTrigger;
36
- import expo.modules.notifications.notifications.triggers.MonthlyTrigger;
37
- import expo.modules.notifications.notifications.triggers.TimeIntervalTrigger;
38
- import expo.modules.notifications.notifications.triggers.WeeklyTrigger;
39
- import expo.modules.notifications.notifications.triggers.YearlyTrigger;
40
35
 
41
36
  public class NotificationSerializer {
42
37
  public static Bundle toBundle(NotificationResponse response) {
@@ -64,14 +59,13 @@ public class NotificationSerializer {
64
59
  Bundle content = toBundle(request.getContent());
65
60
  Bundle existingContentData = content.getBundle("data");
66
61
  if (existingContentData == null) {
67
- if(requestTrigger instanceof FirebaseNotificationTrigger trigger) {
62
+ if (requestTrigger instanceof FirebaseNotificationTrigger trigger) {
68
63
  RemoteMessage message = trigger.getRemoteMessage();
69
- RemoteMessage.Notification notification = message.getNotification();
70
64
  Map<String, String> data = message.getData();
71
65
  String dataBody = data.get("body");
72
- String notificationBody = notification != null ? notification.getBody() : null;
73
- if (isValidJSONString(dataBody) && notificationBody != null && notificationBody.equals(data.get("message"))) {
74
- // Expo sends notification.body as data.message, and JSON stringifies data.body
66
+ if (isValidJSONString(dataBody)) {
67
+ // If the body is a JSON object string, the notification was sent by the Expo notification service,
68
+ // so we do the expected remapping of fields (we JSON-parse the string into an object in JS)
75
69
  content.putString("dataString", dataBody);
76
70
  } else {
77
71
  // The message was sent directly from Firebase or some other service,
@@ -127,7 +121,7 @@ public class NotificationSerializer {
127
121
  serializedContent.putString("priority", content.getPriority().getEnumValue());
128
122
  }
129
123
  if (content.getVibrationPattern() != null) {
130
- serializedContent.putIntArray("vibrationPattern", RemoteMessageSerializer.intArrayFromLongArray(content.getVibrationPattern()));
124
+ serializedContent.putLongArray("vibrationPattern", content.getVibrationPattern());
131
125
  }
132
126
  serializedContent.putBoolean("autoDismiss", content.isAutoDismiss());
133
127
  if (content.getCategoryId() != null) {
@@ -196,9 +190,8 @@ public class NotificationSerializer {
196
190
  serializedContent.putString("title", extras.getString("title"));
197
191
  String body = extras.getString("body");
198
192
  if (isValidJSONString(body) ) {
199
- // If the body is a JSON string,
200
- // the notification was sent by the Expo notification service,
201
- // so we do the expected remapping of fields
193
+ // If the body is a JSON object string, the notification was sent by the Expo notification service,
194
+ // so we do the expected remapping of fields (we JSON-parse the string into an object in JS)
202
195
  serializedContent.putString("dataString", body);
203
196
  serializedContent.putString("body", extras.getString("message"));
204
197
  } else {
@@ -222,7 +215,7 @@ public class NotificationSerializer {
222
215
  serializedNotification.putBundle("request", serializedRequest);
223
216
 
224
217
  Bundle serializedResponse = new Bundle();
225
- serializedResponse.putString("actionIdentifier", "expo.modules.notifications.actions.DEFAULT");
218
+ serializedResponse.putString("actionIdentifier", DEFAULT_ACTION_IDENTIFIER);
226
219
  serializedResponse.putBundle("notification", serializedNotification);
227
220
 
228
221
  return serializedResponse;
@@ -95,7 +95,7 @@ public class RemoteMessageSerializer {
95
95
  serializedNotification.putStringArray("titleLocalizationArgs", notification.getTitleLocalizationArgs());
96
96
  serializedNotification.putString("titleLocalizationKey", notification.getTitleLocalizationKey());
97
97
  if (notification.getVibrateTimings() != null) {
98
- serializedNotification.putIntArray("vibrateTimings", intArrayFromLongArray(notification.getVibrateTimings()));
98
+ serializedNotification.putLongArray("vibrateTimings", notification.getVibrateTimings());
99
99
  }
100
100
  if (notification.getVisibility() != null) {
101
101
  serializedNotification.putInt("visibility", notification.getVisibility());
@@ -104,12 +104,4 @@ public class RemoteMessageSerializer {
104
104
  }
105
105
  return serializedNotification;
106
106
  }
107
-
108
- public static int[] intArrayFromLongArray(long[] longArray) {
109
- int[] intArray = new int[longArray.length];
110
- for (int i = 0; i < longArray.length; i++) {
111
- intArray[i] = (int)(longArray[i]);
112
- }
113
- return intArray;
114
- }
115
107
  }
@@ -38,7 +38,7 @@ public class ExpoNotificationsChannelSerializer implements NotificationsChannelS
38
38
  result.putBoolean(SHOW_BADGE_KEY, channel.canShowBadge());
39
39
  result.putString(SOUND_KEY, toString(channel.getSound()));
40
40
  result.putBundle(SOUND_AUDIO_ATTRIBUTES_KEY, toBundle(channel.getAudioAttributes()));
41
- result.putDoubleArray(VIBRATION_PATTERN_KEY, toArray(channel.getVibrationPattern()));
41
+ result.putLongArray(VIBRATION_PATTERN_KEY, channel.getVibrationPattern());
42
42
  result.putBoolean(ENABLE_LIGHTS_KEY, channel.shouldShowLights());
43
43
  result.putBoolean(ENABLE_VIBRATE_KEY, channel.shouldVibrate());
44
44
  return result;
@@ -85,17 +85,4 @@ public class ExpoNotificationsChannelSerializer implements NotificationsChannelS
85
85
 
86
86
  return result;
87
87
  }
88
-
89
- @Nullable
90
- private double[] toArray(@Nullable long[] array) {
91
- if (array == null) {
92
- return null;
93
- }
94
-
95
- double[] result = new double[array.length];
96
- for (int i = 0; i < array.length; i++) {
97
- result[i] = array[i];
98
- }
99
- return result;
100
- }
101
88
  }
@@ -2,24 +2,18 @@ package expo.modules.notifications.notifications.presentation
2
2
 
3
3
  import android.content.Context
4
4
  import android.os.Bundle
5
- import expo.modules.core.arguments.ReadableArguments
6
5
  import expo.modules.kotlin.Promise
7
6
  import expo.modules.kotlin.exception.Exceptions
8
7
  import expo.modules.kotlin.modules.Module
9
8
  import expo.modules.kotlin.modules.ModuleDefinition
10
9
  import expo.modules.notifications.ResultReceiverBody
11
10
  import expo.modules.notifications.createDefaultResultReceiver
12
- import expo.modules.notifications.notifications.ArgumentsNotificationContentBuilder
13
11
  import expo.modules.notifications.notifications.NotificationSerializer
14
- import expo.modules.notifications.notifications.interfaces.INotificationContent
15
- import expo.modules.notifications.notifications.interfaces.NotificationTrigger
16
12
  import expo.modules.notifications.notifications.model.Notification
17
- import expo.modules.notifications.notifications.model.NotificationRequest
18
13
  import expo.modules.notifications.service.NotificationsService
19
14
  import expo.modules.notifications.service.NotificationsService.Companion.dismiss
20
15
  import expo.modules.notifications.service.NotificationsService.Companion.dismissAll
21
16
  import expo.modules.notifications.service.NotificationsService.Companion.getAllPresented
22
- import expo.modules.notifications.service.NotificationsService.Companion.present
23
17
 
24
18
  open class ExpoNotificationPresentationModule : Module() {
25
19
  private val context: Context
@@ -31,25 +25,6 @@ open class ExpoNotificationPresentationModule : Module() {
31
25
  override fun definition() = ModuleDefinition {
32
26
  Name("ExpoNotificationPresenter")
33
27
 
34
- AsyncFunction("presentNotificationAsync") { identifier: String, payload: ReadableArguments, promise: Promise ->
35
- val content = ArgumentsNotificationContentBuilder(context).setPayload(payload).build()
36
- val request = createNotificationRequest(identifier, content, null)
37
- val notification = Notification(request)
38
- present(
39
- context,
40
- notification,
41
- null,
42
- createResultReceiver { resultCode: Int, resultData: Bundle? ->
43
- if (resultCode == NotificationsService.SUCCESS_CODE) {
44
- promise.resolve(identifier)
45
- } else {
46
- val e = resultData?.getSerializable(NotificationsService.EXCEPTION_KEY) as? Exception
47
- promise.reject("ERR_NOTIFICATION_PRESENTATION_FAILED", "Notification could not be presented.", e)
48
- }
49
- }
50
- )
51
- }
52
-
53
28
  AsyncFunction("getPresentedNotificationsAsync") { promise: Promise ->
54
29
  getAllPresented(
55
30
  context,
@@ -99,14 +74,6 @@ open class ExpoNotificationPresentationModule : Module() {
99
74
  )
100
75
  }
101
76
 
102
- protected open fun createNotificationRequest(
103
- identifier: String,
104
- content: INotificationContent,
105
- trigger: NotificationTrigger?
106
- ): NotificationRequest {
107
- return NotificationRequest(identifier, content, null)
108
- }
109
-
110
77
  protected open fun serializeNotifications(notifications: Collection<Notification>): List<Bundle> {
111
78
  return notifications.map(NotificationSerializer::toBundle)
112
79
  }
@@ -288,7 +288,7 @@ open class ExpoNotificationBuilder(
288
288
  val requestPriorityValue =
289
289
  requestPriority?.nativeValue ?: NotificationPriority.DEFAULT.nativeValue
290
290
 
291
- // TODO (barthap): This is going to be a dead code upon removing presentNotificationAsync()
291
+ // TODO (barthap, vonovak): This is going to be a dead code upon removing presentNotificationAsync()
292
292
  // shouldShowAlert() will always be false here.
293
293
  return if (notificationBehavior.shouldShowAlert()) {
294
294
  // Display as a heads-up notification, as per the behavior
@@ -49,8 +49,8 @@ open class FirebaseMessagingDelegate(protected val context: Context) : FirebaseM
49
49
  if (!sTokenListenersReferences.containsKey(listener)) {
50
50
  sTokenListenersReferences[listener] = WeakReference(listener)
51
51
  // Since it's a new listener and we know of a last valid token, let's let them know.
52
- if (sLastToken != null) {
53
- listener.onNewToken(sLastToken)
52
+ sLastToken?.let {
53
+ listener.onNewToken(it)
54
54
  }
55
55
  }
56
56
  }
@@ -1,43 +1,43 @@
1
1
  package expo.modules.notifications.tokens
2
2
 
3
- import android.os.Bundle
4
3
  import com.google.firebase.messaging.FirebaseMessaging
5
- import expo.modules.core.interfaces.services.EventEmitter
6
4
  import expo.modules.kotlin.Promise
7
5
  import expo.modules.kotlin.modules.Module
8
6
  import expo.modules.kotlin.modules.ModuleDefinition
9
- import expo.modules.notifications.ModuleNotFoundException
10
- import expo.modules.notifications.tokens.interfaces.PushTokenListener
11
- import expo.modules.notifications.tokens.interfaces.PushTokenManager
7
+ import expo.modules.notifications.service.delegates.FirebaseMessagingDelegate.Companion.addTokenListener
8
+ import expo.modules.notifications.tokens.interfaces.FirebaseTokenListener
12
9
 
13
10
  private const val NEW_TOKEN_EVENT_NAME = "onDevicePushToken"
14
11
  private const val NEW_TOKEN_EVENT_TOKEN_KEY = "devicePushToken"
15
12
  private const val REGISTRATION_FAIL_CODE = "E_REGISTRATION_FAILED"
16
13
  private const val UNREGISTER_FOR_NOTIFICATIONS_FAIL_CODE = "E_UNREGISTER_FOR_NOTIFICATIONS_FAILED"
17
14
 
18
- class PushTokenModule : Module(), PushTokenListener {
19
- private val tokenManager: PushTokenManager? get() = appContext.legacyModuleRegistry
20
- .getSingletonModule("PushTokenManager", PushTokenManager::class.java)
21
- private var eventEmitter: EventEmitter? = null
15
+ class PushTokenModule : Module(), FirebaseTokenListener {
16
+
17
+ init {
18
+ addTokenListener(this@PushTokenModule)
19
+ }
20
+
21
+ /**
22
+ * Callback called when [FirebaseMessagingDelegate] gets notified of a new token.
23
+ * Emits a [NEW_TOKEN_EVENT_NAME] event.
24
+ *
25
+ * @param token New push token.
26
+ */
27
+ override fun onNewToken(token: String) {
28
+ sendEvent(
29
+ NEW_TOKEN_EVENT_NAME,
30
+ mapOf(
31
+ NEW_TOKEN_EVENT_TOKEN_KEY to token
32
+ )
33
+ )
34
+ }
22
35
 
23
36
  override fun definition() = ModuleDefinition {
24
37
  Name("ExpoPushTokenManager")
25
38
 
26
39
  Events("onDevicePushToken")
27
40
 
28
- OnCreate {
29
- eventEmitter = appContext.legacyModule()
30
- ?: throw ModuleNotFoundException(EventEmitter::class)
31
-
32
- // Register the module as a listener in PushTokenManager singleton module.
33
- // Deregistration happens in onDestroy callback.
34
- tokenManager?.addListener(this@PushTokenModule)
35
- }
36
-
37
- OnDestroy {
38
- tokenManager?.removeListener(this@PushTokenModule)
39
- }
40
-
41
41
  /**
42
42
  * Fetches Firebase push token and resolves the promise.
43
43
  *
@@ -88,18 +88,4 @@ class PushTokenModule : Module(), PushTokenListener {
88
88
  null
89
89
  }
90
90
  }
91
-
92
- /**
93
- * Callback called when [PushTokenManager] gets notified of a new token.
94
- * Emits a [NEW_TOKEN_EVENT_NAME] event.
95
- *
96
- * @param token New push token.
97
- */
98
- override fun onNewToken(token: String) {
99
- eventEmitter?.let {
100
- val eventBody = Bundle()
101
- eventBody.putString(NEW_TOKEN_EVENT_TOKEN_KEY, token)
102
- it.emit(NEW_TOKEN_EVENT_NAME, eventBody)
103
- }
104
- }
105
91
  }
@@ -0,0 +1,14 @@
1
+ package expo.modules.notifications.tokens.interfaces
2
+
3
+ /**
4
+ * Interface used to register in [NotificationsService]
5
+ * and be notified of new device push tokens.
6
+ */
7
+ interface FirebaseTokenListener {
8
+ /**
9
+ * Callback called when new push token is generated.
10
+ *
11
+ * @param token New push token
12
+ */
13
+ fun onNewToken(token: String)
14
+ }
@@ -1,8 +1,7 @@
1
1
  import { ProxyNativeModule } from 'expo-modules-core';
2
- import { Notification, NotificationContentInput } from './Notifications.types';
2
+ import { Notification } from './Notifications.types';
3
3
  export interface NotificationPresenterModule extends ProxyNativeModule {
4
4
  getPresentedNotificationsAsync?: () => Promise<Notification[]>;
5
- presentNotificationAsync?: (identifier: string, content: NotificationContentInput) => Promise<string>;
6
5
  dismissNotificationAsync?: (identifier: string) => Promise<void>;
7
6
  dismissAllNotificationsAsync?: () => Promise<void>;
8
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationPresenterModule.types.d.ts","sourceRoot":"","sources":["../src/NotificationPresenterModule.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAE/E,MAAM,WAAW,2BAA4B,SAAQ,iBAAiB;IACpE,8BAA8B,CAAC,EAAE,MAAM,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;IAC/D,wBAAwB,CAAC,EAAE,CACzB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,wBAAwB,KAC9B,OAAO,CAAC,MAAM,CAAC,CAAC;IACrB,wBAAwB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE,4BAA4B,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACpD"}
1
+ {"version":3,"file":"NotificationPresenterModule.types.d.ts","sourceRoot":"","sources":["../src/NotificationPresenterModule.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,MAAM,WAAW,2BAA4B,SAAQ,iBAAiB;IACpE,8BAA8B,CAAC,EAAE,MAAM,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;IAC/D,wBAAwB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE,4BAA4B,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACpD"}
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationPresenterModule.types.js","sourceRoot":"","sources":["../src/NotificationPresenterModule.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ProxyNativeModule } from 'expo-modules-core';\n\nimport { Notification, NotificationContentInput } from './Notifications.types';\n\nexport interface NotificationPresenterModule extends ProxyNativeModule {\n getPresentedNotificationsAsync?: () => Promise<Notification[]>;\n presentNotificationAsync?: (\n identifier: string,\n content: NotificationContentInput\n ) => Promise<string>;\n dismissNotificationAsync?: (identifier: string) => Promise<void>;\n dismissAllNotificationsAsync?: () => Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"NotificationPresenterModule.types.js","sourceRoot":"","sources":["../src/NotificationPresenterModule.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ProxyNativeModule } from 'expo-modules-core';\n\nimport { Notification } from './Notifications.types';\n\nexport interface NotificationPresenterModule extends ProxyNativeModule {\n getPresentedNotificationsAsync?: () => Promise<Notification[]>;\n dismissNotificationAsync?: (identifier: string) => Promise<void>;\n dismissAllNotificationsAsync?: () => Promise<void>;\n}\n"]}
@@ -1,18 +1,5 @@
1
1
  import { ProxyNativeModule } from 'expo-modules-core';
2
2
  import { NotificationRequest, NotificationContentInput } from './Notifications.types';
3
- type CalendarTriggerInputValue = {
4
- timezone?: string;
5
- year?: number;
6
- month?: number;
7
- weekday?: number;
8
- weekOfMonth?: number;
9
- weekOfYear?: number;
10
- weekdayOrdinal?: number;
11
- day?: number;
12
- hour?: number;
13
- minute?: number;
14
- second?: number;
15
- };
16
3
  export interface NotificationSchedulerModule extends ProxyNativeModule {
17
4
  getAllScheduledNotificationsAsync?: () => Promise<NotificationRequest[]>;
18
5
  scheduleNotificationAsync?: (identifier: string, notificationContent: NotificationContentInput, trigger: NativeNotificationTriggerInput) => Promise<string>;
@@ -28,7 +15,17 @@ export interface NativeCalendarTriggerInput {
28
15
  type: 'calendar';
29
16
  channelId?: string;
30
17
  repeats?: boolean;
31
- value: CalendarTriggerInputValue;
18
+ timezone?: string;
19
+ year?: number;
20
+ month?: number;
21
+ weekday?: number;
22
+ weekOfMonth?: number;
23
+ weekOfYear?: number;
24
+ weekdayOrdinal?: number;
25
+ day?: number;
26
+ hour?: number;
27
+ minute?: number;
28
+ second?: number;
32
29
  }
33
30
  export interface NativeTimeIntervalTriggerInput {
34
31
  type: 'timeInterval';
@@ -70,5 +67,4 @@ export interface NativeDateTriggerInput {
70
67
  timestamp: number;
71
68
  }
72
69
  export type NativeNotificationTriggerInput = null | NativeChannelAwareTriggerInput | NativeDateTriggerInput | NativeCalendarTriggerInput | NativeTimeIntervalTriggerInput | NativeDailyTriggerInput | NativeWeeklyTriggerInput | NativeMonthlyTriggerInput | NativeYearlyTriggerInput;
73
- export {};
74
70
  //# sourceMappingURL=NotificationScheduler.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationScheduler.types.d.ts","sourceRoot":"","sources":["../src/NotificationScheduler.types.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"NotificationScheduler.types.d.ts","sourceRoot":"","sources":["../src/NotificationScheduler.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEtF,MAAM,WAAW,2BAA4B,SAAQ,iBAAiB;IACpE,iCAAiC,CAAC,EAAE,MAAM,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC;IACzE,yBAAyB,CAAC,EAAE,CAC1B,UAAU,EAAE,MAAM,EAClB,mBAAmB,EAAE,wBAAwB,EAC7C,OAAO,EAAE,8BAA8B,KACpC,OAAO,CAAC,MAAM,CAAC,CAAC;IACrB,gCAAgC,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzE,oCAAoC,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D,uBAAuB,CAAC,EAAE,CAAC,OAAO,EAAE,8BAA8B,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACxF;AAED,MAAM,WAAW,8BAA8B;IAC7C,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAGD,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,8BAA8B;IAC7C,IAAI,EAAE,cAAc,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,8BAA8B,GACtC,IAAI,GACJ,8BAA8B,GAC9B,sBAAsB,GACtB,0BAA0B,GAC1B,8BAA8B,GAC9B,uBAAuB,GACvB,wBAAwB,GACxB,yBAAyB,GACzB,wBAAwB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationScheduler.types.js","sourceRoot":"","sources":["../src/NotificationScheduler.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ProxyNativeModule } from 'expo-modules-core';\n\nimport { NotificationRequest, NotificationContentInput } from './Notifications.types';\n\ntype CalendarTriggerInputValue = {\n timezone?: string;\n year?: number;\n month?: number;\n weekday?: number;\n weekOfMonth?: number;\n weekOfYear?: number;\n weekdayOrdinal?: number;\n day?: number;\n hour?: number;\n minute?: number;\n second?: number;\n};\n\nexport interface NotificationSchedulerModule extends ProxyNativeModule {\n getAllScheduledNotificationsAsync?: () => Promise<NotificationRequest[]>;\n scheduleNotificationAsync?: (\n identifier: string,\n notificationContent: NotificationContentInput,\n trigger: NativeNotificationTriggerInput\n ) => Promise<string>;\n cancelScheduledNotificationAsync?: (identifier: string) => Promise<void>;\n cancelAllScheduledNotificationsAsync?: () => Promise<void>;\n getNextTriggerDateAsync?: (trigger: NativeNotificationTriggerInput) => Promise<number>;\n}\n\nexport interface NativeChannelAwareTriggerInput {\n type: 'channel';\n channelId?: string;\n}\n\n// ISO8601 calendar pattern-matching\nexport interface NativeCalendarTriggerInput {\n type: 'calendar';\n channelId?: string;\n repeats?: boolean;\n value: CalendarTriggerInputValue;\n}\n\nexport interface NativeTimeIntervalTriggerInput {\n type: 'timeInterval';\n channelId?: string;\n repeats: boolean;\n seconds: number;\n}\n\nexport interface NativeDailyTriggerInput {\n type: 'daily';\n channelId?: string;\n hour: number;\n minute: number;\n}\n\nexport interface NativeWeeklyTriggerInput {\n type: 'weekly';\n channelId?: string;\n weekday: number;\n hour: number;\n minute: number;\n}\n\nexport interface NativeYearlyTriggerInput {\n type: 'yearly';\n channelId?: string;\n day: number;\n month: number;\n hour: number;\n minute: number;\n}\n\nexport interface NativeMonthlyTriggerInput {\n type: 'monthly';\n channelId?: string;\n day: number;\n hour: number;\n minute: number;\n}\n\nexport interface NativeDateTriggerInput {\n type: 'date';\n channelId?: string;\n timestamp: number; // seconds since 1970\n}\n\nexport type NativeNotificationTriggerInput =\n | null\n | NativeChannelAwareTriggerInput\n | NativeDateTriggerInput\n | NativeCalendarTriggerInput\n | NativeTimeIntervalTriggerInput\n | NativeDailyTriggerInput\n | NativeWeeklyTriggerInput\n | NativeMonthlyTriggerInput\n | NativeYearlyTriggerInput;\n"]}
1
+ {"version":3,"file":"NotificationScheduler.types.js","sourceRoot":"","sources":["../src/NotificationScheduler.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ProxyNativeModule } from 'expo-modules-core';\n\nimport { NotificationRequest, NotificationContentInput } from './Notifications.types';\n\nexport interface NotificationSchedulerModule extends ProxyNativeModule {\n getAllScheduledNotificationsAsync?: () => Promise<NotificationRequest[]>;\n scheduleNotificationAsync?: (\n identifier: string,\n notificationContent: NotificationContentInput,\n trigger: NativeNotificationTriggerInput\n ) => Promise<string>;\n cancelScheduledNotificationAsync?: (identifier: string) => Promise<void>;\n cancelAllScheduledNotificationsAsync?: () => Promise<void>;\n getNextTriggerDateAsync?: (trigger: NativeNotificationTriggerInput) => Promise<number>;\n}\n\nexport interface NativeChannelAwareTriggerInput {\n type: 'channel';\n channelId?: string;\n}\n\n// ISO8601 calendar pattern-matching\nexport interface NativeCalendarTriggerInput {\n type: 'calendar';\n channelId?: string;\n repeats?: boolean;\n timezone?: string;\n year?: number;\n month?: number;\n weekday?: number;\n weekOfMonth?: number;\n weekOfYear?: number;\n weekdayOrdinal?: number;\n day?: number;\n hour?: number;\n minute?: number;\n second?: number;\n}\n\nexport interface NativeTimeIntervalTriggerInput {\n type: 'timeInterval';\n channelId?: string;\n repeats: boolean;\n seconds: number;\n}\n\nexport interface NativeDailyTriggerInput {\n type: 'daily';\n channelId?: string;\n hour: number;\n minute: number;\n}\n\nexport interface NativeWeeklyTriggerInput {\n type: 'weekly';\n channelId?: string;\n weekday: number;\n hour: number;\n minute: number;\n}\n\nexport interface NativeYearlyTriggerInput {\n type: 'yearly';\n channelId?: string;\n day: number;\n month: number;\n hour: number;\n minute: number;\n}\n\nexport interface NativeMonthlyTriggerInput {\n type: 'monthly';\n channelId?: string;\n day: number;\n hour: number;\n minute: number;\n}\n\nexport interface NativeDateTriggerInput {\n type: 'date';\n channelId?: string;\n timestamp: number; // seconds since 1970\n}\n\nexport type NativeNotificationTriggerInput =\n | null\n | NativeChannelAwareTriggerInput\n | NativeDateTriggerInput\n | NativeCalendarTriggerInput\n | NativeTimeIntervalTriggerInput\n | NativeDailyTriggerInput\n | NativeWeeklyTriggerInput\n | NativeMonthlyTriggerInput\n | NativeYearlyTriggerInput;\n"]}
@@ -487,7 +487,7 @@ export interface NotificationRequest {
487
487
  trigger: NotificationTrigger;
488
488
  }
489
489
  /**
490
- * An object which represents notification content that you pass in to `presentNotificationAsync` or as a part of `NotificationRequestInput`.
490
+ * An object which represents notification content that you pass in as a part of `NotificationRequestInput`.
491
491
  */
492
492
  export type NotificationContentInput = {
493
493
  /**