TypeScript
refactor(mobile): adopt shared alerts in thread and PR screens (#19999)
Julius Marmingee3438b809093
diff --git a/apps/mobile/src/features/browser/BrowserPreviewRouteScreen.tsx b/apps/mobile/src/features/browser/BrowserPreviewRouteScreen.tsxindex 3dd528609e7..a18b97c024d 100644--- a/apps/mobile/src/features/browser/BrowserPreviewRouteScreen.tsx+++ b/apps/mobile/src/features/browser/BrowserPreviewRouteScreen.tsx@@ -1,3 +1,4 @@+import * as Dialog from "../../components/Dialog";import { useIsFocused, useNavigation, type StaticScreenProps } from "@react-navigation/native";import { createNativeStackNavigator } from "@react-navigation/native-stack";import {@@ -8,7 +9,7 @@ import {} from "@t3tools/contracts";import { normalizePreviewUrl } from "@t3tools/shared/preview";import { useCallback, useEffect, useRef, useState } from "react";-import { ActivityIndicator, Alert, AppState, Platform, TextInput, View } from "react-native";+import { ActivityIndicator, AppState, Platform, TextInput, View } from "react-native";import { useSafeAreaInsets } from "react-native-safe-area-context";import { ControlPill } from "../../components/ControlPill";@@ -104,7 +105,7 @@ function BrowserPreviewScreen({}, [focused, loaded, tabs.length, onClose]);const onPictureInPicture = useCallback((state: PreviewPictureInPictureState, detail?: string) => {setPictureInPicture({ supported: state.supported, active: state.active });- if (detail) Alert.alert("Picture in picture is unavailable", detail);+ if (detail) Dialog.alert("Picture in picture is unavailable", detail);}, []);const selectTab = (next: string) => {setPictureInPicture(NO_PICTURE_IN_PICTURE);@@ -228,7 +229,7 @@ function BrowserAddressBar({try {onCommand({ type: "navigate", url: normalizePreviewUrl(value) });} catch {- Alert.alert("Could not open this address", "Enter an http or https URL.");+ Dialog.alert("Could not open this address", "Enter an http or https URL.");}};return (diff --git a/apps/mobile/src/features/browser/BrowserTabMenu.tsx b/apps/mobile/src/features/browser/BrowserTabMenu.tsxindex 20066d4417a..1a850a042e0 100644--- a/apps/mobile/src/features/browser/BrowserTabMenu.tsx+++ b/apps/mobile/src/features/browser/BrowserTabMenu.tsx@@ -1,3 +1,4 @@+import * as Dialog from "../../components/Dialog";import type { MenuAction } from "@react-native-menu/menu";import {DEFAULT_PREVIEW_ZOOM_FACTOR,@@ -9,7 +10,6 @@ import {type PreviewViewportSetting,} from "@t3tools/contracts";import { PREVIEW_VIEWPORT_PRESETS } from "@t3tools/shared/previewViewport";-import { Alert } from "react-native";import { ControlPill } from "../../components/ControlPill";import { Menu } from "../../components/Menu";@@ -114,7 +114,7 @@ export function BrowserTabMenu({const run = async (change: Omit<PreviewAdjustInput, "threadId" | "tabId">) => {const result = await adjust({ environmentId, input: { ...target, ...change } });- if (result._tag === "Failure") Alert.alert("Could not change this browser tab");+ if (result._tag === "Failure") Dialog.alert("Could not change this browser tab");};const onAction = (id: string) => {@@ -134,7 +134,7 @@ export function BrowserTabMenu({if (!option) return;void resize({ environmentId, input: { ...target, viewport: option.setting } }).then((result) => {- if (result._tag === "Failure") Alert.alert("Could not change the viewport");+ if (result._tag === "Failure") Dialog.alert("Could not change the viewport");},);}diff --git a/apps/mobile/src/features/browser/PreviewStreamWebView.tsx b/apps/mobile/src/features/browser/PreviewStreamWebView.tsxindex 081e81f1357..83f48be9d35 100644--- a/apps/mobile/src/features/browser/PreviewStreamWebView.tsx+++ b/apps/mobile/src/features/browser/PreviewStreamWebView.tsx@@ -1,3 +1,4 @@+import * as Dialog from "../../components/Dialog";import previewStreamScript from "@t3tools/mobile-preview-stream";import {previewStreamControlLabel,@@ -18,7 +19,7 @@ import {useState,type Ref,} from "react";-import { ActivityIndicator, Alert, Platform, Pressable, TextInput, View } from "react-native";+import { ActivityIndicator, Platform, Pressable, TextInput, View } from "react-native";import { WebView } from "react-native-webview";import * as Clipboard from "expo-clipboard";@@ -91,7 +92,7 @@ async function sendFilesToPage(chooser: PreviewStreamFileChooser, pick: boolean)/** The file is on the environment; saving it here goes through the share sheet. */function offerDownload(download: PreviewStreamDownload) {- Alert.alert(`Downloaded ${download.fileName}`, undefined, [+ Dialog.alert(`Downloaded ${download.fileName}`, undefined, [{ text: "Not now", style: "cancel" },{text: "Save or share",@@ -101,7 +102,7 @@ function offerDownload(download: PreviewStreamDownload) {attachment: { name: download.fileName, mimeType: "application/octet-stream" },signal: new AbortController().signal,}).catch((cause: unknown) =>- Alert.alert(+ Dialog.alert("Could not save the download",cause instanceof Error ? cause.message : undefined,),@@ -265,7 +266,7 @@ function PreviewStreamDocumentView({if (!chooser) return;setFileChooser(null);void sendFilesToPage(chooser, pick).catch((cause: unknown) =>- Alert.alert(+ Dialog.alert("Could not send the files to the page",cause instanceof Error ? cause.message : undefined,),diff --git a/apps/mobile/src/features/files/AttachmentFileScreen.tsx b/apps/mobile/src/features/files/AttachmentFileScreen.tsxindex f3b667a05a7..2c80d038c1a 100644--- a/apps/mobile/src/features/files/AttachmentFileScreen.tsx+++ b/apps/mobile/src/features/files/AttachmentFileScreen.tsx@@ -1,3 +1,4 @@+import * as Dialog from "../../components/Dialog";/* oxlint-disable react/no-array-index-key -- Captured table rows and columns have stable positions and may contain identical values. */import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";import { useNavigation, type StaticScreenProps } from "@react-navigation/native";@@ -5,7 +6,7 @@ import type { MenuAction } from "@react-native-menu/menu";import { EnvironmentId } from "@t3tools/contracts";import { formatAttachmentSize } from "@t3tools/client-runtime/state/attachments";import { useCallback, useEffect, useMemo, useRef, useState } from "react";-import { Alert, Platform, ScrollView, View } from "react-native";+import { Platform, ScrollView, View } from "react-native";import { AndroidHeaderIconButton, AndroidScreenHeader } from "../../components/AndroidScreenHeader";import { AppText as Text } from "../../components/AppText";@@ -228,7 +229,7 @@ export function AttachmentFileScreen(props: AttachmentFileScreenProps) {pendingNativeError.current = null;if (nativeViewer === null) {// A file this screen renders itself: an explicit viewer failure is worth a word.- if (message) Alert.alert("Could not open document", message);+ if (message) Dialog.alert("Could not open document", message);return;}if (message) {diff --git a/apps/mobile/src/features/pull-requests/PullRequestInlineCommentScreen.tsx b/apps/mobile/src/features/pull-requests/PullRequestInlineCommentScreen.tsxindex 649a0978e87..54f2e8fb03f 100644--- a/apps/mobile/src/features/pull-requests/PullRequestInlineCommentScreen.tsx+++ b/apps/mobile/src/features/pull-requests/PullRequestInlineCommentScreen.tsx@@ -1,6 +1,7 @@+import * as Dialog from "../../components/Dialog";import { useFocusEffect, useNavigation, type StaticScreenProps } from "@react-navigation/native";import { useCallback, useRef, useState } from "react";-import { Alert, View } from "react-native";+import { View } from "react-native";import type { PullRequestReviewPosition } from "@t3tools/contracts";import { AppText as Text, AppTextInput as TextInput } from "../../components/AppText";import { Button } from "../../components/Button";@@ -128,7 +129,7 @@ export function PullRequestInlineCommentScreen({ route }: StaticScreenProps<Inli<Buttonlabel="Delete draft"onPress={() =>- Alert.alert("Delete this draft?", "Your other review comments will be kept.", [+ Dialog.alert("Delete this draft?", "Your other review comments will be kept.", [{ text: "Cancel", style: "cancel" },{text: "Delete",diff --git a/apps/mobile/src/features/pull-requests/PullRequestMergeControls.tsx b/apps/mobile/src/features/pull-requests/PullRequestMergeControls.tsxindex 48d04d3b8a3..399b9c311f5 100644--- a/apps/mobile/src/features/pull-requests/PullRequestMergeControls.tsx+++ b/apps/mobile/src/features/pull-requests/PullRequestMergeControls.tsx@@ -1,9 +1,10 @@+import * as Dialog from "../../components/Dialog";import { useAtomRefresh, useAtomSet, useAtomValue } from "@effect/atom-react";import { squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime";import type { PullRequestDetail, PullRequestMergeMethod } from "@t3tools/contracts";import { AsyncResult } from "effect/reactivity";import { useRef, useState } from "react";-import { ActivityIndicator, Alert, Platform, Pressable, View } from "react-native";+import { ActivityIndicator, Platform, Pressable, View } from "react-native";import { AppText as Text } from "../../components/AppText";import { SymbolView } from "../../components/AppSymbol";import { Menu } from "../../components/Menu";@@ -125,7 +126,7 @@ export function PullRequestMergeControls(props: {});if (response._tag === "Failure") throw squashAtomCommandFailure(response);} catch (cause) {- Alert.alert(+ Dialog.alert("Couldn't complete the merge action",cause instanceof Error ? cause.message : "Try again.",);@@ -155,7 +156,7 @@ export function PullRequestMergeControls(props: {: action === "disable-auto-merge"? "Stop the provider from automatically merging this pull request.": `Merge #${pr.number} into ${pr.baseBranch} using ${method}.`;- Alert.alert(title, message, [+ Dialog.alert(title, message, [{ text: "Cancel", style: "cancel" },{text: action === "merge" ? label : title.replace("?", ""),diff --git a/apps/mobile/src/features/threads/ChatGptSharingStatus.tsx b/apps/mobile/src/features/threads/ChatGptSharingStatus.tsxindex 86361fce467..1285eb387fd 100644--- a/apps/mobile/src/features/threads/ChatGptSharingStatus.tsx+++ b/apps/mobile/src/features/threads/ChatGptSharingStatus.tsx@@ -1,6 +1,7 @@+import * as Dialog from "../../components/Dialog";import type { ServerProvider } from "@t3tools/contracts";import { CHATGPT_USAGE_URL, usesChatGptSharing } from "@t3tools/shared/usageLimits";-import { Alert, Linking, Pressable, View } from "react-native";+import { Linking, Pressable, View } from "react-native";import { AppText as Text } from "../../components/AppText";import { ProviderIcon } from "../../components/ProviderIcon";@@ -13,7 +14,7 @@ export function ChatGptSharingStatus({ provider }: { provider: ServerProvider |accessibilityLabel="ChatGPT token sharing is active"className="min-h-11 flex-row items-center gap-2"onPress={() => {- Alert.alert(+ Dialog.alert("ChatGPT sharing is on",[provider?.auth.email,diff --git a/apps/mobile/src/features/threads/McpAppWebView.tsx b/apps/mobile/src/features/threads/McpAppWebView.tsxindex 7515ed9e41d..17b916610c6 100644--- a/apps/mobile/src/features/threads/McpAppWebView.tsx+++ b/apps/mobile/src/features/threads/McpAppWebView.tsx@@ -1,3 +1,4 @@+import * as Dialog from "../../components/Dialog";import type { EnvironmentId, ThreadId, TurnItemId } from "@t3tools/contracts";import {makeMcpAppHost,@@ -21,7 +22,7 @@ import * as Predicate from "effect/Predicate";import Constants from "expo-constants";import { useNavigation } from "@react-navigation/native";import { useEffect, useMemo, useRef, useState } from "react";-import { ActivityIndicator, Alert, Platform, Pressable, View } from "react-native";+import { ActivityIndicator, Platform, Pressable, View } from "react-native";import { useSafeAreaInsets } from "react-native-safe-area-context";import { WebView, type WebViewMessageEvent } from "react-native-webview";@@ -81,7 +82,7 @@ const commandFailure = (result: {const confirm = (title: string, message: string, action: string) =>new Promise<boolean>((resolve) => {- Alert.alert(+ Dialog.alert(title,message,[diff --git a/apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx b/apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsxindex d08a865d317..4220e13d8d1 100644--- a/apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx+++ b/apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx@@ -1,3 +1,4 @@+import * as Dialog from "../../components/Dialog";import { AppActivityIndicator } from "../../components/AppActivityIndicator";import { NavigationRow } from "../../components/NavigationRow";import type { EnvironmentProject } from "@t3tools/client-runtime/state/shell";@@ -12,7 +13,7 @@ import {import * as Haptics from "expo-haptics";import { useNavigation } from "@react-navigation/native";import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from "react";-import { Alert, Platform, Pressable, ScrollView, TextInput, View } from "react-native";+import { Platform, Pressable, ScrollView, TextInput, View } from "react-native";import { useSafeAreaInsets } from "react-native-safe-area-context";import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";@@ -313,7 +314,7 @@ export function NewTaskBranchPickerRouteScreen() {if (result._tag === "Failure") {if (mountedRef.current && navigation.isFocused() && !isAtomCommandInterrupted(result)) {const error = squashAtomCommandFailure(result);- Alert.alert(+ Dialog.alert("Could not switch branch",error instanceof Error ? error.message : "The branch could not be checked out.",);diff --git a/apps/mobile/src/features/threads/NewTaskDraftRouteScreen.tsx b/apps/mobile/src/features/threads/NewTaskDraftRouteScreen.tsxindex 67b68b35f99..c53d6c1f992 100644--- a/apps/mobile/src/features/threads/NewTaskDraftRouteScreen.tsx+++ b/apps/mobile/src/features/threads/NewTaskDraftRouteScreen.tsx@@ -1,6 +1,7 @@+import * as Dialog from "../../components/Dialog";import { useNavigation, usePreventRemove, type StaticScreenProps } from "@react-navigation/native";import { useEffect, useMemo, useRef, useState } from "react";-import { Alert, View } from "react-native";+import { View } from "react-native";import {isAtomCommandInterrupted,squashAtomCommandFailure,@@ -129,7 +130,7 @@ export function NewTaskDraftRouteScreen({ route }: StaticScreenProps<NewTaskDrafif (checkoutPending || result?._tag !== "Failure") return;if (!isAtomCommandInterrupted(result)) {const error = squashAtomCommandFailure(result);- Alert.alert(+ Dialog.alert("Could not switch branch",error instanceof Error ? error.message : "The branch could not be checked out.",);diff --git a/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx b/apps/mobile/src/features/threads/NewTaskDraftScreen.tsxindex 92b791665e1..3e250602086 100644--- a/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx+++ b/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx@@ -1,3 +1,4 @@+import * as Dialog from "../../components/Dialog";import { useAtomValue } from "@effect/atom-react";import * as Cause from "effect/Cause";import { AsyncResult } from "effect/reactivity";@@ -17,7 +18,7 @@ import {type NavigationAction,} from "@react-navigation/native";import { useCallback, useEffect, useMemo, useRef, useState } from "react";-import { Alert, Platform, Pressable, ScrollView, View } from "react-native";+import { Platform, Pressable, ScrollView, View } from "react-native";import {KeyboardController,KeyboardStickyView,@@ -277,7 +278,7 @@ export function NewTaskDraftScreen(props: {const result = await action();if (AsyncResult.isFailure(result)) {const error = Cause.squash(result.cause);- Alert.alert(title, error instanceof Error ? error.message : "An error occurred.");+ Dialog.alert(title, error instanceof Error ? error.message : "An error occurred.");}};const deleteProject = useAtomCommand(projectEnvironment.delete, { reportFailure: false });@@ -296,7 +297,7 @@ export function NewTaskDraftScreen(props: {});if (AsyncResult.isFailure(result)) {const error = Cause.squash(result.cause);- Alert.alert(+ Dialog.alert("Failed to remove project",error instanceof Error ? error.message : "An error occurred.",);@@ -816,7 +817,7 @@ export function NewTaskDraftScreen(props: {if (!incomingShare) {if (isIncomingShareUnavailable && alertedUnavailableIncomingShareIdRef.current !== shareId) {alertedUnavailableIncomingShareIdRef.current = shareId;- Alert.alert(+ Dialog.alert("Shared content unavailable","The shared content is no longer in the inbox. You can continue editing this task draft.",);@@ -907,7 +908,7 @@ export function NewTaskDraftScreen(props: {);}if (warnings.length > 0) {- Alert.alert("Some shared content was skipped", warnings.join("\n"));+ Dialog.alert("Some shared content was skipped", warnings.join("\n"));}shareImportDraftBackupRef.current.delete(importKey);})()@@ -915,7 +916,7 @@ export function NewTaskDraftScreen(props: {if (!shareImportMountedRef.current || activeShareImportTokenRef.current !== importToken) {return;}- Alert.alert(+ Dialog.alert("Could not import shared content",error instanceof Error ? error.message : "The shared content could not be saved.",[@@ -960,7 +961,7 @@ export function NewTaskDraftScreen(props: {if (!shareImportMountedRef.current) {return;}- Alert.alert(+ Dialog.alert("Could not cancel import",cancelError instanceof Error? cancelError.message@@ -1075,7 +1076,7 @@ export function NewTaskDraftScreen(props: {: []),];if (problems.length > 0) {- Alert.alert("Could not attach photo or video", problems.join("\n\n"));+ Dialog.alert("Could not attach photo or video", problems.join("\n\n"));}}@@ -1086,7 +1087,7 @@ export function NewTaskDraftScreen(props: {const maxBytes =selectedEnvironmentServerConfig?.environment.capabilities.fileAttachments?.maxUploadBytes;if (maxBytes === undefined) {- Alert.alert("File attachments are not available on this server.");+ Dialog.alert("File attachments are not available on this server.");return;}const insertion = flow.draftKey ? captureComposerDraftInsertion(flow.draftKey) : undefined;@@ -1108,7 +1109,7 @@ export function NewTaskDraftScreen(props: {: []),];if (problems.length > 0) {- Alert.alert("Could not attach file", problems.join("\n\n"));+ Dialog.alert("Could not attach file", problems.join("\n\n"));}}@@ -1194,13 +1195,13 @@ export function NewTaskDraftScreen(props: {}if (flow.appendAttachments([attachment], insertion) > 0) {await removePersistedComposerAttachmentFile(attachment.fileUri);- Alert.alert(+ Dialog.alert("Could not attach pasted text",`You can attach up to ${PROVIDER_SEND_TURN_MAX_ATTACHMENTS} files per message.`,);}} catch (error) {- Alert.alert(+ Dialog.alert("Could not attach pasted text",error instanceof Error ? error.message : "Try again.",);@@ -1214,7 +1215,7 @@ export function NewTaskDraftScreen(props: {} else if (!wouldExceedInputLimit) {insertPaste();} else {- Alert.alert(+ Dialog.alert(wouldExceedInputLimit? "Pasted text is too large for this message": "Could not attach pasted text",@@ -1280,7 +1281,7 @@ export function NewTaskDraftScreen(props: {modelSelection,selectedProject.id,);- Alert.alert(title, detail);+ Dialog.alert(title, detail);return;}// T3's own limits command is answered by the thread composer; a new task would@@ -1291,7 +1292,7 @@ export function NewTaskDraftScreen(props: {isUsageLimitsCommand(initialMessageText) &&draft.attachments.length === 0) {- Alert.alert(+ Dialog.alert("Usage limits","Send /usage-limits inside a thread, or open Settings → Usage → Limits.",);@@ -1301,7 +1302,7 @@ export function NewTaskDraftScreen(props: {// never drops the user's files); starting anyway would upload everything// and have the server reject the turn.if (draft.attachments.length > PROVIDER_SEND_TURN_MAX_ATTACHMENTS) {- Alert.alert(+ Dialog.alert("Too many attachments",`Remove attachments until there are at most ${PROVIDER_SEND_TURN_MAX_ATTACHMENTS}.`,);@@ -1310,7 +1311,7 @@ export function NewTaskDraftScreen(props: {const contextBlockReason = composerContextSendBlockReason(draft.context);if (contextBlockReason) {- Alert.alert("Too much context", contextBlockReason);+ Dialog.alert("Too much context", contextBlockReason);return;}@@ -1359,7 +1360,7 @@ export function NewTaskDraftScreen(props: {try {await enqueueThreadOutboxMessage(message);} catch (error) {- Alert.alert(+ Dialog.alert("Could not queue task",error instanceof Error ? error.message : "The task could not be saved to the outbox.",);diff --git a/apps/mobile/src/features/threads/NewTaskRouteScreen.tsx b/apps/mobile/src/features/threads/NewTaskRouteScreen.tsxindex 1b614578e26..36a2dc27835 100644--- a/apps/mobile/src/features/threads/NewTaskRouteScreen.tsx+++ b/apps/mobile/src/features/threads/NewTaskRouteScreen.tsx@@ -1,3 +1,4 @@+import * as Dialog from "../../components/Dialog";import { AppActivityIndicator } from "../../components/AppActivityIndicator";import { NavigationRow } from "../../components/NavigationRow";import { AppBar } from "../../components/AppBar";@@ -16,7 +17,7 @@ import {} from "@t3tools/client-runtime/state/runtime";import type { EnvironmentProject } from "@t3tools/client-runtime/state/shell";import { useEffect, useRef, useState } from "react";-import { Alert, Platform, Pressable, View } from "react-native";+import { Platform, Pressable, View } from "react-native";import { useSafeAreaInsets } from "react-native-safe-area-context";import { cn } from "../../lib/cn";import { ScreenContent } from "../../components/ScreenContent";@@ -211,7 +212,7 @@ export function NewTaskRouteScreen({ route }: StaticScreenProps<NewTaskRouteParatry {await releaseShareReservation(incomingShare.id, incomingShare.destination);} catch (error) {- Alert.alert(+ Dialog.alert("Could not change project",error instanceof Error? error.message@@ -247,7 +248,7 @@ export function NewTaskRouteScreen({ route }: StaticScreenProps<NewTaskRouteParaif (result._tag === "Failure") {if (!isAtomCommandInterrupted(result)) {const error = squashAtomCommandFailure(result);- Alert.alert(+ Dialog.alert("Could not start without a project",error instanceof Error? error.messagediff --git a/apps/mobile/src/features/threads/QuestionAttachments.tsx b/apps/mobile/src/features/threads/QuestionAttachments.tsxindex 803de4e3a9a..f0275978b9f 100644--- a/apps/mobile/src/features/threads/QuestionAttachments.tsx+++ b/apps/mobile/src/features/threads/QuestionAttachments.tsx@@ -1,10 +1,11 @@+import * as Dialog from "../../components/Dialog";import { TextInputWrapper } from "expo-paste-input";import { AppTextInput as TextInput } from "../../components/AppText";import { useNativePaste } from "../../lib/useNativePaste";import { convertPastedImagesToAttachments } from "../../lib/composerImages";import { PROVIDER_SEND_TURN_MAX_ATTACHMENTS, type UserInputQuestion } from "@t3tools/contracts";import { useAtomValue } from "@effect/atom-react";-import { Alert, View } from "react-native";+import { View } from "react-native";import { useEffect, useRef, useState } from "react";import { ComposerAttachmentButton } from "../../components/ComposerAttachmentButton";import { ComposerAttachmentStrip } from "../../components/ComposerAttachmentStrip";@@ -100,11 +101,14 @@ export function QuestionAttachments(props: {(appAtomRegistry.get(questionAttachmentPreparationAtom)[key] ?? 0) > 0) {if (append(key, images) > 0)- Alert.alert("Could not paste image", "Too many attachments.");+ Dialog.alert("Could not paste image", "Too many attachments.");} else await releaseUnusedComposerAttachmentFiles(images);}).catch((error) =>- Alert.alert("Could not paste image", error instanceof Error ? error.message : "Try again."),+ Dialog.alert(+ "Could not paste image",+ error instanceof Error ? error.message : "Try again.",+ ),).finally(() => changeQuestionAttachmentPreparation(key, -1));});@@ -145,9 +149,9 @@ export function QuestionAttachments(props: {}const rejected = append(key, picked);if (result.error || rejected > 0)- Alert.alert("Could not attach file", result.error ?? "Too many attachments.");+ Dialog.alert("Could not attach file", result.error ?? "Too many attachments.");} catch (error) {- Alert.alert("Could not attach file", error instanceof Error ? error.message : "Try again.");+ Dialog.alert("Could not attach file", error instanceof Error ? error.message : "Try again.");} finally {changeQuestionAttachmentPreparation(key, -1);}diff --git a/apps/mobile/src/features/threads/ThreadComposer.tsx b/apps/mobile/src/features/threads/ThreadComposer.tsxindex 586c37fd632..a9a846b59e0 100644--- a/apps/mobile/src/features/threads/ThreadComposer.tsx+++ b/apps/mobile/src/features/threads/ThreadComposer.tsx@@ -1,3 +1,4 @@+import * as Dialog from "../../components/Dialog";import type { ComposerTextPaste } from "../../native/T3ComposerEditor.types";import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell";@@ -33,7 +34,7 @@ import {useState,type RefObject,} from "react";-import { Alert, Keyboard, Platform, Pressable, View, type ViewStyle } from "react-native";+import { Keyboard, Platform, Pressable, View, type ViewStyle } from "react-native";import { composerImageGallery } from "../../lib/composerImageGallery";import { filePreviewGallery } from "../../lib/filePreviewGallery";import { FilePreviewModal, type FilePreviewSource } from "../../components/FilePreviewModal";@@ -486,7 +487,7 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposer);onShowUsageLimits(report);if (!report) {- Alert.alert("Usage limits unavailable", "This provider does not currently report limits.");+ Dialog.alert("Usage limits unavailable", "This provider does not currently report limits.");}return report !== null;}, [currentModelSelection.instanceId, onShowUsageLimits, props.serverConfig]);@@ -999,7 +1000,7 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposer} else if (!wouldExceedInputLimit) {insertPaste();} else {- Alert.alert(+ Dialog.alert(wouldExceedInputLimit? "Pasted text is too large for this message": "Could not attach pasted text",diff --git a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx b/apps/mobile/src/features/threads/ThreadDetailScreen.tsxindex 97663da1ba9..dbc2afcc384 100644--- a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx+++ b/apps/mobile/src/features/threads/ThreadDetailScreen.tsx@@ -1,3 +1,4 @@+import * as Dialog from "../../components/Dialog";import { useAtomValue } from "@effect/atom-react";import { useChildThreadInputs, useThreadReportedModelSelection } from "../../state/entities";import { UsageLimitRecoveryCard } from "./UsageLimitRecoveryCard";@@ -62,7 +63,6 @@ import {useState,} from "react";import {- Alert,AppState,Keyboard,Platform,@@ -1053,7 +1053,7 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: ThreadcomposerEditorRef.current?.focus();}} catch (error) {- Alert.alert(+ Dialog.alert("Could not edit message",error instanceof Error ? error.message : "Please try again.",);diff --git a/apps/mobile/src/features/threads/ThreadFeed.tsx b/apps/mobile/src/features/threads/ThreadFeed.tsxindex 898017f3b77..d495d987897 100644--- a/apps/mobile/src/features/threads/ThreadFeed.tsx+++ b/apps/mobile/src/features/threads/ThreadFeed.tsx@@ -1,3 +1,4 @@+import * as Dialog from "../../components/Dialog";import { useOpenPullRequest } from "../../native/useOpenPullRequest";import { ThreadMarkdownVideo, ThreadMediaVisibleContext } from "./ThreadMarkdownVideo";import { useMarkdownImageSource } from "../../native/useMarkdownImageSource";@@ -81,7 +82,6 @@ import {} from "react";import {ActivityIndicator,- Alert,Image,Platform,type LayoutChangeEvent,@@ -411,7 +411,7 @@ function AssistantForkButton(props: {if (result._tag !== "Success") return;const targetThreadReady = await waitForThreadShell(props.environmentId, targetThreadId);if (!targetThreadReady) {- Alert.alert(+ Dialog.alert("Fork created","Its thread data did not reach this client. Reconnect and try opening it from the thread list.",);@@ -610,7 +610,7 @@ function MessageAttachmentFile(props: {});} catch (error) {if (!controller.signal.aborted) {- Alert.alert(+ Dialog.alert("Could not open attachment",error instanceof Error ? error.message : "The attachment is unavailable.",);@@ -1318,7 +1318,7 @@ function renderFeedEntry(accessibilityLabel={intentBadge.accessibilityLabel}accessibilityHint="Explains this message's badge"hitSlop={8}- onPress={() => Alert.alert("Message history", intentBadge.explanation)}+ onPress={() => Dialog.alert("Message history", intentBadge.explanation)}className={cn("rounded-full border px-1.5 py-0.5",intentBadge.tone === "queued"@@ -1584,7 +1584,7 @@ function UserMessageContent(props: UserMessageContentProps) {).then(() => Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success)).catch(() => {- Alert.alert("Could not copy context", "Try copying this context again.");+ Dialog.alert("Could not copy context", "Try copying this context again.");});}},diff --git a/apps/mobile/src/features/threads/ThreadGitControls.tsx b/apps/mobile/src/features/threads/ThreadGitControls.tsxindex d87218c2da2..f750d7f5cac 100644--- a/apps/mobile/src/features/threads/ThreadGitControls.tsx+++ b/apps/mobile/src/features/threads/ThreadGitControls.tsx@@ -1,3 +1,4 @@+import * as Dialog from "../../components/Dialog";import { useOpenPullRequest } from "../../native/useOpenPullRequest";import { createNativeHeaderMenu } from "../../components/nativeHeaderMenu.ios";import type { AppBarMenu } from "../../components/AppBar.types";@@ -17,7 +18,6 @@ import {import { useNavigation } from "@react-navigation/native";import { NativeHeaderToolbar } from "../../native/StackHeader";import { useCallback, useMemo } from "react";-import { Alert } from "react-native";import { useEnvironmentScope } from "../../state/session";import {basename,@@ -167,11 +167,11 @@ function useThreadGitControlModel(props: ThreadGitMenuProps) {const openExistingPr = useCallback(async () => {const prUrl = gitStatus?.pr?.state === "open" ? gitStatus.pr.url : null;if (!prUrl) {- Alert.alert("No open PR", "This branch does not have an open pull request.");+ Dialog.alert("No open PR", "This branch does not have an open pull request.");return;}if (!(await openPullRequest(prUrl))) {- Alert.alert("Unable to open PR", "The pull request could not be opened.");+ Dialog.alert("Unable to open PR", "The pull request could not be opened.");}}, [gitStatus, openPullRequest]);diff --git a/apps/mobile/src/features/threads/ThreadRouteScreen.tsx b/apps/mobile/src/features/threads/ThreadRouteScreen.tsxindex 1daed7ff8e6..a17ef03c80d 100644--- a/apps/mobile/src/features/threads/ThreadRouteScreen.tsx+++ b/apps/mobile/src/features/threads/ThreadRouteScreen.tsx@@ -1,3 +1,4 @@+import * as Dialog from "../../components/Dialog";import { useOpenPullRequest } from "../../native/useOpenPullRequest";import { makeTurnCommandMetadata } from "../../lib/commandMetadata";import { buildProjectThreadStartTurnInput } from "../../lib/projectThreadStartTurn";@@ -26,7 +27,7 @@ import {projectScriptRuntimeEnv,resolveProjectScripts,} from "@t3tools/shared/projectScripts";-import { Alert, Platform, ScrollView, View } from "react-native";+import { Platform, ScrollView, View } from "react-native";import { useSafeAreaInsets } from "react-native-safe-area-context";import { useConnectionsReady } from "../../state/workspace";import { useEnvironmentShellReadiness } from "../../state/shell";@@ -835,7 +836,7 @@ function ThreadRouteContent(try {await recoverFailedThreadDraft(creation);} catch (error) {- Alert.alert(+ Dialog.alert("Could not restore draft",error instanceof Error ? error.message : String(error),);diff --git a/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx b/apps/mobile/src/features/threads/ThreadSettingsSheet.tsxindex 5f5b2fe16ed..c8b7c299ca1 100644--- a/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx+++ b/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx@@ -1,3 +1,4 @@+import * as Dialog from "../../components/Dialog";import { createV5StackNavigator as createNativeStackNavigator } from "../../native/createV5StackNavigator";import { DEFAULT_SERVER_SETTINGS } from "@t3tools/contracts";import {@@ -36,15 +37,7 @@ import {useState,type ReactNode,} from "react";-import {- Alert,- Platform,- Pressable,- RefreshControl,- ScrollView,- TextInput,- View,-} from "react-native";+import { Platform, Pressable, RefreshControl, ScrollView, TextInput, View } from "react-native";import Animated, { FadeIn, FadeOut, LinearTransition } from "react-native-reanimated";import { useSafeAreaInsets } from "react-native-safe-area-context";@@ -559,7 +552,7 @@ function ThreadSettingsSessionProvider(const commitPendingModel = useCallback(() => {if (pendingModel) {if (!canCommitPendingModel(pendingModel, props.providerGroups)) {- Alert.alert(+ Dialog.alert("Model unavailable","Set up this provider on web or desktop, or select another model.",);@@ -1007,7 +1000,7 @@ function ThreadSettingsMainContent(props: {void refreshProviderCatalog(session.environmentId).then((result) => {setIsRefreshingProviders(false);const error = providerCatalogRefreshError(result);- if (error) Alert.alert("Could not refresh models", error);+ if (error) Dialog.alert("Could not refresh models", error);});}, [isRefreshingProviders, refreshProviderCatalog, session.environmentId]);const catalogItems = useThreadSettingsCatalogItems(session);diff --git a/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx b/apps/mobile/src/features/threads/git/GitOverviewSheet.tsxindex 7a40c3f9c0b..81a5de0329b 100644--- a/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx+++ b/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx@@ -1,3 +1,4 @@+import * as Dialog from "../../../components/Dialog";import { useOpenPullRequest } from "../../../native/useOpenPullRequest";import {type GitActionRequestInput,@@ -18,7 +19,7 @@ import {} from "@react-navigation/native";import { SymbolView } from "../../../components/AppSymbol";import { useCallback, useEffect, useMemo, useState } from "react";-import { Alert, Platform, Pressable, RefreshControl, ScrollView, View } from "react-native";+import { Platform, Pressable, RefreshControl, ScrollView, View } from "react-native";import { Screen, ScreenStack, ScreenStackHeaderConfig } from "react-native-screens";import { useSafeAreaInsets } from "react-native-safe-area-context";@@ -140,11 +141,11 @@ function GitOverviewSheetContent(props: GitOverviewSheetProps) {const openExistingPr = useCallback(async () => {const prUrl = gitStatus.data?.pr?.state === "open" ? gitStatus.data.pr.url : null;if (!prUrl) {- Alert.alert("No open PR", "This branch does not have an open pull request.");+ Dialog.alert("No open PR", "This branch does not have an open pull request.");return;}if (!(await openPullRequest(prUrl))) {- Alert.alert("Unable to open PR", "The pull request could not be opened.");+ Dialog.alert("Unable to open PR", "The pull request could not be opened.");}}, [gitStatus.data, openPullRequest]);@@ -389,7 +390,10 @@ function GitOverviewSheetContent(props: GitOverviewSheetProps) {onPress={() => {void openPullRequest(link.url).then((opened) => {if (!opened)- Alert.alert("Unable to open PR", "The pull request could not be opened.");+ Dialog.alert(+ "Unable to open PR",+ "The pull request could not be opened.",+ );});}}/>diff --git a/apps/mobile/src/features/threads/new-task-flow-provider.tsx b/apps/mobile/src/features/threads/new-task-flow-provider.tsxindex 8d252f15c45..3d65340e8ad 100644--- a/apps/mobile/src/features/threads/new-task-flow-provider.tsx+++ b/apps/mobile/src/features/threads/new-task-flow-provider.tsx@@ -1,8 +1,8 @@+import * as Dialog from "../../components/Dialog";import { resolveFilesystemReadAccess } from "@t3tools/client-runtime/state/filesystem";import { useEnvironmentPresentation } from "../../state/presentation";import { environmentSession } from "../../state/session";import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";-import { Alert } from "react-native";import type {EnvironmentId,@@ -883,7 +883,7 @@ export function NewTaskFlowProvider(props: React.PropsWithChildren) {}if (!isAtomCommandInterrupted(result)) {const error = squashAtomCommandFailure(result);- Alert.alert(+ Dialog.alert("Could not switch machine",error instanceof Error? error.messagediff --git a/apps/mobile/src/features/threads/thread-handoff-row.tsx b/apps/mobile/src/features/threads/thread-handoff-row.tsxindex cc36efe1dad..d8b435e9770 100644--- a/apps/mobile/src/features/threads/thread-handoff-row.tsx+++ b/apps/mobile/src/features/threads/thread-handoff-row.tsx@@ -1,3 +1,4 @@+import * as Dialog from "../../components/Dialog";import { useAtomValue } from "@effect/atom-react";import { scopeThreadRef } from "@t3tools/client-runtime/environment";import { resolveHandoffEndpoints, type HandoffEndpoints } from "@t3tools/client-runtime/handoff";@@ -10,7 +11,7 @@ import type {} from "@t3tools/contracts";import { Atom } from "effect/reactivity";import { useMemo } from "react";-import { Alert, Pressable, View, type ColorValue } from "react-native";+import { Pressable, View, type ColorValue } from "react-native";import { AppText as Text } from "../../components/AppText";import { SymbolView } from "../../components/AppSymbol";import { ProviderIcon } from "../../components/ProviderIcon";@@ -117,7 +118,7 @@ function HandoffEndpoint(props: {className="min-h-6 max-w-full flex-row items-center justify-center gap-1"hitSlop={{ top: 8, bottom: 8 }}onPress={() =>- Alert.alert(+ Dialog.alert(label,provider ? resolveProviderInstanceDisplayName(provider) : props.instanceId,)diff --git a/apps/mobile/src/features/threads/thread-list-v2-items.tsx b/apps/mobile/src/features/threads/thread-list-v2-items.tsxindex 0529814214f..014b319fe15 100644--- a/apps/mobile/src/features/threads/thread-list-v2-items.tsx+++ b/apps/mobile/src/features/threads/thread-list-v2-items.tsx@@ -1,3 +1,4 @@+import * as Dialog from "../../components/Dialog";import type { ThreadRowProviderInstance } from "./thread-provider-instance";import {THREAD_LIST_V2_MONO_FONT as MONO_FONT,@@ -21,7 +22,7 @@ import { AuthOrchestrationOperateScope, type EnvironmentMachineKind } from "@t3timport { canSnooze, resolveSnoozePresets } from "@t3tools/client-runtime/state/thread-settled";import type { MenuAction } from "@react-native-menu/menu";import { memo, useCallback, useEffect, useMemo, useState, type ComponentProps } from "react";-import { Alert, Pressable, useWindowDimensions, View } from "react-native";+import { Pressable, useWindowDimensions, View } from "react-native";import type { SwipeableMethods } from "react-native-gesture-handler/ReanimatedSwipeable";import type { ThreadListProvider } from "../../state/thread-list-environments";@@ -881,7 +882,10 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {if (snoozeSelection._tag === "selected") {handleSnooze(snoozeSelection.preset.snoozedUntil);} else if (snoozeSelection._tag === "expired") {- Alert.alert("Could not snooze thread", "That snooze time has passed. Choose another time.");+ Dialog.alert(+ "Could not snooze thread",+ "That snooze time has passed. Choose another time.",+ );}},[