From 09d074d19fbd8bca6a670c40dfecbe914c3b2af7 Mon Sep 17 00:00:00 2001 From: Erwan Leboucher Date: Tue, 28 Jul 2026 00:05:19 +0200 Subject: [PATCH] feat(call): add native transport probe --- .gitignore | 3 + src-tauri/Cargo.lock | 8 + .../tauri-plugin-call-lifecycle/Cargo.toml | 4 +- src/app/features/call/CallView.tsx | 50 +- .../features/call/livekitProvisioning.test.ts | 3 +- src/app/features/call/livekitProvisioning.ts | 4 +- .../call/nativeCallController.test.ts | 483 ++++++++++++++++++ src/app/features/call/nativeCallController.ts | 387 ++++++++++++++ src/app/features/call/nativeCallProbe.test.ts | 41 ++ src/app/features/call/nativeCallProbe.ts | 17 + src/app/features/call/useCallSignaling.ts | 31 +- src/app/features/room/RoomView.tsx | 6 +- src/app/hooks/useCallEmbed.ts | 47 +- src/app/state/nativeCall.ts | 16 + 14 files changed, 1078 insertions(+), 22 deletions(-) create mode 100644 src/app/features/call/nativeCallController.test.ts create mode 100644 src/app/features/call/nativeCallController.ts create mode 100644 src/app/features/call/nativeCallProbe.test.ts create mode 100644 src/app/features/call/nativeCallProbe.ts create mode 100644 src/app/state/nativeCall.ts diff --git a/.gitignore b/.gitignore index 96e0abe44..73e50380a 100644 --- a/.gitignore +++ b/.gitignore @@ -69,3 +69,6 @@ result .direnv ## auto-generated pre-commit config .pre-commit-config.yaml + +# Local deepwork state +.slim/deepwork/ diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 1fac4151c..4c12916d0 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -3748,6 +3748,7 @@ dependencies = [ "prost", "rand 0.9.5", "reqwest 0.12.28", + "rustls-native-certs", "scopeguard", "serde", "serde_json", @@ -3755,6 +3756,7 @@ dependencies = [ "signature", "thiserror 2.0.19", "tokio", + "tokio-rustls", "tokio-tungstenite", "url", ] @@ -7903,7 +7905,11 @@ checksum = "8f72a05e828585856dacd553fba484c242c46e391fb0e58917c942ee9202915c" dependencies = [ "futures-util", "log", + "rustls", + "rustls-native-certs", + "rustls-pki-types", "tokio", + "tokio-rustls", "tungstenite", ] @@ -8325,6 +8331,8 @@ dependencies = [ "httparse", "log", "rand 0.9.5", + "rustls", + "rustls-pki-types", "sha1", "thiserror 2.0.19", "url", diff --git a/src-tauri/plugins/tauri-plugin-call-lifecycle/Cargo.toml b/src-tauri/plugins/tauri-plugin-call-lifecycle/Cargo.toml index fe3358b72..10f24d4cb 100644 --- a/src-tauri/plugins/tauri-plugin-call-lifecycle/Cargo.toml +++ b/src-tauri/plugins/tauri-plugin-call-lifecycle/Cargo.toml @@ -9,8 +9,8 @@ exclude = ["/examples", "/dist-js", "/guest-js", "/node_modules"] links = "tauri-plugin-call-lifecycle" [dependencies] -tauri = { version = "2.11.3" } -livekit = "0.7" +tauri = { version = "2.11.3", default-features = false } +livekit = { version = "0.7", features = ["rustls-tls-native-roots"] } secrecy = { version = "0.10", features = ["serde"] } serde = "1.0" thiserror = "2" diff --git a/src/app/features/call/CallView.tsx b/src/app/features/call/CallView.tsx index 62d79cd6d..012e07078 100644 --- a/src/app/features/call/CallView.tsx +++ b/src/app/features/call/CallView.tsx @@ -1,5 +1,5 @@ import { useCallback, useEffect, useRef, useState, type RefObject } from 'react'; -import { Badge, Box, color, Header, Scroll, Text, toRem } from 'folds'; +import { Badge, Box, Button, color, Header, Scroll, Text, toRem } from 'folds'; import { useAtomValue } from 'jotai'; import { ContainerColor } from '$styles/ContainerColor.css'; import { useRoom } from '$hooks/useRoom'; @@ -13,6 +13,8 @@ import { CallMemberRenderer } from './CallMemberCard'; import { PrescreenControls } from './PrescreenControls'; import { callEmbedAtom, callEmbedStartErrorAtom } from '$state/callEmbed'; import { canJoinCall } from './callStartCapabilities'; +import { nativeCallAtom } from '$state/nativeCall'; +import { isDesktopTauri } from '$utils/platform'; function LivekitServerMissingMessage() { return ( @@ -80,6 +82,35 @@ function WidgetPreparationErrorMessage({ message }: { message: string }) { ); } +function NativeCallProbe({ + lifecycle, + error, + onHangup, +}: { + lifecycle: string; + error?: string; + onHangup: () => void; +}) { + return ( + + Native call: {lifecycle} + + Media is not implemented. + + {error && ( + + {error} + + )} + + + ); +} + function CallPrescreen() { const room = useRoom(); const callEmbed = useAtomValue(callEmbedAtom); @@ -168,8 +199,11 @@ export function CallView({ resizable }: CallViewProps) { const callEmbed = useCallEmbed(); const callJoined = useCallJoined(callEmbed); + const nativeCall = useAtomValue(nativeCallAtom); - const currentJoined = callEmbed?.roomId === room.roomId && callJoined; + const nativeCallForRoom = + isDesktopTauri() && nativeCall?.roomId === room.roomId ? nativeCall : undefined; + const currentJoined = !nativeCallForRoom && callEmbed?.roomId === room.roomId && callJoined; const [heightRatio, setHeightRatio] = useState(isMobile ? 0.3 : 0.72); const [availableHeight, setAvailableHeight] = useState(0); @@ -284,8 +318,16 @@ export function CallView({ resizable }: CallViewProps) { /> )} - {!currentJoined && } - + {!currentJoined && !nativeCallForRoom && } + {nativeCallForRoom ? ( + void nativeCallForRoom.hangup()} + /> + ) : ( + + )} {resizable && (