expo-notifications 0.30.2 → 0.30.4
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 +8 -0
- package/android/build.gradle +2 -2
- package/build/NotificationPermissions.d.ts.map +1 -1
- package/build/NotificationPermissions.js +1 -0
- package/build/NotificationPermissions.js.map +1 -1
- package/build/NotificationsHandler.d.ts.map +1 -1
- package/build/NotificationsHandler.js +1 -0
- package/build/NotificationsHandler.js.map +1 -1
- package/build/TokenEmitter.js +1 -2
- package/build/TokenEmitter.js.map +1 -1
- package/build/setBadgeCountAsync.js +2 -1
- package/build/setBadgeCountAsync.js.map +1 -1
- package/build/utils/mapNotificationResponse.d.ts +11 -11
- package/build/utils/mapNotificationResponse.d.ts.map +1 -1
- package/build/utils/mapNotificationResponse.js +1 -0
- package/build/utils/mapNotificationResponse.js.map +1 -1
- package/build/utils/updateDevicePushTokenAsync.js +3 -3
- package/build/utils/updateDevicePushTokenAsync.js.map +1 -1
- package/expo-module.config.json +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.30.2/expo.modules.notifications-0.30.2.module → 0.30.4/expo.modules.notifications-0.30.4.module} +7 -7
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.4/expo.modules.notifications-0.30.4.module.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.4/expo.modules.notifications-0.30.4.module.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.4/expo.modules.notifications-0.30.4.module.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.4/expo.modules.notifications-0.30.4.module.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.30.2/expo.modules.notifications-0.30.2.pom → 0.30.4/expo.modules.notifications-0.30.4.pom} +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.4/expo.modules.notifications-0.30.4.pom.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.4/expo.modules.notifications-0.30.4.pom.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.4/expo.modules.notifications-0.30.4.pom.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.4/expo.modules.notifications-0.30.4.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 +6 -6
- package/src/NotificationPermissions.ts +4 -2
- package/src/NotificationsHandler.ts +2 -1
- package/src/TokenEmitter.ts +3 -3
- package/src/setBadgeCountAsync.ts +2 -2
- package/src/utils/mapNotificationResponse.ts +1 -0
- package/src/utils/updateDevicePushTokenAsync.ts +3 -3
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.2/expo.modules.notifications-0.30.2.module.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.2/expo.modules.notifications-0.30.2.module.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.2/expo.modules.notifications-0.30.2.module.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.2/expo.modules.notifications-0.30.2.module.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.2/expo.modules.notifications-0.30.2.pom.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.2/expo.modules.notifications-0.30.2.pom.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.2/expo.modules.notifications-0.30.2.pom.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.30.2/expo.modules.notifications-0.30.2.pom.sha512 +0 -1
- /package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.30.2/expo.modules.notifications-0.30.2-sources.jar → 0.30.4/expo.modules.notifications-0.30.4-sources.jar} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.30.2/expo.modules.notifications-0.30.2-sources.jar.md5 → 0.30.4/expo.modules.notifications-0.30.4-sources.jar.md5} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.30.2/expo.modules.notifications-0.30.2-sources.jar.sha1 → 0.30.4/expo.modules.notifications-0.30.4-sources.jar.sha1} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.30.2/expo.modules.notifications-0.30.2-sources.jar.sha256 → 0.30.4/expo.modules.notifications-0.30.4-sources.jar.sha256} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.30.2/expo.modules.notifications-0.30.2-sources.jar.sha512 → 0.30.4/expo.modules.notifications-0.30.4-sources.jar.sha512} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.30.2/expo.modules.notifications-0.30.2.aar → 0.30.4/expo.modules.notifications-0.30.4.aar} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.30.2/expo.modules.notifications-0.30.2.aar.md5 → 0.30.4/expo.modules.notifications-0.30.4.aar.md5} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.30.2/expo.modules.notifications-0.30.2.aar.sha1 → 0.30.4/expo.modules.notifications-0.30.4.aar.sha1} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.30.2/expo.modules.notifications-0.30.2.aar.sha256 → 0.30.4/expo.modules.notifications-0.30.4.aar.sha256} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.30.2/expo.modules.notifications-0.30.2.aar.sha512 → 0.30.4/expo.modules.notifications-0.30.4.aar.sha512} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,14 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 0.30.4 — 2025-04-14
|
|
14
|
+
|
|
15
|
+
_This version does not introduce any user-facing changes._
|
|
16
|
+
|
|
17
|
+
## 0.30.3 — 2025-04-14
|
|
18
|
+
|
|
19
|
+
_This version does not introduce any user-facing changes._
|
|
20
|
+
|
|
13
21
|
## 0.30.2 — 2025-04-09
|
|
14
22
|
|
|
15
23
|
### 🐛 Bug fixes
|
package/android/build.gradle
CHANGED
|
@@ -5,13 +5,13 @@ plugins {
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
group = 'host.exp.exponent'
|
|
8
|
-
version = '0.30.
|
|
8
|
+
version = '0.30.4'
|
|
9
9
|
|
|
10
10
|
android {
|
|
11
11
|
namespace "expo.modules.notifications"
|
|
12
12
|
defaultConfig {
|
|
13
13
|
versionCode 21
|
|
14
|
-
versionName '0.30.
|
|
14
|
+
versionName '0.30.4'
|
|
15
15
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationPermissions.d.ts","sourceRoot":"","sources":["../src/NotificationPermissions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,8BAA8B,EAAE,MAAM,iCAAiC,CAAC;AAGjF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,mBAAmB,qFAMxC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,uBAAuB,CAAC,WAAW,CAAC,EAAE,8BAA8B,
|
|
1
|
+
{"version":3,"file":"NotificationPermissions.d.ts","sourceRoot":"","sources":["../src/NotificationPermissions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,8BAA8B,EAAE,MAAM,iCAAiC,CAAC;AAGjF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,mBAAmB,qFAMxC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,uBAAuB,CAAC,WAAW,CAAC,EAAE,8BAA8B,oFAgBzF"}
|
|
@@ -59,6 +59,7 @@ export async function requestPermissionsAsync(permissions) {
|
|
|
59
59
|
},
|
|
60
60
|
};
|
|
61
61
|
const requestedPlatformPermissions = requestedPermissions[Platform.OS];
|
|
62
|
+
// TODO(@kitten): This never checks whether the configuration object is undefined
|
|
62
63
|
return await NotificationPermissionsModule.requestPermissionsAsync(requestedPlatformPermissions);
|
|
63
64
|
}
|
|
64
65
|
//# sourceMappingURL=NotificationPermissions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationPermissions.js","sourceRoot":"","sources":["../src/NotificationPermissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGlE,OAAO,6BAA6B,MAAM,iCAAiC,CAAC;AAE5E;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB;IACvC,IAAI,CAAC,6BAA6B,CAAC,mBAAmB,EAAE,CAAC;QACvD,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,qBAAqB,CAAC,CAAC;IACxE,CAAC;IAED,OAAO,MAAM,6BAA6B,CAAC,mBAAmB,EAAE,CAAC;AACnE,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,WAA4C;IACxF,IAAI,CAAC,6BAA6B,CAAC,uBAAuB,EAAE,CAAC;QAC3D,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,yBAAyB,CAAC,CAAC;IAC5E,CAAC;IAED,MAAM,oBAAoB,GAAG,WAAW,IAAI;QAC1C,GAAG,EAAE;YACH,UAAU,EAAE,IAAI;YAChB,UAAU,EAAE,IAAI;YAChB,UAAU,EAAE,IAAI;SACjB;KACF,CAAC;IACF,MAAM,4BAA4B,
|
|
1
|
+
{"version":3,"file":"NotificationPermissions.js","sourceRoot":"","sources":["../src/NotificationPermissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGlE,OAAO,6BAA6B,MAAM,iCAAiC,CAAC;AAE5E;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB;IACvC,IAAI,CAAC,6BAA6B,CAAC,mBAAmB,EAAE,CAAC;QACvD,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,qBAAqB,CAAC,CAAC;IACxE,CAAC;IAED,OAAO,MAAM,6BAA6B,CAAC,mBAAmB,EAAE,CAAC;AACnE,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,WAA4C;IACxF,IAAI,CAAC,6BAA6B,CAAC,uBAAuB,EAAE,CAAC;QAC3D,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,yBAAyB,CAAC,CAAC;IAC5E,CAAC;IAED,MAAM,oBAAoB,GAAG,WAAW,IAAI;QAC1C,GAAG,EAAE;YACH,UAAU,EAAE,IAAI;YAChB,UAAU,EAAE,IAAI;YAChB,UAAU,EAAE,IAAI;SACjB;KACF,CAAC;IACF,MAAM,4BAA4B,GAChC,oBAAoB,CAAC,QAAQ,CAAC,EAAuC,CAAC,CAAC;IACzE,iFAAiF;IACjF,OAAO,MAAM,6BAA6B,CAAC,uBAAuB,CAAC,4BAA6B,CAAC,CAAC;AACpG,CAAC","sourcesContent":["import { Platform, UnavailabilityError } from 'expo-modules-core';\n\nimport { NotificationPermissionsRequest } from './NotificationPermissions.types';\nimport NotificationPermissionsModule from './NotificationPermissionsModule';\n\n/**\n * Calling this function checks current permissions settings related to notifications.\n * It lets you verify whether the app is currently allowed to display alerts, play sounds, etc.\n * There is no user-facing effect of calling this.\n * @return It returns a `Promise` resolving to an object represents permission settings ([`NotificationPermissionsStatus`](#notificationpermissionsstatus)).\n * On iOS, make sure you [properly interpret the permissions response](#interpret-the-ios-permissions-response).\n * @example Check if the app is allowed to send any type of notifications (interrupting and non-interrupting–provisional on iOS).\n * ```ts\n * import * as Notifications from 'expo-notifications';\n *\n * export async function allowsNotificationsAsync() {\n * const settings = await Notifications.getPermissionsAsync();\n * return (\n * settings.granted || settings.ios?.status === Notifications.IosAuthorizationStatus.PROVISIONAL\n * );\n * }\n * ```\n * @header permissions\n */\nexport async function getPermissionsAsync() {\n if (!NotificationPermissionsModule.getPermissionsAsync) {\n throw new UnavailabilityError('Notifications', 'getPermissionsAsync');\n }\n\n return await NotificationPermissionsModule.getPermissionsAsync();\n}\n\n/**\n * Prompts the user for notification permissions according to request. **Request defaults to asking the user to allow displaying alerts,\n * setting badge count and playing sounds**.\n * @param permissions An object representing configuration for the request scope.\n * @return It returns a Promise resolving to an object represents permission settings ([`NotificationPermissionsStatus`](#notificationpermissionsstatus)).\n * On iOS, make sure you [properly interpret the permissions response](#interpret-the-ios-permissions-response).\n * @example Prompts the user to allow the app to show alerts, play sounds, set badge count and let Siri read out messages through AirPods.\n * ```ts\n * import * as Notifications from 'expo-notifications';\n *\n * export function requestPermissionsAsync() {\n * return await Notifications.requestPermissionsAsync({\n * ios: {\n * allowAlert: true,\n * allowBadge: true,\n * allowSound: true,\n * },\n * });\n * }\n * ```\n * @header permissions\n */\nexport async function requestPermissionsAsync(permissions?: NotificationPermissionsRequest) {\n if (!NotificationPermissionsModule.requestPermissionsAsync) {\n throw new UnavailabilityError('Notifications', 'requestPermissionsAsync');\n }\n\n const requestedPermissions = permissions ?? {\n ios: {\n allowAlert: true,\n allowBadge: true,\n allowSound: true,\n },\n };\n const requestedPlatformPermissions =\n requestedPermissions[Platform.OS as keyof typeof requestedPermissions];\n // TODO(@kitten): This never checks whether the configuration object is undefined\n return await NotificationPermissionsModule.requestPermissionsAsync(requestedPlatformPermissions!);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationsHandler.d.ts","sourceRoot":"","sources":["../src/NotificationsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAEX,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAG3E;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,UAAU;IACtD,IAAI,EAAE;QAAE,YAAY,EAAE,YAAY,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;gBACrC,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY;CAI/D;AAGD,MAAM,MAAM,yBAAyB,GAAG,wBAAwB,GAAG,KAAK,CAAC;AAEzE,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,kBAAkB,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAClF;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,yBAAyB,KAAK,IAAI,CAAC;CAClF;AAkBD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"NotificationsHandler.d.ts","sourceRoot":"","sources":["../src/NotificationsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAEX,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAG3E;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,UAAU;IACtD,IAAI,EAAE;QAAE,YAAY,EAAE,YAAY,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;gBACrC,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY;CAI/D;AAGD,MAAM,MAAM,yBAAyB,GAAG,wBAAwB,GAAG,KAAK,CAAC;AAEzE,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,kBAAkB,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAClF;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,yBAAyB,KAAK,IAAI,CAAC;CAClF;AAkBD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI,GAAG,IAAI,CAuChF"}
|
|
@@ -63,6 +63,7 @@ export function setNotificationHandler(handler) {
|
|
|
63
63
|
handler.handleSuccess?.(id);
|
|
64
64
|
}
|
|
65
65
|
catch (error) {
|
|
66
|
+
// TODO(@kitten): This callback expects specific Error types, but we never narrow the type before calling this callback
|
|
66
67
|
handler.handleError?.(id, error);
|
|
67
68
|
}
|
|
68
69
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationsHandler.js","sourceRoot":"","sources":["../src/NotificationsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAElB,UAAU,EACV,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,0BAA0B,MAAM,8BAA8B,CAAC;AAEtE;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,UAAU;IACtD,IAAI,CAA6C;IACjD,YAAY,cAAsB,EAAE,YAA0B;QAC5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E,EAAE,EAAE;YAC7B,IAAI,CAAC,0BAA0B,CAAC,uBAAuB,EAAE,CAAC;gBACxD,OAAO,CAAC,WAAW,EAAE,CACnB,EAAE,EACF,IAAI,mBAAmB,CAAC,eAAe,EAAE,yBAAyB,CAAC,CACpE,CAAC;gBACF,OAAO;YACT,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;gBAChE,MAAM,0BAA0B,CAAC,uBAAuB,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;gBACvE,OAAO,CAAC,aAAa,EAAE,CAAC,EAAE,CAAC,CAAC;YAC9B,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,uHAAuH;gBACvH,OAAO,CAAC,WAAW,EAAE,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;YACnC,CAAC;QACH,CAAC,CACF,CAAC;QAEF,yBAAyB,GAAG,mBAAmB,CAAC,WAAW,CACzD,kCAAkC,EAClC,CAAC,EAAE,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,CACvB,OAAO,CAAC,WAAW,EAAE,CAAC,EAAE,EAAE,IAAI,wBAAwB,CAAC,EAAE,EAAE,YAAY,CAAC,CAAC,CAC5E,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import {\n LegacyEventEmitter,\n type EventSubscription,\n CodedError,\n UnavailabilityError,\n} from 'expo-modules-core';\n\nimport { Notification, NotificationBehavior } from './Notifications.types';\nimport NotificationsHandlerModule from './NotificationsHandlerModule';\n\n/**\n * @hidden\n */\nexport class NotificationTimeoutError extends CodedError {\n info: { notification: Notification; id: string };\n constructor(notificationId: string, notification: Notification) {\n super('ERR_NOTIFICATION_TIMEOUT', `Notification handling timed out for ID ${notificationId}.`);\n this.info = { id: notificationId, notification };\n }\n}\n\n// @docsMissing\nexport type NotificationHandlingError = NotificationTimeoutError | Error;\n\nexport interface NotificationHandler {\n /**\n * A function accepting an incoming notification returning a `Promise` resolving to a behavior ([`NotificationBehavior`](#notificationbehavior))\n * applicable to the notification\n * @param notification An object representing the notification.\n */\n handleNotification: (notification: Notification) => Promise<NotificationBehavior>;\n /**\n * A function called whenever an incoming notification is handled successfully.\n * @param notificationId Identifier of the notification.\n */\n handleSuccess?: (notificationId: string) => void;\n /**\n * A function called whenever calling `handleNotification()` for an incoming notification fails.\n * @param notificationId Identifier of the notification.\n * @param error An error which occurred in form of `NotificationHandlingError` object.\n */\n handleError?: (notificationId: string, error: NotificationHandlingError) => void;\n}\n\ntype HandleNotificationEvent = {\n id: string;\n notification: Notification;\n};\n\ntype HandleNotificationTimeoutEvent = HandleNotificationEvent;\n\n// Web uses SyntheticEventEmitter\nconst notificationEmitter = new LegacyEventEmitter(NotificationsHandlerModule);\n\nconst handleNotificationEventName = 'onHandleNotification';\nconst handleNotificationTimeoutEventName = 'onHandleNotificationTimeout';\n\nlet handleSubscription: EventSubscription | null = null;\nlet handleTimeoutSubscription: EventSubscription | null = null;\n\n/**\n * When a notification is received while the app is running, using this function you can set a callback that will decide\n * whether the notification should be shown to the user or not.\n *\n * When a notification is received, `handleNotification` is called with the incoming notification as an argument.\n * The function should respond with a behavior object within 3 seconds, otherwise, the notification will be discarded.\n * If the notification is handled successfully, `handleSuccess` is called with the identifier of the notification,\n * otherwise (or on timeout) `handleError` will be called.\n *\n * The default behavior when the handler is not set or does not respond in time is not to show the notification.\n * @param handler A single parameter which should be either `null` (if you want to clear the handler) or a [`NotificationHandler`](#notificationhandler) object.\n *\n * @example Implementing a notification handler that always shows the notification when it is received.\n * ```jsx\n * import * as Notifications from 'expo-notifications';\n *\n * Notifications.setNotificationHandler({\n * handleNotification: async () => ({\n * shouldShowAlert: true,\n * shouldPlaySound: false,\n * shouldSetBadge: false,\n * }),\n * });\n * ```\n * @header inForeground\n */\nexport function setNotificationHandler(handler: NotificationHandler | null): void {\n if (handleSubscription) {\n handleSubscription.remove();\n handleSubscription = null;\n }\n if (handleTimeoutSubscription) {\n handleTimeoutSubscription.remove();\n handleTimeoutSubscription = null;\n }\n\n if (handler) {\n handleSubscription = notificationEmitter.addListener<HandleNotificationEvent>(\n handleNotificationEventName,\n async ({ id, notification }) => {\n if (!NotificationsHandlerModule.handleNotificationAsync) {\n handler.handleError?.(\n id,\n new UnavailabilityError('Notifications', 'handleNotificationAsync')\n );\n return;\n }\n\n try {\n const behavior = await handler.handleNotification(notification);\n await NotificationsHandlerModule.handleNotificationAsync(id, behavior);\n handler.handleSuccess?.(id);\n } catch (error: any) {\n // TODO(@kitten): This callback expects specific Error types, but we never narrow the type before calling this callback\n handler.handleError?.(id, error);\n }\n }\n );\n\n handleTimeoutSubscription = notificationEmitter.addListener<HandleNotificationTimeoutEvent>(\n handleNotificationTimeoutEventName,\n ({ id, notification }) =>\n handler.handleError?.(id, new NotificationTimeoutError(id, notification))\n );\n }\n}\n"]}
|
package/build/TokenEmitter.js
CHANGED
|
@@ -31,8 +31,7 @@ const newTokenEventName = 'onDevicePushToken';
|
|
|
31
31
|
*/
|
|
32
32
|
export function addPushTokenListener(listener) {
|
|
33
33
|
warnOfExpoGoPushUsage();
|
|
34
|
-
|
|
35
|
-
return PushTokenManager.addListener(newTokenEventName, wrappingListener);
|
|
34
|
+
return PushTokenManager.addListener(newTokenEventName, ({ devicePushToken }) => listener({ data: devicePushToken, type: Platform.OS }));
|
|
36
35
|
}
|
|
37
36
|
/**
|
|
38
37
|
* Removes a push token subscription returned by an `addPushTokenListener` call.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenEmitter.js","sourceRoot":"","sources":["../src/TokenEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAErE,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAShE,iCAAiC;AACjC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAA2B;IAC9D,qBAAqB,EAAE,CAAC;IACxB,
|
|
1
|
+
{"version":3,"file":"TokenEmitter.js","sourceRoot":"","sources":["../src/TokenEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAErE,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAShE,iCAAiC;AACjC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAA2B;IAC9D,qBAAqB,EAAE,CAAC;IACxB,OAAO,gBAAgB,CAAC,WAAW,CAAC,iBAAiB,EAAE,CAAC,EAAE,eAAe,EAAE,EAAE,EAAE,CAC7E,QAAQ,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,CACvD,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CAAC,YAA+B;IACzE,YAAY,CAAC,MAAM,EAAE,CAAC;AACxB,CAAC","sourcesContent":["import { type EventSubscription, Platform } from 'expo-modules-core';\n\nimport PushTokenManager from './PushTokenManager';\nimport { DevicePushToken } from './Tokens.types';\nimport { warnOfExpoGoPushUsage } from './warnOfExpoGoPushUsage';\n\n/**\n * A function accepting a device push token ([`DevicePushToken`](#devicepushtoken)) as an argument.\n * > **Note:** You should not call `getDevicePushTokenAsync` inside this function, as it triggers the listener and may lead to an infinite loop.\n * @header fetch\n */\nexport type PushTokenListener = (token: DevicePushToken) => void;\n\n// Web uses SyntheticEventEmitter\nconst newTokenEventName = 'onDevicePushToken';\n\n/**\n * In rare situations, a push token may be changed by the push notification service while the app is running.\n * When a token is rolled, the old one becomes invalid and sending notifications to it will fail.\n * A push token listener will let you handle this situation gracefully by registering the new token with your backend right away.\n * @param listener A function accepting a push token as an argument, it will be called whenever the push token changes.\n * @return An [`EventSubscription`](#eventsubscription) object represents the subscription of the provided listener.\n * @header fetch\n * @example Registering a push token listener using a React hook.\n * ```jsx\n * import React from 'react';\n * import * as Notifications from 'expo-notifications';\n *\n * import { registerDevicePushTokenAsync } from '../api';\n *\n * export default function App() {\n * React.useEffect(() => {\n * const subscription = Notifications.addPushTokenListener(registerDevicePushTokenAsync);\n * return () => subscription.remove();\n * }, []);\n *\n * return (\n * // Your app content\n * );\n * }\n * ```\n */\nexport function addPushTokenListener(listener: PushTokenListener): EventSubscription {\n warnOfExpoGoPushUsage();\n return PushTokenManager.addListener(newTokenEventName, ({ devicePushToken }) =>\n listener({ data: devicePushToken, type: Platform.OS })\n );\n}\n\n/**\n * Removes a push token subscription returned by an `addPushTokenListener` call.\n * @param subscription A subscription returned by `addPushTokenListener` method.\n * @header fetch\n */\nexport function removePushTokenSubscription(subscription: EventSubscription) {\n subscription.remove();\n}\n"]}
|
|
@@ -14,6 +14,7 @@ export default async function setBadgeCountAsync(badgeCount, options) {
|
|
|
14
14
|
if (!BadgeModule.setBadgeCountAsync) {
|
|
15
15
|
throw new UnavailabilityError('ExpoNotifications', 'setBadgeCountAsync');
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
const platformOptions = options?.[Platform.OS];
|
|
18
|
+
return await BadgeModule.setBadgeCountAsync(badgeCount, platformOptions);
|
|
18
19
|
}
|
|
19
20
|
//# sourceMappingURL=setBadgeCountAsync.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setBadgeCountAsync.js","sourceRoot":"","sources":["../src/setBadgeCountAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElE,OAAO,WAAW,MAAM,eAAe,CAAC;AAUxC;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,kBAAkB,CAC9C,UAAkB,EAClB,OAA8B;IAE9B,IAAI,CAAC,WAAW,CAAC,kBAAkB,EAAE,CAAC;QACpC,MAAM,IAAI,mBAAmB,CAAC,mBAAmB,EAAE,oBAAoB,CAAC,CAAC;IAC3E,CAAC;
|
|
1
|
+
{"version":3,"file":"setBadgeCountAsync.js","sourceRoot":"","sources":["../src/setBadgeCountAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElE,OAAO,WAAW,MAAM,eAAe,CAAC;AAUxC;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,kBAAkB,CAC9C,UAAkB,EAClB,OAA8B;IAE9B,IAAI,CAAC,WAAW,CAAC,kBAAkB,EAAE,CAAC;QACpC,MAAM,IAAI,mBAAmB,CAAC,mBAAmB,EAAE,oBAAoB,CAAC,CAAC;IAC3E,CAAC;IACD,MAAM,eAAe,GAAG,OAAO,EAAE,CAAC,QAAQ,CAAC,EAA0B,CAAC,CAAC;IACvE,OAAO,MAAM,WAAW,CAAC,kBAAkB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;AAC3E,CAAC","sourcesContent":["import { UnavailabilityError, Platform } from 'expo-modules-core';\n\nimport BadgeModule from './BadgeModule';\nimport { WebSetBadgeCountOptions } from './BadgeModule.types';\n\nexport interface SetBadgeCountOptions {\n /**\n * A configuration object described [in the `badgin` documentation](https://github.com/jaulz/badgin#options).\n */\n web?: WebSetBadgeCountOptions;\n}\n\n/**\n * Sets the badge of the app's icon to the specified number. Setting it to `0` clears the badge. On iOS, this method requires that you have requested\n * the user's permission for `allowBadge` via [`requestPermissionsAsync`](#requestpermissionsasyncpermissions),\n * otherwise it will automatically return `false`.\n * > **Note:** Not all Android launchers support application badges. If the launcher does not support icon badges, the method will resolve to `false`.\n * @param badgeCount The count which should appear on the badge. A value of `0` will clear the badge.\n * @param options An object of options configuring behavior applied.\n * @return It returns a Promise resolving to a boolean representing whether the setting of the badge succeeded.\n * @header badge\n */\nexport default async function setBadgeCountAsync(\n badgeCount: number,\n options?: SetBadgeCountOptions\n): Promise<boolean> {\n if (!BadgeModule.setBadgeCountAsync) {\n throw new UnavailabilityError('ExpoNotifications', 'setBadgeCountAsync');\n }\n const platformOptions = options?.[Platform.OS as keyof typeof options];\n return await BadgeModule.setBadgeCountAsync(badgeCount, platformOptions);\n}\n"]}
|
|
@@ -18,15 +18,15 @@ export declare const mapNotificationResponse: (response: NotificationResponse) =
|
|
|
18
18
|
body: string | null;
|
|
19
19
|
data: Record<string, any>;
|
|
20
20
|
sound: "default" | "defaultCritical" | "custom" | null;
|
|
21
|
-
} & import("
|
|
21
|
+
} & import("..").NotificationContentIos) | ({
|
|
22
22
|
title: string | null;
|
|
23
23
|
subtitle: string | null;
|
|
24
24
|
body: string | null;
|
|
25
25
|
data: Record<string, any>;
|
|
26
26
|
sound: "default" | "defaultCritical" | "custom" | null;
|
|
27
|
-
} & import("
|
|
27
|
+
} & import("..").NotificationContentAndroid);
|
|
28
28
|
identifier: string;
|
|
29
|
-
trigger: import("
|
|
29
|
+
trigger: import("..").NotificationTrigger;
|
|
30
30
|
};
|
|
31
31
|
date: number;
|
|
32
32
|
};
|
|
@@ -50,15 +50,15 @@ export declare const mapNotification: (notification: Notification) => {
|
|
|
50
50
|
body: string | null;
|
|
51
51
|
data: Record<string, any>;
|
|
52
52
|
sound: "default" | "defaultCritical" | "custom" | null;
|
|
53
|
-
} & import("
|
|
53
|
+
} & import("..").NotificationContentIos) | ({
|
|
54
54
|
title: string | null;
|
|
55
55
|
subtitle: string | null;
|
|
56
56
|
body: string | null;
|
|
57
57
|
data: Record<string, any>;
|
|
58
58
|
sound: "default" | "defaultCritical" | "custom" | null;
|
|
59
|
-
} & import("
|
|
59
|
+
} & import("..").NotificationContentAndroid);
|
|
60
60
|
identifier: string;
|
|
61
|
-
trigger: import("
|
|
61
|
+
trigger: import("..").NotificationTrigger;
|
|
62
62
|
};
|
|
63
63
|
date: number;
|
|
64
64
|
};
|
|
@@ -78,15 +78,15 @@ export declare const mapNotificationRequest: (request: NotificationRequest) => {
|
|
|
78
78
|
body: string | null;
|
|
79
79
|
data: Record<string, any>;
|
|
80
80
|
sound: "default" | "defaultCritical" | "custom" | null;
|
|
81
|
-
} & import("
|
|
81
|
+
} & import("..").NotificationContentIos) | ({
|
|
82
82
|
title: string | null;
|
|
83
83
|
subtitle: string | null;
|
|
84
84
|
body: string | null;
|
|
85
85
|
data: Record<string, any>;
|
|
86
86
|
sound: "default" | "defaultCritical" | "custom" | null;
|
|
87
|
-
} & import("
|
|
87
|
+
} & import("..").NotificationContentAndroid);
|
|
88
88
|
identifier: string;
|
|
89
|
-
trigger: import("
|
|
89
|
+
trigger: import("..").NotificationTrigger;
|
|
90
90
|
};
|
|
91
91
|
/**
|
|
92
92
|
* @hidden
|
|
@@ -102,11 +102,11 @@ export declare const mapNotificationContent: (content: NotificationContent) => (
|
|
|
102
102
|
body: string | null;
|
|
103
103
|
data: Record<string, any>;
|
|
104
104
|
sound: "default" | "defaultCritical" | "custom" | null;
|
|
105
|
-
} & import("
|
|
105
|
+
} & import("..").NotificationContentIos) | ({
|
|
106
106
|
title: string | null;
|
|
107
107
|
subtitle: string | null;
|
|
108
108
|
body: string | null;
|
|
109
109
|
data: Record<string, any>;
|
|
110
110
|
sound: "default" | "defaultCritical" | "custom" | null;
|
|
111
|
-
} & import("
|
|
111
|
+
} & import("..").NotificationContentAndroid);
|
|
112
112
|
//# sourceMappingURL=mapNotificationResponse.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapNotificationResponse.d.ts","sourceRoot":"","sources":["../../src/utils/mapNotificationResponse.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,GAAI,UAAU,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;CAKrE,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,GAAI,cAAc,YAAY;;;;;;;;;;;;;;;;;;;CAGxD,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,GAAI,SAAS,mBAAmB;;;;;;;;;;;;;;;;CAGjE,CAAC;AAGH;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,GAAI,SAAS,mBAAmB;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"mapNotificationResponse.d.ts","sourceRoot":"","sources":["../../src/utils/mapNotificationResponse.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,GAAI,UAAU,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;CAKrE,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,GAAI,cAAc,YAAY;;;;;;;;;;;;;;;;;;;CAGxD,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,GAAI,SAAS,mBAAmB;;;;;;;;;;;;;;;;CAGjE,CAAC;AAGH;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,GAAI,SAAS,mBAAmB;;;;;;;;;;;;4CAuBlE,CAAC"}
|
|
@@ -51,6 +51,7 @@ let didWarn = false;
|
|
|
51
51
|
*/
|
|
52
52
|
export const mapNotificationContent = (content) => {
|
|
53
53
|
try {
|
|
54
|
+
// @ts-expect-error: TODO(@kitten): This is not present in the types! This is error prone
|
|
54
55
|
const dataString = content['dataString'];
|
|
55
56
|
if (typeof dataString === 'string') {
|
|
56
57
|
const mappedContent = { ...content };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"m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U,CAAC;gBACpB,CAAC;aACF,CAAC,CAAC;YACH,OAAO,aAAa,CAAC;QACvB,CAAC;IACH,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import {\n Notification,\n NotificationContent,\n NotificationRequest,\n NotificationResponse,\n} from '../Notifications.types';\n\n/**\n * @hidden\n *\n * Does any required processing of a notification response from native code\n * before it is passed to a notification response listener, or to the\n * last notification response hook.\n *\n * @param response The raw response passed in from native code\n * @returns the mapped response.\n */\nexport const mapNotificationResponse = (response: NotificationResponse) => {\n return {\n ...response,\n notification: mapNotification(response.notification),\n };\n};\n\n/**\n * @hidden\n *\n * Does any required processing of a notification from native code\n * before it is passed to a notification listener.\n *\n * @param notification The raw notification passed in from native code\n * @returns the mapped notification.\n */\nexport const mapNotification = (notification: Notification) => ({\n ...notification,\n request: mapNotificationRequest(notification.request),\n});\n\n/**\n * @hidden\n *\n * Does any required processing of a notification request from native code\n * before it is passed to other JS code.\n *\n * @param request The raw request passed in from native code\n * @returns the mapped request.\n */\nexport const mapNotificationRequest = (request: NotificationRequest) => ({\n ...request,\n content: mapNotificationContent(request.content),\n});\n\nlet didWarn = false;\n/**\n * @hidden\n * Does any required processing of notification content from native code\n * before being passed to other JS code.\n *\n * @param content The raw content passed in from native code\n * @returns the mapped content.\n */\nexport const mapNotificationContent = (content: NotificationContent) => {\n try {\n const dataString = content['dataString'];\n if (typeof dataString === 'string') {\n const mappedContent: NotificationContent & { dataString?: string } = { ...content };\n mappedContent.data = JSON.parse(dataString);\n Object.defineProperty(mappedContent, 'dataString', {\n get() {\n if (!didWarn) {\n didWarn = true;\n // TODO(vonovak) remove this warning and delete dataString entry in a next version\n console.warn('reading dataString is deprecated, use data instead');\n }\n return dataString;\n },\n });\n return mappedContent;\n }\n } catch (e: any) {\n console.error(`Error parsing notification: ${e}`);\n }\n return content;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"mapNotificationResponse.js","sourceRoot":"","sources":["../../src/utils/mapNotificationResponse.ts"],"names":[],"mappings":"AAOA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,QAA8B,EAAE,EAAE;IACxE,OAAO;QACL,GAAG,QAAQ;QACX,YAAY,EAAE,eAAe,CAAC,QAAQ,CAAC,YAAY,CAAC;KACrD,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,YAA0B,EAAE,EAAE,CAAC,CAAC;IAC9D,GAAG,YAAY;IACf,OAAO,EAAE,sBAAsB,CAAC,YAAY,CAAC,OAAO,CAAC;CACtD,CAAC,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,OAA4B,EAAE,EAAE,CAAC,CAAC;IACvE,GAAG,OAAO;IACV,OAAO,EAAE,sBAAsB,CAAC,OAAO,CAAC,OAAO,CAAC;CACjD,CAAC,CAAC;AAEH,IAAI,OAAO,GAAG,KAAK,CAAC;AACpB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,OAA4B,EAAE,EAAE;IACrE,IAAI,CAAC;QACH,yFAAyF;QACzF,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;QACzC,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;YACnC,MAAM,aAAa,GAAkD,EAAE,GAAG,OAAO,EAAE,CAAC;YACpF,aAAa,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YAC5C,MAAM,CAAC,cAAc,CAAC,aAAa,EAAE,YAAY,EAAE;gBACjD,GAAG;oBACD,IAAI,CAAC,OAAO,EAAE,CAAC;wBACb,OAAO,GAAG,IAAI,CAAC;wBACf,kFAAkF;wBAClF,OAAO,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAC;oBACrE,CAAC;oBACD,OAAO,UAAU,CAAC;gBACpB,CAAC;aACF,CAAC,CAAC;YACH,OAAO,aAAa,CAAC;QACvB,CAAC;IACH,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import {\n Notification,\n NotificationContent,\n NotificationRequest,\n NotificationResponse,\n} from '../Notifications.types';\n\n/**\n * @hidden\n *\n * Does any required processing of a notification response from native code\n * before it is passed to a notification response listener, or to the\n * last notification response hook.\n *\n * @param response The raw response passed in from native code\n * @returns the mapped response.\n */\nexport const mapNotificationResponse = (response: NotificationResponse) => {\n return {\n ...response,\n notification: mapNotification(response.notification),\n };\n};\n\n/**\n * @hidden\n *\n * Does any required processing of a notification from native code\n * before it is passed to a notification listener.\n *\n * @param notification The raw notification passed in from native code\n * @returns the mapped notification.\n */\nexport const mapNotification = (notification: Notification) => ({\n ...notification,\n request: mapNotificationRequest(notification.request),\n});\n\n/**\n * @hidden\n *\n * Does any required processing of a notification request from native code\n * before it is passed to other JS code.\n *\n * @param request The raw request passed in from native code\n * @returns the mapped request.\n */\nexport const mapNotificationRequest = (request: NotificationRequest) => ({\n ...request,\n content: mapNotificationContent(request.content),\n});\n\nlet didWarn = false;\n/**\n * @hidden\n * Does any required processing of notification content from native code\n * before being passed to other JS code.\n *\n * @param content The raw content passed in from native code\n * @returns the mapped content.\n */\nexport const mapNotificationContent = (content: NotificationContent) => {\n try {\n // @ts-expect-error: TODO(@kitten): This is not present in the types! This is error prone\n const dataString = content['dataString'];\n if (typeof dataString === 'string') {\n const mappedContent: NotificationContent & { dataString?: string } = { ...content };\n mappedContent.data = JSON.parse(dataString);\n Object.defineProperty(mappedContent, 'dataString', {\n get() {\n if (!didWarn) {\n didWarn = true;\n // TODO(vonovak) remove this warning and delete dataString entry in a next version\n console.warn('reading dataString is deprecated, use data instead');\n }\n return dataString;\n },\n });\n return mappedContent;\n }\n } catch (e: any) {\n console.error(`Error parsing notification: ${e}`);\n }\n return content;\n};\n"]}
|
|
@@ -34,20 +34,20 @@ export async function updateDevicePushTokenAsync(signal, token) {
|
|
|
34
34
|
retry();
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
catch (
|
|
37
|
+
catch (error) {
|
|
38
38
|
// Error returned if the request is aborted should be an 'AbortError'. In
|
|
39
39
|
// React Native fetch is polyfilled using `whatwg-fetch` which:
|
|
40
40
|
// - creates `AbortError`s like this
|
|
41
41
|
// https://github.com/github/fetch/blob/75d9455d380f365701151f3ac85c5bda4bbbde76/fetch.js#L505
|
|
42
42
|
// - which creates exceptions like
|
|
43
43
|
// https://github.com/github/fetch/blob/75d9455d380f365701151f3ac85c5bda4bbbde76/fetch.js#L490-L494
|
|
44
|
-
if (
|
|
44
|
+
if (typeof error === 'object' && error?.name === 'AbortError') {
|
|
45
45
|
// We don't consider AbortError a failure, it's a sign somewhere else the
|
|
46
46
|
// request is expected to succeed and we don't need this one, so let's
|
|
47
47
|
// just return.
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
|
-
console.warn('[expo-notifications] Error thrown while updating the device push token with the server:',
|
|
50
|
+
console.warn('[expo-notifications] Error thrown while updating the device push token with the server:', error);
|
|
51
51
|
retry();
|
|
52
52
|
}
|
|
53
53
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateDevicePushTokenAsync.js","sourceRoot":"","sources":["../../src/utils/updateDevicePushTokenAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE9E,OAAO,wBAAwB,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C;QACH,IAAI,CAAC,wBAAwB,CAAC,sBAAsB,EAAE,CAAC;YACrD,MAAM,IAAI,mBAAmB,CAAC,8BAA8B,EAAE,wBAAwB,CAAC,CAAC;QAC1F,CAAC;QAED,OAAO,MAAM,wBAAwB,CAAC,sBAAsB,EAAE,CAAC;IACjE,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,IAAI,UAAU,CAClB,6BAA6B,EAC7B,2DAA2D,CAAC,GAAG,CAChE,CAAC;IACJ,CAAC;AACH,CAAC;AAED,mCAAmC;AACnC,SAAS,cAAc,CAAC,eAAgC;IACtD,QAAQ,eAAe,CAAC,IAAI,EAAE,CAAC;QAC7B,KAAK,KAAK;YACR,OAAO,MAAM,CAAC;QAChB,KAAK,SAAS;YACZ,OAAO,KAAK,CAAC;QACf,gFAAgF;QAChF;YACE,OAAO,eAAe,CAAC,IAAI,CAAC;IAChC,CAAC;AACH,CAAC;AAED,mCAAmC;AACnC,KAAK,UAAU,uCAAuC;IACpD,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;QAC1B,IAAI,CAAC;YACH,MAAM,8BAA8B,GAClC,MAAM,WAAW,CAAC,6CAA6C,EAAE,CAAC;YACpE,IAAI,8BAA8B,KAAK,aAAa,EAAE,CAAC;gBACrD,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,2DAA2D;QAC7D,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { computeNextBackoffInterval } from '@ide/backoff';\nimport * as Application from 'expo-application';\nimport { CodedError, Platform, UnavailabilityError } from 'expo-modules-core';\n\nimport ServerRegistrationModule from '../ServerRegistrationModule';\nimport { DevicePushToken } from '../Tokens.types';\n\nconst updateDevicePushTokenUrl = 'https://exp.host/--/api/v2/push/updateDeviceToken';\n\nexport async function updateDevicePushTokenAsync(signal: AbortSignal, token: DevicePushToken) {\n const doUpdateDevicePushTokenAsync = async (retry: () => void) => {\n const [development, deviceId] = await Promise.all([\n shouldUseDevelopmentNotificationService(),\n getDeviceIdAsync(),\n ]);\n const body = {\n deviceId: deviceId.toLowerCase(),\n development,\n deviceToken: token.data,\n appId: Application.applicationId,\n type: getTypeOfToken(token),\n };\n\n try {\n const response = await fetch(updateDevicePushTokenUrl, {\n method: 'POST',\n headers: {\n 'content-type': 'application/json',\n },\n body: JSON.stringify(body),\n signal,\n });\n\n // Help debug erroring servers\n if (!response.ok) {\n console.debug(\n '[expo-notifications] Error encountered while updating the device push token with the server:',\n await response.text()\n );\n }\n\n // Retry if request failed\n if (!response.ok) {\n retry();\n }\n } catch (error: any) {\n // Error returned if the request is aborted should be an 'AbortError'. In\n // React Native fetch is polyfilled using `whatwg-fetch` which:\n // - creates `AbortError`s like this\n // https://github.com/github/fetch/blob/75d9455d380f365701151f3ac85c5bda4bbbde76/fetch.js#L505\n // - which creates exceptions like\n // https://github.com/github/fetch/blob/75d9455d380f365701151f3ac85c5bda4bbbde76/fetch.js#L490-L494\n if (typeof error === 'object' && error?.name === 'AbortError') {\n // We don't consider AbortError a failure, it's a sign somewhere else the\n // request is expected to succeed and we don't need this one, so let's\n // just return.\n return;\n }\n\n console.warn(\n '[expo-notifications] Error thrown while updating the device push token with the server:',\n error\n );\n\n retry();\n }\n };\n\n let shouldTry = true;\n const retry = () => {\n shouldTry = true;\n };\n\n let retriesCount = 0;\n const initialBackoff = 500; // 0.5 s\n const backoffOptions = {\n maxBackoff: 2 * 60 * 1000, // 2 minutes\n };\n let nextBackoffInterval = computeNextBackoffInterval(\n initialBackoff,\n retriesCount,\n backoffOptions\n );\n\n while (shouldTry && !signal.aborted) {\n // Will be set to true by `retry` if it's called\n shouldTry = false;\n await doUpdateDevicePushTokenAsync(retry);\n\n // Do not wait if we won't retry\n if (shouldTry && !signal.aborted) {\n nextBackoffInterval = computeNextBackoffInterval(\n initialBackoff,\n retriesCount,\n backoffOptions\n );\n retriesCount += 1;\n await new Promise((resolve) => setTimeout(resolve, nextBackoffInterval));\n }\n }\n}\n\n// Same as in getExpoPushTokenAsync\nasync function getDeviceIdAsync() {\n try {\n if (!ServerRegistrationModule.getInstallationIdAsync) {\n throw new UnavailabilityError('ExpoServerRegistrationModule', 'getInstallationIdAsync');\n }\n\n return await ServerRegistrationModule.getInstallationIdAsync();\n } catch (e) {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_DEVICE_ID',\n `Could not fetch the installation ID of the application: ${e}.`\n );\n }\n}\n\n// Same as in getExpoPushTokenAsync\nfunction getTypeOfToken(devicePushToken: DevicePushToken) {\n switch (devicePushToken.type) {\n case 'ios':\n return 'apns';\n case 'android':\n return 'fcm';\n // This probably will error on server, but let's make this function future-safe.\n default:\n return devicePushToken.type;\n }\n}\n\n// Same as in getExpoPushTokenAsync\nasync function shouldUseDevelopmentNotificationService() {\n if (Platform.OS === 'ios') {\n try {\n const notificationServiceEnvironment =\n await Application.getIosPushNotificationServiceEnvironmentAsync();\n if (notificationServiceEnvironment === 'development') {\n return true;\n }\n } catch {\n // We can't do anything here, we'll fallback to false then.\n }\n }\n\n return false;\n}\n"]}
|
package/expo-module.config.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"component": {
|
|
4
4
|
"group": "host.exp.exponent",
|
|
5
5
|
"module": "expo.modules.notifications",
|
|
6
|
-
"version": "0.30.
|
|
6
|
+
"version": "0.30.4",
|
|
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.30.
|
|
28
|
-
"url": "expo.modules.notifications-0.30.
|
|
27
|
+
"name": "expo.modules.notifications-0.30.4.aar",
|
|
28
|
+
"url": "expo.modules.notifications-0.30.4.aar",
|
|
29
29
|
"size": 382390,
|
|
30
30
|
"sha512": "9690f807bfe78356e4a61b9933936a473eb5836ee59ba2a53977c4f389b266e7206a0ea02af7498fee5157242a4251fbc15d1a01be871b83b2747d2c3e3c57fb",
|
|
31
31
|
"sha256": "e705ccdf05a66d7dbfae00445c02cc6fb8fb9baf6da47c4bd1a8e818df54dec6",
|
|
@@ -122,8 +122,8 @@
|
|
|
122
122
|
],
|
|
123
123
|
"files": [
|
|
124
124
|
{
|
|
125
|
-
"name": "expo.modules.notifications-0.30.
|
|
126
|
-
"url": "expo.modules.notifications-0.30.
|
|
125
|
+
"name": "expo.modules.notifications-0.30.4.aar",
|
|
126
|
+
"url": "expo.modules.notifications-0.30.4.aar",
|
|
127
127
|
"size": 382390,
|
|
128
128
|
"sha512": "9690f807bfe78356e4a61b9933936a473eb5836ee59ba2a53977c4f389b266e7206a0ea02af7498fee5157242a4251fbc15d1a01be871b83b2747d2c3e3c57fb",
|
|
129
129
|
"sha256": "e705ccdf05a66d7dbfae00445c02cc6fb8fb9baf6da47c4bd1a8e818df54dec6",
|
|
@@ -142,8 +142,8 @@
|
|
|
142
142
|
},
|
|
143
143
|
"files": [
|
|
144
144
|
{
|
|
145
|
-
"name": "expo.modules.notifications-0.30.
|
|
146
|
-
"url": "expo.modules.notifications-0.30.
|
|
145
|
+
"name": "expo.modules.notifications-0.30.4-sources.jar",
|
|
146
|
+
"url": "expo.modules.notifications-0.30.4-sources.jar",
|
|
147
147
|
"size": 99402,
|
|
148
148
|
"sha512": "6df54ce8184a9bc972a994da8b172c7815baa6133c48f9cc9d603ccfbfd94b2892353005e7b3387e636ddaf42b3a8ec3ddd9fd38a6f25261b94596366bdbc772",
|
|
149
149
|
"sha256": "406cf18838333c6b4a632da39840be07a8e86a174546f72493f8b932c13516b8",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
c8f0985683c391fda420a18befd897ed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
5442bc032b5b5a65eefc293c08cc36ff47e63a1c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1bd268a865641db6a0aefb5d8ae475babe85f3c6a4e4fc990cf54accb945adcf
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
7573f4a03e41c9a396aaca5b128d6e95ef209b54e17f315805c874e0ed84b64dde35fc7bd67a7734a9311a40d1d20cab955a100779c638d51a3d9a8e70b9f5c5
|
|
@@ -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.30.
|
|
12
|
+
<version>0.30.4</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
|
+
0b365a766824a283b33f98d1a2d4baaa
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dac129c0051cf7fb63acea88fefb3efb93843efd
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
c633004e9512ee87df761c7322e0075484daed51da00d266c55ede1f9b007b7f
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
790ae0f1fc343badc18ec3c43b860d640415f93431e60c66ae3c9fadd0597a9f66e12aa9b2fc39944414cdf197a53de89ec2c5de38ac211062d1a65645ab8353
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
<groupId>host.exp.exponent</groupId>
|
|
4
4
|
<artifactId>expo.modules.notifications</artifactId>
|
|
5
5
|
<versioning>
|
|
6
|
-
<latest>0.30.
|
|
7
|
-
<release>0.30.
|
|
6
|
+
<latest>0.30.4</latest>
|
|
7
|
+
<release>0.30.4</release>
|
|
8
8
|
<versions>
|
|
9
|
-
<version>0.30.
|
|
9
|
+
<version>0.30.4</version>
|
|
10
10
|
</versions>
|
|
11
|
-
<lastUpdated>
|
|
11
|
+
<lastUpdated>20250414201103</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
|
+
f00394d3184effb996a1a9d87dccd3b4
|
package/local-maven-repo/host/exp/exponent/expo.modules.notifications/maven-metadata.xml.sha1
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
28dbeea8d5ea39f68b4053f22dacfb933b142131
|
package/local-maven-repo/host/exp/exponent/expo.modules.notifications/maven-metadata.xml.sha256
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
eebfc4d262d319c781cf5fd5a3227b810bf3830b1f604235d34fdca93c16f413
|
package/local-maven-repo/host/exp/exponent/expo.modules.notifications/maven-metadata.xml.sha512
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
4dea283b1008fdcf41d674f62aa72bcec2302a2c11ac330a06247eb40d60e4864e1402de149ca021f0b9ffea575cde60b6b4661bca9285f2bf0d59bb0449c200
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-notifications",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.4",
|
|
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",
|
|
@@ -42,16 +42,16 @@
|
|
|
42
42
|
]
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@expo/image-utils": "^0.7.
|
|
45
|
+
"@expo/image-utils": "^0.7.2",
|
|
46
46
|
"@ide/backoff": "^1.0.0",
|
|
47
47
|
"abort-controller": "^3.0.0",
|
|
48
48
|
"assert": "^2.0.0",
|
|
49
49
|
"badgin": "^1.1.5",
|
|
50
|
-
"expo-application": "~6.1.
|
|
51
|
-
"expo-constants": "~17.1.
|
|
50
|
+
"expo-application": "~6.1.2",
|
|
51
|
+
"expo-constants": "~17.1.2"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"expo-module-scripts": "^4.1.
|
|
54
|
+
"expo-module-scripts": "^4.1.2",
|
|
55
55
|
"memfs": "^3.2.0"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"react": "*",
|
|
60
60
|
"react-native": "*"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "613bb93486a4ac15382e434eef9808f72b18043d"
|
|
63
63
|
}
|
|
@@ -64,6 +64,8 @@ export async function requestPermissionsAsync(permissions?: NotificationPermissi
|
|
|
64
64
|
allowSound: true,
|
|
65
65
|
},
|
|
66
66
|
};
|
|
67
|
-
const requestedPlatformPermissions =
|
|
68
|
-
|
|
67
|
+
const requestedPlatformPermissions =
|
|
68
|
+
requestedPermissions[Platform.OS as keyof typeof requestedPermissions];
|
|
69
|
+
// TODO(@kitten): This never checks whether the configuration object is undefined
|
|
70
|
+
return await NotificationPermissionsModule.requestPermissionsAsync(requestedPlatformPermissions!);
|
|
69
71
|
}
|
|
@@ -110,7 +110,8 @@ export function setNotificationHandler(handler: NotificationHandler | null): voi
|
|
|
110
110
|
const behavior = await handler.handleNotification(notification);
|
|
111
111
|
await NotificationsHandlerModule.handleNotificationAsync(id, behavior);
|
|
112
112
|
handler.handleSuccess?.(id);
|
|
113
|
-
} catch (error) {
|
|
113
|
+
} catch (error: any) {
|
|
114
|
+
// TODO(@kitten): This callback expects specific Error types, but we never narrow the type before calling this callback
|
|
114
115
|
handler.handleError?.(id, error);
|
|
115
116
|
}
|
|
116
117
|
}
|
package/src/TokenEmitter.ts
CHANGED
|
@@ -42,9 +42,9 @@ const newTokenEventName = 'onDevicePushToken';
|
|
|
42
42
|
*/
|
|
43
43
|
export function addPushTokenListener(listener: PushTokenListener): EventSubscription {
|
|
44
44
|
warnOfExpoGoPushUsage();
|
|
45
|
-
|
|
46
|
-
listener({ data: devicePushToken, type: Platform.OS })
|
|
47
|
-
|
|
45
|
+
return PushTokenManager.addListener(newTokenEventName, ({ devicePushToken }) =>
|
|
46
|
+
listener({ data: devicePushToken, type: Platform.OS })
|
|
47
|
+
);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/**
|
|
@@ -27,6 +27,6 @@ export default async function setBadgeCountAsync(
|
|
|
27
27
|
if (!BadgeModule.setBadgeCountAsync) {
|
|
28
28
|
throw new UnavailabilityError('ExpoNotifications', 'setBadgeCountAsync');
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
return await BadgeModule.setBadgeCountAsync(badgeCount,
|
|
30
|
+
const platformOptions = options?.[Platform.OS as keyof typeof options];
|
|
31
|
+
return await BadgeModule.setBadgeCountAsync(badgeCount, platformOptions);
|
|
32
32
|
}
|
|
@@ -61,6 +61,7 @@ let didWarn = false;
|
|
|
61
61
|
*/
|
|
62
62
|
export const mapNotificationContent = (content: NotificationContent) => {
|
|
63
63
|
try {
|
|
64
|
+
// @ts-expect-error: TODO(@kitten): This is not present in the types! This is error prone
|
|
64
65
|
const dataString = content['dataString'];
|
|
65
66
|
if (typeof dataString === 'string') {
|
|
66
67
|
const mappedContent: NotificationContent & { dataString?: string } = { ...content };
|
|
@@ -43,14 +43,14 @@ export async function updateDevicePushTokenAsync(signal: AbortSignal, token: Dev
|
|
|
43
43
|
if (!response.ok) {
|
|
44
44
|
retry();
|
|
45
45
|
}
|
|
46
|
-
} catch (
|
|
46
|
+
} catch (error: any) {
|
|
47
47
|
// Error returned if the request is aborted should be an 'AbortError'. In
|
|
48
48
|
// React Native fetch is polyfilled using `whatwg-fetch` which:
|
|
49
49
|
// - creates `AbortError`s like this
|
|
50
50
|
// https://github.com/github/fetch/blob/75d9455d380f365701151f3ac85c5bda4bbbde76/fetch.js#L505
|
|
51
51
|
// - which creates exceptions like
|
|
52
52
|
// https://github.com/github/fetch/blob/75d9455d380f365701151f3ac85c5bda4bbbde76/fetch.js#L490-L494
|
|
53
|
-
if (
|
|
53
|
+
if (typeof error === 'object' && error?.name === 'AbortError') {
|
|
54
54
|
// We don't consider AbortError a failure, it's a sign somewhere else the
|
|
55
55
|
// request is expected to succeed and we don't need this one, so let's
|
|
56
56
|
// just return.
|
|
@@ -59,7 +59,7 @@ export async function updateDevicePushTokenAsync(signal: AbortSignal, token: Dev
|
|
|
59
59
|
|
|
60
60
|
console.warn(
|
|
61
61
|
'[expo-notifications] Error thrown while updating the device push token with the server:',
|
|
62
|
-
|
|
62
|
+
error
|
|
63
63
|
);
|
|
64
64
|
|
|
65
65
|
retry();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
199dee99a24ca6d195bac14168d032d7
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
f4c07fccdd0079519e252d2366162be37efc49f6
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
d3607106fe3c036dad004449a1b5c6995d52a288a21d97954a47363c292a1acc
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3a5a2e82c9adcc5a59ad6193b4591354d8d1a1557f28dad6a7ce0ff386e94a35172d30f3c7ec3075aa8384c31bbaf1cac6247cb1e86f8ea3b58fbff6db27fa5f
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
82f485c35217440cfbb06320981e703e
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
4fc8e96db2d7e7ca625d6fc3673019708ead2cea
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
94e6cc029f4e6a32cff9f761273abd890f21bb473782f0d74b455b927cf78539
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
c3457bf770ba821bc1b7e82d16bb070f697f94bbcafd0956b882ce4c481e7f9b5bfc3edce93b74fa91a9f5d3d09b432a659dbf210bec7f3ae8741c50a8af8b02
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|