@symbiote-native/notifications 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/README.md +94 -58
  2. package/build/angular/index.d.ts +1 -0
  3. package/build/angular/index.js +1 -0
  4. package/build/angular/services/last-notification-response.service/index.d.ts +8 -0
  5. package/build/angular/services/last-notification-response.service/index.js +78 -0
  6. package/build/core/auto-registration.d.ts +5 -0
  7. package/build/core/auto-registration.js +65 -0
  8. package/build/core/backoff.d.ts +6 -0
  9. package/build/core/backoff.js +15 -0
  10. package/build/core/device-token.d.ts +7 -0
  11. package/build/core/device-token.js +35 -0
  12. package/build/core/emitter.d.ts +4 -0
  13. package/build/core/emitter.js +8 -0
  14. package/build/core/index.d.ts +3 -1
  15. package/build/core/index.js +3 -1
  16. package/build/core/last-notification-response.d.ts +2 -0
  17. package/build/core/last-notification-response.js +12 -0
  18. package/build/core/registration-abort.d.ts +2 -0
  19. package/build/core/registration-abort.js +10 -0
  20. package/build/core/token-metadata.d.ts +4 -0
  21. package/build/core/token-metadata.js +34 -0
  22. package/build/core/tokens.d.ts +4 -22
  23. package/build/core/tokens.js +41 -99
  24. package/build/core/update-device-push-token.d.ts +3 -0
  25. package/build/core/update-device-push-token.js +122 -0
  26. package/build/react/hooks/use-last-notification-response/index.d.ts +2 -0
  27. package/build/react/hooks/use-last-notification-response/index.js +22 -0
  28. package/build/react/index.d.ts +2 -0
  29. package/build/react/index.js +2 -0
  30. package/build/solid/index.d.ts +2 -0
  31. package/build/solid/index.js +2 -0
  32. package/build/solid/primitives/create-last-notification-response.d.ts +3 -0
  33. package/build/solid/primitives/create-last-notification-response.js +20 -0
  34. package/build/svelte/index.d.ts +2 -0
  35. package/build/svelte/index.js +2 -0
  36. package/build/svelte/use-last-notification-response.svelte.d.ts +4 -0
  37. package/build/svelte/use-last-notification-response.svelte.js +25 -0
  38. package/build/vue/composables/use-last-notification-response/index.d.ts +3 -0
  39. package/build/vue/composables/use-last-notification-response/index.js +20 -0
  40. package/build/vue/index.d.ts +2 -0
  41. package/build/vue/index.js +2 -0
  42. package/build-ngc/angular/index.d.ts +1 -0
  43. package/build-ngc/angular/index.js +1 -0
  44. package/build-ngc/angular/index.js.map +1 -1
  45. package/build-ngc/angular/services/last-notification-response.service/index.d.ts +11 -0
  46. package/build-ngc/angular/services/last-notification-response.service/index.js +37 -0
  47. package/build-ngc/angular/services/last-notification-response.service/index.js.map +1 -0
  48. package/build-ngc/core/auto-registration.d.ts +5 -0
  49. package/build-ngc/core/auto-registration.js +66 -0
  50. package/build-ngc/core/auto-registration.js.map +1 -0
  51. package/build-ngc/core/backoff.d.ts +6 -0
  52. package/build-ngc/core/backoff.js +16 -0
  53. package/build-ngc/core/backoff.js.map +1 -0
  54. package/build-ngc/core/device-token.d.ts +7 -0
  55. package/build-ngc/core/device-token.js +36 -0
  56. package/build-ngc/core/device-token.js.map +1 -0
  57. package/build-ngc/core/emitter.d.ts +4 -0
  58. package/build-ngc/core/emitter.js +8 -0
  59. package/build-ngc/core/emitter.js.map +1 -1
  60. package/build-ngc/core/index.d.ts +3 -1
  61. package/build-ngc/core/index.js +3 -1
  62. package/build-ngc/core/index.js.map +1 -1
  63. package/build-ngc/core/last-notification-response.d.ts +2 -0
  64. package/build-ngc/core/last-notification-response.js +13 -0
  65. package/build-ngc/core/last-notification-response.js.map +1 -0
  66. package/build-ngc/core/registration-abort.d.ts +2 -0
  67. package/build-ngc/core/registration-abort.js +11 -0
  68. package/build-ngc/core/registration-abort.js.map +1 -0
  69. package/build-ngc/core/token-metadata.d.ts +4 -0
  70. package/build-ngc/core/token-metadata.js +35 -0
  71. package/build-ngc/core/token-metadata.js.map +1 -0
  72. package/build-ngc/core/tokens.d.ts +4 -22
  73. package/build-ngc/core/tokens.js +41 -99
  74. package/build-ngc/core/tokens.js.map +1 -1
  75. package/build-ngc/core/update-device-push-token.d.ts +3 -0
  76. package/build-ngc/core/update-device-push-token.js +123 -0
  77. package/build-ngc/core/update-device-push-token.js.map +1 -0
  78. package/package.json +24 -23
  79. package/src/angular/index.ts +1 -0
  80. package/src/angular/services/last-notification-response.service/index.ts +54 -0
  81. package/src/core/auto-registration.ts +105 -0
  82. package/src/core/backoff.ts +24 -0
  83. package/src/core/device-token.ts +54 -0
  84. package/src/core/emitter.ts +10 -0
  85. package/src/core/index.ts +8 -0
  86. package/src/core/last-notification-response.ts +19 -0
  87. package/src/core/registration-abort.ts +12 -0
  88. package/src/core/token-metadata.ts +42 -0
  89. package/src/core/tokens.ts +71 -133
  90. package/src/core/update-device-push-token.ts +173 -0
  91. package/src/react/hooks/use-last-notification-response/index.ts +35 -0
  92. package/src/react/index.ts +2 -0
  93. package/src/solid/index.ts +2 -0
  94. package/src/solid/primitives/create-last-notification-response.ts +35 -0
  95. package/src/svelte/index.ts +2 -0
  96. package/src/svelte/svelte-ambient.d.ts +3 -0
  97. package/src/svelte/svelte-compile.test-helper.ts +7 -0
  98. package/src/svelte/use-last-notification-response.svelte.ts +45 -0
  99. package/src/vue/composables/use-last-notification-response/index.ts +35 -0
  100. package/src/vue/index.ts +2 -0
