The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 23, 09:15 UTC
refactor(mobile): adopt shared alerts in thread and PR screens (#19999)
Julius Marminge committed
Oct 15, 2026 at 15:46 UTC
e3438b8090937b8a82a6564c05d9e2bc7c7c83bb
23 files changed
+106
-87
apps/mobile/src/features/browser/BrowserPreviewRouteScreen.tsx
+4
-3
@@ -1,3 +1,4 @@
1
+import * as Dialog from "../../components/Dialog";
2
import { useIsFocused, useNavigation, type StaticScreenProps } from "@react-navigation/native";
3
import { createNativeStackNavigator } from "@react-navigation/native-stack";
4
import {
@@ -8,7 +9,7 @@ import {
9
} from "@t3tools/contracts";
10
import { normalizePreviewUrl } from "@t3tools/shared/preview";
11
import { useCallback, useEffect, useRef, useState } from "react";
11
-import { ActivityIndicator, Alert, AppState, Platform, TextInput, View } from "react-native";
12
+import { ActivityIndicator, AppState, Platform, TextInput, View } from "react-native";
13
import { useSafeAreaInsets } from "react-native-safe-area-context";
14
15
import { ControlPill } from "../../components/ControlPill";
@@ -104,7 +105,7 @@ function BrowserPreviewScreen({
105
}, [focused, loaded, tabs.length, onClose]);
106
const onPictureInPicture = useCallback((state: PreviewPictureInPictureState, detail?: string) => {
107
setPictureInPicture({ supported: state.supported, active: state.active });
107
- if (detail) Alert.alert("Picture in picture is unavailable", detail);
108
+ if (detail) Dialog.alert("Picture in picture is unavailable", detail);
109
}, []);
110
const selectTab = (next: string) => {
111
setPictureInPicture(NO_PICTURE_IN_PICTURE);
@@ -228,7 +229,7 @@ function BrowserAddressBar({
229
try {
230
onCommand({ type: "navigate", url: normalizePreviewUrl(value) });
231
} catch {
231
- Alert.alert("Could not open this address", "Enter an http or https URL.");
232
+ Dialog.alert("Could not open this address", "Enter an http or https URL.");
233
}
234
};
235
return (
apps/mobile/src/features/browser/BrowserTabMenu.tsx
+3
-3
@@ -1,3 +1,4 @@
1
+import * as Dialog from "../../components/Dialog";
2
import type { MenuAction } from "@react-native-menu/menu";
3
import {
4
DEFAULT_PREVIEW_ZOOM_FACTOR,
@@ -9,7 +10,6 @@ import {
10
type PreviewViewportSetting,
11
} from "@t3tools/contracts";
12
import { PREVIEW_VIEWPORT_PRESETS } from "@t3tools/shared/previewViewport";
12
-import { Alert } from "react-native";
13
14
import { ControlPill } from "../../components/ControlPill";
15
import { Menu } from "../../components/Menu";
@@ -114,7 +114,7 @@ export function BrowserTabMenu({
114
115
const run = async (change: Omit<PreviewAdjustInput, "threadId" | "tabId">) => {
116
const result = await adjust({ environmentId, input: { ...target, ...change } });
117
- if (result._tag === "Failure") Alert.alert("Could not change this browser tab");
117
+ if (result._tag === "Failure") Dialog.alert("Could not change this browser tab");
118
};
119
120
const onAction = (id: string) => {
@@ -134,7 +134,7 @@ export function BrowserTabMenu({
134
if (!option) return;
135
void resize({ environmentId, input: { ...target, viewport: option.setting } }).then(
136
(result) => {
137
- if (result._tag === "Failure") Alert.alert("Could not change the viewport");
137
+ if (result._tag === "Failure") Dialog.alert("Could not change the viewport");
138
},
139
);
140
}
apps/mobile/src/features/browser/PreviewStreamWebView.tsx
+5
-4
@@ -1,3 +1,4 @@
1
+import * as Dialog from "../../components/Dialog";
2
import previewStreamScript from "@t3tools/mobile-preview-stream";
3
import {
4
previewStreamControlLabel,
@@ -18,7 +19,7 @@ import {
19
useState,
20
type Ref,
21
} from "react";
21
-import { ActivityIndicator, Alert, Platform, Pressable, TextInput, View } from "react-native";
22
+import { ActivityIndicator, Platform, Pressable, TextInput, View } from "react-native";
23
import { WebView } from "react-native-webview";
24
import * as Clipboard from "expo-clipboard";
25
@@ -91,7 +92,7 @@ async function sendFilesToPage(chooser: PreviewStreamFileChooser, pick: boolean)
92
93
/** The file is on the environment; saving it here goes through the share sheet. */
94
function offerDownload(download: PreviewStreamDownload) {
94
- Alert.alert(`Downloaded ${download.fileName}`, undefined, [
95
+ Dialog.alert(`Downloaded ${download.fileName}`, undefined, [
96
{ text: "Not now", style: "cancel" },
97
{
98
text: "Save or share",
@@ -101,7 +102,7 @@ function offerDownload(download: PreviewStreamDownload) {
102
attachment: { name: download.fileName, mimeType: "application/octet-stream" },
103
signal: new AbortController().signal,
104
}).catch((cause: unknown) =>
104
- Alert.alert(
105
+ Dialog.alert(
106
"Could not save the download",
107
cause instanceof Error ? cause.message : undefined,
108
),
@@ -265,7 +266,7 @@ function PreviewStreamDocumentView({
266
if (!chooser) return;
267
setFileChooser(null);
268
void sendFilesToPage(chooser, pick).catch((cause: unknown) =>
268
- Alert.alert(
269
+ Dialog.alert(
270
"Could not send the files to the page",
271
cause instanceof Error ? cause.message : undefined,
272
),
apps/mobile/src/features/files/AttachmentFileScreen.tsx
+3
-2
@@ -1,3 +1,4 @@
1
+import * as Dialog from "../../components/Dialog";
2
/* oxlint-disable react/no-array-index-key -- Captured table rows and columns have stable positions and may contain identical values. */
3
import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
4
import { useNavigation, type StaticScreenProps } from "@react-navigation/native";
@@ -5,7 +6,7 @@ import type { MenuAction } from "@react-native-menu/menu";
6
import { EnvironmentId } from "@t3tools/contracts";
7
import { formatAttachmentSize } from "@t3tools/client-runtime/state/attachments";
8
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
8
-import { Alert, Platform, ScrollView, View } from "react-native";
9
+import { Platform, ScrollView, View } from "react-native";
10
11
import { AndroidHeaderIconButton, AndroidScreenHeader } from "../../components/AndroidScreenHeader";
12
import { AppText as Text } from "../../components/AppText";
@@ -228,7 +229,7 @@ export function AttachmentFileScreen(props: AttachmentFileScreenProps) {
229
pendingNativeError.current = null;
230
if (nativeViewer === null) {
231
// A file this screen renders itself: an explicit viewer failure is worth a word.
231
- if (message) Alert.alert("Could not open document", message);
232
+ if (message) Dialog.alert("Could not open document", message);
233
return;
234
}
235
if (message) {
apps/mobile/src/features/pull-requests/PullRequestInlineCommentScreen.tsx
+3
-2
@@ -1,6 +1,7 @@
1
+import * as Dialog from "../../components/Dialog";
2
import { useFocusEffect, useNavigation, type StaticScreenProps } from "@react-navigation/native";
3
import { useCallback, useRef, useState } from "react";
3
-import { Alert, View } from "react-native";
4
+import { View } from "react-native";
5
import type { PullRequestReviewPosition } from "@t3tools/contracts";
6
import { AppText as Text, AppTextInput as TextInput } from "../../components/AppText";
7
import { Button } from "../../components/Button";
@@ -128,7 +129,7 @@ export function PullRequestInlineCommentScreen({ route }: StaticScreenProps<Inli
129
<Button
130
label="Delete draft"
131
onPress={() =>
131
- Alert.alert("Delete this draft?", "Your other review comments will be kept.", [
132
+ Dialog.alert("Delete this draft?", "Your other review comments will be kept.", [
133
{ text: "Cancel", style: "cancel" },
134
{
135
text: "Delete",
apps/mobile/src/features/pull-requests/PullRequestMergeControls.tsx
+4
-3
@@ -1,9 +1,10 @@
1
+import * as Dialog from "../../components/Dialog";
2
import { useAtomRefresh, useAtomSet, useAtomValue } from "@effect/atom-react";
3
import { squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime";
4
import type { PullRequestDetail, PullRequestMergeMethod } from "@t3tools/contracts";
5
import { AsyncResult } from "effect/reactivity";
6
import { useRef, useState } from "react";
6
-import { ActivityIndicator, Alert, Platform, Pressable, View } from "react-native";
7
+import { ActivityIndicator, Platform, Pressable, View } from "react-native";
8
import { AppText as Text } from "../../components/AppText";
9
import { SymbolView } from "../../components/AppSymbol";
10
import { Menu } from "../../components/Menu";
@@ -125,7 +126,7 @@ export function PullRequestMergeControls(props: {
126
});
127
if (response._tag === "Failure") throw squashAtomCommandFailure(response);
128
} catch (cause) {
128
- Alert.alert(
129
+ Dialog.alert(
130
"Couldn't complete the merge action",
131
cause instanceof Error ? cause.message : "Try again.",
132
);
@@ -155,7 +156,7 @@ export function PullRequestMergeControls(props: {
156
: action === "disable-auto-merge"
157
? "Stop the provider from automatically merging this pull request."
158
: `Merge #${pr.number} into ${pr.baseBranch} using ${method}.`;
158
- Alert.alert(title, message, [
159
+ Dialog.alert(title, message, [
160
{ text: "Cancel", style: "cancel" },
161
{
162
text: action === "merge" ? label : title.replace("?", ""),
apps/mobile/src/features/threads/ChatGptSharingStatus.tsx
+3
-2
@@ -1,6 +1,7 @@
1
+import * as Dialog from "../../components/Dialog";
2
import type { ServerProvider } from "@t3tools/contracts";
3
import { CHATGPT_USAGE_URL, usesChatGptSharing } from "@t3tools/shared/usageLimits";
3
-import { Alert, Linking, Pressable, View } from "react-native";
4
+import { Linking, Pressable, View } from "react-native";
5
import { AppText as Text } from "../../components/AppText";
6
import { ProviderIcon } from "../../components/ProviderIcon";
7
@@ -13,7 +14,7 @@ export function ChatGptSharingStatus({ provider }: { provider: ServerProvider |
14
accessibilityLabel="ChatGPT token sharing is active"
15
className="min-h-11 flex-row items-center gap-2"
16
onPress={() => {
16
- Alert.alert(
17
+ Dialog.alert(
18
"ChatGPT sharing is on",
19
[
20
provider?.auth.email,
apps/mobile/src/features/threads/McpAppWebView.tsx
+3
-2
@@ -1,3 +1,4 @@
1
+import * as Dialog from "../../components/Dialog";
2
import type { EnvironmentId, ThreadId, TurnItemId } from "@t3tools/contracts";
3
import {
4
makeMcpAppHost,
@@ -21,7 +22,7 @@ import * as Predicate from "effect/Predicate";
22
import Constants from "expo-constants";
23
import { useNavigation } from "@react-navigation/native";
24
import { useEffect, useMemo, useRef, useState } from "react";
24
-import { ActivityIndicator, Alert, Platform, Pressable, View } from "react-native";
25
+import { ActivityIndicator, Platform, Pressable, View } from "react-native";
26
import { useSafeAreaInsets } from "react-native-safe-area-context";
27
import { WebView, type WebViewMessageEvent } from "react-native-webview";
28
@@ -81,7 +82,7 @@ const commandFailure = (result: {
82
83
const confirm = (title: string, message: string, action: string) =>
84
new Promise<boolean>((resolve) => {
84
- Alert.alert(
85
+ Dialog.alert(
86
title,
87
message,
88
[
apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx
+3
-2
@@ -1,3 +1,4 @@
1
+import * as Dialog from "../../components/Dialog";
2
import { AppActivityIndicator } from "../../components/AppActivityIndicator";
3
import { NavigationRow } from "../../components/NavigationRow";
4
import type { EnvironmentProject } from "@t3tools/client-runtime/state/shell";
@@ -12,7 +13,7 @@ import {
13
import * as Haptics from "expo-haptics";
14
import { useNavigation } from "@react-navigation/native";
15
import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from "react";
15
-import { Alert, Platform, Pressable, ScrollView, TextInput, View } from "react-native";
16
+import { Platform, Pressable, ScrollView, TextInput, View } from "react-native";
17
import { useSafeAreaInsets } from "react-native-safe-area-context";
18
19
import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
@@ -313,7 +314,7 @@ export function NewTaskBranchPickerRouteScreen() {
314
if (result._tag === "Failure") {
315
if (mountedRef.current && navigation.isFocused() && !isAtomCommandInterrupted(result)) {
316
const error = squashAtomCommandFailure(result);
316
- Alert.alert(
317
+ Dialog.alert(
318
"Could not switch branch",
319
error instanceof Error ? error.message : "The branch could not be checked out.",
320
);
apps/mobile/src/features/threads/NewTaskDraftRouteScreen.tsx
+3
-2
@@ -1,6 +1,7 @@
1
+import * as Dialog from "../../components/Dialog";
2
import { useNavigation, usePreventRemove, type StaticScreenProps } from "@react-navigation/native";
3
import { useEffect, useMemo, useRef, useState } from "react";
3
-import { Alert, View } from "react-native";
4
+import { View } from "react-native";
5
import {
6
isAtomCommandInterrupted,
7
squashAtomCommandFailure,
@@ -129,7 +130,7 @@ export function NewTaskDraftRouteScreen({ route }: StaticScreenProps<NewTaskDraf
130
if (checkoutPending || result?._tag !== "Failure") return;
131
if (!isAtomCommandInterrupted(result)) {
132
const error = squashAtomCommandFailure(result);
132
- Alert.alert(
133
+ Dialog.alert(
134
"Could not switch branch",
135
error instanceof Error ? error.message : "The branch could not be checked out.",
136
);
apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
+19
-18
@@ -1,3 +1,4 @@
1
+import * as Dialog from "../../components/Dialog";
2
import { useAtomValue } from "@effect/atom-react";
3
import * as Cause from "effect/Cause";
4
import { AsyncResult } from "effect/reactivity";
@@ -17,7 +18,7 @@ import {
18
type NavigationAction,
19
} from "@react-navigation/native";
20
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
20
-import { Alert, Platform, Pressable, ScrollView, View } from "react-native";
21
+import { Platform, Pressable, ScrollView, View } from "react-native";
22
import {
23
KeyboardController,
24
KeyboardStickyView,
@@ -277,7 +278,7 @@ export function NewTaskDraftScreen(props: {
278
const result = await action();
279
if (AsyncResult.isFailure(result)) {
280
const error = Cause.squash(result.cause);
280
- Alert.alert(title, error instanceof Error ? error.message : "An error occurred.");
281
+ Dialog.alert(title, error instanceof Error ? error.message : "An error occurred.");
282
}
283
};
284
const deleteProject = useAtomCommand(projectEnvironment.delete, { reportFailure: false });
@@ -296,7 +297,7 @@ export function NewTaskDraftScreen(props: {
297
});
298
if (AsyncResult.isFailure(result)) {
299
const error = Cause.squash(result.cause);
299
- Alert.alert(
300
+ Dialog.alert(
301
"Failed to remove project",
302
error instanceof Error ? error.message : "An error occurred.",
303
);
@@ -816,7 +817,7 @@ export function NewTaskDraftScreen(props: {
817
if (!incomingShare) {
818
if (isIncomingShareUnavailable && alertedUnavailableIncomingShareIdRef.current !== shareId) {
819
alertedUnavailableIncomingShareIdRef.current = shareId;
819
- Alert.alert(
820
+ Dialog.alert(
821
"Shared content unavailable",
822
"The shared content is no longer in the inbox. You can continue editing this task draft.",
823
);
@@ -907,7 +908,7 @@ export function NewTaskDraftScreen(props: {
908
);
909
}
910
if (warnings.length > 0) {
910
- Alert.alert("Some shared content was skipped", warnings.join("\n"));
911
+ Dialog.alert("Some shared content was skipped", warnings.join("\n"));
912
}
913
shareImportDraftBackupRef.current.delete(importKey);
914
})()
@@ -915,7 +916,7 @@ export function NewTaskDraftScreen(props: {
916
if (!shareImportMountedRef.current || activeShareImportTokenRef.current !== importToken) {
917
return;
918
}
918
- Alert.alert(
919
+ Dialog.alert(
920
"Could not import shared content",
921
error instanceof Error ? error.message : "The shared content could not be saved.",
922
[
@@ -960,7 +961,7 @@ export function NewTaskDraftScreen(props: {
961
if (!shareImportMountedRef.current) {
962
return;
963
}
963
- Alert.alert(
964
+ Dialog.alert(
965
"Could not cancel import",
966
cancelError instanceof Error
967
? cancelError.message
@@ -1075,7 +1076,7 @@ export function NewTaskDraftScreen(props: {
1076
: []),
1077
];
1078
if (problems.length > 0) {
1078
- Alert.alert("Could not attach photo or video", problems.join("\n\n"));
1079
+ Dialog.alert("Could not attach photo or video", problems.join("\n\n"));
1080
}
1081
}
1082
@@ -1086,7 +1087,7 @@ export function NewTaskDraftScreen(props: {
1087
const maxBytes =
1088
selectedEnvironmentServerConfig?.environment.capabilities.fileAttachments?.maxUploadBytes;
1089
if (maxBytes === undefined) {
1089
- Alert.alert("File attachments are not available on this server.");
1090
+ Dialog.alert("File attachments are not available on this server.");
1091
return;
1092
}
1093
const insertion = flow.draftKey ? captureComposerDraftInsertion(flow.draftKey) : undefined;
@@ -1108,7 +1109,7 @@ export function NewTaskDraftScreen(props: {
1109
: []),
1110
];
1111
if (problems.length > 0) {
1111
- Alert.alert("Could not attach file", problems.join("\n\n"));
1112
+ Dialog.alert("Could not attach file", problems.join("\n\n"));
1113
}
1114
}
1115
@@ -1194,13 +1195,13 @@ export function NewTaskDraftScreen(props: {
1195
}
1196
if (flow.appendAttachments([attachment], insertion) > 0) {
1197
await removePersistedComposerAttachmentFile(attachment.fileUri);
1197
- Alert.alert(
1198
+ Dialog.alert(
1199
"Could not attach pasted text",
1200
`You can attach up to ${PROVIDER_SEND_TURN_MAX_ATTACHMENTS} files per message.`,
1201
);
1202
}
1203
} catch (error) {
1203
- Alert.alert(
1204
+ Dialog.alert(
1205
"Could not attach pasted text",
1206
error instanceof Error ? error.message : "Try again.",
1207
);
@@ -1214,7 +1215,7 @@ export function NewTaskDraftScreen(props: {
1215
} else if (!wouldExceedInputLimit) {
1216
insertPaste();
1217
} else {
1217
- Alert.alert(
1218
+ Dialog.alert(
1219
wouldExceedInputLimit
1220
? "Pasted text is too large for this message"
1221
: "Could not attach pasted text",
@@ -1280,7 +1281,7 @@ export function NewTaskDraftScreen(props: {
1281
modelSelection,
1282
selectedProject.id,
1283
);
1283
- Alert.alert(title, detail);
1284
+ Dialog.alert(title, detail);
1285
return;
1286
}
1287
// T3's own limits command is answered by the thread composer; a new task would
@@ -1291,7 +1292,7 @@ export function NewTaskDraftScreen(props: {
1292
isUsageLimitsCommand(initialMessageText) &&
1293
draft.attachments.length === 0
1294
) {
1294
- Alert.alert(
1295
+ Dialog.alert(
1296
"Usage limits",
1297
"Send /usage-limits inside a thread, or open Settings → Usage → Limits.",
1298
);
@@ -1301,7 +1302,7 @@ export function NewTaskDraftScreen(props: {
1302
// never drops the user's files); starting anyway would upload everything
1303
// and have the server reject the turn.
1304
if (draft.attachments.length > PROVIDER_SEND_TURN_MAX_ATTACHMENTS) {
1304
- Alert.alert(
1305
+ Dialog.alert(
1306
"Too many attachments",
1307
`Remove attachments until there are at most ${PROVIDER_SEND_TURN_MAX_ATTACHMENTS}.`,
1308
);
@@ -1310,7 +1311,7 @@ export function NewTaskDraftScreen(props: {
1311
1312
const contextBlockReason = composerContextSendBlockReason(draft.context);
1313
if (contextBlockReason) {
1313
- Alert.alert("Too much context", contextBlockReason);
1314
+ Dialog.alert("Too much context", contextBlockReason);
1315
return;
1316
}
1317
@@ -1359,7 +1360,7 @@ export function NewTaskDraftScreen(props: {
1360
try {
1361
await enqueueThreadOutboxMessage(message);
1362
} catch (error) {
1362
- Alert.alert(
1363
+ Dialog.alert(
1364
"Could not queue task",
1365
error instanceof Error ? error.message : "The task could not be saved to the outbox.",
1366
);
apps/mobile/src/features/threads/NewTaskRouteScreen.tsx
+4
-3
@@ -1,3 +1,4 @@
1
+import * as Dialog from "../../components/Dialog";
2
import { AppActivityIndicator } from "../../components/AppActivityIndicator";
3
import { NavigationRow } from "../../components/NavigationRow";
4
import { AppBar } from "../../components/AppBar";
@@ -16,7 +17,7 @@ import {
17
} from "@t3tools/client-runtime/state/runtime";
18
import type { EnvironmentProject } from "@t3tools/client-runtime/state/shell";
19
import { useEffect, useRef, useState } from "react";
19
-import { Alert, Platform, Pressable, View } from "react-native";
20
+import { Platform, Pressable, View } from "react-native";
21
import { useSafeAreaInsets } from "react-native-safe-area-context";
22
import { cn } from "../../lib/cn";
23
import { ScreenContent } from "../../components/ScreenContent";
@@ -211,7 +212,7 @@ export function NewTaskRouteScreen({ route }: StaticScreenProps<NewTaskRoutePara
212
try {
213
await releaseShareReservation(incomingShare.id, incomingShare.destination);
214
} catch (error) {
214
- Alert.alert(
215
+ Dialog.alert(
216
"Could not change project",
217
error instanceof Error
218
? error.message
@@ -247,7 +248,7 @@ export function NewTaskRouteScreen({ route }: StaticScreenProps<NewTaskRoutePara
248
if (result._tag === "Failure") {
249
if (!isAtomCommandInterrupted(result)) {
250
const error = squashAtomCommandFailure(result);
250
- Alert.alert(
251
+ Dialog.alert(
252
"Could not start without a project",
253
error instanceof Error
254
? error.message
apps/mobile/src/features/threads/QuestionAttachments.tsx
+9
-5
@@ -1,10 +1,11 @@
1
+import * as Dialog from "../../components/Dialog";
2
import { TextInputWrapper } from "expo-paste-input";
3
import { AppTextInput as TextInput } from "../../components/AppText";
4
import { useNativePaste } from "../../lib/useNativePaste";
5
import { convertPastedImagesToAttachments } from "../../lib/composerImages";
6
import { PROVIDER_SEND_TURN_MAX_ATTACHMENTS, type UserInputQuestion } from "@t3tools/contracts";
7
import { useAtomValue } from "@effect/atom-react";
7
-import { Alert, View } from "react-native";
8
+import { View } from "react-native";
9
import { useEffect, useRef, useState } from "react";
10
import { ComposerAttachmentButton } from "../../components/ComposerAttachmentButton";
11
import { ComposerAttachmentStrip } from "../../components/ComposerAttachmentStrip";
@@ -100,11 +101,14 @@ export function QuestionAttachments(props: {
101
(appAtomRegistry.get(questionAttachmentPreparationAtom)[key] ?? 0) > 0
102
) {
103
if (append(key, images) > 0)
103
- Alert.alert("Could not paste image", "Too many attachments.");
104
+ Dialog.alert("Could not paste image", "Too many attachments.");
105
} else await releaseUnusedComposerAttachmentFiles(images);
106
})
107
.catch((error) =>
107
- Alert.alert("Could not paste image", error instanceof Error ? error.message : "Try again."),
108
+ Dialog.alert(
109
+ "Could not paste image",
110
+ error instanceof Error ? error.message : "Try again.",
111
+ ),
112
)
113
.finally(() => changeQuestionAttachmentPreparation(key, -1));
114
});
@@ -145,9 +149,9 @@ export function QuestionAttachments(props: {
149
}
150
const rejected = append(key, picked);
151
if (result.error || rejected > 0)
148
- Alert.alert("Could not attach file", result.error ?? "Too many attachments.");
152
+ Dialog.alert("Could not attach file", result.error ?? "Too many attachments.");
153
} catch (error) {
150
- Alert.alert("Could not attach file", error instanceof Error ? error.message : "Try again.");
154
+ Dialog.alert("Could not attach file", error instanceof Error ? error.message : "Try again.");
155
} finally {
156
changeQuestionAttachmentPreparation(key, -1);
157
}
apps/mobile/src/features/threads/ThreadComposer.tsx
+4
-3
@@ -1,3 +1,4 @@
1
+import * as Dialog from "../../components/Dialog";
2
import type { ComposerTextPaste } from "../../native/T3ComposerEditor.types";
3
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
4
import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell";
@@ -33,7 +34,7 @@ import {
34
useState,
35
type RefObject,
36
} from "react";
36
-import { Alert, Keyboard, Platform, Pressable, View, type ViewStyle } from "react-native";
37
+import { Keyboard, Platform, Pressable, View, type ViewStyle } from "react-native";
38
import { composerImageGallery } from "../../lib/composerImageGallery";
39
import { filePreviewGallery } from "../../lib/filePreviewGallery";
40
import { FilePreviewModal, type FilePreviewSource } from "../../components/FilePreviewModal";
@@ -486,7 +487,7 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposer
487
);
488
onShowUsageLimits(report);
489
if (!report) {
489
- Alert.alert("Usage limits unavailable", "This provider does not currently report limits.");
490
+ Dialog.alert("Usage limits unavailable", "This provider does not currently report limits.");
491
}
492
return report !== null;
493
}, [currentModelSelection.instanceId, onShowUsageLimits, props.serverConfig]);
@@ -999,7 +1000,7 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposer
1000
} else if (!wouldExceedInputLimit) {
1001
insertPaste();
1002
} else {
1002
- Alert.alert(
1003
+ Dialog.alert(
1004
wouldExceedInputLimit
1005
? "Pasted text is too large for this message"
1006
: "Could not attach pasted text",
apps/mobile/src/features/threads/ThreadDetailScreen.tsx
+2
-2
@@ -1,3 +1,4 @@
1
+import * as Dialog from "../../components/Dialog";
2
import { useAtomValue } from "@effect/atom-react";
3
import { useChildThreadInputs, useThreadReportedModelSelection } from "../../state/entities";
4
import { UsageLimitRecoveryCard } from "./UsageLimitRecoveryCard";
@@ -62,7 +63,6 @@ import {
63
useState,
64
} from "react";
65
import {
65
- Alert,
66
AppState,
67
Keyboard,
68
Platform,
@@ -1053,7 +1053,7 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread
1053
composerEditorRef.current?.focus();
1054
}
1055
} catch (error) {
1056
- Alert.alert(
1056
+ Dialog.alert(
1057
"Could not edit message",
1058
error instanceof Error ? error.message : "Please try again.",
1059
);
apps/mobile/src/features/threads/ThreadFeed.tsx
+5
-5
@@ -1,3 +1,4 @@
1
+import * as Dialog from "../../components/Dialog";
2
import { useOpenPullRequest } from "../../native/useOpenPullRequest";
3
import { ThreadMarkdownVideo, ThreadMediaVisibleContext } from "./ThreadMarkdownVideo";
4
import { useMarkdownImageSource } from "../../native/useMarkdownImageSource";
@@ -81,7 +82,6 @@ import {
82
} from "react";
83
import {
84
ActivityIndicator,
84
- Alert,
85
Image,
86
Platform,
87
type LayoutChangeEvent,
@@ -411,7 +411,7 @@ function AssistantForkButton(props: {
411
if (result._tag !== "Success") return;
412
const targetThreadReady = await waitForThreadShell(props.environmentId, targetThreadId);
413
if (!targetThreadReady) {
414
- Alert.alert(
414
+ Dialog.alert(
415
"Fork created",
416
"Its thread data did not reach this client. Reconnect and try opening it from the thread list.",
417
);
@@ -610,7 +610,7 @@ function MessageAttachmentFile(props: {
610
});
611
} catch (error) {
612
if (!controller.signal.aborted) {
613
- Alert.alert(
613
+ Dialog.alert(
614
"Could not open attachment",
615
error instanceof Error ? error.message : "The attachment is unavailable.",
616
);
@@ -1318,7 +1318,7 @@ function renderFeedEntry(
1318
accessibilityLabel={intentBadge.accessibilityLabel}
1319
accessibilityHint="Explains this message's badge"
1320
hitSlop={8}
1321
- onPress={() => Alert.alert("Message history", intentBadge.explanation)}
1321
+ onPress={() => Dialog.alert("Message history", intentBadge.explanation)}
1322
className={cn(
1323
"rounded-full border px-1.5 py-0.5",
1324
intentBadge.tone === "queued"
@@ -1584,7 +1584,7 @@ function UserMessageContent(props: UserMessageContentProps) {
1584
)
1585
.then(() => Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success))
1586
.catch(() => {
1587
- Alert.alert("Could not copy context", "Try copying this context again.");
1587
+ Dialog.alert("Could not copy context", "Try copying this context again.");
1588
});
1589
}
1590
},
apps/mobile/src/features/threads/ThreadGitControls.tsx
+3
-3
@@ -1,3 +1,4 @@
1
+import * as Dialog from "../../components/Dialog";
2
import { useOpenPullRequest } from "../../native/useOpenPullRequest";
3
import { createNativeHeaderMenu } from "../../components/nativeHeaderMenu.ios";
4
import type { AppBarMenu } from "../../components/AppBar.types";
@@ -17,7 +18,6 @@ import {
18
import { useNavigation } from "@react-navigation/native";
19
import { NativeHeaderToolbar } from "../../native/StackHeader";
20
import { useCallback, useMemo } from "react";
20
-import { Alert } from "react-native";
21
import { useEnvironmentScope } from "../../state/session";
22
import {
23
basename,
@@ -167,11 +167,11 @@ function useThreadGitControlModel(props: ThreadGitMenuProps) {
167
const openExistingPr = useCallback(async () => {
168
const prUrl = gitStatus?.pr?.state === "open" ? gitStatus.pr.url : null;
169
if (!prUrl) {
170
- Alert.alert("No open PR", "This branch does not have an open pull request.");
170
+ Dialog.alert("No open PR", "This branch does not have an open pull request.");
171
return;
172
}
173
if (!(await openPullRequest(prUrl))) {
174
- Alert.alert("Unable to open PR", "The pull request could not be opened.");
174
+ Dialog.alert("Unable to open PR", "The pull request could not be opened.");
175
}
176
}, [gitStatus, openPullRequest]);
177
apps/mobile/src/features/threads/ThreadRouteScreen.tsx
+3
-2
@@ -1,3 +1,4 @@
1
+import * as Dialog from "../../components/Dialog";
2
import { useOpenPullRequest } from "../../native/useOpenPullRequest";
3
import { makeTurnCommandMetadata } from "../../lib/commandMetadata";
4
import { buildProjectThreadStartTurnInput } from "../../lib/projectThreadStartTurn";
@@ -26,7 +27,7 @@ import {
27
projectScriptRuntimeEnv,
28
resolveProjectScripts,
29
} from "@t3tools/shared/projectScripts";
29
-import { Alert, Platform, ScrollView, View } from "react-native";
30
+import { Platform, ScrollView, View } from "react-native";
31
import { useSafeAreaInsets } from "react-native-safe-area-context";
32
import { useConnectionsReady } from "../../state/workspace";
33
import { useEnvironmentShellReadiness } from "../../state/shell";
@@ -835,7 +836,7 @@ function ThreadRouteContent(
836
try {
837
await recoverFailedThreadDraft(creation);
838
} catch (error) {
838
- Alert.alert(
839
+ Dialog.alert(
840
"Could not restore draft",
841
error instanceof Error ? error.message : String(error),
842
);
apps/mobile/src/features/threads/ThreadSettingsSheet.tsx
+4
-11
@@ -1,3 +1,4 @@
1
+import * as Dialog from "../../components/Dialog";
2
import { createV5StackNavigator as createNativeStackNavigator } from "../../native/createV5StackNavigator";
3
import { DEFAULT_SERVER_SETTINGS } from "@t3tools/contracts";
4
import {
@@ -36,15 +37,7 @@ import {
37
useState,
38
type ReactNode,
39
} from "react";
39
-import {
40
- Alert,
41
- Platform,
42
- Pressable,
43
- RefreshControl,
44
- ScrollView,
45
- TextInput,
46
- View,
47
-} from "react-native";
40
+import { Platform, Pressable, RefreshControl, ScrollView, TextInput, View } from "react-native";
41
import Animated, { FadeIn, FadeOut, LinearTransition } from "react-native-reanimated";
42
import { useSafeAreaInsets } from "react-native-safe-area-context";
43
@@ -559,7 +552,7 @@ function ThreadSettingsSessionProvider(
552
const commitPendingModel = useCallback(() => {
553
if (pendingModel) {
554
if (!canCommitPendingModel(pendingModel, props.providerGroups)) {
562
- Alert.alert(
555
+ Dialog.alert(
556
"Model unavailable",
557
"Set up this provider on web or desktop, or select another model.",
558
);
@@ -1007,7 +1000,7 @@ function ThreadSettingsMainContent(props: {
1000
void refreshProviderCatalog(session.environmentId).then((result) => {
1001
setIsRefreshingProviders(false);
1002
const error = providerCatalogRefreshError(result);
1010
- if (error) Alert.alert("Could not refresh models", error);
1003
+ if (error) Dialog.alert("Could not refresh models", error);
1004
});
1005
}, [isRefreshingProviders, refreshProviderCatalog, session.environmentId]);
1006
const catalogItems = useThreadSettingsCatalogItems(session);
apps/mobile/src/features/threads/git/GitOverviewSheet.tsx
+8
-4
@@ -1,3 +1,4 @@
1
+import * as Dialog from "../../../components/Dialog";
2
import { useOpenPullRequest } from "../../../native/useOpenPullRequest";
3
import {
4
type GitActionRequestInput,
@@ -18,7 +19,7 @@ import {
19
} from "@react-navigation/native";
20
import { SymbolView } from "../../../components/AppSymbol";
21
import { useCallback, useEffect, useMemo, useState } from "react";
21
-import { Alert, Platform, Pressable, RefreshControl, ScrollView, View } from "react-native";
22
+import { Platform, Pressable, RefreshControl, ScrollView, View } from "react-native";
23
24
import { Screen, ScreenStack, ScreenStackHeaderConfig } from "react-native-screens";
25
import { useSafeAreaInsets } from "react-native-safe-area-context";
@@ -140,11 +141,11 @@ function GitOverviewSheetContent(props: GitOverviewSheetProps) {
141
const openExistingPr = useCallback(async () => {
142
const prUrl = gitStatus.data?.pr?.state === "open" ? gitStatus.data.pr.url : null;
143
if (!prUrl) {
143
- Alert.alert("No open PR", "This branch does not have an open pull request.");
144
+ Dialog.alert("No open PR", "This branch does not have an open pull request.");
145
return;
146
}
147
if (!(await openPullRequest(prUrl))) {
147
- Alert.alert("Unable to open PR", "The pull request could not be opened.");
148
+ Dialog.alert("Unable to open PR", "The pull request could not be opened.");
149
}
150
}, [gitStatus.data, openPullRequest]);
151
@@ -389,7 +390,10 @@ function GitOverviewSheetContent(props: GitOverviewSheetProps) {
390
onPress={() => {
391
void openPullRequest(link.url).then((opened) => {
392
if (!opened)
392
- Alert.alert("Unable to open PR", "The pull request could not be opened.");
393
+ Dialog.alert(
394
+ "Unable to open PR",
395
+ "The pull request could not be opened.",
396
+ );
397
});
398
}}
399
/>
apps/mobile/src/features/threads/new-task-flow-provider.tsx
+2
-2
@@ -1,8 +1,8 @@
1
+import * as Dialog from "../../components/Dialog";
2
import { resolveFilesystemReadAccess } from "@t3tools/client-runtime/state/filesystem";
3
import { useEnvironmentPresentation } from "../../state/presentation";
4
import { environmentSession } from "../../state/session";
5
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
5
-import { Alert } from "react-native";
6
7
import type {
8
EnvironmentId,
@@ -883,7 +883,7 @@ export function NewTaskFlowProvider(props: React.PropsWithChildren) {
883
}
884
if (!isAtomCommandInterrupted(result)) {
885
const error = squashAtomCommandFailure(result);
886
- Alert.alert(
886
+ Dialog.alert(
887
"Could not switch machine",
888
error instanceof Error
889
? error.message
apps/mobile/src/features/threads/thread-handoff-row.tsx
+3
-2
@@ -1,3 +1,4 @@
1
+import * as Dialog from "../../components/Dialog";
2
import { useAtomValue } from "@effect/atom-react";
3
import { scopeThreadRef } from "@t3tools/client-runtime/environment";
4
import { resolveHandoffEndpoints, type HandoffEndpoints } from "@t3tools/client-runtime/handoff";
@@ -10,7 +11,7 @@ import type {
11
} from "@t3tools/contracts";
12
import { Atom } from "effect/reactivity";
13
import { useMemo } from "react";
13
-import { Alert, Pressable, View, type ColorValue } from "react-native";
14
+import { Pressable, View, type ColorValue } from "react-native";
15
import { AppText as Text } from "../../components/AppText";
16
import { SymbolView } from "../../components/AppSymbol";
17
import { ProviderIcon } from "../../components/ProviderIcon";
@@ -117,7 +118,7 @@ function HandoffEndpoint(props: {
118
className="min-h-6 max-w-full flex-row items-center justify-center gap-1"
119
hitSlop={{ top: 8, bottom: 8 }}
120
onPress={() =>
120
- Alert.alert(
121
+ Dialog.alert(
122
label,
123
provider ? resolveProviderInstanceDisplayName(provider) : props.instanceId,
124
)
apps/mobile/src/features/threads/thread-list-v2-items.tsx
+6
-2
@@ -1,3 +1,4 @@
1
+import * as Dialog from "../../components/Dialog";
2
import type { ThreadRowProviderInstance } from "./thread-provider-instance";
3
import {
4
THREAD_LIST_V2_MONO_FONT as MONO_FONT,
@@ -21,7 +22,7 @@ import { AuthOrchestrationOperateScope, type EnvironmentMachineKind } from "@t3t
22
import { canSnooze, resolveSnoozePresets } from "@t3tools/client-runtime/state/thread-settled";
23
import type { MenuAction } from "@react-native-menu/menu";
24
import { memo, useCallback, useEffect, useMemo, useState, type ComponentProps } from "react";
24
-import { Alert, Pressable, useWindowDimensions, View } from "react-native";
25
+import { Pressable, useWindowDimensions, View } from "react-native";
26
import type { SwipeableMethods } from "react-native-gesture-handler/ReanimatedSwipeable";
27
28
import type { ThreadListProvider } from "../../state/thread-list-environments";
@@ -881,7 +882,10 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
882
if (snoozeSelection._tag === "selected") {
883
handleSnooze(snoozeSelection.preset.snoozedUntil);
884
} else if (snoozeSelection._tag === "expired") {
884
- Alert.alert("Could not snooze thread", "That snooze time has passed. Choose another time.");
885
+ Dialog.alert(
886
+ "Could not snooze thread",
887
+ "That snooze time has passed. Choose another time.",
888
+ );
889
}
890
},
891
[