@poolse/react-native 2.15.2 → 2.16.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.
package/dist/index.d.cts CHANGED
@@ -1275,6 +1275,18 @@ interface CallScreenProps {
1275
1275
  onTransportChange?: (transport: 'sfu' | 'mesh' | null) => void;
1276
1276
  /** Called when the call's video state changes. */
1277
1277
  onVideoChange?: (video: boolean) => void;
1278
+ /**
1279
+ * `react-native-incall-manager`, imported by your app.
1280
+ *
1281
+ * Only used here for the ring tones — the earpiece purr while an
1282
+ * outbound call rings, and the ringtone for an inbound one. Without
1283
+ * it a call is completely silent until somebody answers, which reads
1284
+ * as the app having failed to place it at all.
1285
+ *
1286
+ * Injected rather than imported for the same reason every other
1287
+ * native module is: Metro only bundles what it can see statically.
1288
+ */
1289
+ inCallManager?: RingToneModule | null;
1278
1290
  /**
1279
1291
  * Hide this screen while a call is merely ringing in.
1280
1292
  *
@@ -1286,6 +1298,18 @@ interface CallScreenProps {
1286
1298
  */
1287
1299
  nativeIncomingUi?: boolean;
1288
1300
  }
1301
+ /**
1302
+ * The slice of `react-native-incall-manager` used for ring tones.
1303
+ *
1304
+ * Every method optional: older versions lack some, and a missing tone
1305
+ * must never take a call down.
1306
+ */
1307
+ interface RingToneModule {
1308
+ startRingback?: (tone: string) => void;
1309
+ stopRingback?: () => void;
1310
+ startRingtone?: (tone: string, vibrate?: number[], category?: string, seconds?: number) => void;
1311
+ stopRingtone?: () => void;
1312
+ }
1289
1313
  /**
1290
1314
  * WhatsApp-style call UI: a full-screen sheet that covers the app while
1291
1315
  * a call is ringing or connected, and renders nothing when idle.
@@ -1312,7 +1336,7 @@ interface CallScreenProps {
1312
1336
  * The fallback is automatic and silent by design. A deployment without
1313
1337
  * an SFU is a supported configuration, not a broken one.
1314
1338
  */
1315
- declare function CallScreen({ userId, labelFor, calls: callsProp, webrtc, livekit, livekitReactNative, onStatusChange, onTransportChange, onVideoChange, nativeIncomingUi, }: CallScreenProps): react_jsx_runtime.JSX.Element;
1339
+ declare function CallScreen({ userId, labelFor, calls: callsProp, webrtc, livekit, livekitReactNative, onStatusChange, onTransportChange, onVideoChange, inCallManager, nativeIncomingUi, }: CallScreenProps): react_jsx_runtime.JSX.Element;
1316
1340
 