@@ -0,0 +1,66 @@
1
+ // Порт `DevicePushTokenAutoRegistration.fx.ts`, ресинк токена на сервер Expo
2
+ import { UnavailabilityError } from 'expo-modules-core';
3
+ import { addPushTokenListener, getDevicePushTokenAsync } from './device-token';
4
+ import { serverRegistrationModule } from './native-modules';
5
+ import { startAbortableRegistration } from './registration-abort';
6
+ import { hasDeviceTokenChangedAsync, updateDevicePushTokenAsync, } from './update-device-push-token';
7
+ async function updatePushTokenAsync(token) {
8
+ if (!(await hasDeviceTokenChangedAsync(token)))
9
+ return;
10
+ await updateDevicePushTokenAsync(startAbortableRegistration(), token);
11
+ }
12
+ function isEnabledRegistration(info) {
13
+ if (!info)
14
+ return false;
15
+ try {
16
+ const registration = JSON.parse(info);
17
+ return registration?.isEnabled === true;
18
+ }
19
+ catch (error) {
20
+ console.warn('[notifications] Error encountered while fetching registration information for auto token updates.', error);
21
+ return false;
22
+ }
23
+ }
24
+ // Досылает токен, если регистрация включена, а сервер его не получил
25
+ export async function handlePersistedRegistrationInfoAsync(registrationInfo) {
26
+ if (!isEnabledRegistration(registrationInfo))
27
+ return;
28
+ try {
29
+ // Регистрация включена, поэтому запрос "нового" токена безопасен
30
+ await updatePushTokenAsync(await getDevicePushTokenAsync());
31
+ }
32
+ catch (error) {
33
+ console.warn('[notifications] Error encountered while updating server registration with latest device push token.', error);
34
+ }
35
+ }
36
+ let removeListener = null;
37
+ // Upstream ставит подписку при загрузке модуля, здесь явно, т.к. под `inlineRequires` barrel
38
+ // не гарантирует выполнение побочного эффекта
39
+ export function installPushTokenAutoRegistration() {
40
+ if (removeListener)
41
+ return removeListener;
42
+ const getRegistrationInfoAsync = serverRegistrationModule.getRegistrationInfoAsync;
43
+ if (!getRegistrationInfoAsync) {
44
+ console.warn('[notifications] Error encountered while fetching auto-registration state, new tokens will not be automatically registered on server.', new UnavailabilityError('ServerRegistrationModule', 'getRegistrationInfoAsync'));
45
+ return () => undefined;
46
+ }
47
+ const subscription = addPushTokenListener(async (token) => {
48
+ try {
49
+ if (isEnabledRegistration(await serverRegistrationModule.getRegistrationInfoAsync?.())) {
50
+ await updatePushTokenAsync(token);
51
+ }
52
+ }
53
+ catch (error) {
54
+ console.warn('[notifications] Error encountered while updating server registration with latest device push token.', error);
55
+ }
56
+ });
57
+ getRegistrationInfoAsync().then(handlePersistedRegistrationInfoAsync, error => {
58
+ console.error('[notifications] Error reading persisted server registration info: ', error);
59
+ });
60
+ removeListener = () => {
61
+ subscription.remove();
62
+ removeListener = null;
63
+ };
64
+ return removeListener;
65
+ }
66
+ //# sourceMappingURL=auto-registration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auto-registration.js","sourceRoot":"","sources":["../../src/core/auto-registration.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,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C9C,IAAI,cAAc;QAAE,OAAO,cAAc,CAAC;IAE1C,MAAM,wBAAwB,GAC5B,wBAAwB,CAAC,wBAAwB,CAAC;IACpD,IAAI,CAAC,wBAAwB,EAAE,CAAC;QAC9B,OAAO,CAAC,IAAI,CACV,sIAAsI,EACtI,IAAI,mBAAmB,CACrB,0BAA0B,EAC1B,0BAA0B,CAC3B,CACF,CAAC;QACF,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC;IACzB,CAAC;IAED,MAAM,YAAY,GAAG,oBAAoB,CAAC,KAAK,EAAC,KAAK,EAAC,EAAE;QACtD,IAAI,CAAC;YACH,IACE,qBAAqB,CACnB,MAAM,wBAAwB,CAAC,wBAAwB,EAAE,EAAE,CAC5D,EACD,CAAC;gBACD,MAAM,oBAAoB,CAAC,KAAK,CAAC,CAAC;YACpC,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,CACV,qGAAqG,EACrG,KAAK,CACN,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,wBAAwB,EAAE,CAAC,IAAI,CAC7B,oCAAoC,EACpC,KAAK,CAAC,EAAE;QACN,OAAO,CAAC,KAAK,CACX,oEAAoE,EACpE,KAAK,CACN,CAAC;IACJ,CAAC,CACF,CAAC;IAEF,cAAc,GAAG,GAAG,EAAE;QACpB,YAAY,CAAC,MAAM,EAAE,CAAC;QACtB,cAAc,GAAG,IAAI,CAAC;IACxB,CAAC,CAAC;IACF,OAAO,cAAc,CAAC;AACxB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare function computeNextBackoffInterval(initialBackoff: number, previousRetryCount: number, { multiplier, randomizationFactor, minBackoff, maxBackoff, }?: {
2
+ multiplier?: number | undefined;
3
+ randomizationFactor?: number | undefined;
4
+ minBackoff?: number | undefined;
5
+ maxBackoff?: number | undefined;
6
+ }): number;
@@ -0,0 +1,16 @@
1
+ // Ported from expo-notifications sdk-57 utils/backoff.ts, itself from ide/backoff
2
+ export function computeNextBackoffInterval(initialBackoff, previousRetryCount, { multiplier = 1.5, randomizationFactor = 0.25, minBackoff = initialBackoff, maxBackoff = Infinity, } = {}) {
3
+ if (initialBackoff <= 0)
4
+ initialBackoff = 1;
5
+ if (previousRetryCount < 0)
6
+ previousRetryCount = 0;
7
+ if (multiplier < 1)
8
+ multiplier = 1;
9
+ if (randomizationFactor < 0 || randomizationFactor > 1)
10
+ randomizationFactor = 0;
11
+ const nextBackoff = initialBackoff * multiplier ** previousRetryCount;
12
+ // Jitter within the negative to positive range of the randomization factor
13
+ const jitterFactor = 1 - randomizationFactor + 2 * randomizationFactor * Math.random();
14
+ return Math.min(Math.max(nextBackoff * jitterFactor, minBackoff), maxBackoff);
15
+ }
16
+ //# sourceMappingURL=backoff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backoff.js","sourceRoot":"","sources":["../../src/core/backoff.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,MAAM,UAAU,0BAA0B,CACxC,cAAsB,EACtB,kBAA0B,EAC1B,EACE,UAAU,GAAG,GAAG,EAChB,mBAAmB,GAAG,IAAI,EAC1B,UAAU,GAAG,cAAc,EAC3B,UAAU,GAAG,QAAQ,GACtB,GAAG,EAAE;IAEN,IAAI,cAAc,IAAI,CAAC;QAAE,cAAc,GAAG,CAAC,CAAC;IAC5C,IAAI,kBAAkB,GAAG,CAAC;QAAE,kBAAkB,GAAG,CAAC,CAAC;IACnD,IAAI,UAAU,GAAG,CAAC;QAAE,UAAU,GAAG,CAAC,CAAC;IACnC,IAAI,mBAAmB,GAAG,CAAC,IAAI,mBAAmB,GAAG,CAAC;QACpD,mBAAmB,GAAG,CAAC,CAAC;IAE1B,MAAM,WAAW,GAAG,cAAc,GAAG,UAAU,IAAI,kBAAkB,CAAC;IACtE,2EAA2E;IAC3E,MAAM,YAAY,GAChB,CAAC,GAAG,mBAAmB,GAAG,CAAC,GAAG,mBAAmB,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;IAEpE,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,GAAG,YAAY,EAAE,UAAU,CAAC,EAAE,UAAU,CAAC,CAAC;AAChF,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type EventSubscription } from 'expo-modules-core';
2
+ import type { IDevicePushToken } from './types';
3
+ export type IPushTokenListener = (token: IDevicePushToken) => void;
4
+ /** Fires whenever the OS rolls the device push token while the app is running */
5
+ export declare function addPushTokenListener(listener: IPushTokenListener): EventSubscription;
6
+ /** Returns the native FCM (Android) or APNs (iOS) device push token */
7
+ export declare function getDevicePushTokenAsync(): Promise<IDevicePushToken>;
@@ -0,0 +1,36 @@
1
+ // Отдельно от `tokens.ts`, чтобы `auto-registration.ts` не зависел от него по кругу
2
+ import { Platform, UnavailabilityError, } from 'expo-modules-core';
3
+ import { dlog } from '@symbiote-native/engine';
4
+ import { pushTokenManager } from './native-modules';
5
+ // Пакет только под iOS/Android, поэтому `Platform.OS` сужаем один раз здесь, а не кастами
6
+ function nativePlatform() {
7
+ if (Platform.OS === 'ios' || Platform.OS === 'android') {
8
+ return Platform.OS;
9
+ }
10
+ throw new Error(`[notifications] unsupported platform: ${Platform.OS}`);
11
+ }
12
+ /** Fires whenever the OS rolls the device push token while the app is running */
13
+ export function addPushTokenListener(listener) {
14
+ return pushTokenManager.addListener('onDevicePushToken', ({ devicePushToken }) => {
15
+ listener({ data: devicePushToken, type: nativePlatform() });
16
+ });
17
+ }
18
+ let nativeTokenPromise = null;
19
+ /** Returns the native FCM (Android) or APNs (iOS) device push token */
20
+ export async function getDevicePushTokenAsync() {
21
+ if (!pushTokenManager.getDevicePushTokenAsync) {
22
+ throw new UnavailabilityError('Notifications', 'getDevicePushTokenAsync');
23
+ }
24
+ let devicePushToken;
25
+ if (nativeTokenPromise) {
26
+ devicePushToken = await nativeTokenPromise;
27
+ }
28
+ else {
29
+ nativeTokenPromise = pushTokenManager.getDevicePushTokenAsync();
30
+ devicePushToken = await nativeTokenPromise;
31
+ nativeTokenPromise = null;
32
+ }
33
+ dlog('[notifications] getDevicePushTokenAsync resolved');
34
+ return { type: nativePlatform(), data: devicePushToken };
35
+ }
36
+ //# sourceMappingURL=device-token.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device-token.js","sourceRoot":"","sources":["../../src/core/device-token.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,OAAO,EACL,QAAQ,EACR,mBAAmB,GAEpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGpD,0FAA0F;AAC1F,SAAS,cAAc;IACrB,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;QACvD,OAAO,QAAQ,CAAC,EAAE,CAAC;IACrB,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,yCAAyC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;AAC1E,CAAC;AAID,iFAAiF;AACjF,MAAM,UAAU,oBAAoB,CAClC,QAA4B;IAE5B,OAAO,gBAAgB,CAAC,WAAW,CACjC,mBAAmB,EACnB,CAAC,EAAE,eAAe,EAAE,EAAE,EAAE;QACtB,QAAQ,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,CAAC,CAAC;IAC9D,CAAC,CACF,CAAC;AACJ,CAAC;AAED,IAAI,kBAAkB,GAA2B,IAAI,CAAC;AAEtD,uEAAuE;AACvE,MAAM,CAAC,KAAK,UAAU,uBAAuB;IAC3C,IAAI,CAAC,gBAAgB,CAAC,uBAAuB,EAAE,CAAC;QAC9C,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,yBAAyB,CAAC,CAAC;IAC5E,CAAC;IAED,IAAI,eAAuB,CAAC;IAC5B,IAAI,kBAAkB,EAAE,CAAC;QACvB,eAAe,GAAG,MAAM,kBAAkB,CAAC;IAC7C,CAAC;SAAM,CAAC;QACN,kBAAkB,GAAG,gBAAgB,CAAC,uBAAuB,EAAE,CAAC;QAChE,eAAe,GAAG,MAAM,kBAAkB,CAAC;QAC3C,kBAAkB,GAAG,IAAI,CAAC;IAC5B,CAAC;IAED,IAAI,CAAC,kDAAkD,CAAC,CAAC;IACzD,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;AAC3D,CAAC"}
@@ -20,5 +20,9 @@ export declare function getLastNotificationResponse(): INotificationResponse | n
20
20
  * be re-applied on the next read.
