Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(devices): recover simulator streams after failures #12639

Mergedjuliusmarmingemerged 3 commits intomain fromrefs/pull/12639/headmerged by juliusmarminge View on GitHub

Showing 14 changed files with 129 additions and 28 deletions (loading 12).

x
0 of 14 viewed, 14 left
2 additions and 2 deletionsapps/mobile/src/features/devices/DevicePreviewRouteScreen.tsxModified
View file
@@ -68,7 +68,7 @@
const insets = useSafeAreaInsets();
const { themeVariables } = useAppearancePreferences();
const focused = useIsFocused();
- const [foreground, setForeground] = useState(AppState.currentState === "active");
+ const [foreground, setForeground] = useState(AppState.currentState !== "background");
const [selectedKey, setSelectedKey] = useState<string | null>(null);
const [inputConnected, setInputConnected] = useState(false);
const [streamAttempt, setStreamAttempt] = useState(0);
@@ -87,7 +87,7 @@
);
useEffect(() => {
const subscription = AppState.addEventListener("change", (state) =>
- setForeground(state === "active"),
+ setForeground(state !== "background"),
);
return () => subscription.remove();
}, []);
127 additions and 26 deletionsapps/mobile/src/features/devices/DeviceStreamWebView.tsxModified
View file
@@ -1,7 +1,19 @@
import deviceStreamScript from "@t3tools/mobile-device-stream";
-import { useImperativeHandle, useLayoutEffect, useMemo, useRef, useState, type Ref } from "react";
-import { Platform } from "react-native";
+import {
+ useEffect,
+ useEffectEvent,
+ useImperativeHandle,