@fishjam-cloud/react-native-client 0.30.0-rc.0 → 0.30.0-rc.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.
|
@@ -36,10 +36,10 @@ export type CurrentCall = {
|
|
|
36
36
|
*/
|
|
37
37
|
export type VoIPContextValue = {
|
|
38
38
|
/** Current call lifecycle status. */
|
|
39
|
-
|
|
39
|
+
callStatus: VoIPCallStatus;
|
|
40
40
|
/** This device's VoIP push token, or `null` until APNs has issued one. */
|
|
41
41
|
voipToken: string | null;
|
|
42
|
-
/** The call currently being handled, or `null` when `
|
|
42
|
+
/** The call currently being handled, or `null` when `callStatus` is `available`. */
|
|
43
43
|
currentCall: CurrentCall | null;
|
|
44
44
|
/**
|
|
45
45
|
* Why the most recently handled call ended. `null` until a call has ended at
|
|
@@ -66,7 +66,7 @@ export type VoIPContextValue = {
|
|
|
66
66
|
/**
|
|
67
67
|
* Reports an outgoing call to `to` in `roomName` to CallKit/Core-Telecom and moves
|
|
68
68
|
* to `connecting`. Run your own signaling (ringing the callee) *before* calling this.
|
|
69
|
-
* It does **not** join the room — react to `
|
|
69
|
+
* It does **not** join the room — react to `callStatus` becoming `connecting` for that.
|
|
70
70
|
*/
|
|
71
71
|
startCall: (to: string, roomName: string) => Promise<void>;
|
|
72
72
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VoIPContext.d.ts","sourceRoot":"","sources":["../../src/voip/VoIPContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAG1F;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,UAAU,GAAG,YAAY,GAAG,QAAQ,CAAC;AAEhF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,WAAW,EAAE,MAA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KG;IACH,iBAAiB,EAAE,cAAc,GAAG,IAAI,CAAC;IACzC,qFAAqF;IACrF,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B;;;;OAIG;IACH,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D;;;;;;OAMG;IACH,eAAe,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,8EAA8E;IAC9E,mBAAmB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC;;;;OAIG;IACH,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,gFAAgF;IAChF,WAAW,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACjD,CAAC;AAEF,eAAO,MAAM,WAAW,kDAA+C,CAAC;AAExE;;;;;GAKG;AACH,wBAAgB,OAAO,IAAI,gBAAgB,CAQ1C"}
|
|
@@ -19,7 +19,7 @@ export type VoIPProviderProps = PropsWithChildren & {
|
|
|
19
19
|
* Tracks the current VoIP call state, driven by the native CallKit / Core-Telecom
|
|
20
20
|
* events from {@link useVoIPEvents}, and exposes it through {@link useVoIP}.
|
|
21
21
|
*
|
|
22
|
-
* Joining rooms, peer tokens and media are the consumer's — react to `
|
|
22
|
+
* Joining rooms, peer tokens and media are the consumer's — react to `callStatus` and
|
|
23
23
|
* report back with `reportConnected` / `reportConnectFailed`.
|
|
24
24
|
*/
|
|
25
25
|
export declare function VoIPProvider({ onWaitingCallDeclined, isVideo, children }: VoIPProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -8,12 +8,12 @@ import { VoIPContext } from './VoIPContext';
|
|
|
8
8
|
* Tracks the current VoIP call state, driven by the native CallKit / Core-Telecom
|
|
9
9
|
* events from {@link useVoIPEvents}, and exposes it through {@link useVoIP}.
|
|
10
10
|
*
|
|
11
|
-
* Joining rooms, peer tokens and media are the consumer's — react to `
|
|
11
|
+
* Joining rooms, peer tokens and media are the consumer's — react to `callStatus` and
|
|
12
12
|
* report back with `reportConnected` / `reportConnectFailed`.
|
|
13
13
|
*/
|
|
14
14
|
export function VoIPProvider({ onWaitingCallDeclined, isVideo = false, children }) {
|
|
15
15
|
const [voipToken, setVoIPToken] = useState(null);
|
|
16
|
-
const [
|
|
16
|
+
const [callStatus, setCallStatus] = useState('available');
|
|
17
17
|
const [currentCall, setCurrentCall] = useState(null);
|
|
18
18
|
const [lastEndedReason, setLastEndedReason] = useState(null);
|
|
19
19
|
const [isOnHold, setIsOnHold] = useState(false);
|
|
@@ -59,7 +59,7 @@ export function VoIPProvider({ onWaitingCallDeclined, isVideo = false, children
|
|
|
59
59
|
setIsOnHold(false);
|
|
60
60
|
setIsMuted(false);
|
|
61
61
|
setCurrentCall(null);
|
|
62
|
-
|
|
62
|
+
setCallStatus('available');
|
|
63
63
|
setLastEndedReason(reason);
|
|
64
64
|
}, []);
|
|
65
65
|
const endCall = useCallback(async (reason = 'local', options) => {
|
|
@@ -84,7 +84,7 @@ export function VoIPProvider({ onWaitingCallDeclined, isVideo = false, children
|
|
|
84
84
|
};
|
|
85
85
|
currentCallRef.current = call;
|
|
86
86
|
setCurrentCall(call);
|
|
87
|
-
|
|
87
|
+
setCallStatus('connecting');
|
|
88
88
|
setLastEndedReason(null);
|
|
89
89
|
try {
|
|
90
90
|
await startNativeCallSession(to);
|
|
@@ -122,7 +122,7 @@ export function VoIPProvider({ onWaitingCallDeclined, isVideo = false, children
|
|
|
122
122
|
const connectedCall = { ...activeCall, startedAt: Date.now() };
|
|
123
123
|
currentCallRef.current = connectedCall;
|
|
124
124
|
setCurrentCall(connectedCall);
|
|
125
|
-
|
|
125
|
+
setCallStatus('active');
|
|
126
126
|
}
|
|
127
127
|
catch (err) {
|
|
128
128
|
console.error('Failed to activate call:', err);
|
|
@@ -177,7 +177,7 @@ export function VoIPProvider({ onWaitingCallDeclined, isVideo = false, children
|
|
|
177
177
|
pendingAnswerRequestIdRef.current = null;
|
|
178
178
|
isCallOnHoldRef.current = false;
|
|
179
179
|
setCurrentCall(call);
|
|
180
|
-
|
|
180
|
+
setCallStatus('incoming');
|
|
181
181
|
setLastEndedReason(null);
|
|
182
182
|
setIsOnHold(false);
|
|
183
183
|
setIsMuted(false);
|
|
@@ -187,7 +187,7 @@ export function VoIPProvider({ onWaitingCallDeclined, isVideo = false, children
|
|
|
187
187
|
if (pendingAnswer) {
|
|
188
188
|
pendingWaitingAnswerRef.current = null;
|
|
189
189
|
pendingAnswerRequestIdRef.current = pendingAnswer;
|
|
190
|
-
|
|
190
|
+
setCallStatus('connecting');
|
|
191
191
|
}
|
|
192
192
|
});
|
|
193
193
|
}, [enqueueCallTransition]),
|
|
@@ -205,7 +205,7 @@ export function VoIPProvider({ onWaitingCallDeclined, isVideo = false, children
|
|
|
205
205
|
return;
|
|
206
206
|
}
|
|
207
207
|
pendingAnswerRequestIdRef.current = requestId;
|
|
208
|
-
|
|
208
|
+
setCallStatus('connecting');
|
|
209
209
|
});
|
|
210
210
|
}, [enqueueCallTransition]),
|
|
211
211
|
onEnded: useCallback((reason) => {
|
|
@@ -237,7 +237,7 @@ export function VoIPProvider({ onWaitingCallDeclined, isVideo = false, children
|
|
|
237
237
|
});
|
|
238
238
|
const voipValue = useMemo(() => ({
|
|
239
239
|
voipToken,
|
|
240
|
-
|
|
240
|
+
callStatus,
|
|
241
241
|
currentCall,
|
|
242
242
|
lastEndedReason,
|
|
243
243
|
isOnHold,
|
|
@@ -251,7 +251,7 @@ export function VoIPProvider({ onWaitingCallDeclined, isVideo = false, children
|
|
|
251
251
|
setCallHeld,
|
|
252
252
|
}), [
|
|
253
253
|
voipToken,
|
|
254
|
-
|
|
254
|
+
callStatus,
|
|
255
255
|
currentCall,
|
|
256
256
|
lastEndedReason,
|
|
257
257
|
isOnHold,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fishjam-cloud/react-native-client",
|
|
3
|
-
"version": "0.30.0-rc.
|
|
3
|
+
"version": "0.30.0-rc.1",
|
|
4
4
|
"description": "React Native client library for Fishjam",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Fishjam Team",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"react-native-get-random-values": "1.11.0"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@fishjam-cloud/react-client": "0.30.0-rc.
|
|
52
|
+
"@fishjam-cloud/react-client": "0.30.0-rc.1",
|
|
53
53
|
"@fishjam-cloud/react-native-webrtc": "0.30.0-rc.0",
|
|
54
54
|
"fast-text-encoding": "1.0.6",
|
|
55
55
|
"react-native-get-random-values": "1.11.0",
|