diff --git a/apps/mobile/src/features/threads/thread-list-v2-items.tsx b/apps/mobile/src/features/threads/thread-list-v2-items.tsx
index 4d7b76ce2c884..a9ceb4781edaa 100644
--- a/apps/mobile/src/features/threads/thread-list-v2-items.tsx
+++ b/apps/mobile/src/features/threads/thread-list-v2-items.tsx
@@ -34,7 +34,9 @@ import { toServerClock } from "@t3tools/client-runtime/clock";
import type { SnoozePresetSetting } from "@t3tools/contracts/settings";
import { canSnooze } from "@t3tools/client-runtime/state/thread-settled";
import { threadChipCopyTarget } from "@t3tools/client-runtime/thread-reference";
+import { useAtomValue } from "@effect/atom-react";
import type { MenuAction } from "@react-native-menu/menu";
+import { AsyncResult, Atom } from "effect/reactivity";
import { msg, T, useGT, useMessages } from "gt-react-native";
import { memo, useCallback, useMemo, useState, type ComponentProps } from "react";
import { Platform, Pressable, Text as RNText, useWindowDimensions, View } from "react-native";
@@ -56,7 +58,9 @@ import { cn } from "../../lib/cn";
import { copyTextWithHaptic } from "../../lib/copyTextWithHaptic";
import { copyThreadReference } from "../../lib/copyThreadReference";
import { useUniwindTheme } from "../../lib/useUniwindTheme";
-import { useEnvironmentScope } from "../../state/session";
+import { environmentCatalog } from "../../connection/catalog";
+import { environmentPresentations } from "../../state/presentation";
+import { useEnvironmentScopeAccess } from "../../state/session";
import type { PendingNewTask } from "../../state/use-pending-new-tasks";
import {
pendingDraftBranchNeedsRefs,
@@ -84,6 +88,9 @@ import {
resolveThreadListV2Status,
resolveThreadListV2ProviderDrivers,
resolveThreadListV2SwipeActions,
+ resolveThreadListV2ConnectionIssue,
+ resolveThreadListV2LockedReason,
+ THREAD_LIST_V2_CONNECTION_ISSUE_LABEL,
layoutThreadListV2RowMenuActions,
threadListV2RowAccessibilityLabel,
type ThreadListV2Status,
@@ -95,6 +102,17 @@ import { useScaledTextRole } from "../settings/appearance/useScaledTextRole";
import { PullRequestGlyph } from "../pull-requests/pullRequestGlyphs";
import { pullRequestStatus } from "../pull-requests/pullRequestStatus";
+// A string, so rows re-render only when the issue changes, not on every catalog update.
+const environmentConnectionIssueAtom = Atom.family((environmentId: EnvironmentId) =>
+ Atom.make((get) =>
+ resolveThreadListV2ConnectionIssue(
+ get(environmentPresentations.presentationAtom(environmentId))?.connection ?? null,
+ AsyncResult.getOrElse(get(environmentCatalog.stateAtom(environmentId)), () => null)
+ ?.lastFailure ?? null,
+ ),
+ ),
+);
+
interface StatusLabel {
// Null when the icon and timer carry the status on their own.
readonly label: string | null;
@@ -928,7 +946,14 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
const handleDelete = useCallback(() => onDeleteThread(thread), [onDeleteThread, thread]);
const handleRename = useCallback(() => onRenameThread(thread), [onRenameThread, thread]);
- const canOperateThread = useEnvironmentScope(thread.environmentId, AuthOrchestrationOperateScope);
+ const operateAccess = useEnvironmentScopeAccess(
+ thread.environmentId,
+ AuthOrchestrationOperateScope,
+ );
+ const canOperateThread = operateAccess === "granted";
+ const connectionIssue = useAtomValue(environmentConnectionIssueAtom(thread.environmentId));
+ const connectionLabel =
+ connectionIssue === null ? null : m(THREAD_LIST_V2_CONNECTION_ISSUE_LABEL[connectionIssue]);
const handleRegenerateTitle = useCallback(
() => onRegenerateThreadTitle(thread),
[onRegenerateThreadTitle, thread],
@@ -1342,8 +1367,19 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
: null,
[gt, handleMenuAction, snoozePresetActions, swipeActions.secondary, thread.title],
);
+ const lockedMenuTitle =
+ operateAccess === "granted"
+ ? ""
+ : resolveThreadListV2LockedReason(
+ {
+ access: operateAccess,
+ connectionIssue,
+ environmentLabel: props.environmentLabel ?? null,
+ },
+ m,
+ );
const swipeAccessibilityHint = !canOperateThread
- ? gt("Opens the thread")
+ ? gt("Opens the thread. {reason}", { reason: lockedMenuTitle })
: secondaryAction === null
? primaryAction.swipeHint
: primaryAction.swipeSnoozeHint;
@@ -1486,7 +1522,10 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
) : null}
- {(rawStatus === "failed" || rawStatus === "limited") && thread.runtime?.lastError ? (
+ {(rawStatus === "failed" || rawStatus === "limited") &&
+ thread.runtime?.lastError &&
+ // A host that dropped explains the row better than its last run's error.
+ connectionLabel === null ? (
{thread.runtime.lastError}
- ) : props.environmentLabel ? (
+ ) : props.environmentLabel || connectionLabel ? (
- {props.environmentMachine ? (
+ {props.environmentLabel && props.environmentMachine ? (
) : null}
-
- {props.environmentLabel}
-
+ {props.environmentLabel ? (
+
+ {props.environmentLabel}
+ {connectionLabel ? " · " : null}
+
+ ) : null}
+ {connectionLabel ? (
+ // A sibling, not nested, so a long environment name truncates before the status does.
+
+ {connectionLabel}
+
+ ) : null}
) : (
@@ -1720,6 +1776,19 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
/>
) : null}
+ {connectionLabel ? (
+
+ {connectionLabel}
+
+ ) : null}
{props.hasQueuedMessages ? : null}
{rowContent(() => {})};
+ return (
+
+
+
+ );
return (
diff --git a/apps/mobile/src/features/threads/threadListV2.test.ts b/apps/mobile/src/features/threads/threadListV2.test.ts
index 16ef19a32993f..a935675240d72 100644
--- a/apps/mobile/src/features/threads/threadListV2.test.ts
+++ b/apps/mobile/src/features/threads/threadListV2.test.ts
@@ -36,6 +36,8 @@ import {
buildThreadListV2Items,
buildThreadListV2ListItems,
getThreadListV2OrderedSection,
+ resolveThreadListV2ConnectionIssue,
+ resolveThreadListV2LockedReason,
layoutThreadListV2RowMenuActions,
resolveThreadListV2SnoozeMenuSelection,
resolveThreadListV2SwipeActions,
@@ -104,6 +106,65 @@ describe("resolveThreadListV2SnoozePresets", () => {
});
});
+describe("thread rows on hosts they cannot change", () => {
+ it("names the connection issue and stays quiet while connected or on a first attempt", () => {
+ expect(resolveThreadListV2ConnectionIssue({ phase: "connected", error: null })).toBeNull();
+ expect(resolveThreadListV2ConnectionIssue({ phase: "connecting", error: null })).toBeNull();
+ expect(resolveThreadListV2ConnectionIssue(null)).toBeNull();
+ expect(resolveThreadListV2ConnectionIssue({ phase: "offline", error: null })).toBe("offline");
+ expect(resolveThreadListV2ConnectionIssue({ phase: "reconnecting", error: null })).toBe(
+ "reconnecting",
+ );
+ expect(resolveThreadListV2ConnectionIssue({ phase: "reconnecting", error: "timeout" })).toBe(
+ "unreachable",
+ );
+ expect(resolveThreadListV2ConnectionIssue({ phase: "error", error: null })).toBe("unreachable");
+ expect(
+ resolveThreadListV2ConnectionIssue(
+ { phase: "error", error: "The environment credential is invalid." },
+ { reason: "authentication", hop: "server", via: "direct" },
+ ),
+ ).toBe("signed-out");
+ expect(
+ resolveThreadListV2ConnectionIssue(
+ { phase: "error", error: "network" },
+ { reason: "network", hop: "server", via: "direct" },
+ ),
+ ).toBe("unreachable");
+ expect(
+ resolveThreadListV2ConnectionIssue(
+ { phase: "error", error: "cloud sign-in" },
+ { reason: "authentication", hop: "relay", via: "relay" },
+ ),
+ ).toBe("unreachable");
+ });
+
+ it("explains a missing grant, expired credentials, and connection issues differently", () => {
+ const reason = (
+ access: "denied" | "signed-out" | "unknown",
+ connectionIssue: Parameters[0]["connectionIssue"],
+ ) => resolveThreadListV2LockedReason({ access, connectionIssue, environmentLabel: "lxso2" });
+
+ expect(reason("denied", null)).toBe(
+ "This device can view threads on lxso2 but not change them.",
+ );
+ expect(reason("signed-out", null)).toBe(
+ "This device is no longer signed in to lxso2. Pair again to change threads.",
+ );
+ expect(reason("unknown", "signed-out")).toBe(reason("signed-out", null));
+ expect(reason("denied", "signed-out")).toBe(reason("signed-out", null));
+ expect(reason("unknown", "unsupported")).toBe(
+ "lxso2 and this app need compatible versions before threads can be changed.",
+ );
+ expect(reason("unknown", "unreachable")).toBe(
+ "Thread actions are unavailable until lxso2 reconnects.",
+ );
+ expect(reason("unknown", null)).toBe(
+ "Thread actions are unavailable until lxso2 confirms this device's access.",
+ );
+ });
+});
+
describe("layoutThreadListV2RowMenuActions", () => {
const actions = (...ids: string[]): MenuAction[] => ids.map((id) => ({ id, title: id }));
const leafIds = (items: readonly MenuAction[]): string[] =>
diff --git a/apps/mobile/src/features/threads/threadListV2.ts b/apps/mobile/src/features/threads/threadListV2.ts
index b8029d3b0b189..dfc77cddf47fa 100644
--- a/apps/mobile/src/features/threads/threadListV2.ts
+++ b/apps/mobile/src/features/threads/threadListV2.ts
@@ -13,6 +13,10 @@ import {
hasUnseenRunFailure,
type SnoozePreset,
} from "@t3tools/client-runtime/state/thread-settled";
+import type {
+ ConnectionAttemptError,
+ EnvironmentConnectionPresentation,
+} from "@t3tools/client-runtime/connection";
import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell";
import { resolveThreadProviderStack } from "@t3tools/client-runtime/state/models";
import {
@@ -145,6 +149,94 @@ export function resolveThreadListV2SwipeActions(input: {
};
}
+export type ThreadListV2ConnectionIssue =
+ | "offline"
+ | "reconnecting"
+ | "unreachable"
+ | "unsupported"
+ | "disconnected"
+ | "signed-out";
+
+export const THREAD_LIST_V2_CONNECTION_ISSUE_LABEL: Record = {
+ offline: msg("Offline"),
+ reconnecting: msg("Reconnecting…"),
+ unreachable: msg("Can't connect"),
+ unsupported: msg("Unsupported"),
+ disconnected: msg("Not connected"),
+ "signed-out": msg("Sign in again"),
+};
+
+// Cached shells keep listing a host's threads after it drops; the row says so
+// instead of silently refusing swipes and menus.
+export function resolveThreadListV2ConnectionIssue(
+ connection: Pick | null,
+ failure: Pick | null = null,
+): ThreadListV2ConnectionIssue | null {
+ if (
+ connection?.phase === "error" &&
+ failure?.reason === "authentication" &&
+ failure.hop === "server" &&
+ failure.via === "direct"
+ )
+ return "signed-out";
+ switch (connection?.phase) {
+ case undefined:
+ case "connected":
+ // Every host passes through its first attempt at launch; labelling it would
+ // flash on each row. A failed attempt moves on to "reconnecting".
+ case "connecting":
+ return null;
+ case "reconnecting":
+ return connection.error === null ? "reconnecting" : "unreachable";
+ case "error":
+ return "unreachable";
+ case "unsupported":
+ return "unsupported";
+ case "offline":
+ return "offline";
+ case "available":
+ return "disconnected";
+ }
+}
+
+export function resolveThreadListV2LockedReason(
+ input: {
+ readonly access: "denied" | "signed-out" | "unknown";
+ readonly connectionIssue: ThreadListV2ConnectionIssue | null;
+ readonly environmentLabel: string | null;
+ },
+ resolve: MessageResolver = m,
+): string {
+ const environment = input.environmentLabel ?? resolve(msg("this environment"));
+ if (input.access === "signed-out" || input.connectionIssue === "signed-out") {
+ return resolve(
+ msg("This device is no longer signed in to {environment}. Pair again to change threads."),
+ { environment },
+ );
+ }
+ if (input.access === "denied") {
+ return resolve(msg("This device can view threads on {environment} but not change them."), {
+ environment,
+ });
+ }
+ if (input.connectionIssue === "unsupported") {
+ return resolve(
+ msg("{environment} and this app need compatible versions before threads can be changed."),
+ { environment },
+ );
+ }
+ if (input.connectionIssue !== null) {
+ return resolve(msg("Thread actions are unavailable until {environment} reconnects."), {
+ environment,
+ });
+ }
+ // Covers both a host still connecting and a session lookup that failed on a live socket.
+ return resolve(
+ msg("Thread actions are unavailable until {environment} confirms this device's access."),
+ { environment },
+ );
+}
+
// Nested keeps iOS menus short: UIKit scrolls a taller menu, and that scroll
// cancels press-drag-release selection.
export function layoutThreadListV2RowMenuActions(
diff --git a/apps/mobile/src/i18n/translations/de.json b/apps/mobile/src/i18n/translations/de.json
index c9d43d96b3eb8..f1a7eb3147558 100644
--- a/apps/mobile/src/i18n/translations/de.json
+++ b/apps/mobile/src/i18n/translations/de.json
@@ -4620,8 +4620,10 @@
"58e38bd6ed881b01": "Öffnet den Thread. Nach links wischen zum Erledigen.",
"e12c1dd4803b7167": "Öffnet den Thread. Nach links wischen für Erledigen und Zurückstellen.",
"3d1f9836bd07407d": "Wählen, wann {title} zurückgestellt wird",
- "6ada35bfeaf4a4c7": "Öffnet den Thread",
+ "886fb19e4cbd78ed": "Öffnet den Thread. {reason}",
"95c5caae5b3e208a": "Aufgeweckt",
+ "0eb3fd1a4981dd80": "Warum sind Aktionen nicht verfügbar?",
+ "ce5c66ae967fd7c8": "Thread-Aktionen nicht verfügbar",
"a94f4f487f873c7c": "Entwurf",
"79e1c2414afe8ab5": "Wird bei Verbindung gesendet",
"182ddc0acf67e55e": "Neuer Thread auf {branch}",
@@ -4671,6 +4673,15 @@
"2414be1137e0112a": "Verbinde diese Umgebung erneut, um die Unterhaltung zu laden.",
"5e7b8c39e3c0a6a0": "Nachrichten werden synchronisiert…",
"8a1cb930736c03cf": "Nachrichten werden geladen…",
+ "2e10c5faf3870279": "Verbindung nicht möglich",
+ "d82511ccb6662fab": "Nicht unterstützt",
+ "2cf284a7b130b411": "Erneut anmelden",
+ "009e2ca841fdc1ef": "diese Umgebung",
+ "e9356dd910d54cf2": "Dieses Gerät ist nicht mehr bei {environment} angemeldet. Kopple es erneut, um Threads zu ändern.",
+ "00084755c8584425": "Dieses Gerät kann Threads auf {environment} anzeigen, aber nicht ändern.",
+ "ca4d4fc934ee8c8f": "{environment} und diese App benötigen kompatible Versionen, bevor Threads geändert werden können.",
+ "57ebec5af6149219": "Thread-Aktionen sind erst wieder verfügbar, wenn {environment} die Verbindung wiederherstellt.",
+ "6cb10927777def38": "Thread-Aktionen sind erst verfügbar, wenn {environment} den Zugriff dieses Geräts bestätigt.",
"cd625fe969e84626": "Mehr",
"5caf3ae1d7016537": "Anordnen",
"67e93fad069186be": "Nachrichten zum Senden eingereiht",
diff --git a/apps/mobile/src/i18n/translations/en.json b/apps/mobile/src/i18n/translations/en.json
index 7a89a1cf37c22..620a99f36ad66 100644
--- a/apps/mobile/src/i18n/translations/en.json
+++ b/apps/mobile/src/i18n/translations/en.json
@@ -4621,8 +4621,10 @@
"58e38bd6ed881b01": "Opens the thread. Swipe left to settle.",
"e12c1dd4803b7167": "Opens the thread. Swipe left for settle and snooze actions.",
"3d1f9836bd07407d": "Choose when to snooze {title}",
- "6ada35bfeaf4a4c7": "Opens the thread",
+ "886fb19e4cbd78ed": "Opens the thread. {reason}",
"95c5caae5b3e208a": "Woke",
+ "0eb3fd1a4981dd80": "Why are actions unavailable?",
+ "ce5c66ae967fd7c8": "Thread actions unavailable",
"a94f4f487f873c7c": "Draft",
"79e1c2414afe8ab5": "Sends on reconnect",
"182ddc0acf67e55e": "New thread on {branch}",
@@ -4672,6 +4674,15 @@
"2414be1137e0112a": "Reconnect this environment to load the conversation.",
"5e7b8c39e3c0a6a0": "Syncing messages…",
"8a1cb930736c03cf": "Loading messages…",
+ "2e10c5faf3870279": "Can't connect",
+ "d82511ccb6662fab": "Unsupported",
+ "2cf284a7b130b411": "Sign in again",
+ "009e2ca841fdc1ef": "this environment",
+ "e9356dd910d54cf2": "This device is no longer signed in to {environment}. Pair again to change threads.",
+ "00084755c8584425": "This device can view threads on {environment} but not change them.",
+ "ca4d4fc934ee8c8f": "{environment} and this app need compatible versions before threads can be changed.",
+ "57ebec5af6149219": "Thread actions are unavailable until {environment} reconnects.",
+ "6cb10927777def38": "Thread actions are unavailable until {environment} confirms this device's access.",
"cd625fe969e84626": "More",
"5caf3ae1d7016537": "Arrange",
"67e93fad069186be": "messages queued to send",
diff --git a/apps/mobile/src/i18n/translations/es.json b/apps/mobile/src/i18n/translations/es.json
index 288dbfc7da2cf..62c00f93eecb9 100644
--- a/apps/mobile/src/i18n/translations/es.json
+++ b/apps/mobile/src/i18n/translations/es.json
@@ -4613,8 +4613,10 @@
"58e38bd6ed881b01": "Abre el hilo. Desliza a la izquierda para resolverlo.",
"e12c1dd4803b7167": "Abre el hilo. Desliza a la izquierda para resolver o posponer.",
"3d1f9836bd07407d": "Elige hasta cuándo posponer {title}",
- "6ada35bfeaf4a4c7": "Abre el hilo",
+ "886fb19e4cbd78ed": "Abre el hilo. {reason}",
"95c5caae5b3e208a": "Reactivado",
+ "0eb3fd1a4981dd80": "¿Por qué no están disponibles las acciones?",
+ "ce5c66ae967fd7c8": "Acciones del hilo no disponibles",
"a94f4f487f873c7c": "Borrador",
"79e1c2414afe8ab5": "Se envía al reconectar",
"182ddc0acf67e55e": "Nuevo hilo en {branch}",
@@ -4664,6 +4666,15 @@
"2414be1137e0112a": "Vuelve a conectar este entorno para cargar la conversación.",
"5e7b8c39e3c0a6a0": "Sincronizando mensajes…",
"8a1cb930736c03cf": "Cargando mensajes…",
+ "2e10c5faf3870279": "No se puede conectar",
+ "d82511ccb6662fab": "No compatible",
+ "2cf284a7b130b411": "Vuelve a iniciar sesión",
+ "009e2ca841fdc1ef": "este entorno",
+ "e9356dd910d54cf2": "Este dispositivo ya no tiene la sesión iniciada en {environment}. Vuelve a vincularlo para modificar hilos.",
+ "00084755c8584425": "Este dispositivo puede ver los hilos de {environment}, pero no modificarlos.",
+ "ca4d4fc934ee8c8f": "{environment} y esta aplicación necesitan versiones compatibles para poder modificar los hilos.",
+ "57ebec5af6149219": "Las acciones de los hilos no estarán disponibles hasta que {environment} se vuelva a conectar.",
+ "6cb10927777def38": "Las acciones de los hilos no estarán disponibles hasta que {environment} confirme el acceso de este dispositivo.",
"cd625fe969e84626": "Más",
"5caf3ae1d7016537": "Organizar",
"67e93fad069186be": "mensajes en cola para enviar",
diff --git a/apps/mobile/src/i18n/translations/fr.json b/apps/mobile/src/i18n/translations/fr.json
index 28ec2284fca74..1ec337a393da4 100644
--- a/apps/mobile/src/i18n/translations/fr.json
+++ b/apps/mobile/src/i18n/translations/fr.json
@@ -4614,8 +4614,10 @@
"58e38bd6ed881b01": "Ouvre le fil. Balayez vers la gauche pour le clore.",
"e12c1dd4803b7167": "Ouvre le fil. Balayez vers la gauche pour les actions de clôture et de report.",
"3d1f9836bd07407d": "Choisir quand reporter {title}",
- "6ada35bfeaf4a4c7": "Ouvre le fil",
+ "886fb19e4cbd78ed": "Ouvre le fil. {reason}",
"95c5caae5b3e208a": "Réveillé",
+ "0eb3fd1a4981dd80": "Pourquoi les actions sont-elles indisponibles ?",
+ "ce5c66ae967fd7c8": "Actions sur le fil indisponibles",
"a94f4f487f873c7c": "Brouillon",
"79e1c2414afe8ab5": "Envoi à la reconnexion",
"182ddc0acf67e55e": "Nouveau fil sur {branch}",
@@ -4665,6 +4667,15 @@
"2414be1137e0112a": "Reconnectez cet environnement pour charger la conversation.",
"5e7b8c39e3c0a6a0": "Synchronisation des messages…",
"8a1cb930736c03cf": "Chargement des messages…",
+ "2e10c5faf3870279": "Connexion impossible",
+ "d82511ccb6662fab": "Non pris en charge",
+ "2cf284a7b130b411": "Se reconnecter",
+ "009e2ca841fdc1ef": "cet environnement",
+ "e9356dd910d54cf2": "Cet appareil n’est plus connecté à {environment}. Associez-le à nouveau pour modifier les fils.",
+ "00084755c8584425": "Cet appareil peut consulter les fils sur {environment}, mais pas les modifier.",
+ "ca4d4fc934ee8c8f": "{environment} et cette application doivent utiliser des versions compatibles pour pouvoir modifier les fils.",
+ "57ebec5af6149219": "Les actions sur les fils sont indisponibles tant que {environment} ne s’est pas reconnecté.",
+ "6cb10927777def38": "Les actions sur les fils sont indisponibles tant que {environment} n’a pas confirmé l’accès de cet appareil.",
"cd625fe969e84626": "Plus",
"5caf3ae1d7016537": "Organiser",
"67e93fad069186be": "messages en file d’attente d’envoi",
diff --git a/apps/mobile/src/i18n/translations/ja.json b/apps/mobile/src/i18n/translations/ja.json
index f6741fdb8b775..aa639573ce72e 100644
--- a/apps/mobile/src/i18n/translations/ja.json
+++ b/apps/mobile/src/i18n/translations/ja.json
@@ -4595,8 +4595,10 @@
"58e38bd6ed881b01": "スレッドを開きます。左にスワイプすると対応済みにします。",
"e12c1dd4803b7167": "スレッドを開きます。左にスワイプすると対応済みとスヌーズの操作を表示します。",
"3d1f9836bd07407d": "{title} をスヌーズするタイミングを選択",
- "6ada35bfeaf4a4c7": "スレッドを開きます",
+ "886fb19e4cbd78ed": "スレッドを開きます。{reason}",
"95c5caae5b3e208a": "再開",
+ "0eb3fd1a4981dd80": "操作を利用できない理由は?",
+ "ce5c66ae967fd7c8": "スレッドの操作は利用できません",
"a94f4f487f873c7c": "下書き",
"79e1c2414afe8ab5": "再接続時に送信",
"182ddc0acf67e55e": "{branch} で新しいスレッド",
@@ -4646,6 +4648,15 @@
"2414be1137e0112a": "会話を読み込むにはこの環境に再接続してください。",
"5e7b8c39e3c0a6a0": "メッセージを同期しています…",
"8a1cb930736c03cf": "メッセージを読み込んでいます…",
+ "2e10c5faf3870279": "接続できません",
+ "d82511ccb6662fab": "非対応",
+ "2cf284a7b130b411": "再度サインイン",
+ "009e2ca841fdc1ef": "この環境",
+ "e9356dd910d54cf2": "このデバイスは {environment} からサインアウトされています。スレッドを変更するには、再度ペアリングしてください。",
+ "00084755c8584425": "このデバイスでは {environment} のスレッドを表示できますが、変更はできません。",
+ "ca4d4fc934ee8c8f": "スレッドを変更するには、{environment} とこのアプリのバージョンに互換性が必要です。",
+ "57ebec5af6149219": "{environment} が再接続するまで、スレッドの操作は利用できません。",
+ "6cb10927777def38": "{environment} がこのデバイスのアクセス権を確認するまで、スレッドの操作は利用できません。",
"cd625fe969e84626": "その他",
"5caf3ae1d7016537": "並べ替え",
"67e93fad069186be": "送信待ちのメッセージ",
diff --git a/apps/mobile/src/i18n/translations/ko.json b/apps/mobile/src/i18n/translations/ko.json
index b1ef20ba0f347..d54e9e78ac147 100644
--- a/apps/mobile/src/i18n/translations/ko.json
+++ b/apps/mobile/src/i18n/translations/ko.json
@@ -4600,8 +4600,10 @@
"58e38bd6ed881b01": "스레드를 엽니다. 정리하려면 왼쪽으로 스와이프하세요.",
"e12c1dd4803b7167": "스레드를 엽니다. 정리 및 다시 알림 작업을 보려면 왼쪽으로 스와이프하세요.",
"3d1f9836bd07407d": "{title}을(를) 미룰 시점 선택",
- "6ada35bfeaf4a4c7": "스레드를 엽니다",
+ "886fb19e4cbd78ed": "스레드를 엽니다. {reason}",
"95c5caae5b3e208a": "깨어남",
+ "0eb3fd1a4981dd80": "작업을 사용할 수 없는 이유는 무엇인가요?",
+ "ce5c66ae967fd7c8": "스레드 작업을 사용할 수 없음",
"a94f4f487f873c7c": "초안",
"79e1c2414afe8ab5": "다시 연결 시 전송",
"182ddc0acf67e55e": "{branch}에서 새 스레드",
@@ -4651,6 +4653,15 @@
"2414be1137e0112a": "대화를 불러오려면 이 환경을 다시 연결하세요.",
"5e7b8c39e3c0a6a0": "메시지 동기화 중…",
"8a1cb930736c03cf": "메시지 불러오는 중…",
+ "2e10c5faf3870279": "연결할 수 없음",
+ "d82511ccb6662fab": "지원되지 않음",
+ "2cf284a7b130b411": "다시 로그인",
+ "009e2ca841fdc1ef": "이 환경",
+ "e9356dd910d54cf2": "이 기기는 더 이상 {environment}에 로그인되어 있지 않습니다. 스레드를 변경하려면 다시 페어링하세요.",
+ "00084755c8584425": "이 기기는 {environment}의 스레드를 볼 수 있지만 변경할 수는 없습니다.",
+ "ca4d4fc934ee8c8f": "스레드를 변경하려면 {environment}과 이 앱의 버전이 호환되어야 합니다.",
+ "57ebec5af6149219": "{environment}이 다시 연결될 때까지 스레드 작업을 사용할 수 없습니다.",
+ "6cb10927777def38": "{environment}이 이 기기의 접근 권한을 확인할 때까지 스레드 작업을 사용할 수 없습니다.",
"cd625fe969e84626": "더 보기",
"5caf3ae1d7016537": "정렬",
"67e93fad069186be": "전송 대기 중인 메시지",
diff --git a/apps/mobile/src/i18n/translations/pt-BR.json b/apps/mobile/src/i18n/translations/pt-BR.json
index b40494fca3885..f63b576ea20da 100644
--- a/apps/mobile/src/i18n/translations/pt-BR.json
+++ b/apps/mobile/src/i18n/translations/pt-BR.json
@@ -4614,8 +4614,10 @@
"58e38bd6ed881b01": "Abre a thread. Deslize para a esquerda para concluir.",
"e12c1dd4803b7167": "Abre a thread. Deslize para a esquerda para concluir e adiar.",
"3d1f9836bd07407d": "Escolha até quando adiar {title}",
- "6ada35bfeaf4a4c7": "Abre a thread",
+ "886fb19e4cbd78ed": "Abre a thread. {reason}",
"95c5caae5b3e208a": "Despertou",
+ "0eb3fd1a4981dd80": "Por que as ações estão indisponíveis?",
+ "ce5c66ae967fd7c8": "Ações da thread indisponíveis",
"a94f4f487f873c7c": "Rascunho",
"79e1c2414afe8ab5": "Envia ao reconectar",
"182ddc0acf67e55e": "Nova thread em {branch}",
@@ -4665,6 +4667,15 @@
"2414be1137e0112a": "Reconecte este ambiente para carregar a conversa.",
"5e7b8c39e3c0a6a0": "Sincronizando mensagens…",
"8a1cb930736c03cf": "Carregando mensagens…",
+ "2e10c5faf3870279": "Não foi possível conectar",
+ "d82511ccb6662fab": "Não compatível",
+ "2cf284a7b130b411": "Entre novamente",
+ "009e2ca841fdc1ef": "este ambiente",
+ "e9356dd910d54cf2": "Este dispositivo não está mais conectado à conta em {environment}. Faça o pareamento novamente para alterar threads.",
+ "00084755c8584425": "Este dispositivo pode visualizar threads em {environment}, mas não alterá-las.",
+ "ca4d4fc934ee8c8f": "{environment} e este aplicativo precisam de versões compatíveis para que as threads possam ser alteradas.",
+ "57ebec5af6149219": "As ações das threads ficam indisponíveis até que {environment} se reconecte.",
+ "6cb10927777def38": "As ações das threads ficam indisponíveis até que {environment} confirme o acesso deste dispositivo.",
"cd625fe969e84626": "Mais",
"5caf3ae1d7016537": "Organizar",
"67e93fad069186be": "mensagens na fila para envio",
diff --git a/apps/mobile/src/i18n/translations/ru.json b/apps/mobile/src/i18n/translations/ru.json
index cadf07e57eda9..67aa2f5389ec1 100644
--- a/apps/mobile/src/i18n/translations/ru.json
+++ b/apps/mobile/src/i18n/translations/ru.json
@@ -4692,8 +4692,10 @@
"58e38bd6ed881b01": "Открывает тред. Смахните влево, чтобы разобрать.",
"e12c1dd4803b7167": "Открывает тред. Смахните влево, чтобы разобрать или отложить.",
"3d1f9836bd07407d": "Выберите, до какого времени отложить {title}",
- "6ada35bfeaf4a4c7": "Открывает тред",
+ "886fb19e4cbd78ed": "Открывает тред. {reason}",
"95c5caae5b3e208a": "Проснулся",
+ "0eb3fd1a4981dd80": "Почему действия недоступны?",
+ "ce5c66ae967fd7c8": "Действия с тредом недоступны",
"a94f4f487f873c7c": "Черновик",
"79e1c2414afe8ab5": "Отправится при переподключении",
"182ddc0acf67e55e": "Новый тред в {branch}",
@@ -4743,6 +4745,15 @@
"2414be1137e0112a": "Переподключите это окружение, чтобы загрузить беседу.",
"5e7b8c39e3c0a6a0": "Синхронизация сообщений…",
"8a1cb930736c03cf": "Загрузка сообщений…",
+ "2e10c5faf3870279": "Не удаётся подключиться",
+ "d82511ccb6662fab": "Не поддерживается",
+ "2cf284a7b130b411": "Войти снова",
+ "009e2ca841fdc1ef": "эта среда",
+ "e9356dd910d54cf2": "На этом устройстве выполнен выход из {environment}. Повторите сопряжение, чтобы изменять треды.",
+ "00084755c8584425": "Это устройство может просматривать треды в {environment}, но не изменять их.",
+ "ca4d4fc934ee8c8f": "Для изменения тредов нужны совместимые версии {environment} и этого приложения.",
+ "57ebec5af6149219": "Действия с тредами недоступны, пока {environment} не подключится снова.",
+ "6cb10927777def38": "Действия с тредами недоступны, пока {environment} не подтвердит доступ этого устройства.",
"cd625fe969e84626": "Ещё",
"5caf3ae1d7016537": "Упорядочить",
"67e93fad069186be": "сообщения ждут отправки",
diff --git a/apps/mobile/src/i18n/translations/sv.json b/apps/mobile/src/i18n/translations/sv.json
index 3a0273aef36fd..17a5b8bd756fa 100644
--- a/apps/mobile/src/i18n/translations/sv.json
+++ b/apps/mobile/src/i18n/translations/sv.json
@@ -4620,8 +4620,10 @@
"58e38bd6ed881b01": "Öppnar tråden. Svep åt vänster för att markera som klar.",
"e12c1dd4803b7167": "Öppnar tråden. Svep åt vänster för att markera som klar eller snooza.",
"3d1f9836bd07407d": "Välj när {title} ska snoozas",
- "6ada35bfeaf4a4c7": "Öppnar tråden",
+ "886fb19e4cbd78ed": "Öppnar tråden. {reason}",
"95c5caae5b3e208a": "Väckt",
+ "0eb3fd1a4981dd80": "Varför är åtgärder inte tillgängliga?",
+ "ce5c66ae967fd7c8": "Trådåtgärder är inte tillgängliga",
"a94f4f487f873c7c": "Utkast",
"79e1c2414afe8ab5": "Skickas vid återanslutning",
"182ddc0acf67e55e": "Ny tråd på {branch}",
@@ -4671,6 +4673,15 @@
"2414be1137e0112a": "Återanslut miljön för att läsa in konversationen.",
"5e7b8c39e3c0a6a0": "Synkroniserar meddelanden…",
"8a1cb930736c03cf": "Läser in meddelanden…",
+ "2e10c5faf3870279": "Kan inte ansluta",
+ "d82511ccb6662fab": "Stöds inte",
+ "2cf284a7b130b411": "Logga in igen",
+ "009e2ca841fdc1ef": "den här miljön",
+ "e9356dd910d54cf2": "Den här enheten är inte längre inloggad på {environment}. Parkoppla igen för att ändra trådar.",
+ "00084755c8584425": "Den här enheten kan visa trådar på {environment} men inte ändra dem.",
+ "ca4d4fc934ee8c8f": "{environment} och den här appen behöver kompatibla versioner innan trådar kan ändras.",
+ "57ebec5af6149219": "Trådåtgärder är inte tillgängliga förrän {environment} ansluter igen.",
+ "6cb10927777def38": "Trådåtgärder är inte tillgängliga förrän {environment} bekräftar den här enhetens åtkomst.",
"cd625fe969e84626": "Mer",
"5caf3ae1d7016537": "Ordna",
"67e93fad069186be": "meddelanden köade för att skickas",
diff --git a/apps/mobile/src/i18n/translations/zh.json b/apps/mobile/src/i18n/translations/zh.json
index f1c394c60c606..4df259baf8db3 100644
--- a/apps/mobile/src/i18n/translations/zh.json
+++ b/apps/mobile/src/i18n/translations/zh.json
@@ -4603,8 +4603,10 @@
"58e38bd6ed881b01": "打开会话。向左滑动可收尾。",
"e12c1dd4803b7167": "打开会话。向左滑动可执行收尾和暂缓操作。",
"3d1f9836bd07407d": "选择 {title} 的暂缓时间",
- "6ada35bfeaf4a4c7": "打开会话",
+ "886fb19e4cbd78ed": "打开会话。{reason}",
"95c5caae5b3e208a": "已唤醒",
+ "0eb3fd1a4981dd80": "为什么操作不可用?",
+ "ce5c66ae967fd7c8": "会话操作不可用",
"a94f4f487f873c7c": "草稿",
"79e1c2414afe8ab5": "重新连接后发送",
"182ddc0acf67e55e": "在 {branch} 分支新建会话",
@@ -4654,6 +4656,15 @@
"2414be1137e0112a": "重新连接此环境以加载对话。",
"5e7b8c39e3c0a6a0": "正在同步消息…",
"8a1cb930736c03cf": "正在加载消息…",
+ "2e10c5faf3870279": "无法连接",
+ "d82511ccb6662fab": "不支持",
+ "2cf284a7b130b411": "重新登录",
+ "009e2ca841fdc1ef": "此环境",
+ "e9356dd910d54cf2": "此设备已退出 {environment}。请重新配对以修改会话。",
+ "00084755c8584425": "此设备可以查看 {environment} 上的会话,但无法修改。",
+ "ca4d4fc934ee8c8f": "{environment} 和此应用需要使用兼容的版本才能修改会话。",
+ "57ebec5af6149219": "在 {environment} 重新连接之前,会话操作不可用。",
+ "6cb10927777def38": "在 {environment} 确认此设备的访问权限之前,会话操作不可用。",
"cd625fe969e84626": "更多",
"5caf3ae1d7016537": "整理",
"67e93fad069186be": "有待发送的排队消息",
diff --git a/apps/mobile/src/state/session.ts b/apps/mobile/src/state/session.ts
index 74876954b2716..0638d574dfced 100644
--- a/apps/mobile/src/state/session.ts
+++ b/apps/mobile/src/state/session.ts
@@ -20,12 +20,23 @@ export const environmentSession = createEnvironmentSessionAtoms(connectionAtomRu
const EMPTY_SESSION_STATE_ATOM = Atom.make(AsyncResult.initial());
+export type EnvironmentScopeAccess = "granted" | "denied" | "signed-out" | "unknown";
+
+function sessionScopeAccess(
+ result: AsyncResult.AsyncResult,
+ scope: AuthEnvironmentScope,
+): EnvironmentScopeAccess {
+ const session = Option.getOrNull(AsyncResult.value(result));
+ if (result._tag === "Failure" || session === null) return "unknown";
+ if (!session.authenticated) return "signed-out";
+ return sessionGrantsScope(session, scope) ? "granted" : "denied";
+}
+
export function sessionHasScope(
result: AsyncResult.AsyncResult,
scope: AuthEnvironmentScope,
): boolean {
- const session = AsyncResult.getOrElse(result, () => null);
- return result._tag !== "Failure" && session !== null && sessionGrantsScope(session, scope);
+ return sessionScopeAccess(result, scope) === "granted";
}
function sessionStateAtomFor(environmentId: EnvironmentId | null) {
@@ -34,17 +45,24 @@ function sessionStateAtomFor(environmentId: EnvironmentId | null) {
: environmentSession.sessionStateAtom(environmentId);
}
-// Both hooks select a boolean: every revalidation emits a new result, and most consumers are
-// list rows.
-export function useEnvironmentScope(
+/** Separates a grant the session lacks from expired credentials and a session that never loaded. */
+export function useEnvironmentScopeAccess(
environmentId: EnvironmentId | null,
scope: AuthEnvironmentScope,
-): boolean {
+): EnvironmentScopeAccess {
+ // Select the access: every revalidation emits a new result, and most consumers are list rows.
return useAtomValue(sessionStateAtomFor(environmentId), (result) =>
- sessionHasScope(result, scope),
+ sessionScopeAccess(result, scope),
);
}
+export function useEnvironmentScope(
+ environmentId: EnvironmentId | null,
+ scope: AuthEnvironmentScope,
+): boolean {
+ return useEnvironmentScopeAccess(environmentId, scope) === "granted";
+}
+
/** Unlike `!useEnvironmentScope`, stays false until the host has answered without the scope. */
export function useEnvironmentScopeDenied(
environmentId: EnvironmentId | null,