feat(mobile): make Settings easier to navigate and scope #12272
Mergedjuliusmarmingemerged 2 commits into
main fromrefs/pull/12272/headmerged by juliusmarminge View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XXL
- @@ -0,0 +29,21 @@29+ readonly selectAll: () => void;30+ readonly toggleEnvironment: (environmentId: EnvironmentId) => void;31+} | null>(null);32+33+export function SettingsEnvironmentFilterProvider(props: { readonly children: ReactNode }) {34+ const { environments } = useEnvironments();35+ const projects = useProjects();36+ const groupingSettings = useMobileProjectGroupingSettings();37+ const groupingMode = groupingSettings.sidebarProjectGroupingMode;38+ const [selectedIds, setSelectedIds] = useState<ReadonlySet<EnvironmentId> | null>(null);39+ const [selectedProjectKey, setSelectedProjectKey] = useState<string | null>(null);40+ const projectGroups = useMemo(41+ () =>42+ buildProjectGroups({43+ projects,44+ settings: { sidebarProjectGroupingMode: groupingMode, sidebarProjectGroupingOverrides: {} },45+ }),46+ [projects, groupingMode],47+ );48+ const availableTargets = useMemo(() => connectedSettingsTargets(environments), [environments]);49+ const selectedTargets = useMemo(apps/mobile/src/features/settings/SettingsServerControlsRouteScreen.tsx line 132OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +112,21 @@112+ selectedTargets,113+ projectSelected ? (selectedProject?.members.map((member) => member.project) ?? []) : null,114+ );115+ const [pendingWrites, setPendingWrites] = useState(0);116+ const [pendingTargets, setPendingTargets] = useState<117+ readonly ScopedMobileSettingsTarget[] | null118+ >(null);119+ const displayTargets = pendingWrites > 0 && pendingTargets !== null ? pendingTargets : targets;120+ const hasConnectedSelection = targets.length > 0;121+ const reference = displayTargets[0] ?? null;122+ const uniform = <K extends keyof ServerSettings>(key: K): ServerSettings[K] | null => {123+ if (reference === null) return null;124+ const value = reference.settings[key];125+ return displayTargets.every((entry) => entry.settings[key] === value) ? value : null;126+ };127+ const updateSettings = useAtomCommand(serverEnvironment.updateSettings, {128+ label: "environment settings update",129+ reportFailure: true,130+ });131+ const write = (patch: ServerSettingsPatch) => {132+ if (!hasConnectedSelection) return;apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx line 335Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +307,21 @@307+ connections,308+ environmentCount,309+ getToken,310+ isSignedIn,311+ liveActivitiesPreferenceEnabled,312+ promptSignIn,313+ savePreferences,314+ ]);315+316+ const handleDeviceNotificationsChange = useCallback(317+ (enabled: boolean) => {318+ if (enabled) {319+ if (!isSignedIn) {320+ promptSignIn();321+ return;322+ }323+ void requestNotifications();324+ return;325+ }326+327+ Alert.alert(apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx line 342OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +322,21 @@322+ }323+ void requestNotifications();324+ return;325+ }326+327+ Alert.alert(328+ "Disable notifications",329+ "Open system Settings to disable notifications for T3 Code.",330+ [331+ { text: "Cancel", style: "cancel" },332+ { text: "Open Settings", onPress: () => void Linking.openSettings() },333+ ],334+ );335+ },336+ [isSignedIn, promptSignIn, requestNotifications],337+ );338+339+ const handleLiveActivitiesChange = useCallback(340+ (enabled: boolean) => {341+ if (!enabled) {342+ setLiveActivityStatus("disabled");apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx lines 467 to 471Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +432,21 @@432+ !agentAwarenessPushAvailable ||433+ !isLoaded ||434+ liveActivityStatus === "checking" ||435+ liveActivityStatus === "linking"436+ }437+ icon="bolt.circle"438+ label={439+ Platform.OS === "android"440+ ? supportsAndroidLiveUpdateSettings()441+ ? "Agent Live Updates"442+ : "Ongoing Agent Activity"443+ : "Live Activity Updates"444+ }445+ subtitle={agentAwarenessSubtitle}446+ // Same gate: a saved preference is meaningless until the device447+ // registration the relay needs to push updates has succeeded.448+ value={449+ agentAwarenessPushAvailable &&450+ (liveActivityStatus === "enabled" || liveActivityStatus === "linking") &&451+ deviceRegistered452+ }
- apps/mobile/src/features/settings/settings-environment-filter.tsx line 44Resolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -0,0 +24,21 @@24+ readonly selectedIds: ReadonlySet<EnvironmentId> | null;25+ readonly projectGroups: ReturnType<typeof buildProjectGroups>;26+ readonly selectableProjectGroups: ReturnType<typeof buildProjectGroups>;27+ readonly selectedProjectKey: string | null;28+ readonly selectProject: (projectKey: string | null) => void;29+ readonly selectAll: () => void;30+ readonly toggleEnvironment: (environmentId: EnvironmentId) => void;31+} | null>(null);32+33+export function SettingsEnvironmentFilterProvider(props: { readonly children: ReactNode }) {34+ const { environments } = useEnvironments();35+ const projects = useProjects();36+ const groupingSettings = useMobileProjectGroupingSettings();37+ const groupingMode = groupingSettings.sidebarProjectGroupingMode;38+ const [selectedIds, setSelectedIds] = useState<ReadonlySet<EnvironmentId> | null>(null);39+ const [selectedProjectKey, setSelectedProjectKey] = useState<string | null>(null);40+ const projectGroups = useMemo(41+ () =>42+ buildProjectGroups({43+ projects,44+ settings: { sidebarProjectGroupingMode: groupingMode, sidebarProjectGroupingOverrides: {} },apps/mobile/src/features/settings/SettingsProjectOverviewRouteScreen.tsx line 84OutdatedResolvedby juliusmarminge@@ -0,0 +64,21 @@64+ const displayName = deriveProjectGroupLabel({ representative, members: props.members });65+ const [draftName, setDraftName] = useState<string | null>(null);66+ const [isSaving, setIsSaving] = useState(false);67+ const updateProject = useAtomCommand(projectEnvironment.update, {68+ label: "project name update",69+ reportFailure: true,70+ });71+ const nextName = (draftName ?? displayName).trim();72+ const canSave = !isSaving && nextName.length > 0 && nextName !== displayName;73+74+ const saveName = () => {75+ if (!canSave) return;76+ setIsSaving(true);77+ void (async () => {78+ try {79+ for (const member of props.members) {80+ const result = await updateProject({81+ environmentId: member.environmentId,82+ input: { projectId: member.id, title: nextName },83+ });84+ if (result._tag === "Failure") return;
- @@ -0,0 +33,21 @@33+ });34+35+ return (36+ <NativeStackScreenOptions37+ optionsVersion={filterVersion}38+ options={{39+ unstable_headerRightItems: () => [40+ withNativeGlassHeaderItem({41+ accessibilityLabel: "Filter settings environments and projects",42+ icon: { name: filterIcon, type: "sfSymbol" },43+ label: "",44+ type: "menu",45+ menu: {46+ title: "Settings scope",47+ items: [48+ {49+ type: "submenu",50+ label:51+ selectedIds === null52+ ? "All environments"53+ : `${selectedTargets.length} environments`,
juliusmarminge merged thisc25c3e0
juliusmarminge closed this
Sign in to join this conversation.



Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
Baseline:
d4d5d12· PR result:31be8be· Source CI: successScenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.