Open History to see the last commit
1import * as Context from "effect/Context";
2import * as Effect from "effect/Effect";
3import * as Layer from "effect/Layer";
4import * as Option from "effect/Option";
5import * as Ref from "effect/Ref";
6import * as Schema from "effect/Schema";
7import * as Semaphore from "effect/Semaphore";
8import {
9 EnvironmentId,
10 PullRequestInvolvement,
11 PullRequestListFilters,
12 PullRequestListState,
13 type ProviderInstanceId,
14 type PullRequestMergeMethod,
15 type SidebarProjectGroupingMode,
16} from "@t3tools/contracts";
17import { ToolCallVisibility } from "@t3tools/contracts/settings";
18import type { AndroidNavigationStyle } from "../lib/androidNavigationStyle";
19import type { ComposerEnterBehavior } from "../lib/composerEnterBehavior";
20import type { FollowUpBehavior } from "../lib/followUpBehavior";
21import { isMicrophoneKind, type MicrophoneEntry } from "../lib/microphonePriority";
22import { MOBILE_THEME_IDS, type MobileThemeId, type MobileThemeMode } from "../lib/mobileTheme";
23import * as MobileDatabase from "./mobile-database";
24import * as MobileSecureStorage from "./mobile-secure-storage";
25import { MobileStorageDecodeError, MobileStorageEncodeError } from "./mobile-storage";
26
27const PREFERENCES_KEY = "t3code.preferences";
28const PREFERENCES_FALLBACK_KEY = "t3code.preferences.fallback";
29const encodeJson = Schema.encodeUnknownEffect(Schema.fromJsonString(Schema.Unknown));
30
31export const PullRequestListControls = Schema.Struct({
32 state: PullRequestListState,
33 involvement: PullRequestInvolvement,
34 filters: PullRequestListFilters,
35 projectId: Schema.optional(Schema.String),
36 projectEnvironmentId: Schema.optional(Schema.String),
37 sort: Schema.Literals(["updated", "created", "oldest"]),
38});
39export type PullRequestListControls = typeof PullRequestListControls.Type;
40
41const ThreadListFilters = Schema.Struct({
42 environmentId: Schema.NullOr(EnvironmentId),
43 projectKey: Schema.NullOr(Schema.String),
44});
45export type ThreadListFilters = typeof ThreadListFilters.Type;
46
47const PullRequestListPreferences = Schema.Struct({
48 environmentId: Schema.NullOr(Schema.String),
49 controls: Schema.Record(Schema.String, PullRequestListControls),
50});
51export type PullRequestListPreferences = typeof PullRequestListPreferences.Type;
52
53/**
54 * The page each workspace tab last showed, reopened when the tab returns with columns. `key` is
55 * that page's route key: reopening under the same key reuses the screen a tab kept mounted.
56 */
57const WorkspaceSelections = Schema.Struct({
58 threads: Schema.optional(
59 Schema.Struct({
60 environmentId: Schema.String,
61 threadId: Schema.String,
62 key: Schema.optional(Schema.String),
63 }),
64 ),
65 pullRequests: Schema.optional(
66 Schema.Struct({
67 environmentId: Schema.String,
68 projectId: Schema.String,
69 repository: Schema.String,
70 number: Schema.Number,
71 host: Schema.optional(Schema.String),
72 key: Schema.optional(Schema.String),
73 }),
74 ),
75 settings: Schema.optional(Schema.String),
76 settingsKey: Schema.optional(Schema.String),
77 /** A draft the threads tab showed after its last chat; only meaningful in its session. */
78 threadsDraft: Schema.optional(Schema.Struct({ key: Schema.String, params: Schema.Unknown })),
79});
80export type WorkspaceSelections = typeof WorkspaceSelections.Type;
81
82const isThreadListFilters = Schema.is(ThreadListFilters);
83const isWorkspaceSelections = Schema.is(WorkspaceSelections);
84const isPullRequestListPreferences = Schema.is(PullRequestListPreferences);
85const ThreadProject = Schema.Struct({
86 environmentId: Schema.NonEmptyString,
87 projectId: Schema.NonEmptyString,
88});
89const isThreadProject = Schema.is(ThreadProject);
90
91export interface Preferences {
92 readonly navigationTabOrder?: readonly string[];
93 readonly hiddenNavigationTabs?: readonly string[];
94 readonly pullRequestHideTestFiles?: boolean;
95 readonly pullRequestMergeMethod?: PullRequestMergeMethod;
96 readonly liveActivitiesEnabled?: boolean;
97 readonly themeId?: MobileThemeId;
98 readonly lightThemeId?: MobileThemeId;
99 readonly darkThemeId?: MobileThemeId;
100 readonly themeMode?: MobileThemeMode;
101 readonly androidNavigationStyle?: AndroidNavigationStyle;
102 readonly baseFontSize?: number;
103 readonly terminalFontSize?: number | null;
104 readonly markdownFontSize?: number;
105 readonly codeFontSize?: number | null;
106 readonly codeWordBreak?: boolean;
107 readonly mathRenderingEnabled?: boolean;
108 /** Unset means on: crash reports are sent unless the user turns them off. */
109 readonly crashReportsEnabled?: boolean;
110 readonly connectOnboardingOptOutAccounts?: ReadonlyArray<string>;
111 readonly collapsedProjectGroups?: readonly string[];
112 readonly dismissedDatabaseStorageNotices?: readonly string[];
113 /** Hardware-keyboard Return behavior in the composer. */
114 readonly composerEnterBehavior?: ComposerEnterBehavior;
115 readonly followUpBehavior?: FollowUpBehavior;
116 readonly microphones?: ReadonlyArray<MicrophoneEntry>;
117 readonly projectGroupingEnabled?: boolean;
118 readonly projectGroupingMode?: SidebarProjectGroupingMode;
119 readonly toolCallVisibility?: ToolCallVisibility;
120 readonly workingShelfEnabled?: boolean;
121 readonly useLastProjectForNewThreads?: boolean;
122 readonly lastThreadProject?: typeof ThreadProject.Type;
123 readonly modelFavorites?: ReadonlyArray<{
124 readonly provider: ProviderInstanceId;
125 readonly model: string;
126 }>;
127 readonly threadListSettledShelfExpanded?: boolean;
128 readonly threadListSnoozedShelfExpanded?: boolean;
129 readonly threadListWorkingShelfExpanded?: boolean;
130 readonly threadListFilters?: ThreadListFilters;
131 readonly pullRequestListFilters?: PullRequestListPreferences;
132 readonly workspaceSelections?: WorkspaceSelections;
133}
134
135export class MobilePreferencesLoadError extends Schema.TaggedError<MobilePreferencesLoadError>()(
136 "MobilePreferencesLoadError",
137 { cause: Schema.Defect() },
138) {
139 override get message(): string {
140 return "Failed to load mobile preferences.";
141 }
142}
143
144export class MobilePreferencesSaveError extends Schema.TaggedError<MobilePreferencesSaveError>()(
145 "MobilePreferencesSaveError",
146 { cause: Schema.Defect() },
147) {
148 override get message(): string {
149 return "Failed to save mobile preferences.";
150 }
151}
152
153const isMobilePreferencesSaveError = Schema.is(MobilePreferencesSaveError);
154
155interface PreferencesFallback {
156 readonly payload: string;
157 readonly updatedAt: number;
158 readonly preferences: Preferences;
159}
160
161export class MobilePreferencesStore extends Context.Service<
162 MobilePreferencesStore,
163 {
164 readonly load: Effect.Effect<Preferences, MobilePreferencesLoadError>;
165 readonly savePatch: (
166 patch: Partial<Preferences>,
167 ) => Effect.Effect<Preferences, MobilePreferencesSaveError>;
168 readonly update: (
169 transform: (current: Preferences) => Partial<Preferences>,
170 ) => Effect.Effect<Preferences, MobilePreferencesSaveError>;
171 }
172>()("@t3tools/mobile/persistence/mobile-preferences/MobilePreferencesStore") {}
173
174const isToolCallVisibility = Schema.is(ToolCallVisibility);
175
176function sanitizePreferences(parsed: Preferences): Preferences {
177 const preferences: {
178 navigationTabOrder?: readonly string[];
179 hiddenNavigationTabs?: readonly string[];
180 pullRequestHideTestFiles?: boolean;
181 pullRequestMergeMethod?: PullRequestMergeMethod;
182 liveActivitiesEnabled?: boolean;
183 themeId?: MobileThemeId;
184 lightThemeId?: MobileThemeId;
185 darkThemeId?: MobileThemeId;
186 themeMode?: MobileThemeMode;
187 androidNavigationStyle?: AndroidNavigationStyle;
188 baseFontSize?: number;
189 terminalFontSize?: number | null;
190 markdownFontSize?: number;
191 codeFontSize?: number | null;
192 codeWordBreak?: boolean;
193 mathRenderingEnabled?: boolean;
194 crashReportsEnabled?: boolean;
195 connectOnboardingOptOutAccounts?: ReadonlyArray<string>;
196 collapsedProjectGroups?: readonly string[];
197 dismissedDatabaseStorageNotices?: readonly string[];
198 composerEnterBehavior?: ComposerEnterBehavior;
199 followUpBehavior?: FollowUpBehavior;
200 microphones?: ReadonlyArray<MicrophoneEntry>;
201 projectGroupingEnabled?: boolean;
202 projectGroupingMode?: SidebarProjectGroupingMode;
203 toolCallVisibility?: ToolCallVisibility;
204 workingShelfEnabled?: boolean;
205 useLastProjectForNewThreads?: boolean;
206 lastThreadProject?: typeof ThreadProject.Type;
207 modelFavorites?: Preferences["modelFavorites"];
208 threadListSettledShelfExpanded?: boolean;
209 threadListSnoozedShelfExpanded?: boolean;
210 threadListWorkingShelfExpanded?: boolean;
211 threadListFilters?: ThreadListFilters;
212 pullRequestListFilters?: PullRequestListPreferences;
213 workspaceSelections?: WorkspaceSelections;
214 } = {};
215
216 if (Array.isArray(parsed.hiddenNavigationTabs)) {
217 preferences.hiddenNavigationTabs = parsed.hiddenNavigationTabs.filter(
218 (tab): tab is string => typeof tab === "string",
219 );
220 }
221
222 if (Array.isArray(parsed.navigationTabOrder)) {
223 preferences.navigationTabOrder = parsed.navigationTabOrder.filter(
224 (tab): tab is string => typeof tab === "string",
225 );
226 }
227
228 if (typeof parsed.pullRequestHideTestFiles === "boolean") {
229 preferences.pullRequestHideTestFiles = parsed.pullRequestHideTestFiles;
230 }
231
232 if (
233 parsed.pullRequestMergeMethod === "squash" ||
234 parsed.pullRequestMergeMethod === "merge" ||
235 parsed.pullRequestMergeMethod === "rebase"
236 ) {
237 preferences.pullRequestMergeMethod = parsed.pullRequestMergeMethod;
238 }
239
240 if (typeof parsed.liveActivitiesEnabled === "boolean") {
241 preferences.liveActivitiesEnabled = parsed.liveActivitiesEnabled;
242 }
243 if (
244 typeof parsed.themeId === "string" &&
245 (MOBILE_THEME_IDS as readonly string[]).includes(parsed.themeId)
246 ) {
247 preferences.themeId = parsed.themeId as MobileThemeId;
248 }
249 if (
250 typeof parsed.lightThemeId === "string" &&
251 (MOBILE_THEME_IDS as readonly string[]).includes(parsed.lightThemeId)
252 ) {
253 preferences.lightThemeId = parsed.lightThemeId as MobileThemeId;
254 }
255 if (
256 typeof parsed.darkThemeId === "string" &&
257 (MOBILE_THEME_IDS as readonly string[]).includes(parsed.darkThemeId)
258 ) {
259 preferences.darkThemeId = parsed.darkThemeId as MobileThemeId;
260 }
261 if (
262 parsed.themeMode === "system" ||
263 parsed.themeMode === "light" ||
264 parsed.themeMode === "dark"
265 ) {
266 preferences.themeMode = parsed.themeMode;
267 }
268 if (parsed.androidNavigationStyle === "one-ui" || parsed.androidNavigationStyle === "material") {
269 preferences.androidNavigationStyle = parsed.androidNavigationStyle;
270 }
271 if (typeof parsed.baseFontSize === "number") preferences.baseFontSize = parsed.baseFontSize;
272 if (typeof parsed.terminalFontSize === "number" || parsed.terminalFontSize === null) {
273 preferences.terminalFontSize = parsed.terminalFontSize;
274 }
275 if (typeof parsed.markdownFontSize === "number") {
276 preferences.markdownFontSize = parsed.markdownFontSize;
277 }
278 if (typeof parsed.codeFontSize === "number" || parsed.codeFontSize === null) {
279 preferences.codeFontSize = parsed.codeFontSize;
280 }
281 if (typeof parsed.codeWordBreak === "boolean") preferences.codeWordBreak = parsed.codeWordBreak;
282 if (typeof parsed.mathRenderingEnabled === "boolean")
283 preferences.mathRenderingEnabled = parsed.mathRenderingEnabled;
284 if (typeof parsed.crashReportsEnabled === "boolean") {
285 preferences.crashReportsEnabled = parsed.crashReportsEnabled;
286 }
287 if (Array.isArray(parsed.connectOnboardingOptOutAccounts)) {
288 preferences.connectOnboardingOptOutAccounts = parsed.connectOnboardingOptOutAccounts.filter(
289 (account): account is string => typeof account === "string",
290 );
291 }
292 if (Array.isArray(parsed.collapsedProjectGroups)) {
293 preferences.collapsedProjectGroups = parsed.collapsedProjectGroups.filter(
294 (key): key is string => typeof key === "string",
295 );
296 }
297 if (Array.isArray(parsed.dismissedDatabaseStorageNotices)) {
298 preferences.dismissedDatabaseStorageNotices = parsed.dismissedDatabaseStorageNotices.filter(
299 (value): value is string => typeof value === "string",
300 );
301 }
302 if (parsed.composerEnterBehavior === "send" || parsed.composerEnterBehavior === "newline") {
303 preferences.composerEnterBehavior = parsed.composerEnterBehavior;
304 }
305 if (parsed.followUpBehavior === "queue" || parsed.followUpBehavior === "steer") {
306 preferences.followUpBehavior = parsed.followUpBehavior;
307 }
308 if (Array.isArray(parsed.microphones)) {
309 preferences.microphones = parsed.microphones.flatMap((entry): MicrophoneEntry[] => {
310 if (typeof entry !== "object" || entry === null || !isMicrophoneKind(entry.kind)) return [];
311 if (!("uid" in entry)) return [{ kind: entry.kind }];
312 return typeof entry.uid === "string" && typeof entry.name === "string"
313 ? [{ kind: entry.kind, uid: entry.uid, name: entry.name }]
314 : [];
315 });
316 }
317 if (typeof parsed.projectGroupingEnabled === "boolean") {
318 preferences.projectGroupingEnabled = parsed.projectGroupingEnabled;
319 }
320 if (
321 parsed.projectGroupingMode === "repository" ||
322 parsed.projectGroupingMode === "repository_path" ||
323 parsed.projectGroupingMode === "separate"
324 ) {
325 preferences.projectGroupingMode = parsed.projectGroupingMode;
326 }
327 if (isToolCallVisibility(parsed.toolCallVisibility)) {
328 preferences.toolCallVisibility = parsed.toolCallVisibility;
329 }
330 if (typeof parsed.workingShelfEnabled === "boolean") {
331 preferences.workingShelfEnabled = parsed.workingShelfEnabled;
332 }
333 if (typeof parsed.useLastProjectForNewThreads === "boolean") {
334 preferences.useLastProjectForNewThreads = parsed.useLastProjectForNewThreads;
335 }
336 if (isThreadProject(parsed.lastThreadProject)) {
337 preferences.lastThreadProject = parsed.lastThreadProject;
338 }
339 if (Array.isArray(parsed.modelFavorites)) {
340 preferences.modelFavorites = parsed.modelFavorites.filter(
341 (favorite) =>
342 typeof favorite === "object" &&
343 favorite !== null &&
344 typeof favorite.provider === "string" &&
345 favorite.provider.length > 0 &&
346 typeof favorite.model === "string" &&
347 favorite.model.trim().length > 0,
348 );
349 }
350 if (typeof parsed.threadListSettledShelfExpanded === "boolean") {
351 preferences.threadListSettledShelfExpanded = parsed.threadListSettledShelfExpanded;
352 }
353 if (typeof parsed.threadListSnoozedShelfExpanded === "boolean") {
354 preferences.threadListSnoozedShelfExpanded = parsed.threadListSnoozedShelfExpanded;
355 }
356 if (typeof parsed.threadListWorkingShelfExpanded === "boolean") {
357 preferences.threadListWorkingShelfExpanded = parsed.threadListWorkingShelfExpanded;
358 }
359 if (isThreadListFilters(parsed.threadListFilters)) {
360 preferences.threadListFilters = parsed.threadListFilters;
361 }
362 if (isPullRequestListPreferences(parsed.pullRequestListFilters)) {
363 preferences.pullRequestListFilters = parsed.pullRequestListFilters;
364 }
365 if (isWorkspaceSelections(parsed.workspaceSelections)) {
366 preferences.workspaceSelections = parsed.workspaceSelections;
367 }
368 return preferences;
369}
370
371const make = Effect.fn("MobilePreferencesStore.make")(function* () {
372 const database = yield* MobileDatabase.MobileDatabase;
373 const secureStorage = yield* MobileSecureStorage.MobileSecureStorage;
374 const lock = yield* Semaphore.make(1);
375 const lastUpdatedAt = yield* Ref.make(0);
376
377 const parsePayload = (raw: string | null): Preferences | null => {
378 if (raw === null || !raw.trim()) return null;
379 let parsed: unknown;
380 try {
381 parsed = JSON.parse(raw);
382 } catch (cause) {
383 console.warn(
384 "[mobile-storage] ignored invalid JSON",
385 new MobileStorageDecodeError({ key: PREFERENCES_KEY, cause }),
386 );
387 return null;
388 }
389 return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)
390 ? (parsed as Preferences)
391 : null;
392 };
393
394 const parseFallback = (raw: string | null): PreferencesFallback | null => {
395 if (raw === null || !raw.trim()) return null;
396 let parsed: unknown;
397 try {
398 parsed = JSON.parse(raw);
399 } catch (cause) {
400 console.warn(
401 "[mobile-storage] ignored invalid JSON",
402 new MobileStorageDecodeError({ key: PREFERENCES_FALLBACK_KEY, cause }),
403 );
404 return null;
405 }
406 if (
407 typeof parsed !== "object" ||
408 parsed === null ||
409 !("payload" in parsed) ||
410 typeof parsed.payload !== "string" ||
411 !("updatedAt" in parsed) ||
412 typeof parsed.updatedAt !== "number"
413 ) {
414 return null;
415 }
416 const preferences = parsePayload(parsed.payload);
417 return preferences === null
418 ? null
419 : { payload: parsed.payload, updatedAt: parsed.updatedAt, preferences };
420 };
421
422 const encode = Effect.fn("MobilePreferencesStore.encode")(function* (
423 key: string,
424 value: unknown,
425 ) {
426 return yield* encodeJson(value).pipe(
427 Effect.mapError((cause) => new MobileStorageEncodeError({ key, cause })),
428 );
429 });
430
431 const nextUpdatedAt = Ref.modify(lastUpdatedAt, (last) => {
432 const next = Math.max(Date.now(), last + 1);
433 return [next, next] as const;
434 });
435
436 const saveJson = Effect.fn("MobilePreferencesStore.saveJson")(function* (
437 payload: string,
438 updatedAt?: number,
439 ) {
440 const timestamp = updatedAt ?? (yield* nextUpdatedAt);
441 yield* Ref.update(lastUpdatedAt, (last) => Math.max(last, timestamp));
442 const databaseResult = yield* Effect.result(database.savePreferencesJson(payload, timestamp));
443 if (databaseResult._tag === "Failure") {
444 yield* Effect.logWarning("Database unavailable; saving preferences to secure storage.").pipe(
445 Effect.annotateLogs({ cause: databaseResult.failure }),
446 );
447 const fallback = yield* encode(PREFERENCES_FALLBACK_KEY, { payload, updatedAt: timestamp });
448 yield* secureStorage.setItem(PREFERENCES_FALLBACK_KEY, fallback);
449 return;
450 }
451 yield* secureStorage
452 .removeItem(PREFERENCES_FALLBACK_KEY)
453 .pipe(
454 Effect.catch((error) =>
455 Effect.logWarning("Could not remove the mobile preferences fallback.").pipe(
456 Effect.annotateLogs({ error }),
457 ),
458 ),
459 );
460 });
461
462 const loadUnlocked = Effect.gen(function* () {
463 const databaseResult = yield* Effect.result(database.loadPreferencesJson);
464 const databaseAvailable = databaseResult._tag === "Success";
465 const storedJson = databaseAvailable
466 ? databaseResult.success
467 : Option.none<MobileDatabase.StoredPreferencesJson>();
468 if (databaseResult._tag === "Failure") {
469 yield* Effect.logWarning("Database unavailable; loading fallback preferences.").pipe(
470 Effect.annotateLogs({ cause: databaseResult.failure }),
471 );
472 }
473
474 const fallbackResult = yield* Effect.result(secureStorage.getItem(PREFERENCES_FALLBACK_KEY));
475 let fallbackJson: string | null = null;
476 if (fallbackResult._tag === "Success") {
477 fallbackJson = fallbackResult.success;
478 } else if (Option.isNone(storedJson)) {
479 return yield* fallbackResult.failure;
480 } else {
481 yield* Effect.logWarning("Could not inspect the mobile preferences fallback.").pipe(
482 Effect.annotateLogs({ error: fallbackResult.failure }),
483 );
484 }
485
486 const fallback = parseFallback(fallbackJson);
487 const storedPreferences = Option.isSome(storedJson)
488 ? parsePayload(storedJson.value.payload)
489 : null;
490 const fallbackIsNewer =
491 fallback !== null &&
492 (storedPreferences === null ||
493 (Option.isSome(storedJson) && fallback.updatedAt > storedJson.value.updatedAt));
494
495 let parsed: Preferences | null = null;
496 if (fallbackIsNewer) {
497 parsed = fallback.preferences;
498 yield* Ref.update(lastUpdatedAt, (last) => Math.max(last, fallback.updatedAt));
499 if (databaseAvailable) yield* saveJson(fallback.payload, fallback.updatedAt);
500 } else if (storedPreferences !== null && Option.isSome(storedJson)) {
501 parsed = storedPreferences;
502 yield* Ref.update(lastUpdatedAt, (last) => Math.max(last, storedJson.value.updatedAt));
503 if (fallbackJson !== null) {
504 yield* secureStorage
505 .removeItem(PREFERENCES_FALLBACK_KEY)
506 .pipe(
507 Effect.catch((error) =>
508 Effect.logWarning("Could not remove a stale mobile preferences fallback.").pipe(
509 Effect.annotateLogs({ error }),
510 ),
511 ),
512 );
513 }
514 }
515
516 if (parsed === null) {
517 const legacyJson = yield* secureStorage.getItem(PREFERENCES_KEY);
518 const legacyPreferences = parsePayload(legacyJson);
519 parsed = legacyPreferences;
520 if (legacyJson !== null && legacyPreferences !== null && databaseAvailable) {
521 yield* saveJson(legacyJson);
522 yield* secureStorage
523 .removeItem(PREFERENCES_KEY)
524 .pipe(
525 Effect.catch((error) =>
526 Effect.logWarning("Could not remove migrated mobile preferences.").pipe(
527 Effect.annotateLogs({ error }),
528 ),
529 ),
530 );
531 }
532 }
533
534 return parsed === null ? {} : sanitizePreferences(parsed);
535 });
536
537 const load = lock
538 .withPermits(1)(loadUnlocked)
539 .pipe(Effect.mapError((cause) => new MobilePreferencesLoadError({ cause })));
540
541 const update = Effect.fn("MobilePreferencesStore.update")(
542 (transform: (current: Preferences) => Partial<Preferences>) =>
543 lock
544 .withPermits(1)(
545 Effect.gen(function* () {
546 const current = yield* loadUnlocked;
547 const patch = yield* Effect.try({
548 try: () => transform(current),
549 catch: (cause) => new MobilePreferencesSaveError({ cause }),
550 });
551 const next: Preferences = { ...current, ...patch };
552 const payload = yield* encode(PREFERENCES_KEY, next);
553 yield* saveJson(payload);
554 return next;
555 }),
556 )
557 .pipe(
558 Effect.mapError((cause) =>
559 isMobilePreferencesSaveError(cause) ? cause : new MobilePreferencesSaveError({ cause }),
560 ),
561 ),
562 );
563
564 return MobilePreferencesStore.of({
565 load,
566 update,
567 savePatch: Effect.fn("MobilePreferencesStore.savePatch")((patch) => update(() => patch)),
568 });
569});
570
571export const layer = Layer.effect(MobilePreferencesStore, make());