@poolse/react 2.23.0 → 2.24.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 +17 -0
- package/dist/index.cjs +15 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -736,6 +736,16 @@ interface UseCalls {
|
|
|
736
736
|
* `declined` / `busy` / `timed-out` state the UI has finished
|
|
737
737
|
* showing. */
|
|
738
738
|
reset: () => void;
|
|
739
|
+
/**
|
|
740
|
+
* Tell the hook how many OTHER people are currently on the call's
|
|
741
|
+
* media. `hangUp` consults it: with two or more others connected,
|
|
742
|
+
* hanging up just leaves — the call continues without you — and the
|
|
743
|
+
* end-the-call signal is only sent when at most one other remains.
|
|
744
|
+
* Every hang-up path funnels through the hook (the in-call button,
|
|
745
|
+
* CallKit's end event, the OS back gesture), so this is the ONE
|
|
746
|
+
* place group calls are protected from being ended by a leaver.
|
|
747
|
+
*/
|
|
748
|
+
reportOthersOnCall: (count: number) => void;
|
|
739
749
|
}
|
|
740
750
|
/**
|
|
741
751
|
* WhatsApp-style calling: ring a conversation, show an incoming-call
|
package/dist/index.d.ts
CHANGED
|
@@ -736,6 +736,16 @@ interface UseCalls {
|
|
|
736
736
|
* `declined` / `busy` / `timed-out` state the UI has finished
|
|
737
737
|
* showing. */
|
|
738
738
|
reset: () => void;
|
|
739
|
+
/**
|
|
740
|
+
* Tell the hook how many OTHER people are currently on the call's
|
|
741
|
+
* media. `hangUp` consults it: with two or more others connected,
|
|
742
|
+
* hanging up just leaves — the call continues without you — and the
|
|
743
|
+
* end-the-call signal is only sent when at most one other remains.
|
|
744
|
+
* Every hang-up path funnels through the hook (the in-call button,
|
|
745
|
+
* CallKit's end event, the OS back gesture), so this is the ONE
|
|
746
|
+
* place group calls are protected from being ended by a leaver.
|
|
747
|
+
*/
|
|
748
|
+
reportOthersOnCall: (count: number) => void;
|
|
739
749
|
}
|
|
740
750
|
/**
|
|
741
751
|
* WhatsApp-style calling: ring a conversation, show an incoming-call
|
package/dist/index.js
CHANGED
|
@@ -1546,7 +1546,21 @@ function useCalls(userId, opts = {}) {
|
|
|
1546
1546
|
}, ringTimeoutMs);
|
|
1547
1547
|
return () => clearTimeout(timer);
|
|
1548
1548
|
}, [phase, ringTimeoutMs]);
|
|
1549
|
+
const othersOnCallRef = useRef(0);
|
|
1550
|
+
const reportOthersOnCall = useCallback((count) => {
|
|
1551
|
+
othersOnCallRef.current = count;
|
|
1552
|
+
}, []);
|
|
1549
1553
|
const hangUp = useCallback(async () => {
|
|
1554
|
+
if (phaseRef.current === "active" && othersOnCallRef.current >= 2) {
|
|
1555
|
+
setPhase("idle");
|
|
1556
|
+
setIncoming(null);
|
|
1557
|
+
setOutgoing(null);
|
|
1558
|
+
setActiveConversationId(null);
|
|
1559
|
+
setActiveCallId(null);
|
|
1560
|
+
setActiveMedia(null);
|
|
1561
|
+
setError(null);
|
|
1562
|
+
return;
|
|
1563
|
+
}
|
|
1550
1564
|
const conversationId = activeConversationId ?? incoming?.conversationId ?? outgoing?.conversationId;
|
|
1551
1565
|
const callId = activeCallId ?? incoming?.callId ?? outgoing?.callId;
|
|
1552
1566
|
try {
|
|
@@ -1595,6 +1609,7 @@ function useCalls(userId, opts = {}) {
|
|
|
1595
1609
|
decline,
|
|
1596
1610
|
cancel,
|
|
1597
1611
|
hangUp,
|
|
1612
|
+
reportOthersOnCall,
|
|
1598
1613
|
reset
|
|
1599
1614
|
};
|
|
1600
1615
|
}
|