@poolse/native 3.0.0 → 3.2.0-dev.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +91 -123
  3. package/package.json +8 -8
package/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  Formerly `@poolse/react-native-calls` (0.x).
4
4
 
5
+ ## 3.2.0-dev.0 — 2026-11-04 (prerelease, npm tag `dev`)
6
+
7
+ - Moves with `@poolse/sdk` 3.2.0-dev.0.
8
+
9
+ ## 3.1.0 — 2026-10-27
10
+
11
+ - Declares `react` as a peer dependency (the package imports it).
12
+ - `expo prebuild` needs Node 20.19 or newer (the config plugin entry is
13
+ an ES module, loaded with `require`).
14
+
5
15
  ## 3.0.0 — 2026-10-26
6
16
 
7
17
  - **Renamed** from `@poolse/react-native-calls`: import from
package/README.md CHANGED
@@ -1,35 +1,34 @@
1
- # @poolse/native
1
+ # `@poolse/native`
2
2
 
3
- The React Native bridge over poolse's native call core — the Kotlin
4
- (`dev.poolse:call-core`) and, later, Swift engines that ring, answer and
5
- carry audio with the app killed and the phone locked.
3
+ The call engine for phones, for [poolse](https://poolse.dev). A native core
4
+ (Swift on iOS, Kotlin on Android) rings, answers and carries calls with the
5
+ app closed and the phone locked: CallKit and PushKit on iOS, a call service
6
+ and full-screen notifications on Android. You send commands; the core sends
7
+ back one `Snapshot` describing the call. The package also shows poolse's
8
+ chat notifications and gives you helpers for them.
6
9
 
7
- This package is thin on purpose: commands go in, one `Snapshot` event
8
- comes out, and every call decision lives in the native core (behaviour
9
- pinned by `contracts/call-core/vectors.json`). On a build without the
10
- native module it degrades to safe no-ops with an idle state, so a host
11
- can render against it unconditionally.
10
+ Formerly `@poolse/react-native-calls`.
12
11
 
13
- ```ts
14
- import * as calls from '@poolse/native';
12
+ Full reference: <https://poolse.dev/docs/sdk/native>
15
13
 
16
- await calls.configure('https://api.poolse.dev', { smallIcon: 'ic_call', ringback: 'ringback' });
17
- const stop = calls.onCallState((s) => render(s)); // s: Snapshot | null
18
- await calls.place(conversationId, { media: 'audio', sessionToken });
19
- calls.answer();
20
- calls.decline();
21
- calls.hangUp();
14
+ ## Requirements
22
15
 
23
- // Audio output: s.audioOutputs lists the phone, the speaker and every
24
- // connected headset/Bluetooth device by name; s.audioOutputId is the live one.
25
- calls.setAudioOutput(s.audioOutputs[0].id);
26
- calls.setSpeaker(true); // the one-tap toggle, still there
27
- ```
16
+ - A development or release build. It is a native module, so it isn't in
17
+ Expo Go; without the module every command does nothing and
18
+ `nativeCallsAvailable` is `false`.
19
+ - Peers: `expo`, `expo-notifications`, `react`, `react-native`.
20
+ - Node 20.19 or newer for `expo prebuild`.
21
+ - iOS 15.1+; Android `minSdkVersion` 24.
22
+ - Push credentials (APNs key, FCM service account) for your workspace on the
23
+ poolse dashboard.
28
24
 
29
- ## Setup
25
+ ## Install and setup
26
+
27
+ ```bash
28
+ npx expo install @poolse/native expo-notifications
29
+ ```
30
30
 
31
- One config plugin does everything the native core needs from the
32
- generated projects. In `app.json`, after `expo-notifications`:
31
+ In `app.json`, after `expo-notifications`:
33
32
 
34
33
  ```json
35
34
  "plugins": [
@@ -38,112 +37,81 @@ generated projects. In `app.json`, after `expo-notifications`:
38
37
  ]
39
38
  ```
40
39
 
41
- | Option | Default | What it does |
42
- | --- | --- | --- |
43
- | `ringback` | none | A sound file shipped in both bundles; pass its base name to `configure({ ringback })`. Lowercase letters, digits and underscores only (an Android resource name). Without it the caller hears nothing while it rings. |
44
- | `pictureInPicture` | `true` | Android: the activity may float as a picture-in-picture window during a video call. |
45
- | `lockscreen` | `true` | Android: the app shows over the lock screen when it is opened for a call, so answering never demands an unlock. |
40
+ | Option | Default | What it does |
41
+ | ------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------- |
42
+ | `ringback` | none | Ships this sound in both apps; pass its base name to `configure({ ringback })`. Lowercase letters, digits and underscores only. |
43
+ | `pictureInPicture` | `true` | Android: the activity may float as a picture-in-picture window. |
44
+ | `lockscreen` | `true` | Android: the app shows over the lock screen when opened for a call. |
46
45
 
47
- Always applied (Android): the LiveKit media adapter (`poolse.livekit`
48
- gradle property) and `expo-notifications` as the delegate for pushes
49
- that are not calls. iOS needs nothing beyond the ringback: CallKit,
50
- PushKit and picture-in-picture come with the module itself.
46
+ Always applied on Android: the LiveKit media adapter, and `expo-notifications`
47
+ as the receiver for pushes that aren't calls. On iOS, add `UIBackgroundModes`
48
+ `audio`, `voip` and `remote-notification`, `NSMicrophoneUsageDescription`
49
+ (and `NSCameraUsageDescription` for video) and the `aps-environment`
50
+ entitlement yourself. Then run `npx expo prebuild --clean`.
51
51
 
52
- ### Moving from per-app plugins (0.12 and earlier)
53
-
54
- Apps that copied `withNativeCallMedia`, `withCallDelegate`,
55
- `withLockscreenCalls`, `withPictureInPicture` and `withRingback` into
56
- their own `plugins/` folder delete them and add the single entry above;
57
- the generated projects come out the same. Keep the ringback file where
58
- it is and point `ringback` at it — its name is what `configure` already
59
- passes. Run `npx expo prebuild --clean` once afterwards.
60
-
61
- ### Rooms — voice or video, nobody rings
62
-
63
- A room is the conversation's drop-in call: members join when they like
64
- while the chat carries on, and no phone rings. It runs on the same
65
- native core as a call — CallKit on iOS, the call service on Android — so
66
- it keeps going with the phone locked and routes audio like a call.
52
+ ## Usage
67
53
 
68
54
  ```ts
69
- // Start the room (or join whatever is live on the conversation).
70
- await calls.startRoom(conversationId, { media: 'video', sessionToken });
71
-
72
- // Everyone else: useLiveCall(conversationId) from @poolse/react shows it
73
- // (call.kind === 'room'); LiveCallBanner's Join calls
74
- await calls.join(call.id, conversationId, sessionToken);
75
-
76
- calls.hangUp(); // leaves — the room ends once it has been empty a moment
77
- ```
55
+ import * as calls from '@poolse/native';
78
56
 
79
- `snapshot.kind` is `'room'` for a room (`'call'` otherwise), so a host
80
- can show it differently from a call — Loop shows a bar over the chat
81
- with mute, camera, audio output and Leave rather than the call screen.
82
- A room plays on the speaker unless a headset or Bluetooth device is in,
83
- and turning the camera on (`setCamera(true)`) is all it takes to go from
84
- voice to video.
57
+ await calls.configure('https://api.poolse.dev', {
58
+ ringback: 'ringback',
59
+ apnsEnvironment: 'production',
60
+ });
85
61
 
86
- ### Call waiting
62
+ const stop = calls.onCallState((snapshot) => render(snapshot)); // Snapshot | null
63
+ render(calls.getCallState());
87
64
 
88
- A call that rings while one is in progress (or while you sit in a room)
89
- waits beside it instead of being refused: `snapshot.waiting` carries it
90
- (`callId`, names, media), and the native side shows its own surface —
91
- CallKit's call-waiting screen on iOS, a heads-up with Decline / End &
92
- answer and the call-waiting beep on Android.
65
+ await calls.place(conversationId, { media: 'audio', sessionToken }); // sessionToken: the user's poolse JWT
66
+ calls.answer();
67
+ calls.decline();
68
+ calls.hangUp();
69
+ calls.setMuted(true);
70
+ calls.setCamera(true);
93
71
 
94
- ```ts
95
- if (s.waiting) {
96
- calls.answerWaiting(s.waiting.callId); // ends this call, answers that one
97
- calls.declineWaiting(s.waiting.callId); // its caller hears "Busy"
72
+ // Audio outputs: snapshot.audioOutputs lists the phone, the speaker and each
73
+ // connected headset or Bluetooth device; snapshot.audioOutputId is the one in use.
74
+ function onPickOutput(snapshot: calls.Snapshot, id: string) {
75
+ if (snapshot.audioOutputs.some((o) => o.id === id)) calls.setAudioOutput(id);
98
76
  }
77
+ calls.setSpeaker(true); // the one-tap speaker toggle
99
78
  ```
100
79
 
101
- Pass the `callId`: a tap that lands after the waiting call changed is
102
- then ignored rather than acting on a different one. If the current call
103
- ends on its own, the waiting call simply becomes the ringing call; left
104
- alone it times out as missed. A third call while one waits is busy.
105
-
106
- ### Chat notifications
107
-
108
- poolse sends message notifications itself, with the push credentials you
109
- set up for calls. Register the devices (Android: the FCM token; iOS: the
110
- regular APNs token with `kind: 'alert'`, beside the VoIP one), and the
111
- core does the rest — one notification per conversation with every
112
- message a line in it, Reply and Mark as read straight from the
113
- notification (no app, no session), cleared when the chat is read on
114
- another device. Requires `expo-notifications` (a peer dependency).
115
-
116
- ```ts
117
- calls.setActiveConversation(conversationId); // on screen: don't notify it
118
- calls.setActiveConversation(null); // left it, or app backgrounded
119
-
120
- // iOS, in your expo-notifications handler:
121
- Notifications.setNotificationHandler({
122
- handleNotification: async (n) => {
123
- const show = calls.shouldPresentMessage(n.request.content.data);
124
- return {
125
- shouldShowBanner: show,
126
- shouldShowList: show,
127
- shouldPlaySound: show,
128
- shouldSetBadge: true,
129
- };
130
- },
131
- });
132
- // A tap opens the app: calls.conversationOfNotification(data) (iOS), or
133
- // takeCallAction()/onCallAction() with type 'open' (Android).
134
- ```
135
-
136
- ## Layout
137
-
138
- - `src/` — the TypeScript API (this is what apps import).
139
- - `android/src/main/java/dev/poolse/callcore/` — the pure state machine
140
- and ports (contract cv 1).
141
- - `android/src/main/java/dev/poolse/callcore/android/` — the Android
142
- adapters (HTTP, timers, ring surface, foreground service, FCM intake,
143
- composition root).
144
- - `android/src/main/java/expo/modules/poolsecalls/` — the Expo bridge
145
- module (compiled by the app's autolinking).
146
- - `android/src/main/livekit/` — the shipped LiveKit `MediaPort`, opt-in
147
- via the `poolse.livekit` gradle property; the core is SFU-agnostic.
148
-
149
- Stage 3 adds the Swift core under `ios/`.
80
+ The full API:
81
+
82
+ - Setup: `configure`, `nativeCallsAvailable`, `getCallState`, `onCallState`.
83
+ - Calls: `place`, `join`, `answer`, `decline`, `hangUp`, `setMuted`,
84
+ `setCamera`, `switchCamera`, `setSpeaker`, `setAudioOutput`,
85
+ `ringIntoCall({ userIds?, externalIds? })`.
86
+ - Rooms (nobody rings): `startRoom(conversationId, { media, sessionToken })`,
87
+ then `join` for the others and `hangUp` to leave.
88
+ - Call waiting: `snapshot.waiting`, `answerWaiting(callId)`,
89
+ `declineWaiting(callId)`.
90
+ - Video: `<CallVideoView participantId | local mirror fit pictureInPicture />`,
91
+ `setPictureInPictureEnabled`, `isInPictureInPicture`,
92
+ `pictureInPictureSupported`, `onPictureInPicture`.
93
+ - Android: `canUseFullScreenIntent`, `openFullScreenIntentSettings`,
94
+ `setShowOnLockscreen`, `takeCallAction`, `onCallAction`.
95
+ - iOS VoIP token: `getVoipToken`, `onVoipToken`. Register it with
96
+ `poolse.devices.register({ token, platform: 'ios', kind: 'voip', environment })`
97
+ from `@poolse/sdk`, and the regular APNs token with `kind: 'alert'`.
98
+ - Chat notifications: `setActiveConversation`, `shouldPresentMessage`,
99
+ `conversationOfNotification`.
100
+ - Socket forwarding (optional): `onCallFinished`, `onRingEnded`. Feed them
101
+ from `@poolse/sdk` 3.1's user channel:
102
+
103
+ ```ts
104
+ const userChannel = poolse.realtime.user(me.id);
105
+ userChannel.onRingEnded((e) => calls.onRingEnded(e.call_id, e.reason));
106
+ userChannel.onCallFinished((e) => calls.onCallFinished(e.call_id, e.reason));
107
+ ```
108
+
109
+ ## Links
110
+
111
+ - Docs: <https://poolse.dev/docs/sdk/native>
112
+ - Source: <https://github.com/poolse-hq/js-sdk>
113
+
114
+ ## License
115
+
116
+ Licensed under the [poolse SDK License](./LICENSE) from 3.0.0; versions
117
+ before 3.0.0 remain MIT.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@poolse/native",
3
- "version": "3.0.0",
4
- "description": "Native call core for poolse \u2014 Kotlin/Swift calling engine with a thin React Native bridge. Ring, answer and carry audio with the app killed and the phone locked.",
3
+ "version": "3.2.0-dev.0",
4
+ "description": "Native call core for poolse — Kotlin/Swift calling engine with a thin React Native bridge. Ring, answer and carry audio with the app killed and the phone locked.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
7
7
  "main": "./dist/index.cjs",
@@ -37,19 +37,19 @@
37
37
  "LICENSE",
38
38
  "CHANGELOG.md"
39
39
  ],
40
- "scripts": {
41
- "build": "tsup",
42
- "prepublishOnly": "tsup",
43
- "typecheck": "tsc --noEmit"
44
- },
45
40
  "peerDependencies": {
46
41
  "expo": "*",
47
42
  "expo-notifications": "*",
43
+ "react": "*",
48
44
  "react-native": "*"
49
45
  },
50
46
  "devDependencies": {
51
47
  "expo-modules-core": "*",
52
48
  "tsup": "^8.3.5",
53
49
  "typescript": "^5.6.0"
50
+ },
51
+ "scripts": {
52
+ "build": "tsup",
53
+ "typecheck": "tsc --noEmit"
54
54
  }
55
- }
55
+ }