@poolse/react-native 2.2.0 → 2.3.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/dist/index.cjs +21 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +75 -33
- package/dist/index.d.ts +75 -33
- package/dist/index.js +21 -26
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -4942,32 +4942,22 @@ function useAppStateLifecycle() {
|
|
|
4942
4942
|
}
|
|
4943
4943
|
|
|
4944
4944
|
// src/voice/webrtc-native.ts
|
|
4945
|
-
|
|
4946
|
-
function
|
|
4947
|
-
if (cached !== void 0) return cached;
|
|
4948
|
-
try {
|
|
4949
|
-
cached = __require("react-native-webrtc");
|
|
4950
|
-
} catch {
|
|
4951
|
-
cached = null;
|
|
4952
|
-
}
|
|
4953
|
-
return cached;
|
|
4954
|
-
}
|
|
4955
|
-
function isNativeWebRtcAvailable() {
|
|
4956
|
-
return loadNativeWebRtc() != null;
|
|
4945
|
+
function isNativeWebRtcAvailable(mod) {
|
|
4946
|
+
return typeof mod?.RTCPeerConnection === "function" && mod?.mediaDevices != null;
|
|
4957
4947
|
}
|
|
4958
|
-
function createNativeWebRtcAdapter() {
|
|
4959
|
-
|
|
4960
|
-
if (!native) {
|
|
4948
|
+
function createNativeWebRtcAdapter(mod) {
|
|
4949
|
+
if (!isNativeWebRtcAvailable(mod)) {
|
|
4961
4950
|
throw new Error(
|
|
4962
|
-
"react-native-webrtc is not
|
|
4951
|
+
"react-native-webrtc is missing or not linked. Install it and rebuild:\n npx expo install react-native-webrtc\nIt contains native code, so it needs a development build \u2014 it will not run in Expo Go."
|
|
4963
4952
|
);
|
|
4964
4953
|
}
|
|
4954
|
+
const rtc = mod;
|
|
4965
4955
|
return {
|
|
4966
4956
|
createPeerConnection(iceServers) {
|
|
4967
|
-
return new
|
|
4957
|
+
return new rtc.RTCPeerConnection({ iceServers });
|
|
4968
4958
|
},
|
|
4969
4959
|
getUserMedia() {
|
|
4970
|
-
return
|
|
4960
|
+
return rtc.mediaDevices.getUserMedia({
|
|
4971
4961
|
audio: { echoCancellation: true, noiseSuppression: true },
|
|
4972
4962
|
video: false
|
|
4973
4963
|
});
|
|
@@ -4978,12 +4968,17 @@ function createNativeWebRtcAdapter() {
|
|
|
4978
4968
|
}
|
|
4979
4969
|
};
|
|
4980
4970
|
}
|
|
4981
|
-
function VoiceRoomBar({
|
|
4971
|
+
function VoiceRoomBar({
|
|
4972
|
+
conversationId,
|
|
4973
|
+
labelFor,
|
|
4974
|
+
unavailableSlot,
|
|
4975
|
+
webrtc
|
|
4976
|
+
}) {
|
|
4982
4977
|
const theme = usePoolseTheme();
|
|
4983
|
-
const available = isNativeWebRtcAvailable();
|
|
4978
|
+
const available = isNativeWebRtcAvailable(webrtc);
|
|
4984
4979
|
const opts = react.useMemo(
|
|
4985
|
-
() => available ? { webrtc: createNativeWebRtcAdapter() } : {},
|
|
4986
|
-
[available]
|
|
4980
|
+
() => available && webrtc ? { webrtc: createNativeWebRtcAdapter(webrtc) } : {},
|
|
4981
|
+
[available, webrtc]
|
|
4987
4982
|
);
|
|
4988
4983
|
const { status, participants, muted, join, leave, toggleMute, error } = react$1.useVoiceRoom(
|
|
4989
4984
|
available ? conversationId : null,
|
|
@@ -5111,14 +5106,14 @@ var styles23 = reactNative.StyleSheet.create({
|
|
|
5111
5106
|
hint: { fontSize: 13, flexShrink: 1 },
|
|
5112
5107
|
error: { fontSize: 12, marginTop: 6 }
|
|
5113
5108
|
});
|
|
5114
|
-
function CallScreen({ userId, labelFor, calls: external }) {
|
|
5109
|
+
function CallScreen({ userId, labelFor, calls: external, webrtc }) {
|
|
5115
5110
|
const theme = usePoolseTheme();
|
|
5116
5111
|
const own = react$1.useCalls(external ? null : userId);
|
|
5117
5112
|
const calls = external ?? own;
|
|
5118
|
-
const available = isNativeWebRtcAvailable();
|
|
5113
|
+
const available = isNativeWebRtcAvailable(webrtc);
|
|
5119
5114
|
const opts = react.useMemo(
|
|
5120
|
-
() => available ? { webrtc: createNativeWebRtcAdapter() } : {},
|
|
5121
|
-
[available]
|
|
5115
|
+
() => available && webrtc ? { webrtc: createNativeWebRtcAdapter(webrtc) } : {},
|
|
5116
|
+
[available, webrtc]
|
|
5122
5117
|
);
|
|
5123
5118
|
const voice = react$1.useVoiceRoom(
|
|
5124
5119
|
calls.phase === "active" && available ? calls.activeConversationId : null,
|