21
21
  */
22
22
  export declare function clearLastNotificationResponse(): void;
23
+ /** @deprecated Use `getLastNotificationResponse` instead */
24
+ export declare function getLastNotificationResponseAsync(): Promise<INotificationResponse | null>;
25
+ /** @deprecated Use `clearLastNotificationResponse` instead */
26
+ export declare function clearLastNotificationResponseAsync(): Promise<void>;
23
27
  /** Fires whenever `clearLastNotificationResponse` runs. */
24
28
  export declare function addNotificationResponseClearedListener(listener: () => void): EventSubscription;
@@ -52,6 +52,14 @@ export function clearLastNotificationResponse() {
52
52
  notificationsEmitterModule.clearLastNotificationResponse();
53
53
  emitter.emit(RESPONSE_CLEARED_EVENT, []);
54
54
  }
55
+ /** @deprecated Use `getLastNotificationResponse` instead */
56
+ export async function getLastNotificationResponseAsync() {
57
+ return getLastNotificationResponse();
58
+ }
59
+ /** @deprecated Use `clearLastNotificationResponse` instead */
60
+ export async function clearLastNotificationResponseAsync() {
61
+ clearLastNotificationResponse();
62
+ }
55
63
  /** Fires whenever `clearLastNotificationResponse` runs. */
