Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat: sync thread read state across clients #9124

Closedt3dotgg(GitHub profile, opens in a new tab)wants to merge 3 commits intomain fromt3code/server-owned-thread-read-stateopened View on GitHub

Showing 43 changed files with 178 additions and 2 deletions (loading 40).

x
0 of 43 viewed, 43 left
74 additions and 2 deletionsapps/mobile/src/features/threads/ThreadRouteScreen.tsxModified
View file
@@ -22,7 +22,7 @@
projectScriptRuntimeEnv,
resolveProjectScripts,
} from "@t3tools/shared/projectScripts";
-import { Alert, Platform, ScrollView, View } from "react-native";
+import { Alert, AppState, Platform, ScrollView, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { useWorkspaceState } from "../../state/workspace";
import { restoredNewTaskDraftKey } from "../../state/new-task-draft-key";
@@ -88,6 +88,7 @@
ThreadInspectorContentStack,
type ThreadInspectorMode,
} from "./thread-inspector-content-stack";
+import { resolveVisitWatermark, shouldAcknowledgeThreadVisit } from "./threadVisitedState";
​
interface ThreadInspectorSelection {
readonly routeThreadIdentity: string | null;
@@ -303,6 +304,78 @@
const routeConnectionState =
routeEnvironmentRuntime?.connectionState ?? (environmentId ? "available" : connectionState);
const routeConnectionError = routeEnvironmentRuntime?.connectionError ?? null;
+ const serverConfig = routeEnvironmentRuntime?.serverConfig ?? null;
+ const supportsVisitedTracking =
+ serverConfig?.environment.capabilities.threadVisitedTracking === true;
+ const visitThread = useAtomCommand(threadEnvironment.visit, { reportFailure: false });
+ const [appState, setAppState] = useState(() => AppState.currentState);
+ useEffect(() => {
+ const subscription = AppState.addEventListener("change", setAppState);