({
apiRoot = "",
fixedSimulatorUDID = null,
hideSimulatorSelection = false,
pairingEnabled = true,
remoteStream = shouldUseRemoteStreamDefault(apiRoot),
}: AppShellProps = {})
| 429 | } |
| 430 | |
| 431 | export function AppShell({ |
| 432 | apiRoot = "", |
| 433 | fixedSimulatorUDID = null, |
| 434 | hideSimulatorSelection = false, |
| 435 | pairingEnabled = true, |
| 436 | remoteStream = shouldUseRemoteStreamDefault(apiRoot), |
| 437 | }: AppShellProps = {}) { |
| 438 | configureSimDeckClient({ apiRoot }); |
| 439 | const initialStreamTransportRef = useRef<StreamTransport>( |
| 440 | readStreamTransportQueryParam(), |
| 441 | ); |
| 442 | const [initialUiState] = useState(readPersistedUiState); |
| 443 | const [initialSelectedUDID] = useState( |
| 444 | () => |
| 445 | fixedSimulatorUDID ?? |
| 446 | readDeviceQueryParam() ?? |
| 447 | initialUiState.selectedUDID, |
| 448 | ); |
| 449 | const forceInitialFitMode = shouldForceInitialFitMode(); |
| 450 | const initialViewportState = initialSelectedUDID |
| 451 | ? viewportStateForUDID(initialUiState, initialSelectedUDID, { |
| 452 | forceFit: forceInitialFitMode, |
| 453 | }) |
| 454 | : DEFAULT_VIEWPORT_STATE; |
| 455 | const { |
| 456 | error: listError, |
| 457 | isLoading, |
| 458 | refresh, |
| 459 | simulators, |
| 460 | updateSimulator, |
| 461 | } = useSimulatorList({ remote: remoteStream }); |
| 462 | const providerDisconnected = isProviderDisconnected(listError); |
| 463 | const [debugVisible, setDebugVisible] = useState(false); |
| 464 | const [hierarchyVisible, setHierarchyVisible] = useState(false); |
| 465 | const [devToolsVisible, setDevToolsVisible] = useState(false); |
| 466 | const [selectedUDID, setSelectedUDID] = useState(initialSelectedUDID ?? ""); |
| 467 | const [search, setSearch] = useState(""); |
| 468 | const openURLValueRef = useRef( |
| 469 | initialUiState.openURLValue ?? "https://example.com", |
| 470 | ); |
| 471 | const bundleIDValueRef = useRef( |
| 472 | initialUiState.bundleIDValue ?? "com.apple.Preferences", |
| 473 | ); |
| 474 | const [menuOpen, setMenuOpen] = useState(false); |
| 475 | const [simulatorMenuOpen, setSimulatorMenuOpen] = useState(false); |
| 476 | const [newSimulatorOpen, setNewSimulatorOpen] = useState(false); |
| 477 | const [cameraSimulationOpen, setCameraSimulationOpen] = useState(false); |
| 478 | const [localError, setLocalError] = useState(""); |
| 479 | const [captureStatus, setCaptureStatus] = useState<CaptureStatus | null>( |
| 480 | null, |
| 481 | ); |
| 482 | const [screenRecording, setScreenRecording] = |
| 483 | useState<ScreenRecordingState | null>(null); |
| 484 | const [recordingNow, setRecordingNow] = useState(Date.now()); |
| 485 | const [failedStreamUDIDs, setFailedStreamUDIDs] = useState<Set<string>>( |
| 486 | () => new Set(), |
| 487 | ); |
| 488 | const [pairingCode, setPairingCode] = useState(""); |
nothing calls this directly
no test coverage detected