56
64
  export function addNotificationResponseClearedListener(listener) {
57
65
  return emitter.addListener(RESPONSE_CLEARED_EVENT, listener);
@@ -1 +1 @@
1
- {"version":3,"file":"emitter.js","sourceRoot":"","sources":["../../src/core/emitter.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,OAAO,EACL,kBAAkB,EAClB,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Q,CAAC,CAAC,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AACjE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,6BAA6B;IAC3C,IAAI,CAAC,0BAA0B,CAAC,6BAA6B,EAAE,CAAC;QAC9D,MAAM,IAAI,mBAAmB,CAC3B,eAAe,EACf,+BAA+B,CAChC,CAAC;IACJ,CAAC;IACD,0BAA0B,CAAC,6BAA6B,EAAE,CAAC;IAC3D,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE,CAAC,CAAC;AAC3C,CAAC;AAED,4DAA4D;AAC5D,MAAM,CAAC,KAAK,UAAU,gCAAgC;IACpD,OAAO,2BAA2B,EAAE,CAAC;AACvC,CAAC;AAED,8DAA8D;AAC9D,MAAM,CAAC,KAAK,UAAU,kCAAkC;IACtD,6BAA6B,EAAE,CAAC;AAClC,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,sCAAsC,CACpD,QAAoB;IAEpB,OAAO,OAAO,CAAC,WAAW,CAAO,sBAAsB,EAAE,QAAQ,CAAC,CAAC;AACrE,CAAC"}
@@ -1,12 +1,14 @@
1
1
  export { getPermissionsAsync, requestPermissionsAsync } from './permissions';
2
2
  export { addPushTokenListener, getDevicePushTokenAsync, getExpoPushTokenAsync, setAutoServerRegistrationEnabledAsync, subscribeToTopicAsync, unregisterForNotificationsAsync, unsubscribeFromTopicAsync, type IPushTokenListener, } from './tokens';
3
+ export { installPushTokenAutoRegistration, type IDevicePushTokenRegistration, } from './auto-registration';
3
4
  export { dismissAllNotificationsAsync, dismissNotificationAsync, getPresentedNotificationsAsync, } from './presenter';
4
5
  export { getBadgeCountAsync, setBadgeCountAsync } from './badge';
5
6
  export { cancelAllScheduledNotificationsAsync, cancelScheduledNotificationAsync, getAllScheduledNotificationsAsync, getNextTriggerDateAsync, scheduleNotificationAsync, } from './scheduler';
6
7
  export { deleteNotificationCategoryAsync, getNotificationCategoriesAsync, setNotificationCategoryAsync, } from './categories';
7
8
  export { deleteNotificationChannelAsync, deleteNotificationChannelGroupAsync, getNotificationChannelAsync, getNotificationChannelGroupAsync, getNotificationChannelGroupsAsync, getNotificationChannelsAsync, setNotificationChannelAsync, setNotificationChannelGroupAsync, } from './channels';
8
9
  export { NotificationTimeoutError, setNotificationHandler } from './handler';
9
- export { DEFAULT_ACTION_IDENTIFIER, addNotificationReceivedListener, addNotificationResponseClearedListener, addNotificationResponseReceivedListener, addNotificationsDroppedListener, clearLastNotificationResponse, getLastNotificationResponse, } from './emitter';
10
+ export { DEFAULT_ACTION_IDENTIFIER, addNotificationReceivedListener, addNotificationResponseClearedListener, addNotificationResponseReceivedListener, addNotificationsDroppedListener, clearLastNotificationResponse, clearLastNotificationResponseAsync, getLastNotificationResponse, getLastNotificationResponseAsync, } from './emitter';
10
11
  export { BackgroundNotificationTaskResult, registerTaskAsync, unregisterTaskAsync, } from './background-task';
12
+ export { determineNextResponse } from './last-notification-response';
11
13
  export type { IAudioAttributes, IAudioAttributesInput, IBeaconRegion, ICalendarNotificationTrigger, ICalendarTriggerInput, IChannelAwareTriggerInput, ICircularRegion, IDailyNotificationTrigger, IDailyTriggerInput, IDateTriggerInput, IDevicePushToken, IExpoPushToken, IExpoPushTokenOptions, IFirebaseRemoteMessage, IFirebaseRemoteMessageNotification, IInterruptionLevel, IIosNotificationPermissionsRequest, ILocationNotificationTrigger, IMaybeNotificationResponse, IMonthlyNotificationTrigger, IMonthlyTriggerInput, INativeCalendarTriggerInput, INativeChannelAwareTriggerInput, INativeDailyTriggerInput, INativeDateTriggerInput, INativeDevicePushToken, INativeMonthlyTriggerInput, INativeNotificationTriggerInput, INativeTimeIntervalTriggerInput, INativeWeeklyTriggerInput, INativeYearlyTriggerInput, INotification, INotificationAction, INotificationBehavior, INotificationCategory, INotificationCategoryOptions, INotificationChannel, INotificationChannelGroup, INotificationChannelGroupInput, INotificationChannelInput, INotificationContent, INotificationContentAndroid, INotificationContentAttachmentIos, INotificationContentInput, INotificationContentIos, INotificationHandler, INotificationPermissionsRequest, INotificationPermissionsStatus, INotificationRequest, INotificationRequestInput, INotificationResponse, INotificationTaskPayload, INotificationTrigger, INotificationTriggerInput, IPushNotificationTrigger, IRegion, ISchedulableNotificationTriggerInput, ITimeIntervalNotificationTrigger, ITimeIntervalTriggerInput, IUnknownNotificationTrigger, IWeeklyNotificationTrigger, IWeeklyTriggerInput, IYearlyNotificationTrigger, IYearlyTriggerInput, PermissionExpiration, PermissionResponse, } from './types';
12
14
  export { AndroidAudioContentType, AndroidAudioUsage, AndroidImportance, AndroidNotificationPriority, AndroidNotificationVisibility, IosAlertStyle, IosAllowsPreviews, IosAuthorizationStatus, PermissionStatus, SchedulableTriggerInputTypes, } from './types';
@@ -1,12 +1,14 @@
1
1
  export { getPermissionsAsync, requestPermissionsAsync } from './permissions';
2
2
  export { addPushTokenListener, getDevicePushTokenAsync, getExpoPushTokenAsync, setAutoServerRegistrationEnabledAsync, subscribeToTopicAsync, unregisterForNotificationsAsync, unsubscribeFromTopicAsync, } from './tokens';
3
+ export { installPushTokenAutoRegistration, } from './auto-registration';
3
4
  export { dismissAllNotificationsAsync, dismissNotificationAsync, getPresentedNotificationsAsync, } from './presenter';
4
5
  export { getBadgeCountAsync, setBadgeCountAsync } from './badge';
5
6
  export { cancelAllScheduledNotificationsAsync, cancelScheduledNotificationAsync, getAllScheduledNotificationsAsync, getNextTriggerDateAsync, scheduleNotificationAsync, } from './scheduler';
6
7
  export { deleteNotificationCategoryAsync, getNotificationCategoriesAsync, setNotificationCategoryAsync, } from './categories';
7
8
  export { deleteNotificationChannelAsync, deleteNotificationChannelGroupAsync, getNotificationChannelAsync, getNotificationChannelGroupAsync, getNotificationChannelGroupsAsync, getNotificationChannelsAsync, setNotificationChannelAsync, setNotificationChannelGroupAsync, } from './channels';
8
9
  export { NotificationTimeoutError, setNotificationHandler } from './handler';
9
- export { DEFAULT_ACTION_IDENTIFIER, addNotificationReceivedListener, addNotificationResponseClearedListener, addNotificationResponseReceivedListener, addNotificationsDroppedListener, clearLastNotificationResponse, getLastNotificationResponse, } from './emitter';
10
+ export { DEFAULT_ACTION_IDENTIFIER, addNotificationReceivedListener, addNotificationResponseClearedListener, addNotificationResponseReceivedListener, addNotificationsDroppedListener, clearLastNotificationResponse, clearLastNotificationResponseAsync, getLastNotificationResponse, getLastNotificationResponseAsync, } from './emitter';
10
11
  export { BackgroundNotificationTaskResult, registerTaskAsync, unregisterTaskAsync, } from './background-task';
12
+ export { determineNextResponse } from './last-notification-response';
11
13
  export { AndroidAudioContentType, AndroidAudioUsage, AndroidImportance, AndroidNotificationPriority, AndroidNotificationVisibility, IosAlertStyle, IosAllowsPreviews, IosAuthorizationStatus, PermissionStatus, SchedulableTriggerInputTypes, } from './types';
12
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAE7E,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,qCAAqC,EACrC,qBAAqB,EACrB,+BAA+B,EAC/B,yBAAyB,GAE1B,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,4BAA4B,EAC5B,wBAAwB,EACxB,8BAA8B,GAC/B,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAEjE,OAAO,EACL,oCAAoC,EACpC,gCAAgC,EAChC,iCAAiC,EACjC,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,+BAA+B,EAC/B,8BAA8B,EAC9B,4BAA4B,GAC7B,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,8BAA8B,EAC9B,mCAAmC,EACnC,2BAA2B,EAC3B,gCAAgC,EAChC,iCAAiC,EACjC,4BAA4B,EAC5B,2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AA2B,EAC3B,gCAAgC,EAChC,iCAAiC,EACjC,4BAA4B,EAC5B,2BAA2B,EAC3B,gCAAgC,GACjC,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAE7E,OAAO,EACL,yBAAyB,EACzB,+BAA+B,EAC/B,sCAAsC,EACtC,uCAAuC,EACvC,+BAA+B,EAC/B,6BAA6B,EAC7B,kCAAkC,EAClC,2BAA2B,EAC3B,gCAAgC,GACjC,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,gCAAgC,EAChC,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAsErE,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,iBAAiB,EACjB,2BAA2B,EAC3B,6BAA6B,EAC7B,aAAa,EACb,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,EAChB,4BAA4B,GAC7B,MAAM,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { IMaybeNotificationResponse, INotificationResponse } from './types';
2
+ export declare function determineNextResponse(prevResponse: IMaybeNotificationResponse, newResponse: INotificationResponse | null): IMaybeNotificationResponse;
@@ -0,0 +1,13 @@
1
+ // Framework-agnostic twin of expo-notifications' `determineNextResponse` - every adapter's
2
+ // `useLastNotificationResponse` shares this dedup rule instead of re-deriving it
3
+ export function determineNextResponse(prevResponse, newResponse) {
4
+ if (!newResponse)
5
+ return null;
6
+ if (!prevResponse)
7
+ return newResponse;
8
+ return prevResponse.notification.request.identifier !==
9
+ newResponse.notification.request.identifier
10
+ ? newResponse
11
+ : prevResponse;
12
+ }
13
+ //# sourceMappingURL=last-notification-response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"last-notification-response.js","sourceRoot":"","sources":["../../src/core/last-notification-response.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,iFAAiF;AAOjF,MAAM,UAAU,qBAAqB,CACnC,YAAwC,EACxC,WAAyC;IAEzC,IAAI,CAAC,WAAW;QAAE,OAAO,IAAI,CAAC;IAC9B,IAAI,CAAC,YAAY;QAAE,OAAO,WAAW,CAAC;IACtC,OAAO,YAAY,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU;QACjD,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU;QAC3C,CAAC,CAAC,WAAW;QACb,CAAC,CAAC,YAAY,CAAC;AACnB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function abortPendingRegistration(): void;
2
+ export declare function startAbortableRegistration(): AbortSignal;
@@ -0,0 +1,11 @@
1
+ // Один активный запрос ресинка токена, новый прерывает предыдущий
2
+ let lastAbortController = null;
3
+ export function abortPendingRegistration() {
4
+ lastAbortController?.abort();
5
+ }
6
+ export function startAbortableRegistration() {
7
+ abortPendingRegistration();
8
+ lastAbortController = new AbortController();
9
+ return lastAbortController.signal;
10
+ }
11
+ //# sourceMappingURL=registration-abort.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registration-abort.js","sourceRoot":"","sources":["../../src/core/registration-abort.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,IAAI,mBAAmB,GAA2B,IAAI,CAAC;AAEvD,MAAM,UAAU,wBAAwB;IACtC,mBAAmB,EAAE,KAAK,EAAE,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,0BAA0B;IACxC,wBAAwB,EAAE,CAAC;IAC3B,mBAAmB,GAAG,IAAI,eAAe,EAAE,CAAC;IAC5C,OAAO,mBAAmB,CAAC,MAAM,CAAC;AACpC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { IDevicePushToken } from './types';
2
+ export declare function getDeviceIdAsync(): Promise<string>;
3
+ export declare function getTypeOfToken(devicePushToken: IDevicePushToken): string;
4
+ export declare function shouldUseDevelopmentNotificationService(): Promise<boolean>;
@@ -0,0 +1,35 @@
1
+ import { getIosPushNotificationServiceEnvironmentAsync } from '@symbiote-native/application';
2
+ import { CodedError, Platform, UnavailabilityError } from 'expo-modules-core';
3
+ import { serverRegistrationModule } from './native-modules';
4
+ export async function getDeviceIdAsync() {
5
+ try {
6
+ if (!serverRegistrationModule.getInstallationIdAsync) {
7
+ throw new UnavailabilityError('Notifications', 'getInstallationIdAsync');
8
+ }
9
+ return await serverRegistrationModule.getInstallationIdAsync();
10
+ }
11
+ catch (error) {
12
+ throw new CodedError('ERR_NOTIF_DEVICE_ID', `Could not fetch the installation ID of the application: ${error}.`);
13
+ }
14
+ }
15
+ export function getTypeOfToken(devicePushToken) {
16
+ switch (devicePushToken.type) {
17
+ case 'ios':
18
+ return 'apns';
19
+ case 'android':
20
+ return 'fcm';
21
+ }
22
+ }
23
+ export async function shouldUseDevelopmentNotificationService() {
24
+ if (Platform.OS === 'ios') {
25
+ try {
26
+ return ((await getIosPushNotificationServiceEnvironmentAsync()) ===
27
+ 'development');
28
+ }
29
+ catch {
30
+ // Не смогли узнать окружение, считаем что не development
31
+ }
32
+ }
33
+ return false;
34
+ }
35
+ //# sourceMappingURL=token-metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-metadata.js","sourceRoot":"","sources":["../../src/core/token-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6CAA6C,EAAE,MAAM,8BAA8B,CAAC;AAC7F,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE9E,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAG5D,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,IAAI,CAAC;QACH,IAAI,CAAC,wBAAwB,CAAC,sBAAsB,EAAE,CAAC;YACrD,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,wBAAwB,CAAC,CAAC;QAC3E,CAAC;QACD,OAAO,MAAM,wBAAwB,CAAC,sBAAsB,EAAE,CAAC;IACjE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,UAAU,CAClB,qBAAqB,EACrB,2DAA2D,KAAK,GAAG,CACpE,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,eAAiC;IAC9D,QAAQ,eAAe,CAAC,IAAI,EAAE,CAAC;QAC7B,KAAK,KAAK;YACR,OAAO,MAAM,CAAC;QAChB,KAAK,SAAS;YACZ,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,uCAAuC;IAC3D,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;QAC1B,IAAI,CAAC;YACH,OAAO,CACL,CAAC,MAAM,6CAA6C,EAAE,CAAC;gBACvD,aAAa,CACd,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,yDAAyD;QAC3D,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -1,30 +1,12 @@
1
- import { type EventSubscription } from 'expo-modules-core';
2
- import type { IDevicePushToken, IExpoPushToken, IExpoPushTokenOptions } from './types';
3
- export type IPushTokenListener = (token: IDevicePushToken) => void;
4
- /** Fires whenever the OS rolls the device push token while the app is running. */
5
- export declare function addPushTokenListener(listener: IPushTokenListener): EventSubscription;
6
- /** Returns the native FCM (Android) or APNs (iOS) device push token. */
7
- export declare function getDevicePushTokenAsync(): Promise<IDevicePushToken>;
1
+ import type { IExpoPushToken, IExpoPushTokenOptions } from './types';
2
+ export { addPushTokenListener, getDevicePushTokenAsync, type IPushTokenListener, } from './device-token';
8
3
  /** Unregisters the device from receiving remote push notifications entirely. */
9
4
  export declare function unregisterForNotificationsAsync(): Promise<void>;
10
5
  /** Subscribes the device to an FCM topic. @platform android */
11
6
  export declare function subscribeToTopicAsync(topic: string): Promise<null>;
12
7
  /** Unsubscribes the device from an FCM topic. @platform android */
13
8
  export declare function unsubscribeFromTopicAsync(topic: string): Promise<null>;
14
- /**
15
- * Enables/disables letting the OS-level registration blob persist whether the device push
16
- * token should keep being pushed to the Expo push service backend. See the module doc comment
17
- * above for what this deliberately does *not* do (the auto-resync daemon).
18
- */
9
+ /** Persists whether the device push token keeps being pushed to the Expo push service */
19
10
  export declare function setAutoServerRegistrationEnabledAsync(enabled: boolean): Promise<void>;
20
- /**
21
- * Returns an Expo push token usable with Expo's push notification relay service. Makes a
22
- * network request to Expo's servers — wrap in try/catch and retry once the device is back
23
- * online.
24
- *
25
- * ponytail: upstream auto-fills `projectId`/`applicationId`/`development` from
26
- * `expo-constants`/`expo-application`. Neither package is part of this port, so pass them
27
- * explicitly (`applicationId` from `@symbiote-native/application`'s own `applicationId` export
28
- * covers the second one).
29
- */
11
+ /** Returns an Expo push token for Expo's push relay, needs network so retry when back online */
30
12
  export declare function getExpoPushTokenAsync(options?: IExpoPushTokenOptions): Promise<IExpoPushToken>;
@@ -1,49 +1,14 @@
1
- // Ported from expo-notifications @ sdk-57's getDevicePushTokenAsync.ts, getExpoPushTokenAsync.ts,
2
- // unregisterForNotificationsAsync.ts, topicSubscription.ts, TokenEmitter.ts, and the
3
- // `setAutoServerRegistrationEnabledAsync` half of DevicePushTokenAutoRegistration.fx.ts.
4
- //
5
- // ponytail: upstream's DevicePushTokenAutoRegistration.fx.ts also wires a permanent, module-load
6
- // background daemon that re-POSTs the device token to Expo's push backend on every token change
7
- // (with exponential backoff, via `abort-controller`) whenever registration was left enabled.
8
- // That auto-resync daemon is NOT ported — an app that wants it can call
9
- // `getExpoPushTokenAsync()` again from its own `addPushTokenListener` callback, which is the
10
- // same effect without a permanent background retry loop and its extra dependency.
11
- import { CodedError, Platform, UnavailabilityError, } from 'expo-modules-core';
1
+ // Порт токенов из upstream sdk-57, фоновый ресинк токена живёт в `auto-registration.ts`
2
+ import { applicationId } from '@symbiote-native/application';
3
+ import { CodedError, UnavailabilityError } from 'expo-modules-core';
12
4
  import { dlog } from '@symbiote-native/engine';
5
+ import { installPushTokenAutoRegistration } from './auto-registration';
6
+ import { getDevicePushTokenAsync } from './device-token';
13
7
  import { pushTokenManager, serverRegistrationModule, topicSubscriptionModule, } from './native-modules';
8
+ import { abortPendingRegistration } from './registration-abort';
9
+ import { getDeviceIdAsync, getTypeOfToken, shouldUseDevelopmentNotificationService, } from './token-metadata';
10
+ export { addPushTokenListener, getDevicePushTokenAsync, } from './device-token';
14
11
  const PRODUCTION_BASE_URL = 'https://exp.host/--/api/v2/';
15
- // This package targets iOS/Android only (root CLAUDE.md); narrow `Platform.OS` at the one
16
- // boundary that needs it rather than casting at every call site.
17
- function nativePlatform() {
18
- if (Platform.OS === 'ios' || Platform.OS === 'android') {
19
- return Platform.OS;
20
- }
21
- throw new Error(`[notifications] unsupported platform: ${Platform.OS}`);
22
- }
23
- /** Fires whenever the OS rolls the device push token while the app is running. */
24
- export function addPushTokenListener(listener) {
25
- return pushTokenManager.addListener('onDevicePushToken', ({ devicePushToken }) => {
26
- listener({ data: devicePushToken, type: nativePlatform() });
27
- });
28
- }
29
- let nativeTokenPromise = null;
30
- /** Returns the native FCM (Android) or APNs (iOS) device push token. */
31
- export async function getDevicePushTokenAsync() {
32
- if (!pushTokenManager.getDevicePushTokenAsync) {
33
- throw new UnavailabilityError('Notifications', 'getDevicePushTokenAsync');
34
- }
35
- let devicePushToken;
36
- if (nativeTokenPromise) {
37
- devicePushToken = await nativeTokenPromise;
38
- }
39
- else {
40
- nativeTokenPromise = pushTokenManager.getDevicePushTokenAsync();
41
- devicePushToken = await nativeTokenPromise;
42
- nativeTokenPromise = null;
43
- }
44
- dlog('[notifications] getDevicePushTokenAsync resolved');
45
- return { type: nativePlatform(), data: devicePushToken };
46
- }
47
12
  /** Unregisters the device from receiving remote push notifications entirely. */
48
13
  export async function unregisterForNotificationsAsync() {
49
14
  if (!pushTokenManager.unregisterForNotificationsAsync) {
@@ -65,12 +30,10 @@ export async function unsubscribeFromTopicAsync(topic) {
65
30
  }
66
31
  return topicSubscriptionModule.unsubscribeFromTopicAsync(topic);
67
32
  }
68
- /**
69
- * Enables/disables letting the OS-level registration blob persist whether the device push
70
- * token should keep being pushed to the Expo push service backend. See the module doc comment
71
- * above for what this deliberately does *not* do (the auto-resync daemon).
72
- */
33
+ /** Persists whether the device push token keeps being pushed to the Expo push service */
73
34
  export async function setAutoServerRegistrationEnabledAsync(enabled) {
35
+ // Перезаписываем регистрацию, поэтому висящий запрос не должен завершиться
36
+ abortPendingRegistration();
74
37
  if (!serverRegistrationModule.setRegistrationInfoAsync) {
75
38
  throw new UnavailabilityError('Notifications', 'setRegistrationInfoAsync');
76
39
  }
@@ -90,25 +53,7 @@ export async function setAutoServerRegistrationEnabledAsync(enabled) {
90
53
  }
91
54
  existing.isEnabled = true;
92
55
  await serverRegistrationModule.setRegistrationInfoAsync(JSON.stringify(existing));
93
- }
94
- async function getDeviceIdAsync() {
95
- try {
96
- if (!serverRegistrationModule.getInstallationIdAsync) {
97
- throw new UnavailabilityError('Notifications', 'getInstallationIdAsync');
98
- }
99
- return await serverRegistrationModule.getInstallationIdAsync();
100
- }
101
- catch (error) {
102
- throw new CodedError('ERR_NOTIF_DEVICE_ID', `Could not fetch the installation ID of the application: ${error}.`);
103
- }
104
- }
105
- function getTypeOfToken(devicePushToken) {
106
- switch (devicePushToken.type) {
107
- case 'ios':
108
- return 'apns';
109
- case 'android':
110
- return 'fcm';
111
- }
56
+ installPushTokenAutoRegistration();
112
57
  }
113
58
  function getDeviceToken(devicePushToken) {
114
59
  return devicePushToken.data;
@@ -133,37 +78,7 @@ function extractExpoPushToken(data) {
133
78
  }
134
79
  throw new CodedError('ERR_NOTIFICATIONS_SERVER_ERROR', `Malformed response from server, expected "{ data: { expoPushToken: string } }", received: ${JSON.stringify(data)}.`);
135
80
  }
136
- /**
137
- * Returns an Expo push token usable with Expo's push notification relay service. Makes a
138
- * network request to Expo's servers — wrap in try/catch and retry once the device is back
139
- * online.
140
- *
141
- * ponytail: upstream auto-fills `projectId`/`applicationId`/`development` from
142
- * `expo-constants`/`expo-application`. Neither package is part of this port, so pass them
143
- * explicitly (`applicationId` from `@symbiote-native/application`'s own `applicationId` export
144
- * covers the second one).
145
- */
146
- export async function getExpoPushTokenAsync(options = {}) {
147
- const devicePushToken = options.devicePushToken ?? (await getDevicePushTokenAsync());
148
- const deviceId = options.deviceId ?? (await getDeviceIdAsync());
149
- if (!options.projectId) {
150
- throw new CodedError('ERR_NOTIFICATIONS_NO_EXPERIENCE_ID', 'No "projectId" was passed to getExpoPushTokenAsync(). This port does not read expo-constants — pass it explicitly.');
151
- }
152
- if (!options.applicationId) {
153
- throw new CodedError('ERR_NOTIFICATIONS_NO_APPLICATION_ID', 'No "applicationId" was passed to getExpoPushTokenAsync(). This port does not read expo-application — pass it explicitly (e.g. @symbiote-native/application\'s `applicationId`).');
154
- }
155
- const type = options.type ?? getTypeOfToken(devicePushToken);
156
- const development = options.development ?? false;
157
- const baseUrl = options.baseUrl ?? PRODUCTION_BASE_URL;
158
- const url = options.url ?? `${baseUrl}push/getExpoPushToken`;
159
- const body = {
160
- type,
161
- deviceId: deviceId.toLowerCase(),
162
- development,
163
- appId: options.applicationId,
164
- deviceToken: getDeviceToken(devicePushToken),
165
- projectId: options.projectId,
166
- };
81
+ async function requestExpoPushTokenAsync(url, body) {
167
82
  let response;
168
83
  try {
169
84
  response = await fetch(url, {
@@ -178,7 +93,34 @@ export async function getExpoPushTokenAsync(options = {}) {
178
93
  if (!response.ok) {
179
94
  throw new CodedError('ERR_NOTIFICATIONS_SERVER_ERROR', `Error encountered while fetching Expo token, expected an OK response, received: ${response.status}.`);
180
95
  }
181
- const expoPushToken = extractExpoPushToken(await parseJsonResponse(response));
96
+ return extractExpoPushToken(await parseJsonResponse(response));
97
+ }
98
+ // Вынесено, чтобы `getExpoPushTokenAsync` читался как запрос токена и регистрация
99
+ async function buildExpoPushTokenBody(options, devicePushToken) {
100
+ if (!options.projectId) {
101
+ throw new CodedError('ERR_NOTIFICATIONS_NO_EXPERIENCE_ID', 'No "projectId" was passed to getExpoPushTokenAsync(). Pass it explicitly (this port has no expo-constants).');
102
+ }
103
+ const appId = options.applicationId ?? applicationId;
104
+ if (!appId) {
105
+ throw new CodedError('ERR_NOTIFICATIONS_NO_APPLICATION_ID', 'No "applicationId" was passed to getExpoPushTokenAsync() and the app has none of its own.');
106
+ }
107
+ const deviceId = options.deviceId ?? (await getDeviceIdAsync());
108
+ return {
109
+ type: options.type ?? getTypeOfToken(devicePushToken),
110
+ deviceId: deviceId.toLowerCase(),
111
+ development: options.development ?? (await shouldUseDevelopmentNotificationService()),
112
+ appId,
113
+ deviceToken: getDeviceToken(devicePushToken),
114
+ projectId: options.projectId,
115
+ };
116
+ }
117
+ /** Returns an Expo push token for Expo's push relay, needs network so retry when back online */
118
+ export async function getExpoPushTokenAsync(options = {}) {
119
+ const devicePushToken = options.devicePushToken ?? (await getDevicePushTokenAsync());
120
+ const body = await buildExpoPushTokenBody(options, devicePushToken);
121
+ const baseUrl = options.baseUrl ?? PRODUCTION_BASE_URL;
122
+ const url = options.url ?? `${baseUrl}push/getExpoPushToken`;
123
+ const expoPushToken = await requestExpoPushTokenAsync(url, body);
182
124
  if (!options.url && !options.baseUrl) {
183
125
  try {
184
126
  await setAutoServerRegistrationEnabledAsync(true);
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../src/core/tokens.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,qFAAqF;AACrF,yFAAyF;AACzF,EAAE;AACF,iGAAiG;AACjG,gGAAgG;AAChG,6FAA6F;AAC7F,wEAAwE;AACxE,6FAA6F;AAC7F,kFAAkF;AAClF,OAAO,EACL,UAAU,EACV,QAAQ,EACR,mBAAmB,GAEpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAE/C,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAO1B,MAAM,mBAAmB,GAAG,6BAA6B,CAAC;AAE1D,0FA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C;YACf,OAAO,CAAC,IAAI,CACV,2DAA2D,EAC3D,KAAK,CACN,CAAC;QACJ,CAAC;IACH,CAAC;IAED,IAAI,CAAC,gDAAgD,CAAC,CAAC;IACvD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { IDevicePushToken } from './types';
2
+ export declare function hasDeviceTokenChangedAsync(token: IDevicePushToken): Promise<boolean>;
3
+ export declare function updateDevicePushTokenAsync(signal: AbortSignal, token: IDevicePushToken): Promise<void>;