@poolse/native 0.0.0-stage → 3.0.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 +25 -0
- package/LICENSE +206 -0
- package/README.md +148 -2
- package/android/build.gradle +58 -0
- package/android/consumer-rules.pro +11 -0
- package/android/src/main/AndroidManifest.xml +46 -0
- package/android/src/main/java/dev/poolse/callcore/CallCoreRuntime.kt +540 -0
- package/android/src/main/java/dev/poolse/callcore/CallMachine.kt +492 -0
- package/android/src/main/java/dev/poolse/callcore/Ports.kt +132 -0
- package/android/src/main/java/dev/poolse/callcore/android/AndroidRingSurface.kt +383 -0
- package/android/src/main/java/dev/poolse/callcore/android/CallActionReceiver.kt +45 -0
- package/android/src/main/java/dev/poolse/callcore/android/CallCore.kt +578 -0
- package/android/src/main/java/dev/poolse/callcore/android/CallForegroundService.kt +294 -0
- package/android/src/main/java/dev/poolse/callcore/android/CallHttpClient.kt +207 -0
- package/android/src/main/java/dev/poolse/callcore/android/CallMessagingService.kt +161 -0
- package/android/src/main/java/dev/poolse/callcore/android/CallVideo.kt +36 -0
- package/android/src/main/java/dev/poolse/callcore/android/HandlerTimerPort.kt +42 -0
- package/android/src/main/java/dev/poolse/callcore/android/IncomingCallActivity.kt +314 -0
- package/android/src/main/java/dev/poolse/callcore/android/MessageNotifications.kt +353 -0
- package/android/src/main/java/dev/poolse/callcore/android/MissedCallNotification.kt +103 -0
- package/android/src/main/java/dev/poolse/callcore/android/RingBundle.kt +42 -0
- package/android/src/main/java/dev/poolse/callcore/android/SnapshotJson.kt +99 -0
- package/android/src/main/java/expo/modules/poolsecalls/CallLockscreen.kt +42 -0
- package/android/src/main/java/expo/modules/poolsecalls/CallPictureInPicture.kt +92 -0
- package/android/src/main/java/expo/modules/poolsecalls/PoolseCallVideoView.kt +64 -0
- package/android/src/main/java/expo/modules/poolsecalls/PoolseCallsModule.kt +205 -0
- package/android/src/main/livekit/java/dev/poolse/callcore/livekit/LiveKitMediaPort.kt +594 -0
- package/android/src/main/livekit/java/dev/poolse/callcore/livekit/LiveKitVideoSurface.kt +107 -0
- package/android/src/test/java/dev/poolse/callcore/android/CallHttpClientTest.kt +61 -0
- package/app.plugin.js +5 -0
- package/dist/index.cjs +197 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +313 -0
- package/dist/index.d.ts +313 -0
- package/dist/index.js +161 -0
- package/dist/index.js.map +1 -0
- package/expo-module.config.json +11 -0
- package/ios/Core/CallCoreRuntime.swift +543 -0
- package/ios/Core/CallHttpClient.swift +213 -0
- package/ios/Core/CallMachine.swift +394 -0
- package/ios/Core/PORTS_READY.md +93 -0
- package/ios/Core/Ports.swift +238 -0
- package/ios/Core/SnapshotEncoding.swift +122 -0
- package/ios/Module/PoolseCallVideoView.swift +70 -0
- package/ios/Module/PoolseCallsAppDelegateSubscriber.swift +16 -0
- package/ios/Module/PoolseCallsModule.swift +150 -0
- package/ios/Platform/CallCore.swift +623 -0
- package/ios/Platform/CallKitController.swift +326 -0
- package/ios/Platform/CallPictureInPicture.swift +145 -0
- package/ios/Platform/LiveKitMediaPort.swift +798 -0
- package/ios/Platform/LiveKitVideoSurface.swift +68 -0
- package/ios/Platform/MessageNotifications.swift +163 -0
- package/ios/Platform/Ringback.swift +61 -0
- package/ios/Platform/VoipPush.swift +174 -0
- package/ios/PoolseCalls.podspec +68 -0
- package/package.json +53 -4
- package/plugin/index.js +42 -0
- package/plugin/package.json +1 -0
- package/plugin/withCallDelegate.js +35 -0
- package/plugin/withLockscreenCalls.js +84 -0
- package/plugin/withNativeCallMedia.js +19 -0
- package/plugin/withPictureInPicture.js +28 -0
- package/plugin/withRingback.js +86 -0
- package/src/expo-modules-core.d.ts +16 -0
- package/src/index.ts +564 -0
- package/src/react-shims.d.ts +22 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# @poolse/native
|
|
2
|
+
|
|
3
|
+
Formerly `@poolse/react-native-calls` (0.x).
|
|
4
|
+
|
|
5
|
+
## 3.0.0 — 2026-10-26
|
|
6
|
+
|
|
7
|
+
- **Renamed** from `@poolse/react-native-calls`: import from
|
|
8
|
+
`@poolse/native` and list `"@poolse/native"` in `app.json` plugins.
|
|
9
|
+
Same API and native module.
|
|
10
|
+
- **License.** From 3.0.0 under the poolse SDK License (see `LICENSE`);
|
|
11
|
+
earlier versions remain MIT.
|
|
12
|
+
- First stable release, together with the other `@poolse/*` packages.
|
|
13
|
+
|
|
14
|
+
## 0.13.0
|
|
15
|
+
|
|
16
|
+
- **One config plugin.** `["@poolse/react-native-calls", { ringback }]` in
|
|
17
|
+
`app.json` replaces the five per-app plugins (`withNativeCallMedia`,
|
|
18
|
+
`withCallDelegate`, `withLockscreenCalls`, `withPictureInPicture`,
|
|
19
|
+
`withRingback`). Options: `ringback`, `pictureInPicture`, `lockscreen`.
|
|
20
|
+
See "Setup" in the README for the move.
|
|
21
|
+
|
|
22
|
+
## 0.12.0
|
|
23
|
+
|
|
24
|
+
- `setShowOnLockscreen(enabled)`: keeps the Android activity over the lock
|
|
25
|
+
screen while a call rings or runs (iOS: no-op, CallKit owns it).
|
package/LICENSE
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
poolse SDK License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Torsten Labs DOO. All rights reserved.
|
|
4
|
+
|
|
5
|
+
Version 1.0. Applies to poolse SDK releases from version 3.0.0 onwards.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
SUMMARY (NOT PART OF THE LICENSE TERMS)
|
|
9
|
+
|
|
10
|
+
This summary is for convenience only. It is not part of the license and
|
|
11
|
+
has no legal effect. If it differs from the terms below, the terms below
|
|
12
|
+
apply.
|
|
13
|
+
|
|
14
|
+
- You can use, copy and modify the SDK for free, including in
|
|
15
|
+
commercial apps, as long as your app talks to the poolse Services.
|
|
16
|
+
- You can ship the SDK inside your app, compiled or bundled, including
|
|
17
|
+
the native iOS and Android source code needed to build it.
|
|
18
|
+
- You cannot use the SDK with any other backend, use it to build a
|
|
19
|
+
competing chat, realtime, calling or push service, or redistribute
|
|
20
|
+
or sell it as a standalone library or SDK.
|
|
21
|
+
- Keep this license notice in copies of the SDK source.
|
|
22
|
+
- The SDK comes with no warranty.
|
|
23
|
+
- Versions published before 3.0.0 remain under the MIT License.
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
TERMS AND CONDITIONS
|
|
27
|
+
|
|
28
|
+
1. Definitions
|
|
29
|
+
|
|
30
|
+
"Licensor" means Torsten Labs DOO, Ilindenska 335, 1200 Tetovo, North
|
|
31
|
+
Macedonia.
|
|
32
|
+
|
|
33
|
+
"You" means the individual or legal entity exercising rights under this
|
|
34
|
+
license. If you accept this license on behalf of an organisation, "you"
|
|
35
|
+
includes that organisation.
|
|
36
|
+
|
|
37
|
+
"SDK" means the software in this package or repository published by the
|
|
38
|
+
Licensor under this license, including source code, compiled code, native
|
|
39
|
+
iOS and Android code, type definitions, configuration plugins, examples
|
|
40
|
+
and documentation, together with any updates the Licensor provides under
|
|
41
|
+
this license.
|
|
42
|
+
|
|
43
|
+
"poolse Services" means the hosted services operated by the Licensor under
|
|
44
|
+
the name "poolse", currently offered at https://poolse.dev, including their
|
|
45
|
+
APIs, realtime, calling and push notification infrastructure. It also
|
|
46
|
+
includes any self-hosted or on-premise deployment of poolse that you have
|
|
47
|
+
licensed directly from the Licensor, for as long as that license is in
|
|
48
|
+
effect.
|
|
49
|
+
|
|
50
|
+
"Application" means a website, mobile app, desktop app, server or other
|
|
51
|
+
software product that you develop and that provides material functionality
|
|
52
|
+
of its own beyond the SDK.
|
|
53
|
+
|
|
54
|
+
"Derivative Work" means any modification of the SDK, and any work that
|
|
55
|
+
contains the SDK or a substantial portion of it.
|
|
56
|
+
|
|
57
|
+
2. License Grant
|
|
58
|
+
|
|
59
|
+
Subject to the terms of this license, the Licensor grants you a worldwide,
|
|
60
|
+
non-exclusive, non-transferable, royalty-free license to:
|
|
61
|
+
|
|
62
|
+
(a) install, use, copy and modify the SDK, and create Derivative Works,
|
|
63
|
+
solely to develop, test and operate Applications that use the poolse
|
|
64
|
+
Services; and
|
|
65
|
+
|
|
66
|
+
(b) distribute the SDK and your Derivative Works, in source or compiled
|
|
67
|
+
form, only as an integrated part of your Applications. This includes
|
|
68
|
+
bundled or minified JavaScript and the native iOS and Android source
|
|
69
|
+
code that must be included for your Application to be compiled.
|
|
70
|
+
|
|
71
|
+
Your Applications may be commercial, and you may charge for them.
|
|
72
|
+
|
|
73
|
+
3. Restrictions
|
|
74
|
+
|
|
75
|
+
You may not, and may not allow anyone else to:
|
|
76
|
+
|
|
77
|
+
(a) use the SDK or any Derivative Work with, or adapt it to connect to,
|
|
78
|
+
any backend, API or service other than the poolse Services;
|
|
79
|
+
|
|
80
|
+
(b) use the SDK or any Derivative Work to build, offer or operate a
|
|
81
|
+
product or service that competes with the poolse Services, including
|
|
82
|
+
any chat, messaging, realtime, voice or video calling, or push
|
|
83
|
+
notification service or infrastructure offered to third parties;
|
|
84
|
+
|
|
85
|
+
(c) sell, sublicense, rent, lease or distribute the SDK or any Derivative
|
|
86
|
+
Work on its own, or as a library, SDK, framework, component kit or
|
|
87
|
+
developer tool, rather than as an integrated part of an Application;
|
|
88
|
+
|
|
89
|
+
(d) remove, alter or obscure this license, any copyright notice, or any
|
|
90
|
+
other proprietary notice in the SDK; or
|
|
91
|
+
|
|
92
|
+
(e) use the SDK in violation of applicable law or of the terms of service
|
|
93
|
+
that govern your use of the poolse Services.
|
|
94
|
+
|
|
95
|
+
Nothing in this license grants you any right to use the poolse Services
|
|
96
|
+
themselves. Your use of the poolse Services is governed by your separate
|
|
97
|
+
agreement with the Licensor, including its terms of service.
|
|
98
|
+
|
|
99
|
+
4. Notices
|
|
100
|
+
|
|
101
|
+
Any copy of the SDK or a Derivative Work in source form, including native
|
|
102
|
+
source code distributed with an Application, must keep this license file
|
|
103
|
+
or a clear reference to it. You do not need to display this license to the
|
|
104
|
+
end users of your Application.
|
|
105
|
+
|
|
106
|
+
5. Contributions
|
|
107
|
+
|
|
108
|
+
If you submit code, documentation or other material to the Licensor for
|
|
109
|
+
inclusion in the SDK (for example, as a pull request), you grant the
|
|
110
|
+
Licensor a perpetual, worldwide, irrevocable, royalty-free license to use,
|
|
111
|
+
modify, sublicense and distribute that material as part of the SDK or any
|
|
112
|
+
other Licensor product, and you confirm that you have the right to grant
|
|
113
|
+
that license.
|
|
114
|
+
|
|
115
|
+
6. Ownership
|
|
116
|
+
|
|
117
|
+
The SDK is licensed, not sold. The Licensor and its licensors keep all
|
|
118
|
+
rights, title and interest in the SDK, including all intellectual property
|
|
119
|
+
rights. All rights not expressly granted in this license are reserved. The
|
|
120
|
+
names "poolse" and "Torsten Labs" and their logos are not licensed to you
|
|
121
|
+
except as needed to truthfully describe that your Application uses the
|
|
122
|
+
poolse Services.
|
|
123
|
+
|
|
124
|
+
You own your modifications to the SDK, subject to the Licensor's rights in
|
|
125
|
+
the SDK and to the terms of this license.
|
|
126
|
+
|
|
127
|
+
7. Feedback
|
|
128
|
+
|
|
129
|
+
If you give the Licensor suggestions or feedback about the SDK, the
|
|
130
|
+
Licensor may use them without any obligation to you.
|
|
131
|
+
|
|
132
|
+
8. Termination
|
|
133
|
+
|
|
134
|
+
This license ends automatically, without notice, if you breach any of its
|
|
135
|
+
terms. If you cure the breach within 30 days after you become aware of it,
|
|
136
|
+
your license is reinstated, unless the Licensor has notified you in writing
|
|
137
|
+
that it is terminating your license, or you have breached this license
|
|
138
|
+
before.
|
|
139
|
+
|
|
140
|
+
When this license ends, you must stop using and distributing the SDK and
|
|
141
|
+
your Derivative Works, and delete all copies in your possession. Copies of
|
|
142
|
+
Applications already delivered to end users before termination may continue
|
|
143
|
+
to be used by those end users. Sections 3, 5, 6, 7, 9, 10, 11 and 12
|
|
144
|
+
survive termination.
|
|
145
|
+
|
|
146
|
+
9. Disclaimer of Warranty
|
|
147
|
+
|
|
148
|
+
THE SDK IS PROVIDED "AS IS" AND "AS AVAILABLE", WITHOUT WARRANTY OF ANY
|
|
149
|
+
KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE
|
|
150
|
+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
|
|
151
|
+
NON-INFRINGEMENT. THE LICENSOR DOES NOT WARRANT THAT THE SDK WILL BE
|
|
152
|
+
ERROR-FREE, SECURE OR UNINTERRUPTED. YOU USE THE SDK AT YOUR OWN RISK.
|
|
153
|
+
|
|
154
|
+
10. Limitation of Liability
|
|
155
|
+
|
|
156
|
+
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT WILL THE
|
|
157
|
+
LICENSOR, ITS AFFILIATES OR ITS CONTRIBUTORS BE LIABLE FOR ANY INDIRECT,
|
|
158
|
+
INCIDENTAL, SPECIAL, CONSEQUENTIAL, EXEMPLARY OR PUNITIVE DAMAGES, OR FOR
|
|
159
|
+
ANY LOSS OF PROFITS, REVENUE, DATA, GOODWILL OR BUSINESS OPPORTUNITY,
|
|
160
|
+
ARISING OUT OF OR IN CONNECTION WITH THIS LICENSE OR THE SDK, WHETHER IN
|
|
161
|
+
CONTRACT, TORT (INCLUDING NEGLIGENCE) OR OTHERWISE, EVEN IF ADVISED OF THE
|
|
162
|
+
POSSIBILITY OF SUCH DAMAGES. BECAUSE THE SDK IS PROVIDED FREE OF CHARGE,
|
|
163
|
+
THE LICENSOR'S TOTAL LIABILITY ARISING OUT OF OR IN CONNECTION WITH THIS
|
|
164
|
+
LICENSE OR THE SDK WILL NOT EXCEED ONE HUNDRED EUROS (EUR 100).
|
|
165
|
+
|
|
166
|
+
NOTHING IN THIS LICENSE EXCLUDES OR LIMITS ANY LIABILITY THAT CANNOT BE
|
|
167
|
+
EXCLUDED OR LIMITED UNDER APPLICABLE LAW, INCLUDING LIABILITY FOR WILFUL
|
|
168
|
+
MISCONDUCT OR GROSS NEGLIGENCE.
|
|
169
|
+
|
|
170
|
+
11. Governing Law and Disputes
|
|
171
|
+
|
|
172
|
+
This license is governed by the laws of the Republic of North Macedonia,
|
|
173
|
+
without regard to its conflict of laws rules. The courts of the Republic of
|
|
174
|
+
North Macedonia have exclusive jurisdiction over any dispute arising out of
|
|
175
|
+
or in connection with this license, except that the Licensor may seek
|
|
176
|
+
injunctive relief to protect its intellectual property in any court of
|
|
177
|
+
competent jurisdiction.
|
|
178
|
+
|
|
179
|
+
12. General
|
|
180
|
+
|
|
181
|
+
This license is the entire agreement between you and the Licensor about the
|
|
182
|
+
SDK. If any provision is found unenforceable, it will be enforced to the
|
|
183
|
+
maximum extent possible and the remaining provisions stay in effect. A
|
|
184
|
+
failure to enforce a provision is not a waiver. You may not assign this
|
|
185
|
+
license without the Licensor's prior written consent. The Licensor may
|
|
186
|
+
publish new versions of this license; each release of the SDK is governed
|
|
187
|
+
by the version of this license included with it.
|
|
188
|
+
|
|
189
|
+
13. Earlier Versions
|
|
190
|
+
|
|
191
|
+
Versions of the poolse SDK packages published before version 3.0.0
|
|
192
|
+
(including @poolse/sdk, @poolse/react, @poolse/react-ui and
|
|
193
|
+
@poolse/react-native) were released under the MIT License and remain
|
|
194
|
+
available under the MIT License. This license applies only to versions
|
|
195
|
+
3.0.0 and later, and to any package first published by the Licensor under
|
|
196
|
+
this license.
|
|
197
|
+
|
|
198
|
+
14. Contact
|
|
199
|
+
|
|
200
|
+
Questions about this license, or requests for permission beyond it, can be
|
|
201
|
+
sent to legal@poolse.dev.
|
|
202
|
+
|
|
203
|
+
Torsten Labs DOO
|
|
204
|
+
Ilindenska 335
|
|
205
|
+
1200 Tetovo
|
|
206
|
+
North Macedonia
|
package/README.md
CHANGED
|
@@ -1,3 +1,149 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @poolse/native
|
|
2
2
|
|
|
3
|
-
|
|
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.
|
|
6
|
+
|
|
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.
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import * as calls from '@poolse/native';
|
|
15
|
+
|
|
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();
|
|
22
|
+
|
|
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
|
+
```
|
|
28
|
+
|
|
29
|
+
## Setup
|
|
30
|
+
|
|
31
|
+
One config plugin does everything the native core needs from the
|
|
32
|
+
generated projects. In `app.json`, after `expo-notifications`:
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
"plugins": [
|
|
36
|
+
"expo-notifications",
|
|
37
|
+
["@poolse/native", { "ringback": "./assets/sounds/ringback.mp3" }]
|
|
38
|
+
]
|
|
39
|
+
```
|
|
40
|
+
|
|
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. |
|
|
46
|
+
|
|
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.
|
|
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.
|
|
67
|
+
|
|
68
|
+
```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
|
+
```
|
|
78
|
+
|
|
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.
|
|
85
|
+
|
|
86
|
+
### Call waiting
|
|
87
|
+
|
|
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.
|
|
93
|
+
|
|
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"
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
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/`.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
apply plugin: 'com.android.library'
|
|
2
|
+
apply plugin: 'kotlin-android'
|
|
3
|
+
|
|
4
|
+
group = 'dev.poolse.callcore'
|
|
5
|
+
version = '0.1.0'
|
|
6
|
+
|
|
7
|
+
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
8
|
+
apply from: expoModulesCorePlugin
|
|
9
|
+
applyKotlinExpoModulesCorePlugin()
|
|
10
|
+
useCoreDependencies()
|
|
11
|
+
|
|
12
|
+
def safeExtGet(prop, fallback) {
|
|
13
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// The shipped LiveKit MediaPort lives in its own source set, off the
|
|
17
|
+
// core classpath, so the library carries no SFU dependency unless the
|
|
18
|
+
// app opts in with `-Ppoolse.livekit` (or ext.poolseLiveKit = true).
|
|
19
|
+
def useLiveKit = project.hasProperty('poolse.livekit') ||
|
|
20
|
+
(rootProject.ext.has('poolseLiveKit') && rootProject.ext.get('poolseLiveKit'))
|
|
21
|
+
|
|
22
|
+
android {
|
|
23
|
+
namespace "dev.poolse.callcore"
|
|
24
|
+
compileSdk safeExtGet("compileSdkVersion", 36)
|
|
25
|
+
|
|
26
|
+
defaultConfig {
|
|
27
|
+
minSdkVersion safeExtGet("minSdkVersion", 24)
|
|
28
|
+
targetSdkVersion safeExtGet("targetSdkVersion", 36)
|
|
29
|
+
versionCode 1
|
|
30
|
+
versionName "0.1.0"
|
|
31
|
+
// Keeps the reflectively-loaded LiveKit adapter in minified apps.
|
|
32
|
+
consumerProguardFiles "consumer-rules.pro"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (useLiveKit) {
|
|
36
|
+
sourceSets {
|
|
37
|
+
main {
|
|
38
|
+
java.srcDir "src/main/livekit/java"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
dependencies {
|
|
45
|
+
implementation 'androidx.core:core-ktx:1.13.1'
|
|
46
|
+
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
|
|
47
|
+
implementation 'com.google.firebase:firebase-messaging:24.0.3'
|
|
48
|
+
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1'
|
|
49
|
+
|
|
50
|
+
if (useLiveKit) {
|
|
51
|
+
implementation 'io.livekit:livekit-android:2.11.0'
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// JVM unit tests (CallHttpClient's parser). The real org.json replaces
|
|
55
|
+
// android.jar's throwing stubs on the test classpath.
|
|
56
|
+
testImplementation 'junit:junit:4.13.2'
|
|
57
|
+
testImplementation 'org.json:json:20180813'
|
|
58
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Applied to the HOST app's minified release build.
|
|
2
|
+
|
|
3
|
+
# CallCore loads the LiveKit MediaPort reflectively
|
|
4
|
+
# (Class.forName("dev.poolse.callcore.livekit.LiveKitMediaPort") and its
|
|
5
|
+
# Companion.getFactory), so R8 cannot see the reference: keep it whole.
|
|
6
|
+
-keep class dev.poolse.callcore.livekit.** { *; }
|
|
7
|
+
|
|
8
|
+
# The core's entry points are named in the manifest / by the Expo
|
|
9
|
+
# module registry; keep them (and their companions) un-renamed too.
|
|
10
|
+
-keep class dev.poolse.callcore.android.** { *; }
|
|
11
|
+
-keep class expo.modules.poolsecalls.** { *; }
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
2
|
+
|
|
3
|
+
<uses-permission android:name="android.permission.INTERNET" />
|
|
4
|
+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
|
5
|
+
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
|
|
6
|
+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
|
7
|
+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_PHONE_CALL" />
|
|
8
|
+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
|
|
9
|
+
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
|
10
|
+
<uses-permission android:name="android.permission.VIBRATE" />
|
|
11
|
+
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
|
12
|
+
<!-- Android 14: a phoneCall-type foreground service requires it. -->
|
|
13
|
+
<uses-permission android:name="android.permission.MANAGE_OWN_CALLS" />
|
|
14
|
+
|
|
15
|
+
<application>
|
|
16
|
+
<activity
|
|
17
|
+
android:name="dev.poolse.callcore.android.IncomingCallActivity"
|
|
18
|
+
android:exported="false"
|
|
19
|
+
android:showWhenLocked="true"
|
|
20
|
+
android:turnScreenOn="true"
|
|
21
|
+
android:excludeFromRecents="true"
|
|
22
|
+
android:launchMode="singleInstance"
|
|
23
|
+
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" />
|
|
24
|
+
|
|
25
|
+
<receiver
|
|
26
|
+
android:name="dev.poolse.callcore.android.CallActionReceiver"
|
|
27
|
+
android:exported="false" />
|
|
28
|
+
|
|
29
|
+
<receiver
|
|
30
|
+
android:name="dev.poolse.callcore.android.MessageActionReceiver"
|
|
31
|
+
android:exported="false" />
|
|
32
|
+
|
|
33
|
+
<service
|
|
34
|
+
android:name="dev.poolse.callcore.android.CallForegroundService"
|
|
35
|
+
android:exported="false"
|
|
36
|
+
android:foregroundServiceType="phoneCall|microphone" />
|
|
37
|
+
|
|
38
|
+
<service
|
|
39
|
+
android:name="dev.poolse.callcore.android.CallMessagingService"
|
|
40
|
+
android:exported="false">
|
|
41
|
+
<intent-filter>
|
|
42
|
+
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
|
43
|
+
</intent-filter>
|
|
44
|
+
</service>
|
|
45
|
+
</application>
|
|
46
|
+
</manifest>
|