expo-notifications 0.29.0 → 0.29.1

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 CHANGED
@@ -10,6 +10,10 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 0.29.1 — 2024-10-24
14
+
15
+ _This version does not introduce any user-facing changes._
16
+
13
17
  ## 0.29.0 — 2024-10-22
14
18
 
15
19
  ### 🛠 Breaking changes
@@ -36,6 +40,7 @@
36
40
 
37
41
  ### 💡 Others
38
42
 
43
+ - warn when using push tokens in Expo Go ([#32122](https://github.com/expo/expo/pull/32122) by [@vonovak](https://github.com/vonovak))
39
44
  - [android] refactor trigger serialization ([#32032](https://github.com/expo/expo/pull/32032) by [@vonovak](https://github.com/vonovak))
40
45
  - [android] simplify DateTrigger ([#32002](https://github.com/expo/expo/pull/32002) by [@vonovak](https://github.com/vonovak))
41
46
  - [android] refactor ExpoNotificationBuilder ([#31838](https://github.com/expo/expo/pull/31838) by [@vonovak](https://github.com/vonovak))
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
2
2
  apply plugin: 'kotlin-parcelize'
3
3
 
4
4
  group = 'host.exp.exponent'
5
- version = '0.29.0'
5
+ version = '0.29.1'
6
6
 
7
7
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
8
8
  apply from: expoModulesCorePlugin
@@ -15,7 +15,7 @@ android {
15
15
  namespace "expo.modules.notifications"
16
16
  defaultConfig {
17
17
  versionCode 21
18
- versionName '0.29.0'
18
+ versionName '0.29.1'
19
19
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
20
20
  }
21
21
 
@@ -1 +1 @@
1
- {"version":3,"file":"TokenEmitter.d.ts","sourceRoot":"","sources":["../src/TokenEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,iBAAiB,EAAY,MAAM,mBAAmB,CAAC;AAGzF,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;AAMjE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,iBAAiB,CAInF;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,YAAY,EAAE,iBAAiB,QAE1E"}
1
+ {"version":3,"file":"TokenEmitter.d.ts","sourceRoot":"","sources":["../src/TokenEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,iBAAiB,EAAY,MAAM,mBAAmB,CAAC;AAGzF,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGjD;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;AAMjE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,iBAAiB,CAKnF;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,YAAY,EAAE,iBAAiB,QAE1E"}
@@ -1,5 +1,6 @@
1
1
  import { LegacyEventEmitter, Platform } from 'expo-modules-core';
2
2
  import PushTokenManager from './PushTokenManager';
3
+ import { warnOfExpoGoPushUsage } from './warnOfExpoGoPushUsage';
3
4
  // Web uses SyntheticEventEmitter
4
5
  const tokenEmitter = new LegacyEventEmitter(PushTokenManager);
5
6
  const newTokenEventName = 'onDevicePushToken';
@@ -30,6 +31,7 @@ const newTokenEventName = 'onDevicePushToken';
30
31
  * ```
31
32
  */
32
33
  export function addPushTokenListener(listener) {
34
+ warnOfExpoGoPushUsage();
33
35
  const wrappingListener = ({ devicePushToken }) => listener({ data: devicePushToken, type: Platform.OS });
34
36
  return tokenEmitter.addListener(newTokenEventName, wrappingListener);
35
37
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TokenEmitter.js","sourceRoot":"","sources":["../src/TokenEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAA0B,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEzF,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAUlD,iCAAiC;AACjC,MAAM,YAAY,GAAG,IAAI,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;AAC9D,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAA2B;IAC9D,MAAM,gBAAgB,GAAG,CAAC,EAAE,eAAe,EAAE,EAAE,EAAE,CAC/C,QAAQ,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;IACzD,OAAO,YAAY,CAAC,WAAW,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;AACvE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CAAC,YAA+B;IACzE,YAAY,CAAC,MAAM,EAAE,CAAC;AACxB,CAAC","sourcesContent":["import { LegacyEventEmitter, type EventSubscription, Platform } from 'expo-modules-core';\n\nimport PushTokenManager from './PushTokenManager';\nimport { DevicePushToken } from './Tokens.types';\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 tokenEmitter = new LegacyEventEmitter(PushTokenManager);\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 A [`Subscription`](#subscription) 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 const wrappingListener = ({ devicePushToken }) =>\n listener({ data: devicePushToken, type: Platform.OS });\n return tokenEmitter.addListener(newTokenEventName, wrappingListener);\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"]}
1
+ {"version":3,"file":"TokenEmitter.js","sourceRoot":"","sources":["../src/TokenEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAA0B,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEzF,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAShE,iCAAiC;AACjC,MAAM,YAAY,GAAG,IAAI,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;AAC9D,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAA2B;IAC9D,qBAAqB,EAAE,CAAC;IACxB,MAAM,gBAAgB,GAAG,CAAC,EAAE,eAAe,EAAE,EAAE,EAAE,CAC/C,QAAQ,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;IACzD,OAAO,YAAY,CAAC,WAAW,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;AACvE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CAAC,YAA+B;IACzE,YAAY,CAAC,MAAM,EAAE,CAAC;AACxB,CAAC","sourcesContent":["import { LegacyEventEmitter, 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 tokenEmitter = new LegacyEventEmitter(PushTokenManager);\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 A [`Subscription`](#subscription) 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 const wrappingListener = ({ devicePushToken }) =>\n listener({ data: devicePushToken, type: Platform.OS });\n return tokenEmitter.addListener(newTokenEventName, wrappingListener);\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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"getDevicePushTokenAsync.d.ts","sourceRoot":"","sources":["../src/getDevicePushTokenAsync.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAIjD;;;;GAIG;AACH,wBAA8B,uBAAuB,IAAI,OAAO,CAAC,eAAe,CAAC,CAkBhF"}
1
+ {"version":3,"file":"getDevicePushTokenAsync.d.ts","sourceRoot":"","sources":["../src/getDevicePushTokenAsync.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAKjD;;;;GAIG;AACH,wBAA8B,uBAAuB,IAAI,OAAO,CAAC,eAAe,CAAC,CAmBhF"}
@@ -1,5 +1,6 @@
1
1
  import { UnavailabilityError, Platform } from 'expo-modules-core';
2
2
  import PushTokenManager from './PushTokenManager';
3
+ import { warnOfExpoGoPushUsage } from './warnOfExpoGoPushUsage';
3
4
  let nativeTokenPromise = null;
4
5
  /**
5
6
  * Returns a native FCM, APNs token or a [`PushSubscription` data](https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription)
@@ -10,6 +11,7 @@ export default async function getDevicePushTokenAsync() {
10
11
  if (!PushTokenManager.getDevicePushTokenAsync) {
11
12
  throw new UnavailabilityError('ExpoNotifications', 'getDevicePushTokenAsync');
12
13
  }
14
+ warnOfExpoGoPushUsage();
13
15
  let devicePushToken;
14
16
  if (nativeTokenPromise) {
15
17
  // Reuse existing Promise
@@ -1 +1 @@
1
- {"version":3,"file":"getDevicePushTokenAsync.js","sourceRoot":"","sources":["../src/getDevicePushTokenAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElE,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAGlD,IAAI,kBAAkB,GAA2B,IAAI,CAAC;AAEtD;;;;GAIG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,uBAAuB;IACnD,IAAI,CAAC,gBAAgB,CAAC,uBAAuB,EAAE;QAC7C,MAAM,IAAI,mBAAmB,CAAC,mBAAmB,EAAE,yBAAyB,CAAC,CAAC;KAC/E;IAED,IAAI,eAA8B,CAAC;IACnC,IAAI,kBAAkB,EAAE;QACtB,yBAAyB;QACzB,eAAe,GAAG,MAAM,kBAAkB,CAAC;KAC5C;SAAM;QACL,+CAA+C;QAC/C,kBAAkB,GAAG,gBAAgB,CAAC,uBAAuB,EAAE,CAAC;QAChE,eAAe,GAAG,MAAM,kBAAkB,CAAC;QAC3C,kBAAkB,GAAG,IAAI,CAAC;KAC3B;IAED,uFAAuF;IACvF,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;AACtD,CAAC","sourcesContent":["import { UnavailabilityError, Platform } from 'expo-modules-core';\n\nimport PushTokenManager from './PushTokenManager';\nimport { DevicePushToken } from './Tokens.types';\n\nlet nativeTokenPromise: Promise<string> | null = null;\n\n/**\n * Returns a native FCM, APNs token or a [`PushSubscription` data](https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription)\n * that can be used with another push notification service.\n * @header fetch\n */\nexport default async function getDevicePushTokenAsync(): Promise<DevicePushToken> {\n if (!PushTokenManager.getDevicePushTokenAsync) {\n throw new UnavailabilityError('ExpoNotifications', 'getDevicePushTokenAsync');\n }\n\n let devicePushToken: string | null;\n if (nativeTokenPromise) {\n // Reuse existing Promise\n devicePushToken = await nativeTokenPromise;\n } else {\n // Create a new Promise and clear it afterwards\n nativeTokenPromise = PushTokenManager.getDevicePushTokenAsync();\n devicePushToken = await nativeTokenPromise;\n nativeTokenPromise = null;\n }\n\n // @ts-ignore: TS thinks Platform.OS could be anything and can't decide what type is it\n return { type: Platform.OS, data: devicePushToken };\n}\n"]}
1
+ {"version":3,"file":"getDevicePushTokenAsync.js","sourceRoot":"","sources":["../src/getDevicePushTokenAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElE,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,IAAI,kBAAkB,GAA2B,IAAI,CAAC;AAEtD;;;;GAIG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,uBAAuB;IACnD,IAAI,CAAC,gBAAgB,CAAC,uBAAuB,EAAE;QAC7C,MAAM,IAAI,mBAAmB,CAAC,mBAAmB,EAAE,yBAAyB,CAAC,CAAC;KAC/E;IACD,qBAAqB,EAAE,CAAC;IAExB,IAAI,eAA8B,CAAC;IACnC,IAAI,kBAAkB,EAAE;QACtB,yBAAyB;QACzB,eAAe,GAAG,MAAM,kBAAkB,CAAC;KAC5C;SAAM;QACL,+CAA+C;QAC/C,kBAAkB,GAAG,gBAAgB,CAAC,uBAAuB,EAAE,CAAC;QAChE,eAAe,GAAG,MAAM,kBAAkB,CAAC;QAC3C,kBAAkB,GAAG,IAAI,CAAC;KAC3B;IAED,uFAAuF;IACvF,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;AACtD,CAAC","sourcesContent":["import { UnavailabilityError, Platform } from 'expo-modules-core';\n\nimport PushTokenManager from './PushTokenManager';\nimport { DevicePushToken } from './Tokens.types';\nimport { warnOfExpoGoPushUsage } from './warnOfExpoGoPushUsage';\n\nlet nativeTokenPromise: Promise<string> | null = null;\n\n/**\n * Returns a native FCM, APNs token or a [`PushSubscription` data](https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription)\n * that can be used with another push notification service.\n * @header fetch\n */\nexport default async function getDevicePushTokenAsync(): Promise<DevicePushToken> {\n if (!PushTokenManager.getDevicePushTokenAsync) {\n throw new UnavailabilityError('ExpoNotifications', 'getDevicePushTokenAsync');\n }\n warnOfExpoGoPushUsage();\n\n let devicePushToken: string | null;\n if (nativeTokenPromise) {\n // Reuse existing Promise\n devicePushToken = await nativeTokenPromise;\n } else {\n // Create a new Promise and clear it afterwards\n nativeTokenPromise = PushTokenManager.getDevicePushTokenAsync();\n devicePushToken = await nativeTokenPromise;\n nativeTokenPromise = null;\n }\n\n // @ts-ignore: TS thinks Platform.OS could be anything and can't decide what type is it\n return { type: Platform.OS, data: devicePushToken };\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export declare const warnOfExpoGoPushUsage: () => void;
2
+ //# sourceMappingURL=warnOfExpoGoPushUsage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"warnOfExpoGoPushUsage.d.ts","sourceRoot":"","sources":["../src/warnOfExpoGoPushUsage.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,qBAAqB,YAOjC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { isRunningInExpoGo } from 'expo';
2
+ let didWarn = false;
3
+ export const warnOfExpoGoPushUsage = () => {
4
+ if (__DEV__ && isRunningInExpoGo() && !didWarn) {
5
+ didWarn = true;
6
+ console.warn(`expo-notifications: Push notifications (remote notifications) functionality provided by expo-notifications will be removed from Expo Go in SDK 53. Instead, use a development build. Read more at https://docs.expo.dev/develop/development-builds/introduction/.`);
7
+ }
8
+ };
9
+ //# sourceMappingURL=warnOfExpoGoPushUsage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"warnOfExpoGoPushUsage.js","sourceRoot":"","sources":["../src/warnOfExpoGoPushUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAEzC,IAAI,OAAO,GAAG,KAAK,CAAC;AAEpB,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,IAAI,OAAO,IAAI,iBAAiB,EAAE,IAAI,CAAC,OAAO,EAAE;QAC9C,OAAO,GAAG,IAAI,CAAC;QACf,OAAO,CAAC,IAAI,CACV,mQAAmQ,CACpQ,CAAC;KACH;AACH,CAAC,CAAC","sourcesContent":["import { isRunningInExpoGo } from 'expo';\n\nlet didWarn = false;\n\nexport const warnOfExpoGoPushUsage = () => {\n if (__DEV__ && isRunningInExpoGo() && !didWarn) {\n didWarn = true;\n console.warn(\n `expo-notifications: Push notifications (remote notifications) functionality provided by expo-notifications will be removed from Expo Go in SDK 53. Instead, use a development build. Read more at https://docs.expo.dev/develop/development-builds/introduction/.`\n );\n }\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-notifications",
3
- "version": "0.29.0",
3
+ "version": "0.29.1",
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",
@@ -58,5 +58,5 @@
58
58
  "react": "*",
59
59
  "react-native": "*"
60
60
  },
61
- "gitHead": "685ebb8a213326cb33c80281ca8756b374ccb63d"
61
+ "gitHead": "0a07b965c4bef67e7718355a0dc770d524ad3cee"
62
62
  }
@@ -2,6 +2,7 @@ import { LegacyEventEmitter, type EventSubscription, Platform } from 'expo-modul
2
2
 
3
3
  import PushTokenManager from './PushTokenManager';
4
4
  import { DevicePushToken } from './Tokens.types';
5
+ import { warnOfExpoGoPushUsage } from './warnOfExpoGoPushUsage';
5
6
 
6
7
  /**
7
8
  * A function accepting a device push token ([`DevicePushToken`](#devicepushtoken)) as an argument.
@@ -41,6 +42,7 @@ const newTokenEventName = 'onDevicePushToken';
41
42
  * ```
42
43
  */
43
44
  export function addPushTokenListener(listener: PushTokenListener): EventSubscription {
45
+ warnOfExpoGoPushUsage();
44
46
  const wrappingListener = ({ devicePushToken }) =>
45
47
  listener({ data: devicePushToken, type: Platform.OS });
46
48
  return tokenEmitter.addListener(newTokenEventName, wrappingListener);
@@ -2,6 +2,7 @@ import { UnavailabilityError, Platform } from 'expo-modules-core';
2
2
 
3
3
  import PushTokenManager from './PushTokenManager';
4
4
  import { DevicePushToken } from './Tokens.types';
5
+ import { warnOfExpoGoPushUsage } from './warnOfExpoGoPushUsage';
5
6
 
6
7
  let nativeTokenPromise: Promise<string> | null = null;
7
8
 
@@ -14,6 +15,7 @@ export default async function getDevicePushTokenAsync(): Promise<DevicePushToken
14
15
  if (!PushTokenManager.getDevicePushTokenAsync) {
15
16
  throw new UnavailabilityError('ExpoNotifications', 'getDevicePushTokenAsync');
16
17
  }
18
+ warnOfExpoGoPushUsage();
17
19
 
18
20
  let devicePushToken: string | null;
19
21
  if (nativeTokenPromise) {
@@ -0,0 +1,12 @@
1
+ import { isRunningInExpoGo } from 'expo';
2
+
3
+ let didWarn = false;
4
+
5
+ export const warnOfExpoGoPushUsage = () => {
6
+ if (__DEV__ && isRunningInExpoGo() && !didWarn) {
7
+ didWarn = true;
8
+ console.warn(
9
+ `expo-notifications: Push notifications (remote notifications) functionality provided by expo-notifications will be removed from Expo Go in SDK 53. Instead, use a development build. Read more at https://docs.expo.dev/develop/development-builds/introduction/.`
10
+ );
11
+ }
12
+ };