1import type { EnvironmentId } from "@t3tools/contracts";
2
3/** Wait for earlier grants before choosing the settings that edits and synchronization use. */
4export function resolveAutoSettleReferenceEnvironmentId(
5 environments: ReadonlyArray<{
6 readonly environmentId: EnvironmentId;
7 readonly canWriteSettings: boolean | null;
8 }>,
9): EnvironmentId | null {
10 for (const environment of environments) {
11 if (environment.canWriteSettings === null) return null;
12 if (environment.canWriteSettings) return environment.environmentId;
13 }
14 return environments[0]?.environmentId ?? null;
15}
16
17export function resolveAgentAwarenessPlatformPresentation(platform: string): {
18 readonly supported: boolean;
19 readonly subtitle: string | undefined;
20} {
21 return platform === "ios" || platform === "android"
22 ? { supported: true, subtitle: undefined }
23 : { supported: false, subtitle: "Unavailable on this platform" };
24}