Skip to content

Commit 7724887

Browse files
committed
fix(mobile): explain iOS-only settings on Android
1 parent 50871eb commit 7724887

4 files changed

Lines changed: 40 additions & 1 deletion

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { describe, expect, it } from "vite-plus/test";
2+
3+
import { resolveAgentAwarenessPlatformPresentation } from "./SettingsRouteScreen.logic";
4+
5+
describe("resolveAgentAwarenessPlatformPresentation", () => {
6+
it("explains that agent awareness settings are unavailable on Android", () => {
7+
expect(resolveAgentAwarenessPlatformPresentation("android")).toEqual({
8+
supported: false,
9+
subtitle: "iOS only",
10+
});
11+
});
12+
13+
it("leaves supported iOS settings unchanged", () => {
14+
expect(resolveAgentAwarenessPlatformPresentation("ios")).toEqual({
15+
supported: true,
16+
subtitle: undefined,
17+
});
18+
});
19+
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export function resolveAgentAwarenessPlatformPresentation(platform: string): {
2+
readonly supported: boolean;
3+
readonly subtitle: string | undefined;
4+
} {
5+
return platform === "ios"
6+
? { supported: true, subtitle: undefined }
7+
: { supported: false, subtitle: "iOS only" };
8+
}

‎apps/mobile/src/features/settings/SettingsRouteScreen.tsx‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import { useSavedRemoteConnections } from "../../state/use-remote-environment-re
5151
import { SettingsRow } from "./components/SettingsRow";
5252
import { SettingsSection } from "./components/SettingsSection";
5353
import { SettingsSwitchRow } from "./components/SettingsSwitchRow";
54+
import { resolveAgentAwarenessPlatformPresentation } from "./SettingsRouteScreen.logic";
5455

5556
type NotificationStatus = "checking" | "enabled" | "disabled" | "unsupported";
5657
type LiveActivityStatus = "checking" | "enabled" | "disabled" | "signed-out" | "linking";
@@ -149,6 +150,7 @@ function ConfiguredSettingsRouteScreen() {
149150
const preferencesResult = useAtomValue(mobilePreferencesAtom);
150151
const savePreferences = useAtomSet(updateMobilePreferencesAtom);
151152
const agentAwarenessPushAvailable = supportsAgentAwarenessPush();
153+
const agentAwarenessPlatform = resolveAgentAwarenessPlatformPresentation(Platform.OS);
152154
const insets = useSafeAreaInsets();
153155
const navigation = useNavigation();
154156
const { expand: expandClerkSheet } = useClerkSettingsSheetDetent();
@@ -485,10 +487,12 @@ function ConfiguredSettingsRouteScreen() {
485487
icon="bell.badge"
486488
label="Device Notifications"
487489
disabled={
490+
!agentAwarenessPlatform.supported ||
488491
!agentAwarenessPushAvailable ||
489492
notificationStatus === "checking" ||
490493
notificationStatus === "unsupported"
491494
}
495+
subtitle={agentAwarenessPlatform.subtitle}
492496
// Only reads as on when this device is actually registered with the
493497
// relay; otherwise notifications cannot be delivered regardless of
494498
// the local iOS permission.
@@ -499,13 +503,15 @@ function ConfiguredSettingsRouteScreen() {
499503
/>
500504
<SettingsSwitchRow
501505
disabled={
506+
!agentAwarenessPlatform.supported ||
502507
!agentAwarenessPushAvailable ||
503508
!isLoaded ||
504509
liveActivityStatus === "checking" ||
505510
liveActivityStatus === "linking"
506511
}
507512
icon="bolt.circle"
508513
label="Live Activity Updates"
514+
subtitle={agentAwarenessPlatform.subtitle}
509515
// Same gate: a saved preference is meaningless until the device
510516
// registration the relay needs to push updates has succeeded.
511517
value={

‎apps/mobile/src/features/settings/components/SettingsSwitchRow.tsx‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export function SettingsSwitchRow(props: {
1111
readonly disabled?: boolean;
1212
readonly icon: SymbolName;
1313
readonly label: string;
14+
readonly subtitle?: string;
1415
readonly value: boolean;
1516
readonly onValueChange: (value: boolean) => void;
1617
}) {
@@ -27,7 +28,12 @@ export function SettingsSwitchRow(props: {
2728
}
2829
>
2930
<SymbolView name={props.icon} size={22} tintColor={icon} type="monochrome" weight="regular" />
30-
<Text className="flex-1 text-lg text-foreground">{props.label}</Text>
31+
<View className="min-w-0 flex-1">
32+
<Text className="text-lg text-foreground">{props.label}</Text>
33+
{props.subtitle ? (
34+
<Text className="text-sm text-foreground-muted">{props.subtitle}</Text>
35+
) : null}
36+
</View>
3137
<Switch
3238
disabled={props.disabled}
3339
ios_backgroundColor={track}

0 commit comments

Comments
 (0)