@poolse/react-native 2.17.1 → 2.18.0

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
@@ -4,6 +4,23 @@ All notable changes to `@poolse/react-native` are documented here.
4
4
  Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/);
5
5
  versions follow [semver](https://semver.org).
6
6
 
7
+ ## [2.18.0] — 2026-08-24
8
+
9
+ ### Fixed
10
+
11
+ - **The device was often never registered for VoIP push, so no call
12
+ ever rang a backgrounded or closed app.** `useVoipCalls` registered
13
+ the PushKit token the instant iOS issued it — which is moments after
14
+ launch, and routinely before the host app has a session. Registering
15
+ is an authenticated call, so it 401'd, and the error was swallowed as
16
+ "offline at launch". No device row meant poolse had nothing to push
17
+ to.
18
+
19
+ The token is now held until a signed-in user exists, and registered
20
+ when both are present — in whichever order they arrive. A failure no
21
+ longer marks the pair as done, so it retries rather than giving up
22
+ until the next launch.
23
+
7
24
  ## [2.17.1] — 2026-08-24
8
25
 
9
26
  ### Fixed
package/dist/index.cjs CHANGED
@@ -6218,6 +6218,9 @@ function useVoipCalls({
6218
6218
  }) {
6219
6219
  const poolse = react$1.usePoolse();
6220
6220
  const shown = react.useRef(/* @__PURE__ */ new Map());
6221
+ const [voipToken, setVoipToken] = react.useState(null);
6222
+ const { me } = react$1.useMe();
6223
+ const registered = react.useRef(null);
6221
6224
  const handlers = react.useRef({ onAnswer, onDecline, calls });
6222
6225
  handlers.current = { onAnswer, onDecline, calls };
6223
6226
  const staleRef = react.useRef(staleAfterMs);
@@ -6257,6 +6260,20 @@ function useVoipCalls({
6257
6260
  void ready.current.then(done, done);
6258
6261
  if (isStalePush(sentAt, Date.now(), staleRef.current)) dismiss.current(call.callId);
6259
6262
  });
6263
+ react.useEffect(() => {
6264
+ const userId = me?.id;
6265
+ if (!voipToken || !userId) return;
6266
+ const pair = `${userId}:${voipToken}`;
6267
+ if (registered.current === pair) return;
6268
+ void poolse.devices.register({
6269
+ token: voipToken,
6270
+ platform: "ios",
6271
+ environment: apnsEnvironment ?? guessApnsEnvironment()
6272
+ }).then(() => {
6273
+ registered.current = pair;
6274
+ }).catch(() => {
6275
+ });
6276
+ }, [poolse, voipToken, me?.id, apnsEnvironment]);
6260
6277
  react.useEffect(() => {
6261
6278
  let cancelled = false;
6262
6279
  const fromPush = (payload) => {
@@ -6289,12 +6306,7 @@ function useVoipCalls({
6289
6306
  });
6290
6307
  voipPush.addEventListener("register", ((token) => {
6291
6308
  if (cancelled || !token) return;
6292
- void poolse.devices.register({
6293
- token,
6294
- platform: "ios",
6295
- environment: apnsEnvironment ?? guessApnsEnvironment()
6296
- }).catch(() => {
6297
- });
6309
+ setVoipToken(token);
6298
6310
  }));
6299
6311
  voipPush.addEventListener("notification", ((payload) => {
6300
6312
  fromPush(payload);