1317
1341
  interface CallVideoGridProps {
1318
1342
  participants: CallParticipant[];
@@ -1776,4 +1800,4 @@ declare function isStalePush(sentAt: number | undefined, now: number, staleAfter
1776
1800
  */
1777
1801
  declare function useVoipCalls({ voipPush, callKeep, calls, onAnswer, onDecline, appName, apnsEnvironment, staleAfterMs, }: UseVoipCallsOptions): void;
1778
1802
 
1779
- export { AttachmentPicker, type AttachmentPickerProps, AttachmentPreview, type AttachmentPreviewProps, type AudioRoute, type AudioRouteKind, AudioRouteSheet, type AudioRouteSheetProps, Avatar, type AvatarProps, type CallAudio, CallAvatar, type CallAvatarProps, CallControlButton, type CallControlButtonProps, type CallKeepModule, CallParticipantTile, type CallParticipantTileProps, CallScreen, type CallScreenProps, CallVideoGrid, type CallVideoGridProps, ChatHeader, type ChatHeaderProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, DaySeparator, type DaySeparatorProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, ImageMosaic, type ImageMosaicProps, type InboxUser, type LiveKitAudioSession, type LiveKitReactNativeModule, LocalVideoPip, type LocalVideoPipProps, 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 UseCallAudioOptions, type UseVoipCallsOptions, UserName, type UserNameProps, VoiceRoomBar, type VoiceRoomBarProps, type VoipIncomingCall, type VoipPushModule, callColors, createNativeWebRtcAdapter, defaultDarkTheme, defaultLightTheme, describeRoute, isNativeWebRtcAvailable, isStalePush, useAppStateLifecycle, useCallAudio, useCallDuration, useDisplayName, usePoolseTheme, useVoipCalls };
1803
+ export { AttachmentPicker, type AttachmentPickerProps, AttachmentPreview, type AttachmentPreviewProps, type AudioRoute, type AudioRouteKind, AudioRouteSheet, type AudioRouteSheetProps, Avatar, type AvatarProps, type CallAudio, CallAvatar, type CallAvatarProps, CallControlButton, type CallControlButtonProps, type CallKeepModule, CallParticipantTile, type CallParticipantTileProps, CallScreen, type CallScreenProps, CallVideoGrid, type CallVideoGridProps, ChatHeader, type ChatHeaderProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, DaySeparator, type DaySeparatorProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, ImageMosaic, type ImageMosaicProps, type InboxUser, type LiveKitAudioSession, type LiveKitReactNativeModule, LocalVideoPip, type LocalVideoPipProps, 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 RingToneModule, type ThemeColors, type ThemeRadii, type ThemeShadows, type ThemeSpacing, type ThemeType, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, type UseCallAudioOptions, type UseVoipCallsOptions, UserName, type UserNameProps, VoiceRoomBar, type VoiceRoomBarProps, type VoipIncomingCall, type VoipPushModule, callColors, createNativeWebRtcAdapter, defaultDarkTheme, defaultLightTheme, describeRoute, isNativeWebRtcAvailable, isStalePush, useAppStateLifecycle, useCallAudio, useCallDuration, useDisplayName, usePoolseTheme, useVoipCalls };
package/dist/index.d.ts CHANGED
@@ -1275,6 +1275,18 @@ interface CallScreenProps {
1275
1275
  onTransportChange?: (transport: 'sfu' | 'mesh' | null) => void;
1276
1276
  /** Called when the call's video state changes. */
1277
1277
  onVideoChange?: (video: boolean) => void;
1278
+ /**
1279
+ * `react-native-incall-manager`, imported by your app.
1280
+ *
1281
+ * Only used here for the ring tones — the earpiece purr while an
1282
+ * outbound call rings, and the ringtone for an inbound one. Without
1283
+ * it a call is completely silent until somebody answers, which reads
1284
+ * as the app having failed to place it at all.
1285
+ *
1286
+ * Injected rather than imported for the same reason every other
1287
+ * native module is: Metro only bundles what it can see statically.
1288
+ */
1289
+ inCallManager?: RingToneModule | null;
1278
1290
  /**
1279
1291
  * Hide this screen while a call is merely ringing in.
1280
1292
  *
@@ -1286,6 +1298,18 @@ interface CallScreenProps {
1286
1298
  */
1287
1299
  nativeIncomingUi?: boolean;
1288
1300
  }
1301
+ /**
1302
+ * The slice of `react-native-incall-manager` used for ring tones.
1303
+ *
1304
+ * Every method optional: older versions lack some, and a missing tone
1305
+ * must never take a call down.
1306
+ */
1307
+ interface RingToneModule {
1308
+ startRingback?: (tone: string) => void;
1309
+ stopRingback?: () => void;
1310
+ startRingtone?: (tone: string, vibrate?: number[], category?: string, seconds?: number) => void;
1311
+ stopRingtone?: () => void;
1312
+ }
1289
1313
  /**
1290
1314
  * WhatsApp-style call UI: a full-screen sheet that covers the app while
1291
1315
  * a call is ringing or connected, and renders nothing when idle.
@@ -1312,7 +1336,7 @@ interface CallScreenProps {
1312
1336
  * The fallback is automatic and silent by design. A deployment without
1313
1337
  * an SFU is a supported configuration, not a broken one.
1314
1338
  */
1315
- declare function CallScreen({ userId, labelFor, calls: callsProp, webrtc, livekit, livekitReactNative, onStatusChange, onTransportChange, onVideoChange, nativeIncomingUi, }: CallScreenProps): react_jsx_runtime.JSX.Element;
1339
+ declare function CallScreen({ userId, labelFor, calls: callsProp, webrtc, livekit, livekitReactNative, onStatusChange, onTransportChange, onVideoChange, inCallManager, nativeIncomingUi, }: CallScreenProps): react_jsx_runtime.JSX.Element;
1316
1340
 
1317
1341
  interface CallVideoGridProps {
1318
1342
  participants: CallParticipant[];
@@ -1776,4 +1800,4 @@ declare function isStalePush(sentAt: number | undefined, now: number, staleAfter
1776
1800
  */
1777
1801
  declare function useVoipCalls({ voipPush, callKeep, calls, onAnswer, onDecline, appName, apnsEnvironment, staleAfterMs, }: UseVoipCallsOptions): void;
1778
1802
 
1779
- export { AttachmentPicker, type AttachmentPickerProps, AttachmentPreview, type AttachmentPreviewProps, type AudioRoute, type AudioRouteKind, AudioRouteSheet, type AudioRouteSheetProps, Avatar, type AvatarProps, type CallAudio, CallAvatar, type CallAvatarProps, CallControlButton, type CallControlButtonProps, type CallKeepModule, CallParticipantTile, type CallParticipantTileProps, CallScreen, type CallScreenProps, CallVideoGrid, type CallVideoGridProps, ChatHeader, type ChatHeaderProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, DaySeparator, type DaySeparatorProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, ImageMosaic, type ImageMosaicProps, type InboxUser, type LiveKitAudioSession, type LiveKitReactNativeModule, LocalVideoPip, type LocalVideoPipProps, 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 UseCallAudioOptions, type UseVoipCallsOptions, UserName, type UserNameProps, VoiceRoomBar, type VoiceRoomBarProps, type VoipIncomingCall, type VoipPushModule, callColors, createNativeWebRtcAdapter, defaultDarkTheme, defaultLightTheme, describeRoute, isNativeWebRtcAvailable, isStalePush, useAppStateLifecycle, useCallAudio, useCallDuration, useDisplayName, usePoolseTheme, useVoipCalls };
1803
+ export { AttachmentPicker, type AttachmentPickerProps, AttachmentPreview, type AttachmentPreviewProps, type AudioRoute, type AudioRouteKind, AudioRouteSheet, type AudioRouteSheetProps, Avatar, type AvatarProps, type CallAudio, CallAvatar, type CallAvatarProps, CallControlButton, type CallControlButtonProps, type CallKeepModule, CallParticipantTile, type CallParticipantTileProps, CallScreen, type CallScreenProps, CallVideoGrid, type CallVideoGridProps, ChatHeader, type ChatHeaderProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, DaySeparator, type DaySeparatorProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, ImageMosaic, type ImageMosaicProps, type InboxUser, type LiveKitAudioSession, type LiveKitReactNativeModule, LocalVideoPip, type LocalVideoPipProps, 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 RingToneModule, type ThemeColors, type ThemeRadii, type ThemeShadows, type ThemeSpacing, type ThemeType, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, type UseCallAudioOptions, type UseVoipCallsOptions, UserName, type UserNameProps, VoiceRoomBar, type VoiceRoomBarProps, type VoipIncomingCall, type VoipPushModule, callColors, createNativeWebRtcAdapter, defaultDarkTheme, defaultLightTheme, describeRoute, isNativeWebRtcAvailable, isStalePush, useAppStateLifecycle, useCallAudio, useCallDuration, useDisplayName, usePoolseTheme, useVoipCalls };
package/dist/index.js CHANGED
@@ -5819,6 +5819,7 @@ function CallScreen({
5819
5819
  onStatusChange,
5820
5820
  onTransportChange,
5821
5821
  onVideoChange,
5822
+ inCallManager,
5822
5823
  nativeIncomingUi
5823
5824
  }) {
5824
5825
  const insets = useSafeAreaInsets();
@@ -5829,7 +5830,7 @@ function CallScreen({
5829
5830
  () => meshAvailable && webrtc ? { webrtc: createNativeWebRtcAdapter(webrtc) } : {},
5830
5831
  [meshAvailable, webrtc]
5831
5832
  );
5832
- const conversationId = calls.phase === "active" ? calls.activeConversationId : null;
5833
+ const conversationId = calls.phase === "active" ? calls.activeConversationId : calls.phase === "ringing-out" ? calls.outgoing?.conversationId ?? null : null;
5833
5834
  const isVideoCall = calls.media === "video";
5834
5835
  const sfu = useCallRoom(livekit ? conversationId : null, {
5835
5836
  livekit,
@@ -5840,7 +5841,8 @@ function CallScreen({
5840
5841
  const status = usingSfu ? toVoiceStatus(sfu.status) : mesh.status;
5841
5842
  const connected = calls.phase === "active" && status === "connected";
5842
5843
  useEffect(() => {
5843
- if (calls.phase !== "active" || !conversationId) return;
5844
+ const wants = calls.phase === "active" || calls.phase === "ringing-out";
5845
+ if (!wants || !conversationId) return;
5844
5846
  let cancelled = false;
5845
5847
  void (async () => {
5846
5848
  const joined = livekit ? await sfu.join() : false;
@@ -5868,6 +5870,23 @@ function CallScreen({
5868
5870
  livekitReactNative
5869
5871
  });
5870
5872
  const [routesOpen, setRoutesOpen] = useState(false);
5873
+ const showingIncoming = calls.phase === "ringing-in" && !nativeIncomingUi;
5874
+ useEffect(() => {
5875
+ const ringing = calls.phase === "ringing-out";
5876
+ if (!ringing && !showingIncoming) return;
5877
+ try {
5878
+ if (ringing) inCallManager?.startRingback?.("_DEFAULT_");
5879
+ else inCallManager?.startRingtone?.("_DEFAULT_");
5880
+ } catch {
5881
+ }
5882
+ return () => {
5883
+ try {
5884
+ inCallManager?.stopRingback?.();
5885
+ inCallManager?.stopRingtone?.();
5886
+ } catch {
5887
+ }
5888
+ };
5889
+ }, [calls.phase, showingIncoming, inCallManager]);
5871
5890
  const [chromeVisible, setChromeVisible] = useState(true);
5872
5891
  const [lastWake, setLastWake] = useState(0);
5873
5892
  const chromeHides = connected && isVideoCall;
@@ -5878,6 +5897,13 @@ function CallScreen({
5878
5897
  return () => clearTimeout(timer);
5879
5898
  }, [chromeHides, lastWake]);
5880
5899
  const wakeChrome = useCallback(() => setLastWake(Date.now()), []);
5900
+ const toggleChrome = useCallback(() => {
5901
+ setChromeVisible((visible2) => {
5902
+ if (visible2) return false;
5903
+ setLastWake(Date.now());
5904
+ return true;
5905
+ });
5906
+ }, []);
5881
5907
  const withWake = useCallback(
5882
5908
  (fn) => () => {
5883
5909
  wakeChrome();
@@ -5936,7 +5962,7 @@ function CallScreen({
5936
5962
  onRequestClose: hangUp,
5937
5963
  children: [
5938
5964
  /* @__PURE__ */ jsx(StatusBar, { barStyle: "light-content" }),
5939
- /* @__PURE__ */ jsxs(Pressable, { style: styles30.screen, onPress: wakeChrome, accessible: false, children: [
5965
+ /* @__PURE__ */ jsxs(Pressable, { style: styles30.screen, onPress: toggleChrome, accessible: false, children: [
5940
5966
  showStage ? /* @__PURE__ */ jsx(
5941
5967
  CallVideoGrid,
5942
5968
  {