@poolse/react-native 2.5.0 → 2.6.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 +24 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -4
- package/dist/index.d.ts +32 -4
- package/dist/index.js +24 -6
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -4972,7 +4972,8 @@ function VoiceRoomBar({
|
|
|
4972
4972
|
conversationId,
|
|
4973
4973
|
labelFor,
|
|
4974
4974
|
unavailableSlot,
|
|
4975
|
-
webrtc
|
|
4975
|
+
webrtc,
|
|
4976
|
+
onStatusChange
|
|
4976
4977
|
}) {
|
|
4977
4978
|
const theme = usePoolseTheme();
|
|
4978
4979
|
const available = isNativeWebRtcAvailable(webrtc);
|
|
@@ -4984,6 +4985,9 @@ function VoiceRoomBar({
|
|
|
4984
4985
|
available ? conversationId : null,
|
|
4985
4986
|
opts
|
|
4986
4987
|
);
|
|
4988
|
+
react.useEffect(() => {
|
|
4989
|
+
onStatusChange?.(status);
|
|
4990
|
+
}, [status, onStatusChange]);
|
|
4987
4991
|
const label = labelFor ?? ((id) => `User ${id.slice(0, 6)}`);
|
|
4988
4992
|
const connected = status === "connected";
|
|
4989
4993
|
if (!available) {
|
|
@@ -5106,7 +5110,13 @@ var styles23 = reactNative.StyleSheet.create({
|
|
|
5106
5110
|
hint: { fontSize: 13, flexShrink: 1 },
|
|
5107
5111
|
error: { fontSize: 12, marginTop: 6 }
|
|
5108
5112
|
});
|
|
5109
|
-
function CallScreen({
|
|
5113
|
+
function CallScreen({
|
|
5114
|
+
userId,
|
|
5115
|
+
labelFor,
|
|
5116
|
+
calls: external,
|
|
5117
|
+
webrtc,
|
|
5118
|
+
onStatusChange
|
|
5119
|
+
}) {
|
|
5110
5120
|
const theme = usePoolseTheme();
|
|
5111
5121
|
const own = react$1.useCalls(external ? null : userId);
|
|
5112
5122
|
const calls = external ?? own;
|
|
@@ -5122,6 +5132,9 @@ function CallScreen({ userId, labelFor, calls: external, webrtc }) {
|
|
|
5122
5132
|
react.useEffect(() => {
|
|
5123
5133
|
if (calls.phase === "active" && voice.status === "idle") void voice.join();
|
|
5124
5134
|
}, [calls.phase, voice]);
|
|
5135
|
+
react.useEffect(() => {
|
|
5136
|
+
onStatusChange?.(voice.status);
|
|
5137
|
+
}, [voice.status, onStatusChange]);
|
|
5125
5138
|
const label = labelFor ?? ((id) => `User ${id.slice(0, 6)}`);
|
|
5126
5139
|
const visible = calls.phase !== "idle";
|
|
5127
5140
|
const hangUp = () => {
|
|
@@ -5226,7 +5239,8 @@ function useVoipCalls({
|
|
|
5226
5239
|
callKeep,
|
|
5227
5240
|
onAnswer,
|
|
5228
5241
|
onDecline,
|
|
5229
|
-
appName = "poolse"
|
|
5242
|
+
appName = "poolse",
|
|
5243
|
+
apnsEnvironment
|
|
5230
5244
|
}) {
|
|
5231
5245
|
const poolse = react$1.usePoolse();
|
|
5232
5246
|
const pending = react.useRef(/* @__PURE__ */ new Map());
|
|
@@ -5260,7 +5274,11 @@ function useVoipCalls({
|
|
|
5260
5274
|
});
|
|
5261
5275
|
voipPush.addEventListener("register", ((token) => {
|
|
5262
5276
|
if (cancelled || !token) return;
|
|
5263
|
-
void poolse.devices.register({
|
|
5277
|
+
void poolse.devices.register({
|
|
5278
|
+
token,
|
|
5279
|
+
platform: "ios",
|
|
5280
|
+
environment: apnsEnvironment ?? guessApnsEnvironment()
|
|
5281
|
+
}).catch(() => {
|
|
5264
5282
|
});
|
|
5265
5283
|
}));
|
|
5266
5284
|
voipPush.addEventListener("notification", ((payload) => {
|
|
@@ -5291,9 +5309,9 @@ function useVoipCalls({
|
|
|
5291
5309
|
callKeep.removeEventListener("answerCall");
|
|
5292
5310
|
callKeep.removeEventListener("endCall");
|
|
5293
5311
|
};
|
|
5294
|
-
}, [poolse, voipPush, callKeep, appName]);
|
|
5312
|
+
}, [poolse, voipPush, callKeep, appName, apnsEnvironment]);
|
|
5295
5313
|
}
|
|
5296
|
-
function
|
|
5314
|
+
function guessApnsEnvironment() {
|
|
5297
5315
|
return __DEV__ ? "sandbox" : "production";
|
|
5298
5316
|
}
|
|
5299
5317
|
|