expo-notifications 0.32.14 → 0.32.16
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/CHANGELOG.md +16 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/notifications/notifications/enums/NotificationImportance.java +4 -0
- package/android/src/main/java/expo/modules/notifications/tokens/PushTokenModule.kt +9 -5
- package/build/NotificationChannelManager.types.d.ts +3 -0
- package/build/NotificationChannelManager.types.d.ts.map +1 -1
- package/build/NotificationChannelManager.types.js +3 -0
- package/build/NotificationChannelManager.types.js.map +1 -1
- package/build/hasValidTriggerObject.d.ts +2 -0
- package/build/hasValidTriggerObject.d.ts.map +1 -0
- package/build/hasValidTriggerObject.js +5 -0
- package/build/hasValidTriggerObject.js.map +1 -0
- package/build/scheduleNotificationAsync.d.ts.map +1 -1
- package/build/scheduleNotificationAsync.js +4 -0
- package/build/scheduleNotificationAsync.js.map +1 -1
- package/build/setNotificationChannelAsync.android.d.ts.map +1 -1
- package/build/setNotificationChannelAsync.android.js +6 -0
- package/build/setNotificationChannelAsync.android.js.map +1 -1
- package/expo-module.config.json +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.32.14/expo.modules.notifications-0.32.14-sources.jar → 0.32.16/expo.modules.notifications-0.32.16-sources.jar} +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.16/expo.modules.notifications-0.32.16-sources.jar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.16/expo.modules.notifications-0.32.16-sources.jar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.16/expo.modules.notifications-0.32.16-sources.jar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.16/expo.modules.notifications-0.32.16-sources.jar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.32.14/expo.modules.notifications-0.32.14.aar → 0.32.16/expo.modules.notifications-0.32.16.aar} +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.16/expo.modules.notifications-0.32.16.aar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.16/expo.modules.notifications-0.32.16.aar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.16/expo.modules.notifications-0.32.16.aar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.16/expo.modules.notifications-0.32.16.aar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.32.14/expo.modules.notifications-0.32.14.module → 0.32.16/expo.modules.notifications-0.32.16.module} +22 -22
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.16/expo.modules.notifications-0.32.16.module.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.16/expo.modules.notifications-0.32.16.module.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.16/expo.modules.notifications-0.32.16.module.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.16/expo.modules.notifications-0.32.16.module.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.32.14/expo.modules.notifications-0.32.14.pom → 0.32.16/expo.modules.notifications-0.32.16.pom} +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.16/expo.modules.notifications-0.32.16.pom.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.16/expo.modules.notifications-0.32.16.pom.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.16/expo.modules.notifications-0.32.16.pom.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.16/expo.modules.notifications-0.32.16.pom.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/maven-metadata.xml +4 -4
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/maven-metadata.xml.sha512 +1 -1
- package/package.json +3 -3
- package/src/NotificationChannelManager.types.ts +3 -0
- package/src/hasValidTriggerObject.ts +6 -0
- package/src/scheduleNotificationAsync.ts +7 -1
- package/src/setNotificationChannelAsync.android.ts +12 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.14/expo.modules.notifications-0.32.14-sources.jar.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.14/expo.modules.notifications-0.32.14-sources.jar.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.14/expo.modules.notifications-0.32.14-sources.jar.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.14/expo.modules.notifications-0.32.14-sources.jar.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.14/expo.modules.notifications-0.32.14.aar.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.14/expo.modules.notifications-0.32.14.aar.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.14/expo.modules.notifications-0.32.14.aar.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.14/expo.modules.notifications-0.32.14.aar.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.14/expo.modules.notifications-0.32.14.module.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.14/expo.modules.notifications-0.32.14.module.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.14/expo.modules.notifications-0.32.14.module.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.14/expo.modules.notifications-0.32.14.module.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.14/expo.modules.notifications-0.32.14.pom.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.14/expo.modules.notifications-0.32.14.pom.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.14/expo.modules.notifications-0.32.14.pom.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.14/expo.modules.notifications-0.32.14.pom.sha512 +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,22 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 0.32.16 — 2026-01-06
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug fixes
|
|
16
|
+
|
|
17
|
+
- [android] avoid crash emitting new token event when module is destroyed ([#41754](https://github.com/expo/expo/pull/41754) by [@vonovak](https://github.com/vonovak))
|
|
18
|
+
|
|
19
|
+
### 💡 Others
|
|
20
|
+
|
|
21
|
+
- mark `NotificationImportance.UNSPECIFIED` as not suitable for use ([#41709](https://github.com/expo/expo/pull/41709) by [@vonovak](https://github.com/vonovak))
|
|
22
|
+
|
|
23
|
+
## 0.32.15 — 2025-12-12
|
|
24
|
+
|
|
25
|
+
### 🎉 New features
|
|
26
|
+
|
|
27
|
+
- improve runtime validation for NotificationTriggerInput ([#41538](https://github.com/expo/expo/pull/41538) by [@vonovak](https://github.com/vonovak))
|
|
28
|
+
|
|
13
29
|
## 0.32.14 — 2025-12-05
|
|
14
30
|
|
|
15
31
|
_This version does not introduce any user-facing changes._
|
package/android/build.gradle
CHANGED
|
@@ -5,13 +5,13 @@ plugins {
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
group = 'host.exp.exponent'
|
|
8
|
-
version = '0.32.
|
|
8
|
+
version = '0.32.16'
|
|
9
9
|
|
|
10
10
|
android {
|
|
11
11
|
namespace "expo.modules.notifications"
|
|
12
12
|
defaultConfig {
|
|
13
13
|
versionCode 21
|
|
14
|
-
versionName '0.32.
|
|
14
|
+
versionName '0.32.16'
|
|
15
15
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -3,6 +3,10 @@ package expo.modules.notifications.notifications.enums;
|
|
|
3
3
|
import androidx.core.app.NotificationManagerCompat;
|
|
4
4
|
|
|
5
5
|
public enum NotificationImportance {
|
|
6
|
+
/**
|
|
7
|
+
* IMPORTANCE_UNSPECIFIED fails validation in com.android.server.notification.PreferencesHelper.createNotificationChannel
|
|
8
|
+
* and it should not be used
|
|
9
|
+
* */
|
|
6
10
|
UNSPECIFIED(NotificationManagerCompat.IMPORTANCE_UNSPECIFIED, 1),
|
|
7
11
|
NONE(NotificationManagerCompat.IMPORTANCE_NONE, 2),
|
|
8
12
|
MIN(NotificationManagerCompat.IMPORTANCE_MIN, 3),
|
|
@@ -20,12 +20,16 @@ class PushTokenModule : Module(), FirebaseTokenListener {
|
|
|
20
20
|
* @param token New push token.
|
|
21
21
|
*/
|
|
22
22
|
override fun onNewToken(token: String) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
runCatching {
|
|
24
|
+
// onNewToken is emitted asynchronously and the module may be destroyed by the time sendEvent is called
|
|
25
|
+
// that would result in an exception
|
|
26
|
+
sendEvent(
|
|
27
|
+
NEW_TOKEN_EVENT_NAME,
|
|
28
|
+
mapOf(
|
|
29
|
+
NEW_TOKEN_EVENT_TOKEN_KEY to token
|
|
30
|
+
)
|
|
27
31
|
)
|
|
28
|
-
|
|
32
|
+
}
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
override fun definition() = ModuleDefinition {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationChannelManager.types.d.ts","sourceRoot":"","sources":["../src/Notification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CAAC,IAAI,CAAC,CAAC;CACvE"}
|
|
1
|
+
{"version":3,"file":"NotificationChannelManager.types.d.ts","sourceRoot":"","sources":["../src/NotificationChannelManager.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGtD,oBAAY,6BAA6B;IACvC,OAAO,IAAI;IACX,MAAM,IAAI;IACV,OAAO,IAAI;IACX,MAAM,IAAI;CACX;AAGD,oBAAY,uBAAuB;IACjC,OAAO,IAAI;IACX,MAAM,IAAI;IACV,KAAK,IAAI;IACT,KAAK,IAAI;IACT,YAAY,IAAI;CACjB;AAGD,oBAAY,iBAAiB;IAC3B,OAAO,IAAI;IACX;;SAEK;IACL,WAAW,IAAI;IACf,IAAI,IAAI;IACR,GAAG,IAAI;IACP,GAAG,IAAI;IACP,OAAO,IAAI;IACX,IAAI,IAAI;IACR,GAAG,IAAI;CACR;AAGD,oBAAY,iBAAiB;IAC3B,OAAO,IAAI;IACX,KAAK,IAAI;IACT,mBAAmB,IAAI;IACvB,8BAA8B,IAAI;IAClC,KAAK,IAAI;IACT,YAAY,IAAI;IAChB,qBAAqB,IAAI;IACzB,kCAAkC,IAAI;IACtC,kCAAkC,IAAI;IACtC,kCAAkC,IAAI;IACtC,kBAAkB,KAAK;IACvB,wBAAwB,KAAK;IAC7B,8BAA8B,KAAK;IACnC,uBAAuB,KAAK;IAC5B,IAAI,KAAK;CACV;AAGD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,iBAAiB,CAAC;IACzB,WAAW,EAAE,uBAAuB,CAAC;IACrC,KAAK,EAAE;QACL,iBAAiB,EAAE,OAAO,CAAC;QAC3B,wCAAwC,EAAE,OAAO,CAAC;KACnD,CAAC;CACH;AAKD,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAE5D;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAA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AC3C,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;IACzC,8BAA8B,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACvE"}
|
|
@@ -19,6 +19,9 @@ export var AndroidAudioContentType;
|
|
|
19
19
|
export var AndroidImportance;
|
|
20
20
|
(function (AndroidImportance) {
|
|
21
21
|
AndroidImportance[AndroidImportance["UNKNOWN"] = 0] = "UNKNOWN";
|
|
22
|
+
/**
|
|
23
|
+
* Use `DEFAULT` instead. This value is present for compatibility reasons.
|
|
24
|
+
* */
|
|
22
25
|
AndroidImportance[AndroidImportance["UNSPECIFIED"] = 1] = "UNSPECIFIED";
|
|
23
26
|
AndroidImportance[AndroidImportance["NONE"] = 2] = "NONE";
|
|
24
27
|
AndroidImportance[AndroidImportance["MIN"] = 3] = "MIN";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationChannelManager.types.js","sourceRoot":"","sources":["../src/NotificationChannelManager.types.ts"],"names":[],"mappings":"AAEA,eAAe;AACf,MAAM,CAAN,IAAY,6BAKX;AALD,WAAY,6BAA6B;IACvC,uFAAW,CAAA;IACX,qFAAU,CAAA;IACV,uFAAW,CAAA;IACX,qFAAU,CAAA;AACZ,CAAC,EALW,6BAA6B,KAA7B,6BAA6B,QAKxC;AAED,eAAe;AACf,MAAM,CAAN,IAAY,uBAMX;AAND,WAAY,uBAAuB;IACjC,2EAAW,CAAA;IACX,yEAAU,CAAA;IACV,uEAAS,CAAA;IACT,uEAAS,CAAA;IACT,qFAAgB,CAAA;AAClB,CAAC,EANW,uBAAuB,KAAvB,uBAAuB,QAMlC;AAED,eAAe;AACf,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"NotificationChannelManager.types.js","sourceRoot":"","sources":["../src/NotificationChannelManager.types.ts"],"names":[],"mappings":"AAEA,eAAe;AACf,MAAM,CAAN,IAAY,6BAKX;AALD,WAAY,6BAA6B;IACvC,uFAAW,CAAA;IACX,qFAAU,CAAA;IACV,uFAAW,CAAA;IACX,qFAAU,CAAA;AACZ,CAAC,EALW,6BAA6B,KAA7B,6BAA6B,QAKxC;AAED,eAAe;AACf,MAAM,CAAN,IAAY,uBAMX;AAND,WAAY,uBAAuB;IACjC,2EAAW,CAAA;IACX,yEAAU,CAAA;IACV,uEAAS,CAAA;IACT,uEAAS,CAAA;IACT,qFAAgB,CAAA;AAClB,CAAC,EANW,uBAAuB,KAAvB,uBAAuB,QAMlC;AAED,eAAe;AACf,MAAM,CAAN,IAAY,iBAYX;AAZD,WAAY,iBAAiB;IAC3B,+DAAW,CAAA;IACX;;SAEK;IACL,uEAAe,CAAA;IACf,yDAAQ,CAAA;IACR,uDAAO,CAAA;IACP,uDAAO,CAAA;IACP,+DAAW,CAAA;IACX,yDAAQ,CAAA;IACR,uDAAO,CAAA;AACT,CAAC,EAZW,iBAAiB,KAAjB,iBAAiB,QAY5B;AAED,eAAe;AACf,MAAM,CAAN,IAAY,iBAgBX;AAhBD,WAAY,iBAAiB;IAC3B,+DAAW,CAAA;IACX,2DAAS,CAAA;IACT,uFAAuB,CAAA;IACvB,6GAAkC,CAAA;IAClC,2DAAS,CAAA;IACT,yEAAgB,CAAA;IAChB,2FAAyB,CAAA;IACzB,qHAAsC,CAAA;IACtC,qHAAsC,CAAA;IACtC,qHAAsC,CAAA;IACtC,sFAAuB,CAAA;IACvB,kGAA6B,CAAA;IAC7B,8GAAmC,CAAA;IACnC,gGAA4B,CAAA;IAC5B,0DAAS,CAAA;AACX,CAAC,EAhBW,iBAAiB,KAAjB,iBAAiB,QAgB5B","sourcesContent":["import { ProxyNativeModule } from 'expo-modules-core';\n\n// @docsMissing\nexport enum AndroidNotificationVisibility {\n UNKNOWN = 0,\n PUBLIC = 1,\n PRIVATE = 2,\n SECRET = 3,\n}\n\n// @docsMissing\nexport enum AndroidAudioContentType {\n UNKNOWN = 0,\n SPEECH = 1,\n MUSIC = 2,\n MOVIE = 3,\n SONIFICATION = 4,\n}\n\n// @docsMissing\nexport enum AndroidImportance {\n UNKNOWN = 0,\n /**\n * Use `DEFAULT` instead. This value is present for compatibility reasons.\n * */\n UNSPECIFIED = 1,\n NONE = 2,\n MIN = 3,\n LOW = 4,\n DEFAULT = 5,\n HIGH = 6,\n MAX = 7,\n}\n\n// @docsMissing\nexport enum AndroidAudioUsage {\n UNKNOWN = 0,\n MEDIA = 1,\n VOICE_COMMUNICATION = 2,\n VOICE_COMMUNICATION_SIGNALLING = 3,\n ALARM = 4,\n NOTIFICATION = 5,\n NOTIFICATION_RINGTONE = 6,\n NOTIFICATION_COMMUNICATION_REQUEST = 7,\n NOTIFICATION_COMMUNICATION_INSTANT = 8,\n NOTIFICATION_COMMUNICATION_DELAYED = 9,\n NOTIFICATION_EVENT = 10,\n ASSISTANCE_ACCESSIBILITY = 11,\n ASSISTANCE_NAVIGATION_GUIDANCE = 12,\n ASSISTANCE_SONIFICATION = 13,\n GAME = 14,\n}\n\n// @docsMissing\nexport interface AudioAttributes {\n usage: AndroidAudioUsage;\n contentType: AndroidAudioContentType;\n flags: {\n enforceAudibility: boolean;\n requestHardwareAudioVideoSynchronization: boolean;\n };\n}\n\n// We're making inner flags required to set intentionally.\n// Not providing `true` for a flag makes it false, it doesn't make sense\n// to let it be left undefined.\nexport type AudioAttributesInput = Partial<AudioAttributes>;\n\n/**\n * An object which represents a notification channel.\n * @platform android\n */\nexport interface NotificationChannel {\n id: string;\n name: string | null;\n importance: AndroidImportance;\n bypassDnd: boolean;\n description: string | null;\n groupId?: string | null;\n lightColor: string;\n lockscreenVisibility: AndroidNotificationVisibility;\n showBadge: boolean;\n sound: 'default' | 'custom' | null;\n audioAttributes: AudioAttributes;\n vibrationPattern: number[] | null;\n enableLights: boolean;\n enableVibrate: boolean;\n}\n\nexport type RequiredBy<T, K extends keyof T> = Partial<Omit<T, K>> & Required<Pick<T, K>>;\n\n/**\n * An object which represents a notification channel to be set.\n * @platform android\n */\nexport type NotificationChannelInput = RequiredBy<\n Omit<\n NotificationChannel,\n | 'id' // id is handled separately as a function argument\n | 'audioAttributes' // need to make it AudioAttributesInput\n | 'sound'\n > & { audioAttributes?: AudioAttributesInput; sound?: string | null },\n 'name' | 'importance'\n>;\n\nexport interface NotificationChannelManager extends ProxyNativeModule {\n getNotificationChannelsAsync?: () => Promise<NotificationChannel[] | null>;\n getNotificationChannelAsync?: (channelId: string) => Promise<NotificationChannel | null>;\n setNotificationChannelAsync?: (\n channelId: string,\n channelConfiguration: NotificationChannelInput\n ) => Promise<NotificationChannel | null>;\n deleteNotificationChannelAsync?: (channelId: string) => Promise<void>;\n}\n"]}
|
|
@@ -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 @@
|
|
|
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,
|
|
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":"AA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ACD,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,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;I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,CAAC,EAAE,CAAC;oBAC/B,MAAM,IAAI,UAAU,CAClB,6DAA6D,OAAO,EAAE,CACvE,CAAC;gBACJ,CAAC;gBACD,MAAM;YACR,CAAC;YACD,KAAK,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 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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setNotificationChannelAsync.android.d.ts","sourceRoot":"","sources":["../src/setNotificationChannelAsync.android.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"setNotificationChannelAsync.android.d.ts","sourceRoot":"","sources":["../src/setNotificationChannelAsync.android.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EAEpB,MAAM,oCAAoC,CAAC;AAE5C,wBAA8B,2BAA2B,CACvD,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAarC"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { UnavailabilityError } from 'expo-modules-core';
|
|
2
2
|
import NotificationChannelManager from './NotificationChannelManager';
|
|
3
|
+
import { AndroidImportance, } from './NotificationChannelManager.types';
|
|
3
4
|
export default async function setNotificationChannelAsync(channelId, channel) {
|
|
4
5
|
if (!NotificationChannelManager.setNotificationChannelAsync) {
|
|
5
6
|
throw new UnavailabilityError('Notifications', 'setNotificationChannelAsync');
|
|
6
7
|
}
|
|
8
|
+
if (channel?.importance === AndroidImportance.UNSPECIFIED) {
|
|
9
|
+
console.warn(`Warning: You are setting the importance of the notification channel "${channelId}" to "UNSPECIFIED". ` +
|
|
10
|
+
`This may lead to errors on some Android versions. ` +
|
|
11
|
+
`It's recommended to instead use AndroidImportance.DEFAULT.`);
|
|
12
|
+
}
|
|
7
13
|
return await NotificationChannelManager.setNotificationChannelAsync(channelId, channel);
|
|
8
14
|
}
|
|
9
15
|
//# sourceMappingURL=setNotificationChannelAsync.android.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setNotificationChannelAsync.android.js","sourceRoot":"","sources":["../src/setNotificationChannelAsync.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,0BAA0B,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"setNotificationChannelAsync.android.js","sourceRoot":"","sources":["../src/setNotificationChannelAsync.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,0BAA0B,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAGL,iBAAiB,GAClB,MAAM,oCAAoC,CAAC;AAE5C,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,2BAA2B,CACvD,SAAiB,EACjB,OAAiC;IAEjC,IAAI,CAAC,0BAA0B,CAAC,2BAA2B,EAAE,CAAC;QAC5D,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,6BAA6B,CAAC,CAAC;IAChF,CAAC;IAED,IAAI,OAAO,EAAE,UAAU,KAAK,iBAAiB,CAAC,WAAW,EAAE,CAAC;QAC1D,OAAO,CAAC,IAAI,CACV,wEAAwE,SAAS,sBAAsB;YACrG,oDAAoD;YACpD,4DAA4D,CAC/D,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,0BAA0B,CAAC,2BAA2B,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAC1F,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport NotificationChannelManager from './NotificationChannelManager';\nimport {\n NotificationChannelInput,\n NotificationChannel,\n AndroidImportance,\n} from './NotificationChannelManager.types';\n\nexport default async function setNotificationChannelAsync(\n channelId: string,\n channel: NotificationChannelInput\n): Promise<NotificationChannel | null> {\n if (!NotificationChannelManager.setNotificationChannelAsync) {\n throw new UnavailabilityError('Notifications', 'setNotificationChannelAsync');\n }\n\n if (channel?.importance === AndroidImportance.UNSPECIFIED) {\n console.warn(\n `Warning: You are setting the importance of the notification channel \"${channelId}\" to \"UNSPECIFIED\". ` +\n `This may lead to errors on some Android versions. ` +\n `It's recommended to instead use AndroidImportance.DEFAULT.`\n );\n }\n return await NotificationChannelManager.setNotificationChannelAsync(channelId, channel);\n}\n"]}
|
package/expo-module.config.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a38139afac3cb19d995773ce25f29c8e
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
671674d316adabd0f3fab56be019ecbf2e74cc60
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1dc6d57311206e18aaf930501d9ebe65b2082a117d3c7e19e46e4d273765e303
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
7847bd35440d2d7ba46401fef6683d15c6b696ef077cd6a9458ee787c15783419facd8006981a70cc7c9b3aae3349c516a2d5d365a0a4d8d72d4dbb7269e8ddb
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3d8eef10ef7a77cc63f9f35ae7adee5a
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
9a331b9f4b0afc71ead9f33625f66a5702bba869
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
bc423d5d9749c677df1fe6855ea2e1c85687947b758dad00605d7a5dd5f05110
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
7469c28dbe35acc053c3c2f4769c0cd80eea0cf4ad6a5d90f9517e4411240724aa560398b2ab279255bc9f0a7740701f34327155c17779ca4b0e45a344cad571
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"component": {
|
|
4
4
|
"group": "host.exp.exponent",
|
|
5
5
|
"module": "expo.modules.notifications",
|
|
6
|
-
"version": "0.32.
|
|
6
|
+
"version": "0.32.16",
|
|
7
7
|
"attributes": {
|
|
8
8
|
"org.gradle.status": "release"
|
|
9
9
|
}
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
{
|
|
27
|
-
"name": "expo.modules.notifications-0.32.
|
|
28
|
-
"url": "expo.modules.notifications-0.32.
|
|
29
|
-
"size":
|
|
30
|
-
"sha512": "
|
|
31
|
-
"sha256": "
|
|
32
|
-
"sha1": "
|
|
33
|
-
"md5": "
|
|
27
|
+
"name": "expo.modules.notifications-0.32.16.aar",
|
|
28
|
+
"url": "expo.modules.notifications-0.32.16.aar",
|
|
29
|
+
"size": 385426,
|
|
30
|
+
"sha512": "7469c28dbe35acc053c3c2f4769c0cd80eea0cf4ad6a5d90f9517e4411240724aa560398b2ab279255bc9f0a7740701f34327155c17779ca4b0e45a344cad571",
|
|
31
|
+
"sha256": "bc423d5d9749c677df1fe6855ea2e1c85687947b758dad00605d7a5dd5f05110",
|
|
32
|
+
"sha1": "9a331b9f4b0afc71ead9f33625f66a5702bba869",
|
|
33
|
+
"md5": "3d8eef10ef7a77cc63f9f35ae7adee5a"
|
|
34
34
|
}
|
|
35
35
|
]
|
|
36
36
|
},
|
|
@@ -122,13 +122,13 @@
|
|
|
122
122
|
],
|
|
123
123
|
"files": [
|
|
124
124
|
{
|
|
125
|
-
"name": "expo.modules.notifications-0.32.
|
|
126
|
-
"url": "expo.modules.notifications-0.32.
|
|
127
|
-
"size":
|
|
128
|
-
"sha512": "
|
|
129
|
-
"sha256": "
|
|
130
|
-
"sha1": "
|
|
131
|
-
"md5": "
|
|
125
|
+
"name": "expo.modules.notifications-0.32.16.aar",
|
|
126
|
+
"url": "expo.modules.notifications-0.32.16.aar",
|
|
127
|
+
"size": 385426,
|
|
128
|
+
"sha512": "7469c28dbe35acc053c3c2f4769c0cd80eea0cf4ad6a5d90f9517e4411240724aa560398b2ab279255bc9f0a7740701f34327155c17779ca4b0e45a344cad571",
|
|
129
|
+
"sha256": "bc423d5d9749c677df1fe6855ea2e1c85687947b758dad00605d7a5dd5f05110",
|
|
130
|
+
"sha1": "9a331b9f4b0afc71ead9f33625f66a5702bba869",
|
|
131
|
+
"md5": "3d8eef10ef7a77cc63f9f35ae7adee5a"
|
|
132
132
|
}
|
|
133
133
|
]
|
|
134
134
|
},
|
|
@@ -142,13 +142,13 @@
|
|
|
142
142
|
},
|
|
143
143
|
"files": [
|
|
144
144
|
{
|
|
145
|
-
"name": "expo.modules.notifications-0.32.
|
|
146
|
-
"url": "expo.modules.notifications-0.32.
|
|
147
|
-
"size":
|
|
148
|
-
"sha512": "
|
|
149
|
-
"sha256": "
|
|
150
|
-
"sha1": "
|
|
151
|
-
"md5": "
|
|
145
|
+
"name": "expo.modules.notifications-0.32.16-sources.jar",
|
|
146
|
+
"url": "expo.modules.notifications-0.32.16-sources.jar",
|
|
147
|
+
"size": 99572,
|
|
148
|
+
"sha512": "7847bd35440d2d7ba46401fef6683d15c6b696ef077cd6a9458ee787c15783419facd8006981a70cc7c9b3aae3349c516a2d5d365a0a4d8d72d4dbb7269e8ddb",
|
|
149
|
+
"sha256": "1dc6d57311206e18aaf930501d9ebe65b2082a117d3c7e19e46e4d273765e303",
|
|
150
|
+
"sha1": "671674d316adabd0f3fab56be019ecbf2e74cc60",
|
|
151
|
+
"md5": "a38139afac3cb19d995773ce25f29c8e"
|
|
152
152
|
}
|
|
153
153
|
]
|
|
154
154
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
6cab568ba2aac18bccf04e3b4b69ed40
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
52da0a8fff5f7decf384fccafc525499bf85b6b5
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
4de68a62a6b816fede592cbcbc28924f72c2ff5fb97923b3ede6d2dcf8788b9d
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
4b91adfcb9e41505f10fee9e80c8203797b4601d1dd491ce8f9698a9b5cf13354b9af3a6d4367cd6e84fc4cb9da34e5908d387349085dae59979be84e58121b0
|
|
@@ -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.
|
|
12
|
+
<version>0.32.16</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
|
+
8b4c69c6f288d5fbad80439851cca498
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1ee9e0cc38198fa01f4ed820673fb4f988e172ed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
61d4a668e0a38971af46d6753095f065cae450703d15b4d970c0569e0987e9a6
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
b0036d6fdddb3ad2a590afaafe8366d709a64e7489e90cacd701db12859f7f1b45396afc9459e4828e39cf636589b1f00dcf6e3e7750d94a1b2117403e6399ed
|
|
@@ -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.
|
|
7
|
-
<release>0.32.
|
|
6
|
+
<latest>0.32.16</latest>
|
|
7
|
+
<release>0.32.16</release>
|
|
8
8
|
<versions>
|
|
9
|
-
<version>0.32.
|
|
9
|
+
<version>0.32.16</version>
|
|
10
10
|
</versions>
|
|
11
|
-
<lastUpdated>
|
|
11
|
+
<lastUpdated>20260106233044</lastUpdated>
|
|
12
12
|
</versioning>
|
|
13
13
|
</metadata>
|
package/local-maven-repo/host/exp/exponent/expo.modules.notifications/maven-metadata.xml.md5
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
cf268b880a86c099bd35e9a0b7c40578
|
package/local-maven-repo/host/exp/exponent/expo.modules.notifications/maven-metadata.xml.sha1
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
428c471418bea8961b71577c12ceab88e30e844a
|
package/local-maven-repo/host/exp/exponent/expo.modules.notifications/maven-metadata.xml.sha256
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
e3e7b3ec64b6c472ad7c30756d6dc0506052374e3650925f2f90ffdd2a505bcc
|
package/local-maven-repo/host/exp/exponent/expo.modules.notifications/maven-metadata.xml.sha512
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
6aaa091ebfb9f085a4b124641b0ad29f0f649c81d60c62a36f29456e89c834e1d2259eeb496fac4f30f1f46e1d2ea2f8c6685a1ed4b3ef4c5e56d2d3d251c1cb
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-notifications",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.16",
|
|
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",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"assert": "^2.0.0",
|
|
50
50
|
"badgin": "^1.1.5",
|
|
51
51
|
"expo-application": "~7.0.8",
|
|
52
|
-
"expo-constants": "~18.0.
|
|
52
|
+
"expo-constants": "~18.0.13"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"expo-module-scripts": "^5.0.8",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"react": "*",
|
|
61
61
|
"react-native": "*"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "e615daa250a27c60da3cea1f0572dcde93df5b68"
|
|
64
64
|
}
|
|
@@ -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,7 +1,11 @@
|
|
|
1
1
|
import { UnavailabilityError } from 'expo-modules-core';
|
|
2
2
|
|
|
3
3
|
import NotificationChannelManager from './NotificationChannelManager';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
NotificationChannelInput,
|
|
6
|
+
NotificationChannel,
|
|
7
|
+
AndroidImportance,
|
|
8
|
+
} from './NotificationChannelManager.types';
|
|
5
9
|
|
|
6
10
|
export default async function setNotificationChannelAsync(
|
|
7
11
|
channelId: string,
|
|
@@ -11,5 +15,12 @@ export default async function setNotificationChannelAsync(
|
|
|
11
15
|
throw new UnavailabilityError('Notifications', 'setNotificationChannelAsync');
|
|
12
16
|
}
|
|
13
17
|
|
|
18
|
+
if (channel?.importance === AndroidImportance.UNSPECIFIED) {
|
|
19
|
+
console.warn(
|
|
20
|
+
`Warning: You are setting the importance of the notification channel "${channelId}" to "UNSPECIFIED". ` +
|
|
21
|
+
`This may lead to errors on some Android versions. ` +
|
|
22
|
+
`It's recommended to instead use AndroidImportance.DEFAULT.`
|
|
23
|
+
);
|
|
24
|
+
}
|
|
14
25
|
return await NotificationChannelManager.setNotificationChannelAsync(channelId, channel);
|
|
15
26
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
26b870ecb6040de42f6cfa1a5caad419
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
c04acc3b1369624a875d78158cd92ab7fc941043
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2674c7c733ba0f80e0d2b10696cc21141756c0d32100db7c96c942573bc9afde
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3f440b5ad0a2bc1e931aeee41a90e73a01fcfb49151052c2dda06d7fee844fa89e0279562e931009ccc6d4dcc21b3da0d3c9d8eba0a9dc9c04771570d79845fd
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
02b90c5af6b9e46fdecff4078fda30e2
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
14759938e29335ec7a016ef07d987e0e9b73eb5d
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
b88d228f0b12d4d4368ffd0d703b032c0b384fd31773f424ab2817ec8a609878
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
75fcafe2e4fc8e91394b5f2068b4e85ee3212a75af260727f242c63aa0290db4dc890a1b9ff60bda008bee9d6c3d947c0c32364473925778884115281f1ddc67
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
68b4651bc55a751cd82fb07f0f0d709d
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
f40c2433efd790589944ef432c97af42fac65a34
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
329e75afede0b36def6081265e2ea13c5334514256a25203ebd6dedbcfbf6930
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
efc6b9a7f7064041feb0ac4124e709cba10e20bfc3ed9b00cae78693834611f0177cf76a41c399ea765a4c3a1f6681391a75639e51a127c56f46b115d94b951f
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
92928080de21af79dac2055a84348c85
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
96b345de27c6470a64bc40d6955d461dfe03a40a
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
b57b461865876e42578a2311ac9ec9abc5b6363a4b41876d149fff734b8e195c
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
91ef7596cac76fb2ea67bcc30f0bd13c91ed8370e6f59c11d39ac8aaa8c2ec773c720c55afc2e53b598f9e700eef063559750671b8cf728ff38146edd3f32cf1
|