@devries-cameron20 / t3code Mirror · read-only / commits / f7867addbe
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 24, 22:45 UTC

[codex] Structure mobile notification setting failures (#3391)

Co-authored-by: codex <codex@users.noreply.github.com>

Julius Marminge committed Jun 20, 2026 at 10:58 UTC f7867addbe18ebb55c916041dc168aa4b8f39335
2 files changed +40 -4
apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts
+14 -1
@@ -1,4 +1,5 @@
1 import * as Effect from "effect/Effect";
2 +import * as Schema from "effect/Schema";
3 import { HttpClient } from "effect/unstable/http";
4 import { ManagedRelay } from "@t3tools/client-runtime/relay";
5
@@ -7,6 +8,18 @@ import { savePreferencesPatch } from "../../lib/storage";
8 import { linkEnvironmentToCloud } from "../cloud/linkEnvironment";
9 import { refreshAgentAwarenessRegistration } from "./remoteRegistration";
10
11 +export class LiveActivityPreferenceSaveError extends Schema.TaggedErrorClass<LiveActivityPreferenceSaveError>()(
12 + "LiveActivityPreferenceSaveError",
13 + {
14 + enabled: Schema.Boolean,
15 + cause: Schema.Defect(),
16 + },
17 +) {
18 + override get message(): string {
19 + return `Failed to save the Live Activity updates setting (enabled: ${this.enabled}).`;
20 + }
21 +}
22 +
23 export function setLiveActivityUpdatesEnabled(input: {
24 readonly enabled: boolean;
25 readonly clerkToken: string | null;
@@ -15,7 +28,7 @@ export function setLiveActivityUpdatesEnabled(input: {
28 return Effect.gen(function* () {
29 yield* Effect.tryPromise({
30 try: () => savePreferencesPatch({ liveActivitiesEnabled: input.enabled }),
18 - catch: (error) => error,
31 + catch: (cause) => new LiveActivityPreferenceSaveError({ enabled: input.enabled, cause }),
32 });
33
34 yield* refreshAgentAwarenessRegistration();
apps/mobile/src/features/agent-awareness/notificationPermissions.ts
+26 -3
@@ -1,5 +1,6 @@
1 import * as Notifications from "expo-notifications";
2 import * as Effect from "effect/Effect";
3 +import * as Schema from "effect/Schema";
4 import { Platform } from "react-native";
5
6 export type NotificationPermissionResult =
@@ -7,9 +8,31 @@ export type NotificationPermissionResult =
8 | { readonly type: "granted" }
9 | { readonly type: "denied"; readonly canAskAgain: boolean };
10
11 +export class NotificationPermissionReadError extends Schema.TaggedErrorClass<NotificationPermissionReadError>()(
12 + "NotificationPermissionReadError",
13 + {
14 + cause: Schema.Defect(),
15 + },
16 +) {
17 + override get message(): string {
18 + return "Failed to read notification permissions on iOS.";
19 + }
20 +}
21 +
22 +export class NotificationPermissionRequestError extends Schema.TaggedErrorClass<NotificationPermissionRequestError>()(
23 + "NotificationPermissionRequestError",
24 + {
25 + cause: Schema.Defect(),
26 + },
27 +) {
28 + override get message(): string {
29 + return "Failed to request notification permissions on iOS.";
30 + }
31 +}
32 +
33 export const requestAgentNotificationPermission: Effect.Effect<
34 NotificationPermissionResult,
12 - unknown
35 + NotificationPermissionReadError | NotificationPermissionRequestError
36 > = Effect.gen(function* () {
37 if (Platform.OS !== "ios") {
38 return { type: "unsupported" };
@@ -17,7 +40,7 @@ export const requestAgentNotificationPermission: Effect.Effect<
40
41 const existing = yield* Effect.tryPromise({
42 try: () => Notifications.getPermissionsAsync(),
20 - catch: (error) => error,
43 + catch: (cause) => new NotificationPermissionReadError({ cause }),
44 });
45 if (existing.granted) {
46 return { type: "granted" };
@@ -36,7 +59,7 @@ export const requestAgentNotificationPermission: Effect.Effect<
59 allowSound: true,
60 },
61 }),
39 - catch: (error) => error,
62 + catch: (cause) => new NotificationPermissionRequestError({ cause }),
63 });
64 return requested.granted
65 ? { type: "granted" }