@poolse/react-native 2.4.1 → 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.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, ReactElement } from 'react';
|
|
3
|
-
import { Conversation, Uuid, Message, AttachmentUploadInput, Membership, Attachment, WebRtcAdapter } from '@poolse/sdk';
|
|
3
|
+
import { Conversation, Uuid, Message, AttachmentUploadInput, Membership, Attachment, WebRtcAdapter, VoiceStatus } from '@poolse/sdk';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import { UseCalls } from '@poolse/react';
|
|
6
6
|
|
|
@@ -1045,6 +1045,15 @@ interface VoiceRoomBarProps {
|
|
|
1045
1045
|
* want in Expo Go.
|
|
1046
1046
|
*/
|
|
1047
1047
|
webrtc?: NativeWebRtcModule | null;
|
|
1048
|
+
/**
|
|
1049
|
+
* Called whenever the room's connection state changes.
|
|
1050
|
+
*
|
|
1051
|
+
* Audio routing is the app's job — speakerphone, the proximity sensor
|
|
1052
|
+
* that blanks the screen at your ear, and holding the audio session
|
|
1053
|
+
* open all need a native module this package deliberately doesn't
|
|
1054
|
+
* depend on. Use this to start and stop it.
|
|
1055
|
+
*/
|
|
1056
|
+
onStatusChange?: (status: VoiceStatus) => void;
|
|
1048
1057
|
/** Resolves a user id to a display label. Defaults to a short id. */
|
|
1049
1058
|
labelFor?: (userId: string) => string;
|
|
1050
1059
|
/**
|
|
@@ -1061,7 +1070,7 @@ interface VoiceRoomBarProps {
|
|
|
1061
1070
|
* always-on voice channel. For ringing a specific person, use
|
|
1062
1071
|
* `<IncomingCallSheet>` together with `useCalls`.
|
|
1063
1072
|
*/
|
|
1064
|
-
declare function VoiceRoomBar({ conversationId, labelFor, unavailableSlot, webrtc, }: VoiceRoomBarProps): react_jsx_runtime.JSX.Element;
|
|
1073
|
+
declare function VoiceRoomBar({ conversationId, labelFor, unavailableSlot, webrtc, onStatusChange, }: VoiceRoomBarProps): react_jsx_runtime.JSX.Element;
|
|
1065
1074
|
|
|
1066
1075
|
interface CallScreenProps {
|
|
1067
1076
|
/** The signed-in user's id — the topic calls are delivered on. */
|
|
@@ -1080,6 +1089,12 @@ interface CallScreenProps {
|
|
|
1080
1089
|
* that there is no audio. See {@link VoiceRoomBarProps.webrtc}.
|
|
1081
1090
|
*/
|
|
1082
1091
|
webrtc?: NativeWebRtcModule | null;
|
|
1092
|
+
/**
|
|
1093
|
+
* Called whenever the call's audio connection state changes. Drive
|
|
1094
|
+
* speakerphone and the proximity sensor from here — see
|
|
1095
|
+
* {@link VoiceRoomBarProps.onStatusChange}.
|
|
1096
|
+
*/
|
|
1097
|
+
onStatusChange?: (status: VoiceStatus) => void;
|
|
1083
1098
|
}
|
|
1084
1099
|
/**
|
|
1085
1100
|
* WhatsApp-style call UI: a full-screen sheet that covers the app while
|
|
@@ -1096,7 +1111,7 @@ interface CallScreenProps {
|
|
|
1096
1111
|
* to whatever button your UI wants. Pass the same instance in via
|
|
1097
1112
|
* `calls` so both halves share one state machine.
|
|
1098
1113
|
*/
|
|
1099
|
-
declare function CallScreen({ userId, labelFor, calls: external, webrtc }: CallScreenProps): react_jsx_runtime.JSX.Element;
|
|
1114
|
+
declare function CallScreen({ userId, labelFor, calls: external, webrtc, onStatusChange, }: CallScreenProps): react_jsx_runtime.JSX.Element;
|
|
1100
1115
|
|
|
1101
1116
|
/**
|
|
1102
1117
|
* Bridges iOS PushKit + CallKit to poolse calls, so a call rings a
|
|
@@ -1175,6 +1190,19 @@ interface UseVoipCallsOptions {
|
|
|
1175
1190
|
onDecline?: (call: VoipIncomingCall) => void;
|
|
1176
1191
|
/** CallKit display name for your app. Shown on the lock screen. */
|
|
1177
1192
|
appName?: string;
|
|
1193
|
+
/**
|
|
1194
|
+
* Which APNs environment issued this build's PushKit token — it must
|
|
1195
|
+
* match the app's `aps-environment` entitlement.
|
|
1196
|
+
*
|
|
1197
|
+
* Pass it explicitly. The fallback guesses from `__DEV__`, which
|
|
1198
|
+
* describes the JS bundle and NOT the entitlement: an ad-hoc or
|
|
1199
|
+
* TestFlight build has `__DEV__ === false` while still carrying the
|
|
1200
|
+
* `development` entitlement, so it receives a sandbox token and
|
|
1201
|
+
* reports it as production. The server then pushes to the wrong
|
|
1202
|
+
* environment, Apple answers BadDeviceToken, and the phone never
|
|
1203
|
+
* rings — with nothing in the app to suggest why.
|
|
1204
|
+
*/
|
|
1205
|
+
apnsEnvironment?: 'production' | 'sandbox';
|
|
1178
1206
|
}
|
|
1179
1207
|
/**
|
|
1180
1208
|
* Registers this device for VoIP pushes and wires the native call UI.
|
|
@@ -1182,6 +1210,6 @@ interface UseVoipCallsOptions {
|
|
|
1182
1210
|
* Safe to mount once at the app root. Does nothing on Android, which
|
|
1183
1211
|
* needs a separate FCM + ConnectionService integration.
|
|
1184
1212
|
*/
|
|
1185
|
-
declare function useVoipCalls({ voipPush, callKeep, onAnswer, onDecline, appName, }: UseVoipCallsOptions): void;
|
|
1213
|
+
declare function useVoipCalls({ voipPush, callKeep, onAnswer, onDecline, appName, apnsEnvironment, }: UseVoipCallsOptions): void;
|
|
1186
1214
|
|
|
1187
1215
|
export { AttachmentPicker, type AttachmentPickerProps, AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, type CallKeepModule, CallScreen, type CallScreenProps, ChatHeader, type ChatHeaderProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, DaySeparator, type DaySeparatorProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, ImageMosaic, type ImageMosaicProps, type InboxUser, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, MessageList, type MessageListItem, type MessageListProps, MessageRow, type MessageRowProps, type NativeWebRtcModule, PoolseIcon, type PoolseIconProps, PoolseInbox, type PoolseInboxHandle, type PoolseInboxProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, type PoolseRNTheme, type PoolseRNThemeOverrides, PoolseTheme, type PoolseThemeProps, primitives as Primitives, ReactionPicker, type ReactionPickerProps, ReactionStrip, type ReactionStripProps, type ThemeColors, type ThemeRadii, type ThemeShadows, type ThemeSpacing, type ThemeType, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, type UseVoipCallsOptions, UserName, type UserNameProps, VoiceRoomBar, type VoiceRoomBarProps, type VoipIncomingCall, type VoipPushModule, createNativeWebRtcAdapter, defaultDarkTheme, defaultLightTheme, isNativeWebRtcAvailable, useAppStateLifecycle, useDisplayName, usePoolseTheme, useVoipCalls };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, ReactElement } from 'react';
|
|
3
|
-
import { Conversation, Uuid, Message, AttachmentUploadInput, Membership, Attachment, WebRtcAdapter } from '@poolse/sdk';
|
|
3
|
+
import { Conversation, Uuid, Message, AttachmentUploadInput, Membership, Attachment, WebRtcAdapter, VoiceStatus } from '@poolse/sdk';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import { UseCalls } from '@poolse/react';
|
|
6
6
|
|
|
@@ -1045,6 +1045,15 @@ interface VoiceRoomBarProps {
|
|
|
1045
1045
|
* want in Expo Go.
|
|
1046
1046
|
*/
|
|
1047
1047
|
webrtc?: NativeWebRtcModule | null;
|
|
1048
|
+
/**
|
|
1049
|
+
* Called whenever the room's connection state changes.
|
|
1050
|
+
*
|
|
1051
|
+
* Audio routing is the app's job — speakerphone, the proximity sensor
|
|
1052
|
+
* that blanks the screen at your ear, and holding the audio session
|
|
1053
|
+
* open all need a native module this package deliberately doesn't
|
|
1054
|
+
* depend on. Use this to start and stop it.
|
|
1055
|
+
*/
|
|
1056
|
+
onStatusChange?: (status: VoiceStatus) => void;
|
|
1048
1057
|
/** Resolves a user id to a display label. Defaults to a short id. */
|
|
1049
1058
|
labelFor?: (userId: string) => string;
|
|
1050
1059
|
/**
|
|
@@ -1061,7 +1070,7 @@ interface VoiceRoomBarProps {
|
|
|
1061
1070
|
* always-on voice channel. For ringing a specific person, use
|
|
1062
1071
|
* `<IncomingCallSheet>` together with `useCalls`.
|
|
1063
1072
|
*/
|
|
1064
|
-
declare function VoiceRoomBar({ conversationId, labelFor, unavailableSlot, webrtc, }: VoiceRoomBarProps): react_jsx_runtime.JSX.Element;
|
|
1073
|
+
declare function VoiceRoomBar({ conversationId, labelFor, unavailableSlot, webrtc, onStatusChange, }: VoiceRoomBarProps): react_jsx_runtime.JSX.Element;
|
|
1065
1074
|
|
|
1066
1075
|
interface CallScreenProps {
|
|
1067
1076
|
/** The signed-in user's id — the topic calls are delivered on. */
|
|
@@ -1080,6 +1089,12 @@ interface CallScreenProps {
|
|
|
1080
1089
|
* that there is no audio. See {@link VoiceRoomBarProps.webrtc}.
|
|
1081
1090
|
*/
|
|
1082
1091
|
webrtc?: NativeWebRtcModule | null;
|
|
1092
|
+
/**
|
|
1093
|
+
* Called whenever the call's audio connection state changes. Drive
|
|
1094
|
+
* speakerphone and the proximity sensor from here — see
|
|
1095
|
+
* {@link VoiceRoomBarProps.onStatusChange}.
|
|
1096
|
+
*/
|
|
1097
|
+
onStatusChange?: (status: VoiceStatus) => void;
|
|
1083
1098
|
}
|
|
1084
1099
|
/**
|
|
1085
1100
|
* WhatsApp-style call UI: a full-screen sheet that covers the app while
|
|
@@ -1096,7 +1111,7 @@ interface CallScreenProps {
|
|
|
1096
1111
|
* to whatever button your UI wants. Pass the same instance in via
|
|
1097
1112
|
* `calls` so both halves share one state machine.
|
|
1098
1113
|
*/
|
|
1099
|
-
declare function CallScreen({ userId, labelFor, calls: external, webrtc }: CallScreenProps): react_jsx_runtime.JSX.Element;
|
|
1114
|
+
declare function CallScreen({ userId, labelFor, calls: external, webrtc, onStatusChange, }: CallScreenProps): react_jsx_runtime.JSX.Element;
|
|
1100
1115
|
|
|
1101
1116
|
/**
|
|
1102
1117
|
* Bridges iOS PushKit + CallKit to poolse calls, so a call rings a
|
|
@@ -1175,6 +1190,19 @@ interface UseVoipCallsOptions {
|
|
|
1175
1190
|
onDecline?: (call: VoipIncomingCall) => void;
|
|
1176
1191
|
/** CallKit display name for your app. Shown on the lock screen. */
|
|
1177
1192
|
appName?: string;
|
|
1193
|
+
/**
|
|
1194
|
+
* Which APNs environment issued this build's PushKit token — it must
|
|
1195
|
+
* match the app's `aps-environment` entitlement.
|
|
1196
|
+
*
|
|
1197
|
+
* Pass it explicitly. The fallback guesses from `__DEV__`, which
|
|
1198
|
+
* describes the JS bundle and NOT the entitlement: an ad-hoc or
|
|
1199
|
+
* TestFlight build has `__DEV__ === false` while still carrying the
|
|
1200
|
+
* `development` entitlement, so it receives a sandbox token and
|
|
1201
|
+
* reports it as production. The server then pushes to the wrong
|
|
1202
|
+
* environment, Apple answers BadDeviceToken, and the phone never
|
|
1203
|
+
* rings — with nothing in the app to suggest why.
|
|
1204
|
+
*/
|
|
1205
|
+
apnsEnvironment?: 'production' | 'sandbox';
|
|
1178
1206
|
}
|
|
1179
1207
|
/**
|
|
1180
1208
|
* Registers this device for VoIP pushes and wires the native call UI.
|
|
@@ -1182,6 +1210,6 @@ interface UseVoipCallsOptions {
|
|
|
1182
1210
|
* Safe to mount once at the app root. Does nothing on Android, which
|
|
1183
1211
|
* needs a separate FCM + ConnectionService integration.
|
|
1184
1212
|
*/
|
|
1185
|
-
declare function useVoipCalls({ voipPush, callKeep, onAnswer, onDecline, appName, }: UseVoipCallsOptions): void;
|
|
1213
|
+
declare function useVoipCalls({ voipPush, callKeep, onAnswer, onDecline, appName, apnsEnvironment, }: UseVoipCallsOptions): void;
|
|
1186
1214
|
|
|
1187
1215
|
export { AttachmentPicker, type AttachmentPickerProps, AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, type CallKeepModule, CallScreen, type CallScreenProps, ChatHeader, type ChatHeaderProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, DaySeparator, type DaySeparatorProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, ImageMosaic, type ImageMosaicProps, type InboxUser, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, MessageList, type MessageListItem, type MessageListProps, MessageRow, type MessageRowProps, type NativeWebRtcModule, PoolseIcon, type PoolseIconProps, PoolseInbox, type PoolseInboxHandle, type PoolseInboxProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, type PoolseRNTheme, type PoolseRNThemeOverrides, PoolseTheme, type PoolseThemeProps, primitives as Primitives, ReactionPicker, type ReactionPickerProps, ReactionStrip, type ReactionStripProps, type ThemeColors, type ThemeRadii, type ThemeShadows, type ThemeSpacing, type ThemeType, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, type UseVoipCallsOptions, UserName, type UserNameProps, VoiceRoomBar, type VoiceRoomBarProps, type VoipIncomingCall, type VoipPushModule, createNativeWebRtcAdapter, defaultDarkTheme, defaultLightTheme, isNativeWebRtcAvailable, useAppStateLifecycle, useDisplayName, usePoolseTheme, useVoipCalls };
|
package/dist/index.js
CHANGED
|
@@ -4945,7 +4945,8 @@ function VoiceRoomBar({
|
|
|
4945
4945
|
conversationId,
|
|
4946
4946
|
labelFor,
|
|
4947
4947
|
unavailableSlot,
|
|
4948
|
-
webrtc
|
|
4948
|
+
webrtc,
|
|
4949
|
+
onStatusChange
|
|
4949
4950
|
}) {
|
|
4950
4951
|
const theme = usePoolseTheme();
|
|
4951
4952
|
const available = isNativeWebRtcAvailable(webrtc);
|
|
@@ -4957,6 +4958,9 @@ function VoiceRoomBar({
|
|
|
4957
4958
|
available ? conversationId : null,
|
|
4958
4959
|
opts
|
|
4959
4960
|
);
|
|
4961
|
+
useEffect(() => {
|
|
4962
|
+
onStatusChange?.(status);
|
|
4963
|
+
}, [status, onStatusChange]);
|
|
4960
4964
|
const label = labelFor ?? ((id) => `User ${id.slice(0, 6)}`);
|
|
4961
4965
|
const connected = status === "connected";
|
|
4962
4966
|
if (!available) {
|
|
@@ -5079,7 +5083,13 @@ var styles23 = StyleSheet.create({
|
|
|
5079
5083
|
hint: { fontSize: 13, flexShrink: 1 },
|
|
5080
5084
|
error: { fontSize: 12, marginTop: 6 }
|
|
5081
5085
|
});
|
|
5082
|
-
function CallScreen({
|
|
5086
|
+
function CallScreen({
|
|
5087
|
+
userId,
|
|
5088
|
+
labelFor,
|
|
5089
|
+
calls: external,
|
|
5090
|
+
webrtc,
|
|
5091
|
+
onStatusChange
|
|
5092
|
+
}) {
|
|
5083
5093
|
const theme = usePoolseTheme();
|
|
5084
5094
|
const own = useCalls(external ? null : userId);
|
|
5085
5095
|
const calls = external ?? own;
|
|
@@ -5095,6 +5105,9 @@ function CallScreen({ userId, labelFor, calls: external, webrtc }) {
|
|
|
5095
5105
|
useEffect(() => {
|
|
5096
5106
|
if (calls.phase === "active" && voice.status === "idle") void voice.join();
|
|
5097
5107
|
}, [calls.phase, voice]);
|
|
5108
|
+
useEffect(() => {
|
|
5109
|
+
onStatusChange?.(voice.status);
|
|
5110
|
+
}, [voice.status, onStatusChange]);
|
|
5098
5111
|
const label = labelFor ?? ((id) => `User ${id.slice(0, 6)}`);
|
|
5099
5112
|
const visible = calls.phase !== "idle";
|
|
5100
5113
|
const hangUp = () => {
|
|
@@ -5199,7 +5212,8 @@ function useVoipCalls({
|
|
|
5199
5212
|
callKeep,
|
|
5200
5213
|
onAnswer,
|
|
5201
5214
|
onDecline,
|
|
5202
|
-
appName = "poolse"
|
|
5215
|
+
appName = "poolse",
|
|
5216
|
+
apnsEnvironment
|
|
5203
5217
|
}) {
|
|
5204
5218
|
const poolse = usePoolse();
|
|
5205
5219
|
const pending = useRef(/* @__PURE__ */ new Map());
|
|
@@ -5233,7 +5247,11 @@ function useVoipCalls({
|
|
|
5233
5247
|
});
|
|
5234
5248
|
voipPush.addEventListener("register", ((token) => {
|
|
5235
5249
|
if (cancelled || !token) return;
|
|
5236
|
-
void poolse.devices.register({
|
|
5250
|
+
void poolse.devices.register({
|
|
5251
|
+
token,
|
|
5252
|
+
platform: "ios",
|
|
5253
|
+
environment: apnsEnvironment ?? guessApnsEnvironment()
|
|
5254
|
+
}).catch(() => {
|
|
5237
5255
|
});
|
|
5238
5256
|
}));
|
|
5239
5257
|
voipPush.addEventListener("notification", ((payload) => {
|
|
@@ -5264,9 +5282,9 @@ function useVoipCalls({
|
|
|
5264
5282
|
callKeep.removeEventListener("answerCall");
|
|
5265
5283
|
callKeep.removeEventListener("endCall");
|
|
5266
5284
|
};
|
|
5267
|
-
}, [poolse, voipPush, callKeep, appName]);
|
|
5285
|
+
}, [poolse, voipPush, callKeep, appName, apnsEnvironment]);
|
|
5268
5286
|
}
|
|
5269
|
-
function
|
|
5287
|
+
function guessApnsEnvironment() {
|
|
5270
5288
|
return __DEV__ ? "sandbox" : "production";
|
|
5271
5289
|
}
|
|
5272
5290
|
|