Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import Foundation

extension MobileShellComposite {
/// Whether any foreground Mac switch attempt is currently in flight.
///
/// `switchToMac` returns `false` both for a genuine connection failure and
/// for an attempt superseded by a newer switch (which leaves the newer
/// attempt's id in place; `finishMacSwitchAttempt` only clears a matching
/// id). Reconnect UIs read this at result time to avoid showing a
/// "couldn't connect" alert for an attempt that merely lost the race to a
/// switch the user started elsewhere.
///
/// Lives in an extension file (with `macSwitchAttemptID` made internal)
/// instead of `MobileShellComposite.swift` to respect that file's length
/// budget.
public var isMacSwitchInFlight: Bool { macSwitchAttemptID != nil }
}
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ public final class MobileShellComposite: MobileTerminalOutputSinking {
private var createTerminalTaskID: UUID?
private var connectionGeneration: UUID
private var connectionAttemptGeneration: UUID
@ObservationIgnored private var macSwitchAttemptID: UUID?
@ObservationIgnored var macSwitchAttemptID: UUID?
@ObservationIgnored private var macSwitchAttemptSignInGeneration: Int?
@ObservationIgnored private var macSwitchRestorePreviousOnCancelAttemptIDs: Set<UUID> = []
@ObservationIgnored private var macSwitchRestoreBaseline: MobilePairedMac?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,33 +36,11 @@ struct DeviceTreeView: View {
/// actually removes. (Building from `deviceTreeDevices`, which prefers the team
/// registry, would make Remove ineffective: a registry-backed row reappears on
/// the next registry load.) Each is enriched with presence, live status, and how
/// many aggregated workspaces it contributes.
/// many aggregated workspaces it contributes. Built by the shared
/// ``MacComputerSnapshot/snapshots(from:)`` so the disconnected reconnect
/// list shows exactly the same computer set.
private var computers: [MacComputerSnapshot] {
let colorIndex = store.machineColorIndex
// The PHONE's own per-Mac connection (foreground or live secondary) — the
// source of truth for the dot, distinct from presence.
let connectionStatuses = store.macConnectionStatuses
return store.displayPairedMacs.map { mac in
let aliases = store.pairedMacAliasIDs(for: mac.macDeviceID)
let summary = store.presenceSummary(for: mac.macDeviceID)
let presence: DeviceTreePresence? = summary
.map { $0.online ? .online : .offline(lastSeenAt: $0.lastSeenAt) }
return MacComputerSnapshot(
deviceId: mac.macDeviceID,
title: mac.resolvedName,
platform: "mac",
colorIndex: aliases.compactMap { colorIndex[$0] }.first,
customColor: mac.customColor,
customIcon: mac.customIcon,
connectionStatus: connectionStatuses[mac.macDeviceID],
presence: presence,
buildLabel: summary?.buildLabel,
routeDescription: CmxAttachRoute.deviceTreeRouteDescription(for: mac.routes),
lastSeenAt: mac.lastSeenAt,
workspaceCount: store.workspaceCount(for: mac.macDeviceID),
aliasIDs: aliases
)
}
MacComputerSnapshot.snapshots(from: store)
}

var body: some View {
Expand Down
Loading
Loading