Address mobile review lifecycle issues
This commit is contained in:
1 parent
e4ec3cfca7
commit
5efa2df4ab
6 files changed
+60
-19
No files matched your search
@@ -492,6 +492,8 @@ public final class T3ReviewDiffView: ExpoView, UIScrollViewDelegate {
|
||||
}
|
||||
|
||||
func setTokensPatchJson(_ tokensPatchJson: String) {
|
||||
let contentResetKey = self.contentResetKey
|
||||
|
||||
payloadDecodeQueue.async { [weak self] in
|
||||
guard let data = tokensPatchJson.data(using: .utf8) else {
|
||||
return
|
||||
@@ -503,6 +505,9 @@ public final class T3ReviewDiffView: ExpoView, UIScrollViewDelegate {
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
guard contentResetKey == self.contentResetKey else {
|
||||
return
|
||||
}
|
||||
// A highlighter request from the previous file can finish after the view has
|
||||
// already reset. Never let that stale patch roll the native token state back.
|
||||
if let resetKey = patch.resetKey, resetKey != self.tokensResetKey {
|
||||
@@ -550,6 +555,7 @@ public final class T3ReviewDiffView: ExpoView, UIScrollViewDelegate {
|
||||
}
|
||||
|
||||
self.contentResetKey = contentResetKey
|
||||
rowsDecodeGeneration += 1
|
||||
tokensDecodeGeneration += 1
|
||||
contentView.tokensByRowId = [:]
|
||||
hasAppliedInitialRowIndex = false
|
||||
|
||||
@@ -12,12 +12,23 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||
) {
|
||||
guard
|
||||
let windowScene = scene as? UIWindowScene,
|
||||
let appDelegate = UIApplication.shared.delegate as? AppDelegate,
|
||||
let appWindow = appDelegate.window
|
||||
let appDelegate = UIApplication.shared.delegate as? AppDelegate
|
||||
else {
|
||||
return
|
||||
}
|
||||
|
||||
let appWindow: UIWindow
|
||||
if let existingWindow = appDelegate.window {
|
||||
appWindow = existingWindow
|
||||
} else {
|
||||
appWindow = UIWindow(windowScene: windowScene)
|
||||
appDelegate.window = appWindow
|
||||
appDelegate.reactNativeFactory?.startReactNative(
|
||||
withModuleName: "main",
|
||||
in: appWindow,
|
||||
launchOptions: nil)
|
||||
}
|
||||
|
||||
window = appWindow
|
||||
appWindow.windowScene = windowScene
|
||||
appWindow.makeKeyAndVisible()
|
||||
@@ -25,6 +36,13 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||
if let url = connectionOptions.urlContexts.first?.url {
|
||||
_ = appDelegate.application(UIApplication.shared, open: url, options: [:])
|
||||
}
|
||||
|
||||
if let userActivity = connectionOptions.userActivities.first {
|
||||
_ = appDelegate.application(
|
||||
UIApplication.shared,
|
||||
continue: userActivity,
|
||||
restorationHandler: { _ in })
|
||||
}
|
||||
}
|
||||
|
||||
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
|
||||
|
||||
@@ -16,7 +16,6 @@ import { useResolveClassNames } from "uniwind";
|
||||
|
||||
import { LoadingScreen } from "../components/LoadingScreen";
|
||||
|
||||
import { useWorkspaceState } from "../state/workspace";
|
||||
import { useThreadOutboxDrain } from "../state/use-thread-outbox-drain";
|
||||
import { RegistryContext } from "@effect/atom-react";
|
||||
import { appAtomRegistry } from "../state/atom-registry";
|
||||
@@ -47,16 +46,11 @@ function AppNavigator() {
|
||||
}
|
||||
|
||||
function AppNavigatorContent() {
|
||||
const { state } = useWorkspaceState();
|
||||
const colorScheme = useColorScheme();
|
||||
const statusBarBg = useThemeColor("--color-status-bar");
|
||||
useAgentNotificationNavigation();
|
||||
useThreadOutboxDrain();
|
||||
|
||||
if (state.isLoadingConnections) {
|
||||
return <LoadingScreen message="Loading remote workspace…" />;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<StatusBar
|
||||
|
||||
@@ -22,7 +22,7 @@ function NewTaskCloseButton() {
|
||||
accessibilityRole="button"
|
||||
className="h-9 w-9 items-center justify-center rounded-full bg-subtle active:opacity-70"
|
||||
hitSlop={8}
|
||||
onPress={() => router.back()}
|
||||
onPress={() => router.dismiss()}
|
||||
>
|
||||
<SymbolView name="xmark" size={14} tintColor={String(tintColor)} type="monochrome" />
|
||||
</Pressable>
|
||||
|
||||
@@ -538,14 +538,6 @@ export function ThreadFilesTreeScreen() {
|
||||
[projectName],
|
||||
);
|
||||
|
||||
if (selectedThread === null || environmentId === null || threadId === null) {
|
||||
return <LoadingScreen message="Opening files..." messagePlacement="above-spinner" />;
|
||||
}
|
||||
|
||||
if (cwd === null) {
|
||||
return <FilesUnavailable />;
|
||||
}
|
||||
|
||||
if (fileInspector.supported) {
|
||||
return (
|
||||
<ThreadRouteScreen
|
||||
@@ -555,6 +547,14 @@ export function ThreadFilesTreeScreen() {
|
||||
);
|
||||
}
|
||||
|
||||
if (selectedThread === null || environmentId === null || threadId === null) {
|
||||
return <LoadingScreen message="Opening files..." messagePlacement="above-spinner" />;
|
||||
}
|
||||
|
||||
if (cwd === null) {
|
||||
return <FilesUnavailable />;
|
||||
}
|
||||
|
||||
return (
|
||||
<View className="flex-1 bg-sheet">
|
||||
<Stack.Screen
|
||||
@@ -652,6 +652,15 @@ export function ThreadFileScreen() {
|
||||
assetPreviewUri === null || previewRevision === 0
|
||||
? assetPreviewUri
|
||||
: `${assetPreviewUri}${assetPreviewUri.includes("?") ? "&" : "?"}revision=${previewRevision}`;
|
||||
const handleReturnToThread = useCallback(() => {
|
||||
if (router.canGoBack()) {
|
||||
router.back();
|
||||
return;
|
||||
}
|
||||
if (environmentId !== null && threadId !== null) {
|
||||
router.replace(buildThreadRoutePath({ environmentId, threadId }));
|
||||
}
|
||||
}, [environmentId, router, threadId]);
|
||||
const needsFileContents =
|
||||
relativePath !== null &&
|
||||
(resolvedActiveMode === "source" || isMarkdownPreviewFile(relativePath));
|
||||
@@ -692,6 +701,15 @@ export function ThreadFileScreen() {
|
||||
[cwd, environmentId, fileInspector.supported, handleSelectFile, projectName, relativePath],
|
||||
);
|
||||
|
||||
if (fileInspector.supported && environmentId !== null && threadId !== null) {
|
||||
return (
|
||||
<ThreadRouteScreen
|
||||
onReturnToThread={handleReturnToThread}
|
||||
renderInspector={renderInspector}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (selectedThread === null || environmentId === null || threadId === null) {
|
||||
return <LoadingScreen message="Opening file..." messagePlacement="above-spinner" />;
|
||||
}
|
||||
|
||||
@@ -418,9 +418,14 @@ function ThreadRouteContent(
|
||||
if (selectedThread === null) {
|
||||
return;
|
||||
}
|
||||
router.push(buildThreadFilesNavigation(selectedThread, path));
|
||||
const navigation = buildThreadFilesNavigation(selectedThread, path);
|
||||
if (fileInspector.supported) {
|
||||
router.replace(navigation);
|
||||
return;
|
||||
}
|
||||
router.push(navigation);
|
||||
},
|
||||
[router, selectedThread],
|
||||
[fileInspector.supported, router, selectedThread],
|
||||
);
|
||||
const GitInspector = useCallback(
|
||||
() => <GitOverviewSheet headerInset={headerHeight} presentation="inspector" />,
|
||||
|
||||
Reference in new issue
Block a user