@devries-cameron20 / t3code-1 / commits / d88f515441
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

refactor(mobile): adopt shared alerts in settings and connections (#19998)

Julius Marminge committed Oct 15, 2026 at 15:46 UTC d88f515441ad5c88f82ccc04be546466ef1ed602
10 files changed +53 -44
apps/mobile/src/features/cloud/T3ConnectProfilePage.tsx
+2 -2
@@ -7,7 +7,7 @@ import type { MenuAction } from "@react-native-menu/menu";
7 import type { EnvironmentId } from "@t3tools/contracts";
8 import type { RelayClientEnvironmentRecord } from "@t3tools/contracts/relay";
9 import { type ReactNode, useRef, useState } from "react";
10 -import { Alert, Pressable, RefreshControl, ScrollView, Text, View } from "react-native";
10 +import { Pressable, RefreshControl, ScrollView, Text, View } from "react-native";
11
12 import { AppActivityIndicator } from "../../components/AppActivityIndicator";
13 import { SymbolView } from "../../components/AppSymbol";
@@ -95,7 +95,7 @@ export function T3ConnectProfilePage() {
95 traceId,
96 cause,
97 });
98 - Alert.alert(
98 + Dialog.alert(
99 "Could not deregister server",
100 traceId ? `${message}\n\nTrace ID: ${traceId}` : message,
101 traceId
apps/mobile/src/features/connection/ConnectionEnvironmentRow.tsx
+3 -2
@@ -1,3 +1,4 @@
1 +import * as Dialog from "../../components/Dialog";
2 import { ConnectionTraceId } from "./ConnectionTraceId";
3 import { SymbolView } from "../../components/AppSymbol";
4 import type { AtomCommandResult } from "@t3tools/client-runtime/state/runtime";
@@ -6,7 +7,7 @@ import { useAtomValue } from "@effect/atom-react";
7 import * as Cause from "effect/Cause";
8 import { AsyncResult } from "effect/reactivity";
9 import { useCallback, useState } from "react";
9 -import { Platform, Alert, Pressable, View } from "react-native";
10 +import { Platform, Pressable, View } from "react-native";
11 import Animated, { FadeIn, FadeOut, LinearTransition } from "react-native-reanimated";
12
13 import { AppText as Text } from "../../components/AppText";
@@ -70,7 +71,7 @@ export function ConnectionEnvironmentRow(props: {
71 return;
72 }
73 const error = Cause.squash(result.cause);
73 - Alert.alert(
74 + Dialog.alert(
75 "Could not update environment",
76 error instanceof Error ? error.message : "The environment could not be updated.",
77 );
apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx
+4 -3
@@ -1,3 +1,4 @@
1 +import * as Dialog from "../../components/Dialog";
2 import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
3 import { useAuth } from "@clerk/expo";
4 import { CameraView, useCameraPermissions } from "expo-camera";
@@ -12,7 +13,7 @@ import {
13 import type { EnvironmentId } from "@t3tools/contracts";
14 import { AsyncResult } from "effect/reactivity";
15 import { useCallback, useEffect, useRef, useState } from "react";
15 -import { Alert, Linking, Pressable, StyleSheet, View } from "react-native";
16 +import { Linking, Pressable, StyleSheet, View } from "react-native";
17 import Svg, { Defs, RadialGradient, Rect, Stop } from "react-native-svg";
18 import { useSafeAreaInsets } from "react-native-safe-area-context";
19 import { cn } from "../../lib/cn";
@@ -116,7 +117,7 @@ export function ConnectionsNewRouteScreen({
117 return;
118 }
119 if (permission.canAskAgain) return;
119 - Alert.alert(
120 + Dialog.alert(
121 "Camera access needed",
122 "Camera access was denied for this app. Open Settings to enable it.",
123 [
@@ -144,7 +145,7 @@ export function ConnectionsNewRouteScreen({
145 setScannerLocked(false);
146 } catch (error) {
147 void Haptics.notificationAsync(Haptics.NotificationFeedbackType.Error);
147 - Alert.alert(
148 + Dialog.alert(
149 "Invalid QR code",
150 error instanceof Error ? error.message : "Scanned QR code was not recognized.",
151 );
apps/mobile/src/features/connection/GitHubRoutingSettings.tsx
+3 -2
@@ -1,3 +1,4 @@
1 +import * as Dialog from "../../components/Dialog";
2 import { useAtomValue } from "@effect/atom-react";
3 import {
4 connectionCatalogDisplayUrl,
@@ -6,7 +7,7 @@ import {
7 type GitHubRoutingPermission,
8 } from "@t3tools/client-runtime/connection";
9 import { useState } from "react";
9 -import { Alert, Pressable, View } from "react-native";
10 +import { Pressable, View } from "react-native";
11
12 import { AppText as Text } from "../../components/AppText";
13 import { SymbolView } from "../../components/AppSymbol";
@@ -86,7 +87,7 @@ export function GitHubRoutingSettings() {
87 void update({ environmentId, permission: option.value }).then((result) => {
88 setSaving(false);
89 if (result._tag === "Failure")
89 - Alert.alert(
90 + Dialog.alert(
91 "Could not save GitHub routing permission",
92 "Try again before leaving this screen.",
93 );
apps/mobile/src/features/settings/EnvironmentRoutesSection.tsx
+3 -2
@@ -1,3 +1,4 @@
1 +import * as Dialog from "../../components/Dialog";
2 import { useAtomValue } from "@effect/atom-react";
3 import {
4 type ConnectionRoute,
@@ -14,7 +15,7 @@ import { AUTH_SCOPE_OPTIONS } from "@t3tools/shared/authScopeOptions";
15 import { AsyncResult } from "effect/reactivity";
16 import * as Option from "effect/Option";
17 import { useState } from "react";
17 -import { Alert, Platform, Pressable, View } from "react-native";
18 +import { Platform, Pressable, View } from "react-native";
19 import Reanimated, { ReduceMotion, useAnimatedStyle, withTiming } from "react-native-reanimated";
20
21 import { type AppSymbolName, SymbolView } from "../../components/AppSymbol";
@@ -118,7 +119,7 @@ export function EnvironmentRoutesSection({
119 return to;
120 };
121 const confirmRemove = (route: ConnectionRoute) =>
121 - Alert.alert(
122 + Dialog.alert(
123 `Remove ${connectionRouteLabel(route)}?`,
124 connectionRouteAddress(route) ?? undefined,
125 [
apps/mobile/src/features/settings/SettingsAboutRouteScreen.tsx
+3 -2
@@ -1,7 +1,8 @@
1 +import * as Dialog from "../../components/Dialog";
2 import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
3 import Constants from "expo-constants";
4 import { useCallback, useEffect, useRef, useState } from "react";
4 -import { Alert, Pressable, View } from "react-native";
5 +import { Pressable, View } from "react-native";
6 import { useSafeAreaInsets } from "react-native-safe-area-context";
7
8 import { AppText as Text } from "../../components/AppText";
@@ -67,7 +68,7 @@ function AppSettingsSection() {
68 // apply immediately instead of prompting.
69 await runAppUpdateCheck({
70 applyMode: "immediate",
70 - onFailure: (message) => Alert.alert("Update failed", message),
71 + onFailure: (message) => Dialog.alert("Update failed", message),
72 onStateChange: setUpdateState,
73 });
74 } finally {
apps/mobile/src/features/settings/SettingsEnvironmentDetailRouteScreen.tsx
+3 -2
@@ -1,3 +1,4 @@
1 +import * as Dialog from "../../components/Dialog";
2 import { useAtomValue } from "@effect/atom-react";
3 import { useNavigation, type StaticScreenProps } from "@react-navigation/native";
4 import {
@@ -9,7 +10,7 @@ import {
10 import { squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime";
11 import { AsyncResult } from "effect/reactivity";
12 import { useEffect, useRef, useState } from "react";
12 -import { Alert, View } from "react-native";
13 +import { View } from "react-native";
14 import { useSafeAreaInsets } from "react-native-safe-area-context";
15
16 import { AppText as Text } from "../../components/AppText";
@@ -111,7 +112,7 @@ function EnvironmentDetail({ environmentId }: { readonly environmentId: Environm
112 const targetVersion = checkedRelease?.targetVersion;
113 if (disabled || !targetVersion || !capabilities || !supportsEnvironmentUpdate(capabilities))
114 return;
114 - Alert.alert(
115 + Dialog.alert(
116 `Update ${environment?.environmentLabel ?? "environment"}?`,
117 `Install T3 Code ${targetVersion}. ${capabilities.serverSelfUpdate === "desktop-managed" ? "The desktop app will close and relaunch." : "The server will restart and reconnect."} Running threads may be interrupted.`,
118 [
apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx
+17 -16
@@ -1,3 +1,4 @@
1 +import * as Dialog from "../../components/Dialog";
2 import { AuthRelayWriteScope } from "@t3tools/contracts";
3 import { readEnvironmentScope } from "../../state/session";
4 import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
@@ -8,7 +9,7 @@ import { useNavigation } from "@react-navigation/native";
9 import * as Effect from "effect/Effect";
10 import { AsyncResult } from "effect/reactivity";
11 import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
11 -import { Alert, AppState, Linking, Platform } from "react-native";
12 +import { AppState, Linking, Platform } from "react-native";
13 import { useSafeAreaInsets } from "react-native-safe-area-context";
14
15 import { AppText as Text } from "../../components/AppText";
@@ -162,7 +163,7 @@ function ConfiguredSettingsNotificationsRouteScreen() {
163 if (result._tag === "Failure") {
164 if (!isAtomCommandInterrupted(result)) {
165 const error = squashAtomCommandFailure(result);
165 - Alert.alert(
166 + Dialog.alert(
167 "Notifications unavailable",
168 error instanceof Error ? error.message : "Could not request notification permission.",
169 );
@@ -174,9 +175,9 @@ function ConfiguredSettingsNotificationsRouteScreen() {
175 // Permission alone is not enough: the switch stays off until the relay
176 // registration succeeds, so tell the user the truth about which happened.
177 if (getAgentAwarenessRegistrationStatus() === "registered") {
177 - Alert.alert("Notifications enabled", "Agent notifications are enabled for this device.");
178 + Dialog.alert("Notifications enabled", "Agent notifications are enabled for this device.");
179 } else {
179 - Alert.alert(
180 + Dialog.alert(
181 "Couldn't finish enabling notifications",
182 "Notification access was granted, but this device could not be registered with T3 Connect. Notifications will start once registration succeeds.",
183 );
@@ -185,7 +186,7 @@ function ConfiguredSettingsNotificationsRouteScreen() {
186 }
187 if (result.value.type === "unsupported") {
188 setNotificationStatus("unsupported");
188 - Alert.alert(
189 + Dialog.alert(
190 "Notifications unavailable",
191 "Agent notifications are unavailable on this platform.",
192 );
@@ -193,10 +194,10 @@ function ConfiguredSettingsNotificationsRouteScreen() {
194 }
195 setNotificationStatus("disabled");
196 if (result.value.canAskAgain) {
196 - Alert.alert("Notifications disabled", "Notifications were not enabled.");
197 + Dialog.alert("Notifications disabled", "Notifications were not enabled.");
198 return;
199 }
199 - Alert.alert(
200 + Dialog.alert(
201 "Notifications disabled",
202 "Notifications were denied for this app. Open Settings to enable them.",
203 [
@@ -207,7 +208,7 @@ function ConfiguredSettingsNotificationsRouteScreen() {
208 }, []);
209
210 const promptSignIn = useCallback(() => {
210 - Alert.alert(
211 + Dialog.alert(
212 "Sign in to T3 Connect",
213 "Live Activity updates require T3 Connect so relay can deliver updates to this device.",
214 [
@@ -234,7 +235,7 @@ function ConfiguredSettingsNotificationsRouteScreen() {
235 if (permission._tag === "Failure") {
236 setLiveActivityStatus("disabled");
237 const error = squashAtomCommandFailure(permission);
237 - Alert.alert(
238 + Dialog.alert(
239 "Ongoing activity unavailable",
240 error instanceof Error ? error.message : "Could not enable agent notifications.",
241 );
@@ -242,7 +243,7 @@ function ConfiguredSettingsNotificationsRouteScreen() {
243 }
244 if (permission.value.type !== "granted") {
245 setLiveActivityStatus("disabled");
245 - Alert.alert(
246 + Dialog.alert(
247 "Notification permission needed",
248 "Enable notifications in system Settings to show ongoing agent activity.",
249 [
@@ -258,7 +259,7 @@ function ConfiguredSettingsNotificationsRouteScreen() {
259 if (tokenResult._tag === "Failure") {
260 setLiveActivityStatus("disabled");
261 const error = squashAtomCommandFailure(tokenResult);
261 - Alert.alert(
262 + Dialog.alert(
263 Platform.OS === "android" ? "Ongoing activity unavailable" : "Live Activities unavailable",
264 error instanceof Error ? error.message : "Could not enable agent activity updates.",
265 );
@@ -286,7 +287,7 @@ function ConfiguredSettingsNotificationsRouteScreen() {
287 setLiveActivityStatus("disabled");
288 if (!isAtomCommandInterrupted(updateResult)) {
289 const error = squashAtomCommandFailure(updateResult);
289 - Alert.alert(
290 + Dialog.alert(
291 Platform.OS === "android"
292 ? "Ongoing activity unavailable"
293 : "Live Activities unavailable",
@@ -303,14 +304,14 @@ function ConfiguredSettingsNotificationsRouteScreen() {
304 // (the push-to-start token the relay needs) has not — don't claim Live
305 // Activities are live until the device is actually registered.
306 if (getAgentAwarenessRegistrationStatus() === "registered") {
306 - Alert.alert(
307 + Dialog.alert(
308 Platform.OS === "android" ? "Ongoing activity enabled" : "Live Activities enabled",
309 environmentCount > 0
310 ? "Agent activity updates are enabled for environments this connection can configure."
311 : "Agent activity updates are enabled. Add an environment to start receiving updates.",
312 );
313 } else {
313 - Alert.alert(
314 + Dialog.alert(
315 "Couldn't finish enabling activity updates",
316 "This device could not be registered with T3 Connect, so activity updates won't appear yet. They'll start once registration succeeds.",
317 );
@@ -336,7 +337,7 @@ function ConfiguredSettingsNotificationsRouteScreen() {
337 return;
338 }
339
339 - Alert.alert(
340 + Dialog.alert(
341 "Disable notifications",
342 "Open system Settings to disable notifications for T3 Code.",
343 [
@@ -490,7 +491,7 @@ function ConfiguredSettingsNotificationsRouteScreen() {
491 label="Live Update Settings"
492 onPress={() => {
493 void openAndroidLiveUpdateSettings().catch(() => {
493 - Alert.alert(
494 + Dialog.alert(
495 "Couldn't open Settings",
496 "Open Android Settings, select T3 Code, then enable Live Updates in Notifications.",
497 );
apps/mobile/src/features/settings/SettingsProviderAccountsRouteScreen.tsx
+3 -2
@@ -1,3 +1,4 @@
1 +import * as Dialog from "../../components/Dialog";
2 import {
3 isAtomCommandInterrupted,
4 squashAtomCommandFailure,
@@ -5,7 +6,7 @@ import {
6 } from "@t3tools/client-runtime/state/runtime";
7 import type { ProviderAuthResponse, ServerProvider } from "@t3tools/contracts";
8 import { useRef, useState } from "react";
8 -import { Alert, Linking, Pressable, ScrollView, TextInput, View } from "react-native";
9 +import { Linking, Pressable, ScrollView, TextInput, View } from "react-native";
10 import { useSafeAreaInsets } from "react-native-safe-area-context";
11
12 import { AppText as Text } from "../../components/AppText";
@@ -333,7 +334,7 @@ function ProviderAccount({
334 tone="danger"
335 disabled={disabled || state === null}
336 onPress={() =>
336 - Alert.alert(
337 + Dialog.alert(
338 "Sign out?",
339 `Running threads sharing this sign-in on ${environment.label} will stop. Thread history is kept.`,
340 [
apps/mobile/src/features/settings/SettingsScheduledTasksRouteScreen.tsx
+12 -11
@@ -1,3 +1,4 @@
1 +import * as Dialog from "../../components/Dialog";
2 import { useAtomValue } from "@effect/atom-react";
3 import {
4 AuthOrchestrationOperateScope,
@@ -36,7 +37,7 @@ import {
37 } from "react";
38 import { useFocusEffect, useNavigation, usePreventRemove } from "@react-navigation/native";
39 import type { NativeStackNavigationProp } from "@react-navigation/native-stack";
39 -import { Alert, AppState, Platform, Pressable, TextInput as RNTextInput, View } from "react-native";
40 +import { AppState, Platform, Pressable, TextInput as RNTextInput, View } from "react-native";
41 import { useSafeAreaInsets } from "react-native-safe-area-context";
42
43 import { Button } from "../../components/Button";
@@ -447,10 +448,10 @@ function SettingsScheduledTaskEditorScreen({ title }: { readonly title: string }
448 const preventRemove = !saved && (hasChanges || saving);
449 usePreventRemove(preventRemove, ({ data }) => {
450 if (saving) {
450 - Alert.alert("Saving task", "Wait for the task to finish saving before leaving.");
451 + Dialog.alert("Saving task", "Wait for the task to finish saving before leaving.");
452 return;
453 }
453 - Alert.alert("Discard changes?", "Your unsaved changes will be lost.", [
454 + Dialog.alert("Discard changes?", "Your unsaved changes will be lost.", [
455 { text: "Keep editing", style: "cancel" },
456 {
457 text: "Discard changes",
@@ -609,7 +610,7 @@ function TaskForm({
610
611 const failure = (title: string, result: AtomCommandResult<unknown, unknown>) => {
612 if (result._tag === "Failure" && !isAtomCommandInterrupted(result)) {
612 - Alert.alert(title, String(squashAtomCommandFailure(result)));
613 + Dialog.alert(title, String(squashAtomCommandFailure(result)));
614 }
615 };
616
@@ -635,7 +636,7 @@ function TaskForm({
636 draft.schedule.mode === "webhook" &&
637 parseMaxDeliveryAge(draft.schedule.maxDeliveryAgeMinutes) === undefined
638 ) {
638 - Alert.alert(
639 + Dialog.alert(
640 "Invalid age limit",
641 `Enter whole minutes from 1 to ${MAX_WEBHOOK_DELIVERY_AGE_MINUTES}, or leave it blank.`,
642 );
@@ -649,14 +650,14 @@ function TaskForm({
650 !schedule ||
651 (draft.workspace === "existing_worktree" && !draft.checkoutPath.trim())
652 ) {
652 - Alert.alert(
653 + Dialog.alert(
654 "Incomplete task",
655 "Add a name, prompt, project, model, valid schedule, and checkout path if needed.",
656 );
657 return;
658 }
659 if (!projects.some((project) => project.id === draft.projectId)) {
659 - Alert.alert("Project unavailable", "Choose a project in this environment.");
660 + Dialog.alert("Project unavailable", "Choose a project in this environment.");
661 return;
662 }
663 const input: ScheduledTaskUpsertInput = {
@@ -1089,7 +1090,7 @@ function WebhookScheduleDetails({
1090 accessibilityState={{ disabled: disabled || rotating }}
1091 disabled={disabled || rotating}
1092 onPress={() =>
1092 - Alert.alert("Rotate URL?", "The current URL stops working immediately.", [
1093 + Dialog.alert("Rotate URL?", "The current URL stops working immediately.", [
1094 { text: "Cancel", style: "cancel" },
1095 {
1096 text: "Rotate",
@@ -1099,7 +1100,7 @@ function WebhookScheduleDetails({
1100 void rotate({ environmentId, input: { id: task.id } }).then((result) => {
1101 setRotating(false);
1102 if (result._tag === "Failure" && !isAtomCommandInterrupted(result)) {
1102 - Alert.alert(
1103 + Dialog.alert(
1104 "Could not rotate URL",
1105 String(squashAtomCommandFailure(result)),
1106 );
@@ -1161,7 +1162,7 @@ function EnvironmentTasks({
1162 });
1163 const failure = (title: string, result: AtomCommandResult<unknown, unknown>) => {
1164 if (result._tag === "Failure" && !isAtomCommandInterrupted(result)) {
1164 - Alert.alert(title, String(squashAtomCommandFailure(result)));
1165 + Dialog.alert(title, String(squashAtomCommandFailure(result)));
1166 }
1167 };
1168
@@ -1254,7 +1255,7 @@ function EnvironmentTasks({
1255 if (action === "edit") {
1256 onEdit(task);
1257 } else if (action === "delete") {
1257 - Alert.alert("Delete task?", task.title, [
1258 + Dialog.alert("Delete task?", task.title, [
1259 { text: "Cancel", style: "cancel" },
1260 {
1261 text: "Delete",