expo-notifications 0.32.13 → 0.32.15

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 (46) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/android/build.gradle +2 -2
  3. package/build/hasValidTriggerObject.d.ts +2 -0
  4. package/build/hasValidTriggerObject.d.ts.map +1 -0
  5. package/build/hasValidTriggerObject.js +5 -0
  6. package/build/hasValidTriggerObject.js.map +1 -0
  7. package/build/scheduleNotificationAsync.d.ts.map +1 -1
  8. package/build/scheduleNotificationAsync.js +4 -0
  9. package/build/scheduleNotificationAsync.js.map +1 -1
  10. package/expo-module.config.json +1 -1
  11. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.32.13/expo.modules.notifications-0.32.13.module → 0.32.15/expo.modules.notifications-0.32.15.module} +7 -7
  12. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.15/expo.modules.notifications-0.32.15.module.md5 +1 -0
  13. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.15/expo.modules.notifications-0.32.15.module.sha1 +1 -0
  14. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.15/expo.modules.notifications-0.32.15.module.sha256 +1 -0
  15. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.15/expo.modules.notifications-0.32.15.module.sha512 +1 -0
  16. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.32.13/expo.modules.notifications-0.32.13.pom → 0.32.15/expo.modules.notifications-0.32.15.pom} +1 -1
  17. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.15/expo.modules.notifications-0.32.15.pom.md5 +1 -0
  18. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.15/expo.modules.notifications-0.32.15.pom.sha1 +1 -0
  19. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.15/expo.modules.notifications-0.32.15.pom.sha256 +1 -0
  20. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.15/expo.modules.notifications-0.32.15.pom.sha512 +1 -0
  21. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/maven-metadata.xml +4 -4
  22. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/maven-metadata.xml.md5 +1 -1
  23. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/maven-metadata.xml.sha1 +1 -1
  24. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/maven-metadata.xml.sha256 +1 -1
  25. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/maven-metadata.xml.sha512 +1 -1
  26. package/package.json +6 -6
  27. package/src/hasValidTriggerObject.ts +6 -0
  28. package/src/scheduleNotificationAsync.ts +7 -1
  29. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.13/expo.modules.notifications-0.32.13.module.md5 +0 -1
  30. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.13/expo.modules.notifications-0.32.13.module.sha1 +0 -1
  31. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.13/expo.modules.notifications-0.32.13.module.sha256 +0 -1
  32. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.13/expo.modules.notifications-0.32.13.module.sha512 +0 -1
  33. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.13/expo.modules.notifications-0.32.13.pom.md5 +0 -1
  34. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.13/expo.modules.notifications-0.32.13.pom.sha1 +0 -1
  35. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.13/expo.modules.notifications-0.32.13.pom.sha256 +0 -1
  36. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.13/expo.modules.notifications-0.32.13.pom.sha512 +0 -1
  37. /package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.32.13/expo.modules.notifications-0.32.13-sources.jar → 0.32.15/expo.modules.notifications-0.32.15-sources.jar} +0 -0
  38. /package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.32.13/expo.modules.notifications-0.32.13-sources.jar.md5 → 0.32.15/expo.modules.notifications-0.32.15-sources.jar.md5} +0 -0
  39. /package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.32.13/expo.modules.notifications-0.32.13-sources.jar.sha1 → 0.32.15/expo.modules.notifications-0.32.15-sources.jar.sha1} +0 -0
  40. /package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.32.13/expo.modules.notifications-0.32.13-sources.jar.sha256 → 0.32.15/expo.modules.notifications-0.32.15-sources.jar.sha256} +0 -0
  41. /package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.32.13/expo.modules.notifications-0.32.13-sources.jar.sha512 → 0.32.15/expo.modules.notifications-0.32.15-sources.jar.sha512} +0 -0
  42. /package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.32.13/expo.modules.notifications-0.32.13.aar → 0.32.15/expo.modules.notifications-0.32.15.aar} +0 -0
  43. /package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.32.13/expo.modules.notifications-0.32.13.aar.md5 → 0.32.15/expo.modules.notifications-0.32.15.aar.md5} +0 -0
  44. /package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.32.13/expo.modules.notifications-0.32.13.aar.sha1 → 0.32.15/expo.modules.notifications-0.32.15.aar.sha1} +0 -0
  45. /package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.32.13/expo.modules.notifications-0.32.13.aar.sha256 → 0.32.15/expo.modules.notifications-0.32.15.aar.sha256} +0 -0
  46. /package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.32.13/expo.modules.notifications-0.32.13.aar.sha512 → 0.32.15/expo.modules.notifications-0.32.15.aar.sha512} +0 -0
