Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/mobile/src/features/cloud/T3ConnectProfilePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { MenuAction } from "@react-native-menu/menu";
import type { EnvironmentId } from "@t3tools/contracts";
import type { RelayClientEnvironmentRecord } from "@t3tools/contracts/relay";
import { type ReactNode, useRef, useState } from "react";
import { Alert, Pressable, RefreshControl, ScrollView, Text, View } from "react-native";
import { Pressable, RefreshControl, ScrollView, Text, View } from "react-native";

import { AppActivityIndicator } from "../../components/AppActivityIndicator";
import { SymbolView } from "../../components/AppSymbol";
Expand Down Expand Up @@ -95,7 +95,7 @@ export function T3ConnectProfilePage() {
traceId,
cause,
});
Alert.alert(
Dialog.alert(
"Could not deregister server",
traceId ? `${message}\n\nTrace ID: ${traceId}` : message,
traceId
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as Dialog from "../../components/Dialog";
import { ConnectionTraceId } from "./ConnectionTraceId";
import { SymbolView } from "../../components/AppSymbol";
import type { AtomCommandResult } from "@t3tools/client-runtime/state/runtime";
Expand All @@ -6,7 +7,7 @@ import { useAtomValue } from "@effect/atom-react";
import * as Cause from "effect/Cause";
import { AsyncResult } from "effect/reactivity";
import { useCallback, useState } from "react";
import { Platform, Alert, Pressable, View } from "react-native";
import { Platform, Pressable, View } from "react-native";
import Animated, { FadeIn, FadeOut, LinearTransition } from "react-native-reanimated";

import { AppText as Text } from "../../components/AppText";
Expand Down Expand Up @@ -70,7 +71,7 @@ export function ConnectionEnvironmentRow(props: {
return;
}
const error = Cause.squash(result.cause);
Alert.alert(
Dialog.alert(
"Could not update environment",
error instanceof Error ? error.message : "The environment could not be updated.",
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as Dialog from "../../components/Dialog";
import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
import { useAuth } from "@clerk/expo";
import { CameraView, useCameraPermissions } from "expo-camera";
Expand All @@ -12,7 +13,7 @@ import {
import type { EnvironmentId } from "@t3tools/contracts";
import { AsyncResult } from "effect/reactivity";
import { useCallback, useEffect, useRef, useState } from "react";
import { Alert, Linking, Pressable, StyleSheet, View } from "react-native";
import { Linking, Pressable, StyleSheet, View } from "react-native";
import Svg, { Defs, RadialGradient, Rect, Stop } from "react-native-svg";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { cn } from "../../lib/cn";
Expand Down Expand Up @@ -116,7 +117,7 @@ export function ConnectionsNewRouteScreen({
return;
}
if (permission.canAskAgain) return;
Alert.alert(
Dialog.alert(
"Camera access needed",
"Camera access was denied for this app. Open Settings to enable it.",
[
Expand Down Expand Up @@ -144,7 +145,7 @@ export function ConnectionsNewRouteScreen({
setScannerLocked(false);
} catch (error) {
void Haptics.notificationAsync(Haptics.NotificationFeedbackType.Error);
Alert.alert(
Dialog.alert(
"Invalid QR code",
error instanceof Error ? error.message : "Scanned QR code was not recognized.",
);
Expand Down
5 changes: 3 additions & 2 deletions apps/mobile/src/features/connection/GitHubRoutingSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as Dialog from "../../components/Dialog";
import { useAtomValue } from "@effect/atom-react";
import {
connectionCatalogDisplayUrl,
Expand All @@ -6,7 +7,7 @@ import {
type GitHubRoutingPermission,
} from "@t3tools/client-runtime/connection";
import { useState } from "react";
import { Alert, Pressable, View } from "react-native";
import { Pressable, View } from "react-native";

import { AppText as Text } from "../../components/AppText";
import { SymbolView } from "../../components/AppSymbol";
Expand Down Expand Up @@ -86,7 +87,7 @@ export function GitHubRoutingSettings() {
void update({ environmentId, permission: option.value }).then((result) => {
setSaving(false);
if (result._tag === "Failure")
Alert.alert(
Dialog.alert(
"Could not save GitHub routing permission",
"Try again before leaving this screen.",
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as Dialog from "../../components/Dialog";
import { useAtomValue } from "@effect/atom-react";
import {
type ConnectionRoute,
Expand All @@ -14,7 +15,7 @@ import { AUTH_SCOPE_OPTIONS } from "@t3tools/shared/authScopeOptions";
import { AsyncResult } from "effect/reactivity";
import * as Option from "effect/Option";
import { useState } from "react";
import { Alert, Platform, Pressable, View } from "react-native";
import { Platform, Pressable, View } from "react-native";
import Reanimated, { ReduceMotion, useAnimatedStyle, withTiming } from "react-native-reanimated";

import { type AppSymbolName, SymbolView } from "../../components/AppSymbol";
Expand Down Expand Up @@ -118,7 +119,7 @@ export function EnvironmentRoutesSection({
return to;
};
const confirmRemove = (route: ConnectionRoute) =>
Alert.alert(
Dialog.alert(
`Remove ${connectionRouteLabel(route)}?`,
connectionRouteAddress(route) ?? undefined,
[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as Dialog from "../../components/Dialog";
import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
import Constants from "expo-constants";
import { useCallback, useEffect, useRef, useState } from "react";
import { Alert, Pressable, View } from "react-native";
import { Pressable, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";

import { AppText as Text } from "../../components/AppText";
Expand Down Expand Up @@ -67,7 +68,7 @@ function AppSettingsSection() {
// apply immediately instead of prompting.
await runAppUpdateCheck({
applyMode: "immediate",
onFailure: (message) => Alert.alert("Update failed", message),
onFailure: (message) => Dialog.alert("Update failed", message),
onStateChange: setUpdateState,
});
} finally {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as Dialog from "../../components/Dialog";
import { useAtomValue } from "@effect/atom-react";
import { useNavigation, type StaticScreenProps } from "@react-navigation/native";
import {
Expand All @@ -9,7 +10,7 @@ import {
import { squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime";
import { AsyncResult } from "effect/reactivity";
import { useEffect, useRef, useState } from "react";
import { Alert, View } from "react-native";
import { View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";

import { AppText as Text } from "../../components/AppText";
Expand Down Expand Up @@ -111,7 +112,7 @@ function EnvironmentDetail({ environmentId }: { readonly environmentId: Environm
const targetVersion = checkedRelease?.targetVersion;
if (disabled || !targetVersion || !capabilities || !supportsEnvironmentUpdate(capabilities))
return;
Alert.alert(
Dialog.alert(
`Update ${environment?.environmentLabel ?? "environment"}?`,
`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.`,
[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as Dialog from "../../components/Dialog";
import { AuthRelayWriteScope } from "@t3tools/contracts";
import { readEnvironmentScope } from "../../state/session";
import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
Expand All @@ -8,7 +9,7 @@ import { useNavigation } from "@react-navigation/native";
import * as Effect from "effect/Effect";
import { AsyncResult } from "effect/reactivity";
import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
import { Alert, AppState, Linking, Platform } from "react-native";
import { AppState, Linking, Platform } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";

import { AppText as Text } from "../../components/AppText";
Expand Down Expand Up @@ -162,7 +163,7 @@ function ConfiguredSettingsNotificationsRouteScreen() {
if (result._tag === "Failure") {
if (!isAtomCommandInterrupted(result)) {
const error = squashAtomCommandFailure(result);
Alert.alert(
Dialog.alert(
"Notifications unavailable",
error instanceof Error ? error.message : "Could not request notification permission.",
);
Expand All @@ -174,9 +175,9 @@ function ConfiguredSettingsNotificationsRouteScreen() {
// Permission alone is not enough: the switch stays off until the relay
// registration succeeds, so tell the user the truth about which happened.
if (getAgentAwarenessRegistrationStatus() === "registered") {
Alert.alert("Notifications enabled", "Agent notifications are enabled for this device.");
Dialog.alert("Notifications enabled", "Agent notifications are enabled for this device.");
} else {
Alert.alert(
Dialog.alert(
"Couldn't finish enabling notifications",
"Notification access was granted, but this device could not be registered with T3 Connect. Notifications will start once registration succeeds.",
);
Expand All @@ -185,18 +186,18 @@ function ConfiguredSettingsNotificationsRouteScreen() {
}
if (result.value.type === "unsupported") {
setNotificationStatus("unsupported");
Alert.alert(
Dialog.alert(
"Notifications unavailable",
"Agent notifications are unavailable on this platform.",
);
return;
}
setNotificationStatus("disabled");
if (result.value.canAskAgain) {
Alert.alert("Notifications disabled", "Notifications were not enabled.");
Dialog.alert("Notifications disabled", "Notifications were not enabled.");
return;
}
Alert.alert(
Dialog.alert(
"Notifications disabled",
"Notifications were denied for this app. Open Settings to enable them.",
[
Expand All @@ -207,7 +208,7 @@ function ConfiguredSettingsNotificationsRouteScreen() {
}, []);

const promptSignIn = useCallback(() => {
Alert.alert(
Dialog.alert(
"Sign in to T3 Connect",
"Live Activity updates require T3 Connect so relay can deliver updates to this device.",
[
Expand All @@ -234,15 +235,15 @@ function ConfiguredSettingsNotificationsRouteScreen() {
if (permission._tag === "Failure") {
setLiveActivityStatus("disabled");
const error = squashAtomCommandFailure(permission);
Alert.alert(
Dialog.alert(
"Ongoing activity unavailable",
error instanceof Error ? error.message : "Could not enable agent notifications.",
);
return;
}
if (permission.value.type !== "granted") {
setLiveActivityStatus("disabled");
Alert.alert(
Dialog.alert(
"Notification permission needed",
"Enable notifications in system Settings to show ongoing agent activity.",
[
Expand All @@ -258,7 +259,7 @@ function ConfiguredSettingsNotificationsRouteScreen() {
if (tokenResult._tag === "Failure") {
setLiveActivityStatus("disabled");
const error = squashAtomCommandFailure(tokenResult);
Alert.alert(
Dialog.alert(
Platform.OS === "android" ? "Ongoing activity unavailable" : "Live Activities unavailable",
error instanceof Error ? error.message : "Could not enable agent activity updates.",
);
Expand Down Expand Up @@ -286,7 +287,7 @@ function ConfiguredSettingsNotificationsRouteScreen() {
setLiveActivityStatus("disabled");
if (!isAtomCommandInterrupted(updateResult)) {
const error = squashAtomCommandFailure(updateResult);
Alert.alert(
Dialog.alert(
Platform.OS === "android"
? "Ongoing activity unavailable"
: "Live Activities unavailable",
Expand All @@ -303,14 +304,14 @@ function ConfiguredSettingsNotificationsRouteScreen() {
// (the push-to-start token the relay needs) has not — don't claim Live
// Activities are live until the device is actually registered.
if (getAgentAwarenessRegistrationStatus() === "registered") {
Alert.alert(
Dialog.alert(
Platform.OS === "android" ? "Ongoing activity enabled" : "Live Activities enabled",
environmentCount > 0
? "Agent activity updates are enabled for environments this connection can configure."
: "Agent activity updates are enabled. Add an environment to start receiving updates.",
);
} else {
Alert.alert(
Dialog.alert(
"Couldn't finish enabling activity updates",
"This device could not be registered with T3 Connect, so activity updates won't appear yet. They'll start once registration succeeds.",
);
Expand All @@ -336,7 +337,7 @@ function ConfiguredSettingsNotificationsRouteScreen() {
return;
}

Alert.alert(
Dialog.alert(
"Disable notifications",
"Open system Settings to disable notifications for T3 Code.",
[
Expand Down Expand Up @@ -490,7 +491,7 @@ function ConfiguredSettingsNotificationsRouteScreen() {
label="Live Update Settings"
onPress={() => {
void openAndroidLiveUpdateSettings().catch(() => {
Alert.alert(
Dialog.alert(
"Couldn't open Settings",
"Open Android Settings, select T3 Code, then enable Live Updates in Notifications.",
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import * as Dialog from "../../components/Dialog";
import {
isAtomCommandInterrupted,
squashAtomCommandFailure,
type AtomCommandResult,
} from "@t3tools/client-runtime/state/runtime";
import type { ProviderAuthResponse, ServerProvider } from "@t3tools/contracts";
import { useRef, useState } from "react";
import { Alert, Linking, Pressable, ScrollView, TextInput, View } from "react-native";
import { Linking, Pressable, ScrollView, TextInput, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";

import { AppText as Text } from "../../components/AppText";
Expand Down Expand Up @@ -333,7 +334,7 @@ function ProviderAccount({
tone="danger"
disabled={disabled || state === null}
onPress={() =>
Alert.alert(
Dialog.alert(
"Sign out?",
`Running threads sharing this sign-in on ${environment.label} will stop. Thread history is kept.`,
[
Expand Down
Loading
Loading