package/CHANGELOG.md CHANGED
@@ -10,6 +10,16 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 0.32.15 — 2025-12-12
14
+
15
+ ### 🎉 New features
16
+
17
+ - improve runtime validation for NotificationTriggerInput ([#41538](https://github.com/expo/expo/pull/41538) by [@vonovak](https://github.com/vonovak))
18
+
19
+ ## 0.32.14 — 2025-12-05
20
+
21
+ _This version does not introduce any user-facing changes._
22
+
13
23
  ## 0.32.13 — 2025-11-17
14
24
 
15
25
  _This version does not introduce any user-facing changes._
@@ -5,13 +5,13 @@ plugins {
5
5
  }
6
6
 
7
7
  group = 'host.exp.exponent'
8
- version = '0.32.13'
8
+ version = '0.32.15'
9
9
 
10
10
  android {
11
11
  namespace "expo.modules.notifications"
12
12
  defaultConfig {
13
13
  versionCode 21
14
- versionName '0.32.13'
14
+ versionName '0.32.15'
15
15
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
16
16
  }
17
17
 
@@ -0,0 +1,2 @@
1
+ export declare function hasValidTriggerObject(trigger: unknown): trigger is (object & Record<"type", unknown>) | (object & Record<"channelId", unknown>) | null;
2
+ //# sourceMappingURL=hasValidTriggerObject.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hasValidTriggerObject.d.ts","sourceRoot":"","sources":["../src/hasValidTriggerObject.ts"],"names":[],"mappings":"AAAA,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,kGAKrD"}
@@ -0,0 +1,5 @@
1
+ export function hasValidTriggerObject(trigger) {
2
+ return (trigger === null ||
3
+ (typeof trigger === 'object' && ('type' in trigger || 'channelId' in trigger)));
4
+ }
5
+ //# sourceMappingURL=hasValidTriggerObject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hasValidTriggerObject.js","sourceRoot":"","sources":["../src/hasValidTriggerObject.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,qBAAqB,CAAC,OAAgB;IACpD,OAAO,CACL,OAAO,KAAK,IAAI;QAChB,CAAC,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,MAAM,IAAI,OAAO,IAAI,WAAW,IAAI,OAAO,CAAC,CAAC,CAC/E,CAAC;AACJ,CAAC","sourcesContent":["export function hasValidTriggerObject(trigger: unknown) {\n return (\n trigger === null ||\n (typeof trigger === 'object' && ('type' in trigger || 'channelId' in trigger))\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"scheduleNotificationAsync.d.ts","sourceRoot":"","sources":["../src/scheduleNotificationAsync.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,8BAA8B,EAK/B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EAEzB,MAAM,uBAAuB,CAAC;AAE/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,wBAA8B,yBAAyB,CACrD,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,MAAM,CAAC,CAUjB;AAID,wBAAgB,YAAY,CAC1B,iBAAiB,EAAE,wBAAwB,GAC1C,8BAA8B,CAmDhC"}
1
+ {"version":3,"file":"scheduleNotificationAsync.d.ts","sourceRoot":"","sources":["../src/scheduleNotificationAsync.ts"],"names":[],"mappings":"AAGA,OAAO,EAKL,8BAA8B,EAI/B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EAEzB,MAAM,uBAAuB,CAAC;AAG/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,wBAA8B,yBAAyB,CACrD,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,MAAM,CAAC,CAUjB;AAID,wBAAgB,YAAY,CAC1B,iBAAiB,EAAE,wBAAwB,GAC1C,8BAA8B,CAwDhC"}
@@ -1,6 +1,7 @@
1
1
  import { Platform, UnavailabilityError, uuid } from 'expo-modules-core';
2
2
  import NotificationScheduler from './NotificationScheduler';
3
3
  import { SchedulableTriggerInputTypes, } from './Notifications.types';
4
+ import { hasValidTriggerObject } from './hasValidTriggerObject';
4
5
  /**
5
6
  * Schedules a notification to be triggered in the future.
6
7
  * > **Note:** This does not mean that the notification will be presented when it is triggered.
@@ -74,6 +75,9 @@ export function parseTrigger(userFacingTrigger) {
74
75
  if (userFacingTrigger === undefined) {
75
76
  throw new TypeError('Encountered an `undefined` notification trigger. If you want to trigger the notification immediately, pass in an explicit `null` value.');
76
77
  }
78
+ if (!hasValidTriggerObject(userFacingTrigger)) {
79
+ throw new TypeError(`The \`trigger\` object you provided is invalid. It needs to contain a \`type\` or \`channelId\` entry. Refer to the documentation to update your code: https://docs.expo.dev/versions/latest/sdk/notifications/#notificationtriggerinput`);
80
+ }
77
81
  const dateTrigger = parseDateTrigger(userFacingTrigger);
78
82
  if (dateTrigger) {
79
83
  return dateTrigger;
@@ -1 +1 @@
1
- {"version":3,"file":"scheduleNotificationAsync.js","sourceRoot":"","sources":["../src/scheduleNotificationAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAExE,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAW5D,OAAO,EAGL,4BAA4B,GAC7B,MAAM,uBAAuB,CAAC;AAE/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,yBAAyB,CACrD,OAAiC;IAEjC,IAAI,CAAC,qBAAqB,CAAC,yBAAyB,EAAE,CAAC;QACrD,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,2BAA2B,CAAC,CAAC;IAC9E,CAAC;IAED,OAAO,MAAM,qBAAqB,CAAC,yBAAyB,CAC1D,OAAO,CAAC,UAAU,IAAI,IAAI,CAAC,EAAE,EAAE,EAC/B,OAAO,CAAC,OAAO,EACf,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAC9B,CAAC;AACJ,CAAC;AAID,MAAM,UAAU,YAAY,CAC1B,iBAA2C;IAE3C,IAAI,iBAAiB,KAAK,IAAI,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CA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K,MAAM,CAAC,CAAC,CAAC;gBACZ,MAAM,EAAE,IAAI,EAAE,GAAG,cAAc,CAAC;gBAChC,IAAI,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,EAAE,EAAE,CAAC;oBAC1B,MAAM,IAAI,UAAU,CAAC,2DAA2D,IAAI,EAAE,CAAC,CAAC;gBAC1F,CAAC;gBACD,MAAM;YACR,CAAC;YACD,KAAK,QAAQ,CAAC,CAAC,CAAC;gBACd,MAAM,EAAE,MAAM,EAAE,GAAG,cAAc,CAAC;gBAClC,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,GAAG,EAAE,EAAE,CAAC;oBAC9B,MAAM,IAAI,UAAU,CAClB,6DAA6D,MAAM,EAAE,CACtE,CAAC;gBACJ,CAAC;gBACD,MAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,SAAS,WAAW,CAAC,QAAgB,CAAC,EAAE,IAAa;IACnD,OAAO,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;AACxD,CAAC","sourcesContent":["import { Platform, UnavailabilityError, uuid } from 'expo-modules-core';\n\nimport NotificationScheduler from './NotificationScheduler';\nimport {\n NativeCalendarTriggerInput,\n NativeDailyTriggerInput,\n NativeDateTriggerInput,\n NativeNotificationTriggerInput,\n NativeTimeIntervalTriggerInput,\n NativeWeeklyTriggerInput,\n NativeMonthlyTriggerInput,\n NativeYearlyTriggerInput,\n} from './NotificationScheduler.types';\nimport {\n NotificationRequestInput,\n NotificationTriggerInput,\n SchedulableTriggerInputTypes,\n} from './Notifications.types';\n\n/**\n * Schedules a notification to be triggered in the future.\n * > **Note:** This does not mean that the notification will be presented when it is triggered.\n * For the notification to be presented you have to set a notification handler with [`setNotificationHandler`](#setnotificationhandlerhandler)\n * that will return an appropriate notification behavior. For more information see the example below.\n * @param request An object describing the notification to be triggered.\n * @return Returns a Promise resolving to a string which is a notification identifier you can later use to cancel the notification or to identify an incoming notification.\n * @example\n * # Schedule the notification that will trigger once, in one minute from now\n * ```ts\n * import * as Notifications from 'expo-notifications';\n *\n * Notifications.scheduleNotificationAsync({\n * content: {\n * title: \"Time's up!\",\n * body: 'Change sides!',\n * },\n * trigger: {\n * type: Notifications.SchedulableTriggerInputTypes.TIME_INTERVAL,\n * seconds: 60,\n * },\n * });\n * ```\n *\n * # Schedule the notification that will trigger repeatedly, every 20 minutes\n * ```ts\n * import * as Notifications from 'expo-notifications';\n *\n * Notifications.scheduleNotificationAsync({\n * content: {\n * title: 'Remember to drink water!',\n * },\n * trigger: {\n * type: Notifications.SchedulableTriggerInputTypes.TIME_INTERVAL,\n * seconds: 60 * 20,\n * repeats: true,\n * },\n * });\n * ```\n *\n * # Schedule the notification that will trigger once, at the beginning of next hour\n * ```ts\n * import * as Notifications from 'expo-notifications';\n *\n * const date = new Date(Date.now() + 60 * 60 * 1000);\n * date.setMinutes(0);\n * date.setSeconds(0);\n *\n * Notifications.scheduleNotificationAsync({\n * content: {\n * title: 'Happy new hour!',\n * },\n * trigger: {\n * type: Notifications.SchedulableTriggerInputTypes.DATE,\n * date\n * },\n * });\n * ```\n * @header schedule\n */\nexport default async function scheduleNotificationAsync(\n request: NotificationRequestInput\n): Promise<string> {\n if (!NotificationScheduler.scheduleNotificationAsync) {\n throw new UnavailabilityError('Notifications', 'scheduleNotificationAsync');\n }\n\n return await NotificationScheduler.scheduleNotificationAsync(\n request.identifier ?? uuid.v4(),\n request.content,\n parseTrigger(request.trigger)\n );\n}\n\ntype ValidTriggerDateComponents = 'month' | 'day' | 'weekday' | 'hour' | 'minute';\n\nexport function parseTrigger(\n userFacingTrigger: NotificationTriggerInput\n): NativeNotificationTriggerInput {\n if (userFacingTrigger === null) {\n return null;\n }\n\n if (userFacingTrigger === undefined) {\n throw new TypeError(\n 'Encountered an `undefined` notification trigger. If you want to trigger the notification immediately, pass in an explicit `null` value.'\n );\n }\n\n const dateTrigger = parseDateTrigger(userFacingTrigger);\n if (dateTrigger) {\n return dateTrigger;\n }\n const calendarTrigger = parseCalendarTrigger(userFacingTrigger);\n if (calendarTrigger) {\n return calendarTrigger;\n }\n const dailyTrigger = parseDailyTrigger(userFacingTrigger);\n if (dailyTrigger) {\n return dailyTrigger;\n }\n const weeklyTrigger = parseWeeklyTrigger(userFacingTrigger);\n if (weeklyTrigger) {\n return weeklyTrigger;\n }\n const monthlyTrigger = parseMonthlyTrigger(userFacingTrigger);\n if (monthlyTrigger) {\n return monthlyTrigger;\n }\n const yearlyTrigger = parseYearlyTrigger(userFacingTrigger);\n if (yearlyTrigger) {\n return yearlyTrigger;\n }\n const timeIntervalTrigger = parseTimeIntervalTrigger(userFacingTrigger);\n if (timeIntervalTrigger) {\n return timeIntervalTrigger;\n }\n return Platform.select({\n default: null, // There's no notion of channels on platforms other than Android.\n android: {\n type: 'channel',\n channelId:\n typeof userFacingTrigger === 'object' &&\n userFacingTrigger !== null &&\n !(userFacingTrigger instanceof Date)\n ? userFacingTrigger?.channelId\n : undefined,\n },\n });\n}\n\nfunction parseCalendarTrigger(\n trigger: NotificationTriggerInput\n): NativeCalendarTriggerInput | undefined {\n if (\n trigger !== null &&\n typeof trigger === 'object' &&\n 'type' in trigger &&\n trigger.type === SchedulableTriggerInputTypes.CALENDAR\n ) {\n const { repeats, ...calendarTrigger } = trigger;\n return { ...calendarTrigger, repeats: !!repeats, type: 'calendar' };\n }\n return undefined;\n}\n\nfunction parseDateTrigger(trigger: NotificationTriggerInput): NativeDateTriggerInput | undefined {\n if (trigger instanceof Date || typeof trigger === 'number') {\n // TODO @vonovak this branch is not be used by people using TS\n // but was part of the public api previously so we keep it for a bit for JS users\n console.warn(\n `You are using a deprecated parameter type (${trigger}) for the notification trigger. Use \"{ type: 'date', date: someValue }\" instead.`\n );\n return { type: 'date', timestamp: toTimestamp(trigger) };\n } else if (\n typeof trigger === 'object' &&\n trigger !== null &&\n 'type' in trigger &&\n trigger.type === SchedulableTriggerInputTypes.DATE &&\n 'date' in trigger\n ) {\n const result: NativeDateTriggerInput = {\n type: 'date',\n timestamp: toTimestamp(trigger.date),\n };\n if (trigger.channelId) {\n result.channelId = trigger.channelId;\n }\n return result;\n } else {\n return undefined;\n }\n}\n\nfunction toTimestamp(date: number | Date) {\n if (date instanceof Date) {\n return date.getTime();\n }\n return date;\n}\n\nfunction parseDailyTrigger(trigger: NotificationTriggerInput): NativeDailyTriggerInput | undefined {\n if (\n trigger !== null &&\n typeof trigger === 'object' &&\n 'type' in trigger &&\n trigger.type === SchedulableTriggerInputTypes.DAILY\n ) {\n validateDateComponentsInTrigger(trigger, ['hour', 'minute']);\n const result: NativeDailyTriggerInput = {\n type: 'daily',\n hour: trigger.hour ?? placeholderDateComponentValue,\n minute: trigger.minute ?? placeholderDateComponentValue,\n };\n if (trigger.channelId) {\n result.channelId = trigger.channelId;\n }\n return result;\n }\n return undefined;\n}\n\nfunction parseWeeklyTrigger(\n trigger: NotificationTriggerInput\n): NativeWeeklyTriggerInput | undefined {\n if (\n trigger !== null &&\n typeof trigger === 'object' &&\n 'type' in trigger &&\n trigger.type === SchedulableTriggerInputTypes.WEEKLY\n ) {\n validateDateComponentsInTrigger(trigger, ['weekday', 'hour', 'minute']);\n const result: NativeWeeklyTriggerInput = {\n type: 'weekly',\n weekday: trigger.weekday ?? placeholderDateComponentValue,\n hour: trigger.hour ?? placeholderDateComponentValue,\n minute: trigger.minute ?? placeholderDateComponentValue,\n };\n if (trigger.channelId) {\n result.channelId = trigger.channelId;\n }\n return result;\n }\n return undefined;\n}\n\nfunction parseMonthlyTrigger(\n trigger: NotificationTriggerInput\n): NativeMonthlyTriggerInput | undefined {\n if (\n trigger !== null &&\n typeof trigger === 'object' &&\n 'type' in trigger &&\n trigger.type === SchedulableTriggerInputTypes.MONTHLY\n ) {\n validateDateComponentsInTrigger(trigger, ['day', 'hour', 'minute']);\n const result: NativeMonthlyTriggerInput = {\n type: 'monthly',\n day: trigger.day ?? placeholderDateComponentValue,\n hour: trigger.hour ?? placeholderDateComponentValue,\n minute: trigger.minute ?? placeholderDateComponentValue,\n };\n if (trigger.channelId) {\n result.channelId = trigger.channelId;\n }\n return result;\n }\n return undefined;\n}\n\nfunction parseYearlyTrigger(\n trigger: NotificationTriggerInput\n): NativeYearlyTriggerInput | undefined {\n if (\n trigger !== null &&\n typeof trigger === 'object' &&\n 'type' in trigger &&\n trigger.type === SchedulableTriggerInputTypes.YEARLY\n ) {\n validateDateComponentsInTrigger(trigger, ['month', 'day', 'hour', 'minute']);\n const result: NativeYearlyTriggerInput = {\n type: 'yearly',\n month: trigger.month ?? placeholderDateComponentValue,\n day: trigger.day ?? placeholderDateComponentValue,\n hour: trigger.hour ?? placeholderDateComponentValue,\n minute: trigger.minute ?? placeholderDateComponentValue,\n };\n if (trigger.channelId) {\n result.channelId = trigger.channelId;\n }\n return result;\n }\n return undefined;\n}\n\nfunction parseTimeIntervalTrigger(\n trigger: NotificationTriggerInput\n): NativeTimeIntervalTriggerInput | undefined {\n if (\n trigger !== null &&\n typeof trigger === 'object' &&\n 'type' in trigger &&\n trigger.type === SchedulableTriggerInputTypes.TIME_INTERVAL &&\n 'seconds' in trigger &&\n typeof trigger.seconds === 'number'\n ) {\n const result: NativeTimeIntervalTriggerInput = {\n type: 'timeInterval',\n seconds: trigger.seconds,\n repeats: trigger.repeats ?? false,\n };\n if (trigger.channelId) {\n result.channelId = trigger.channelId;\n }\n return result;\n }\n return undefined;\n}\n\n// Needed only to satisfy Typescript types for validated date components\nconst placeholderDateComponentValue = -9999;\n\nfunction validateDateComponentsInTrigger(\n trigger: NonNullable<NotificationTriggerInput>,\n components: readonly ValidTriggerDateComponents[]\n) {\n const anyTriggerType = trigger as any;\n components.forEach((component) => {\n if (!(component in anyTriggerType)) {\n throw new TypeError(`The ${component} parameter needs to be present`);\n }\n if (typeof anyTriggerType[component] !== 'number') {\n throw new TypeError(`The ${component} parameter should be a number`);\n }\n switch (component) {\n case 'month': {\n const { month } = anyTriggerType;\n if (month < 0 || month > 11) {\n throw new RangeError(`The month parameter needs to be between 0 and 11. Found: ${month}`);\n }\n break;\n }\n case 'day': {\n const day = anyTriggerType.day;\n const month =\n anyTriggerType.month !== undefined ? anyTriggerType.month : new Date().getMonth();\n const daysInGivenMonth = daysInMonth(month);\n if (day < 1 || day > daysInGivenMonth) {\n throw new RangeError(\n `The day parameter for month ${month} must be between 1 and ${daysInGivenMonth}. Found: ${day}`\n );\n }\n break;\n }\n case 'weekday': {\n const { weekday } = anyTriggerType;\n if (weekday < 1 || weekday > 7) {\n throw new RangeError(\n `The weekday parameter needs to be between 1 and 7. Found: ${weekday}`\n );\n }\n break;\n }\n case 'hour': {\n const { hour } = anyTriggerType;\n if (hour < 0 || hour > 23) {\n throw new RangeError(`The hour parameter needs to be between 0 and 23. Found: ${hour}`);\n }\n break;\n }\n case 'minute': {\n const { minute } = anyTriggerType;\n if (minute < 0 || minute > 59) {\n throw new RangeError(\n `The minute parameter needs to be between 0 and 59. Found: ${minute}`\n );\n }\n break;\n }\n }\n });\n}\n\n/**\n * Determines the number of days in the given month (or January if omitted).\n * If year is specified, it will include leap year logic, else it will always assume a leap year\n */\nfunction daysInMonth(month: number = 0, year?: number) {\n return new Date(year ?? 2000, month + 1, 0).getDate();\n}\n"]}
1
+ {"version":3,"file":"scheduleNotificationAsync.js","sourceRoot":"","sources":["../src/scheduleNotificationAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAExE,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAW5D,OAAO,EAGL,4BAA4B,GAC7B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,MAAM,CAAC,OAAO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,IAAI,IAAI,IAAI,EAAE,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;AACxD,CAAC","sourcesContent":["import { Platform, UnavailabilityError, uuid } from 'expo-modules-core';\n\nimport NotificationScheduler from './NotificationScheduler';\nimport {\n NativeCalendarTriggerInput,\n NativeDailyTriggerInput,\n NativeDateTriggerInput,\n NativeMonthlyTriggerInput,\n NativeNotificationTriggerInput,\n NativeTimeIntervalTriggerInput,\n NativeWeeklyTriggerInput,\n NativeYearlyTriggerInput,\n} from './NotificationScheduler.types';\nimport {\n NotificationRequestInput,\n NotificationTriggerInput,\n SchedulableTriggerInputTypes,\n} from './Notifications.types';\nimport { hasValidTriggerObject } from './hasValidTriggerObject';\n\n/**\n * Schedules a notification to be triggered in the future.\n * > **Note:** This does not mean that the notification will be presented when it is triggered.\n * For the notification to be presented you have to set a notification handler with [`setNotificationHandler`](#setnotificationhandlerhandler)\n * that will return an appropriate notification behavior. For more information see the example below.\n * @param request An object describing the notification to be triggered.\n * @return Returns a Promise resolving to a string which is a notification identifier you can later use to cancel the notification or to identify an incoming notification.\n * @example\n * # Schedule the notification that will trigger once, in one minute from now\n * ```ts\n * import * as Notifications from 'expo-notifications';\n *\n * Notifications.scheduleNotificationAsync({\n * content: {\n * title: \"Time's up!\",\n * body: 'Change sides!',\n * },\n * trigger: {\n * type: Notifications.SchedulableTriggerInputTypes.TIME_INTERVAL,\n * seconds: 60,\n * },\n * });\n * ```\n *\n * # Schedule the notification that will trigger repeatedly, every 20 minutes\n * ```ts\n * import * as Notifications from 'expo-notifications';\n *\n * Notifications.scheduleNotificationAsync({\n * content: {\n * title: 'Remember to drink water!',\n * },\n * trigger: {\n * type: Notifications.SchedulableTriggerInputTypes.TIME_INTERVAL,\n * seconds: 60 * 20,\n * repeats: true,\n * },\n * });\n * ```\n *\n * # Schedule the notification that will trigger once, at the beginning of next hour\n * ```ts\n * import * as Notifications from 'expo-notifications';\n *\n * const date = new Date(Date.now() + 60 * 60 * 1000);\n * date.setMinutes(0);\n * date.setSeconds(0);\n *\n * Notifications.scheduleNotificationAsync({\n * content: {\n * title: 'Happy new hour!',\n * },\n * trigger: {\n * type: Notifications.SchedulableTriggerInputTypes.DATE,\n * date\n * },\n * });\n * ```\n * @header schedule\n */\nexport default async function scheduleNotificationAsync(\n request: NotificationRequestInput\n): Promise<string> {\n if (!NotificationScheduler.scheduleNotificationAsync) {\n throw new UnavailabilityError('Notifications', 'scheduleNotificationAsync');\n }\n\n return await NotificationScheduler.scheduleNotificationAsync(\n request.identifier ?? uuid.v4(),\n request.content,\n parseTrigger(request.trigger)\n );\n}\n\ntype ValidTriggerDateComponents = 'month' | 'day' | 'weekday' | 'hour' | 'minute';\n\nexport function parseTrigger(\n userFacingTrigger: NotificationTriggerInput\n): NativeNotificationTriggerInput {\n if (userFacingTrigger === null) {\n return null;\n }\n\n if (userFacingTrigger === undefined) {\n throw new TypeError(\n 'Encountered an `undefined` notification trigger. If you want to trigger the notification immediately, pass in an explicit `null` value.'\n );\n }\n\n if (!hasValidTriggerObject(userFacingTrigger)) {\n throw new TypeError(\n `The \\`trigger\\` object you provided is invalid. It needs to contain a \\`type\\` or \\`channelId\\` entry. Refer to the documentation to update your code: https://docs.expo.dev/versions/latest/sdk/notifications/#notificationtriggerinput`\n );\n }\n const dateTrigger = parseDateTrigger(userFacingTrigger);\n if (dateTrigger) {\n return dateTrigger;\n }\n const calendarTrigger = parseCalendarTrigger(userFacingTrigger);\n if (calendarTrigger) {\n return calendarTrigger;\n }\n const dailyTrigger = parseDailyTrigger(userFacingTrigger);\n if (dailyTrigger) {\n return dailyTrigger;\n }\n const weeklyTrigger = parseWeeklyTrigger(userFacingTrigger);\n if (weeklyTrigger) {\n return weeklyTrigger;\n }\n const monthlyTrigger = parseMonthlyTrigger(userFacingTrigger);\n if (monthlyTrigger) {\n return monthlyTrigger;\n }\n const yearlyTrigger = parseYearlyTrigger(userFacingTrigger);\n if (yearlyTrigger) {\n return yearlyTrigger;\n }\n const timeIntervalTrigger = parseTimeIntervalTrigger(userFacingTrigger);\n if (timeIntervalTrigger) {\n return timeIntervalTrigger;\n }\n return Platform.select({\n default: null, // There's no notion of channels on platforms other than Android.\n android: {\n type: 'channel',\n channelId:\n typeof userFacingTrigger === 'object' &&\n userFacingTrigger !== null &&\n !(userFacingTrigger instanceof Date)\n ? userFacingTrigger?.channelId\n : undefined,\n },\n });\n}\n\nfunction parseCalendarTrigger(\n trigger: NotificationTriggerInput\n): NativeCalendarTriggerInput | undefined {\n if (\n trigger !== null &&\n typeof trigger === 'object' &&\n 'type' in trigger &&\n trigger.type === SchedulableTriggerInputTypes.CALENDAR\n ) {\n const { repeats, ...calendarTrigger } = trigger;\n return { ...calendarTrigger, repeats: !!repeats, type: 'calendar' };\n }\n return undefined;\n}\n\nfunction parseDateTrigger(trigger: NotificationTriggerInput): NativeDateTriggerInput | undefined {\n if (trigger instanceof Date || typeof trigger === 'number') {\n // TODO @vonovak this branch is not be used by people using TS\n // but was part of the public api previously so we keep it for a bit for JS users\n console.warn(\n `You are using a deprecated parameter type (${trigger}) for the notification trigger. Use \"{ type: 'date', date: someValue }\" instead.`\n );\n return { type: 'date', timestamp: toTimestamp(trigger) };\n } else if (\n typeof trigger === 'object' &&\n trigger !== null &&\n 'type' in trigger &&\n trigger.type === SchedulableTriggerInputTypes.DATE &&\n 'date' in trigger\n ) {\n const result: NativeDateTriggerInput = {\n type: 'date',\n timestamp: toTimestamp(trigger.date),\n };\n if (trigger.channelId) {\n result.channelId = trigger.channelId;\n }\n return result;\n } else {\n return undefined;\n }\n}\n\nfunction toTimestamp(date: number | Date) {\n if (date instanceof Date) {\n return date.getTime();\n }\n return date;\n}\n\nfunction parseDailyTrigger(trigger: NotificationTriggerInput): NativeDailyTriggerInput | undefined {\n if (\n trigger !== null &&\n typeof trigger === 'object' &&\n 'type' in trigger &&\n trigger.type === SchedulableTriggerInputTypes.DAILY\n ) {\n validateDateComponentsInTrigger(trigger, ['hour', 'minute']);\n const result: NativeDailyTriggerInput = {\n type: 'daily',\n hour: trigger.hour ?? placeholderDateComponentValue,\n minute: trigger.minute ?? placeholderDateComponentValue,\n };\n if (trigger.channelId) {\n result.channelId = trigger.channelId;\n }\n return result;\n }\n return undefined;\n}\n\nfunction parseWeeklyTrigger(\n trigger: NotificationTriggerInput\n): NativeWeeklyTriggerInput | undefined {\n if (\n trigger !== null &&\n typeof trigger === 'object' &&\n 'type' in trigger &&\n trigger.type === SchedulableTriggerInputTypes.WEEKLY\n ) {\n validateDateComponentsInTrigger(trigger, ['weekday', 'hour', 'minute']);\n const result: NativeWeeklyTriggerInput = {\n type: 'weekly',\n weekday: trigger.weekday ?? placeholderDateComponentValue,\n hour: trigger.hour ?? placeholderDateComponentValue,\n minute: trigger.minute ?? placeholderDateComponentValue,\n };\n if (trigger.channelId) {\n result.channelId = trigger.channelId;\n }\n return result;\n }\n return undefined;\n}\n\nfunction parseMonthlyTrigger(\n trigger: NotificationTriggerInput\n): NativeMonthlyTriggerInput | undefined {\n if (\n trigger !== null &&\n typeof trigger === 'object' &&\n 'type' in trigger &&\n trigger.type === SchedulableTriggerInputTypes.MONTHLY\n ) {\n validateDateComponentsInTrigger(trigger, ['day', 'hour', 'minute']);\n const result: NativeMonthlyTriggerInput = {\n type: 'monthly',\n day: trigger.day ?? placeholderDateComponentValue,\n hour: trigger.hour ?? placeholderDateComponentValue,\n minute: trigger.minute ?? placeholderDateComponentValue,\n };\n if (trigger.channelId) {\n result.channelId = trigger.channelId;\n }\n return result;\n }\n return undefined;\n}\n\nfunction parseYearlyTrigger(\n trigger: NotificationTriggerInput\n): NativeYearlyTriggerInput | undefined {\n if (\n trigger !== null &&\n typeof trigger === 'object' &&\n 'type' in trigger &&\n trigger.type === SchedulableTriggerInputTypes.YEARLY\n ) {\n validateDateComponentsInTrigger(trigger, ['month', 'day', 'hour', 'minute']);\n const result: NativeYearlyTriggerInput = {\n type: 'yearly',\n month: trigger.month ?? placeholderDateComponentValue,\n day: trigger.day ?? placeholderDateComponentValue,\n hour: trigger.hour ?? placeholderDateComponentValue,\n minute: trigger.minute ?? placeholderDateComponentValue,\n };\n if (trigger.channelId) {\n result.channelId = trigger.channelId;\n }\n return result;\n }\n return undefined;\n}\n\nfunction parseTimeIntervalTrigger(\n trigger: NotificationTriggerInput\n): NativeTimeIntervalTriggerInput | undefined {\n if (\n trigger !== null &&\n typeof trigger === 'object' &&\n 'type' in trigger &&\n trigger.type === SchedulableTriggerInputTypes.TIME_INTERVAL &&\n 'seconds' in trigger &&\n typeof trigger.seconds === 'number'\n ) {\n const result: NativeTimeIntervalTriggerInput = {\n type: 'timeInterval',\n seconds: trigger.seconds,\n repeats: trigger.repeats ?? false,\n };\n if (trigger.channelId) {\n result.channelId = trigger.channelId;\n }\n return result;\n }\n return undefined;\n}\n\n// Needed only to satisfy Typescript types for validated date components\nconst placeholderDateComponentValue = -9999;\n\nfunction validateDateComponentsInTrigger(\n trigger: NonNullable<NotificationTriggerInput>,\n components: readonly ValidTriggerDateComponents[]\n) {\n const anyTriggerType = trigger as any;\n components.forEach((component) => {\n if (!(component in anyTriggerType)) {\n throw new TypeError(`The ${component} parameter needs to be present`);\n }\n if (typeof anyTriggerType[component] !== 'number') {\n throw new TypeError(`The ${component} parameter should be a number`);\n }\n switch (component) {\n case 'month': {\n const { month } = anyTriggerType;\n if (month < 0 || month > 11) {\n throw new RangeError(`The month parameter needs to be between 0 and 11. Found: ${month}`);\n }\n break;\n }\n case 'day': {\n const day = anyTriggerType.day;\n const month =\n anyTriggerType.month !== undefined ? anyTriggerType.month : new Date().getMonth();\n const daysInGivenMonth = daysInMonth(month);\n if (day < 1 || day > daysInGivenMonth) {\n throw new RangeError(\n `The day parameter for month ${month} must be between 1 and ${daysInGivenMonth}. Found: ${day}`\n );\n }\n break;\n }\n case 'weekday': {\n const { weekday } = anyTriggerType;\n if (weekday < 1 || weekday > 7) {\n throw new RangeError(\n `The weekday parameter needs to be between 1 and 7. Found: ${weekday}`\n );\n }\n break;\n }\n case 'hour': {\n const { hour } = anyTriggerType;\n if (hour < 0 || hour > 23) {\n throw new RangeError(`The hour parameter needs to be between 0 and 23. Found: ${hour}`);\n }\n break;\n }\n case 'minute': {\n const { minute } = anyTriggerType;\n if (minute < 0 || minute > 59) {\n throw new RangeError(\n `The minute parameter needs to be between 0 and 59. Found: ${minute}`\n );\n }\n break;\n }\n }\n });\n}\n\n/**\n * Determines the number of days in the given month (or January if omitted).\n * If year is specified, it will include leap year logic, else it will always assume a leap year\n */\nfunction daysInMonth(month: number = 0, year?: number) {\n return new Date(year ?? 2000, month + 1, 0).getDate();\n}\n"]}
@@ -33,7 +33,7 @@
33
33
  "publication": {
34
34
  "groupId": "host.exp.exponent",
35
35
  "artifactId": "expo.modules.notifications",
36
- "version": "0.32.13",
36
+ "version": "0.32.15",
37
37
  "repository": "local-maven-repo"
38
38
  }
39
39
  }
@@ -3,7 +3,7 @@
3
3
  "component": {
4
4
  "group": "host.exp.exponent",
5
5
  "module": "expo.modules.notifications",
6
- "version": "0.32.13",
6
+ "version": "0.32.15",
7
7
  "attributes": {
8
8
  "org.gradle.status": "release"
9
9
  }
@@ -24,8 +24,8 @@
24
24
  },
25
25
  "files": [
26
26
  {
27
- "name": "expo.modules.notifications-0.32.13.aar",
28
- "url": "expo.modules.notifications-0.32.13.aar",
27
+ "name": "expo.modules.notifications-0.32.15.aar",
28
+ "url": "expo.modules.notifications-0.32.15.aar",
29
29
  "size": 385184,
30
30
  "sha512": "75fcafe2e4fc8e91394b5f2068b4e85ee3212a75af260727f242c63aa0290db4dc890a1b9ff60bda008bee9d6c3d947c0c32364473925778884115281f1ddc67",
31
31
  "sha256": "b88d228f0b12d4d4368ffd0d703b032c0b384fd31773f424ab2817ec8a609878",
@@ -122,8 +122,8 @@
122
122
  ],
123
123
  "files": [
124
124
  {
125
- "name": "expo.modules.notifications-0.32.13.aar",
126
- "url": "expo.modules.notifications-0.32.13.aar",
125
+ "name": "expo.modules.notifications-0.32.15.aar",
126
+ "url": "expo.modules.notifications-0.32.15.aar",
127
127
  "size": 385184,
128
128
  "sha512": "75fcafe2e4fc8e91394b5f2068b4e85ee3212a75af260727f242c63aa0290db4dc890a1b9ff60bda008bee9d6c3d947c0c32364473925778884115281f1ddc67",
129
129
  "sha256": "b88d228f0b12d4d4368ffd0d703b032c0b384fd31773f424ab2817ec8a609878",
@@ -142,8 +142,8 @@
142
142
  },
143
143
  "files": [
144
144
  {
145
- "name": "expo.modules.notifications-0.32.13-sources.jar",
146
- "url": "expo.modules.notifications-0.32.13-sources.jar",
145
+ "name": "expo.modules.notifications-0.32.15-sources.jar",
146
+ "url": "expo.modules.notifications-0.32.15-sources.jar",
147
147
  "size": 99407,
148
148
  "sha512": "3f440b5ad0a2bc1e931aeee41a90e73a01fcfb49151052c2dda06d7fee844fa89e0279562e931009ccc6d4dcc21b3da0d3c9d8eba0a9dc9c04771570d79845fd",
149
149
  "sha256": "2674c7c733ba0f80e0d2b10696cc21141756c0d32100db7c96c942573bc9afde",
@@ -0,0 +1 @@
1
+ ad3595bbcdf4315fd8ff6ff17ec912db84ebd1a43e1085a82ff03560c1fce0c9
@@ -0,0 +1 @@
1
+ 26d669180424ca759839694edd53194701e0fc1289040cdf0a3d49ee0da51d26f19b050a65ed5f3c9053d2637098cd2d3da847cb5fcb6f59745fab0bea1d10e0
@@ -9,7 +9,7 @@
9
9
  <modelVersion>4.0.0</modelVersion>
10
10
  <groupId>host.exp.exponent</groupId>
11
11
  <artifactId>expo.modules.notifications</artifactId>
12
- <version>0.32.13</version>
12
+ <version>0.32.15</version>
13
13
  <packaging>aar</packaging>
14
14
  <name>expo.modules.notifications</name>
15
15
  <url>https://github.com/expo/expo</url>
@@ -0,0 +1 @@
1
+ 24aedc9e2941230239308e1a799e8ca1bdf90de9ea0dddf74323f4d4571e8c12
@@ -0,0 +1 @@
1
+ c352ccaa613b0e2c01c1ce22b6b3a1885c84caeb4e46cf0b3a1bb91738a190a442cb94feacddd6e019f1fe63b500ea9a496c9c814e146fefdb4e0ea7b08c0e1e
@@ -3,11 +3,11 @@
3
3
  <groupId>host.exp.exponent</groupId>
4
4
  <artifactId>expo.modules.notifications</artifactId>
5
5
  <versioning>
6
- <latest>0.32.13</latest>
7
- <release>0.32.13</release>
6
+ <latest>0.32.15</latest>
7
+ <release>0.32.15</release>
8
8
  <versions>
9
- <version>0.32.13</version>
9
+ <version>0.32.15</version>
10
10
  </versions>
11
- <lastUpdated>20251117153705</lastUpdated>
11
+ <lastUpdated>20251212085512</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- 51e6acd7f820b0e5123d732dd7dd339e
1
+ 6bf668d335cc8e5875f13a4bad960f2d
@@ -1 +1 @@
1
- fdedd9d413bd8a8ceefb34f5dd4a8ebca2fb8ade
1
+ 102124fdd0139f18405dc8382fa5e05381548da1
@@ -1 +1 @@
1
- b978a35502b59de72ffe76cfb4a0dd57e3cc1a4034b7a34c5163a6f73eb0a216
1
+ 00bfaede1a8c6891682556215b6aae25320047320edab1f8f63fdd80a614f613
@@ -1 +1 @@
1
- e2de8f081d30f8875b8373b3844f43136d88b96a4809fd76846102f5caa9427c9a98bfb1c71ec5f8291bb927df415f67ac0004cf14c2254d300f95114e793f66
1
+ 1ab57dc30d635fa6b0f8ff27d7b0e8ff80decf2619d93b1b733ab9a4d31a3fd1c479c54cfbac7f2d0cfee3adda4e6c9e51c7592e8cdf2c2ddca29ff5269fbaa2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-notifications",
3
- "version": "0.32.13",
3
+ "version": "0.32.15",
4
4
  "description": "Provides an API to fetch push notification tokens and to present, schedule, receive, and respond to notifications.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -43,16 +43,16 @@
43
43
  ]
44
44
  },
45
45
  "dependencies": {
46
- "@expo/image-utils": "^0.8.7",
46
+ "@expo/image-utils": "^0.8.8",
47
47
  "@ide/backoff": "^1.0.0",
48
48
  "abort-controller": "^3.0.0",
49
49
  "assert": "^2.0.0",
50
50
  "badgin": "^1.1.5",
51
- "expo-application": "~7.0.7",
52
- "expo-constants": "~18.0.10"
51
+ "expo-application": "~7.0.8",
52
+ "expo-constants": "~18.0.12"
53
53
  },
54
54
  "devDependencies": {
55
- "expo-module-scripts": "^5.0.7",
55
+ "expo-module-scripts": "^5.0.8",
56
56
  "memfs": "^3.2.0"
57
57
  },
58
58
  "peerDependencies": {
@@ -60,5 +60,5 @@
60
60
  "react": "*",
61
61
  "react-native": "*"
62
62
  },
63
- "gitHead": "6d7c221dc8a1994043c4f2ddcf33a16bf3e508dc"
63
+ "gitHead": "599ebc94db5c972f961641db9aa33e2964498c42"
64
64
  }
@@ -0,0 +1,6 @@
1
+ export function hasValidTriggerObject(trigger: unknown) {
2
+ return (
3
+ trigger === null ||
4
+ (typeof trigger === 'object' && ('type' in trigger || 'channelId' in trigger))
5
+ );
6
+ }
@@ -5,10 +5,10 @@ import {
5
5
  NativeCalendarTriggerInput,
6
6
  NativeDailyTriggerInput,
7
7
  NativeDateTriggerInput,
8
+ NativeMonthlyTriggerInput,
8
9
  NativeNotificationTriggerInput,
9
10
  NativeTimeIntervalTriggerInput,
10
11
  NativeWeeklyTriggerInput,
11
- NativeMonthlyTriggerInput,
12
12
  NativeYearlyTriggerInput,
13
13
  } from './NotificationScheduler.types';
14
14
  import {
@@ -16,6 +16,7 @@ import {
16
16
  NotificationTriggerInput,
17
17
  SchedulableTriggerInputTypes,
18
18
  } from './Notifications.types';
19
+ import { hasValidTriggerObject } from './hasValidTriggerObject';
19
20
 
20
21
  /**
21
22
  * Schedules a notification to be triggered in the future.
@@ -106,6 +107,11 @@ export function parseTrigger(
106
107
  );
107
108
  }
108
109
 
110
+ if (!hasValidTriggerObject(userFacingTrigger)) {
111
+ throw new TypeError(
112
+ `The \`trigger\` object you provided is invalid. It needs to contain a \`type\` or \`channelId\` entry. Refer to the documentation to update your code: https://docs.expo.dev/versions/latest/sdk/notifications/#notificationtriggerinput`
113
+ );
114
+ }
109
115
  const dateTrigger = parseDateTrigger(userFacingTrigger);
110
116
  if (dateTrigger) {
111
117
  return dateTrigger;
@@ -1 +0,0 @@
1
- 1e340c17ef889c8467c40d5dcfd6cecbe2e3d4ed9b27ffd72d34c297221ef965
@@ -1 +0,0 @@
1
- a626efb12d75ff7c12e3e76242db493e529c66a3a8075089f2b4d0ee31f549c76522f522d0e9e3a108db79a2e619f78b347b564c30c11c569ae3289f9f8558a2
@@ -1 +0,0 @@
1
- a078fc7d418adeb33bb19284cbd4ce637c1dc6da777609a809b695957f5a41ff
@@ -1 +0,0 @@
1
- dfcf3ef9eae11efa0a322f985e8d90d0c659f478931b7e70f17adebedbc1c5326a802e6b84dfccf4951867599b1b36b7b9a8d76205d49b23275947336f3ec50e