macOS: unify device + OS chip

This commit is contained in:
Peter Steinberger
2025-12-18 00:43:58 +01:00
parent 14fa2f47f5
commit cbb327227a

View File

@@ -70,20 +70,26 @@ struct InstancesSettings: View {
if let version = inst.version { if let version = inst.version {
self.label(icon: "shippingbox", text: version) self.label(icon: "shippingbox", text: version)
} }
if let platform = inst.platform, let prettyPlatform = self.prettyPlatform(platform) { let prettyPlatform = inst.platform.flatMap { self.prettyPlatform($0) }
self.label(icon: self.platformIcon(platform), text: prettyPlatform) let device = DeviceModelCatalog.presentation(
}
if let device = DeviceModelCatalog.presentation(
deviceFamily: inst.deviceFamily, deviceFamily: inst.deviceFamily,
modelIdentifier: inst.modelIdentifier) modelIdentifier: inst.modelIdentifier)
{
// Avoid showing generic "Mac"/"iPhone"/etc when we already show the OS + role. if let device {
// Avoid showing generic "Mac"/"iPhone"/etc; prefer the concrete model name.
let family = (inst.deviceFamily ?? "").trimmingCharacters(in: .whitespacesAndNewlines) let family = (inst.deviceFamily ?? "").trimmingCharacters(in: .whitespacesAndNewlines)
if !family.isEmpty, device.title != family { let isGeneric = !family.isEmpty && device.title == family
self.label(icon: device.symbol, text: device.title) if !isGeneric {
} else if family.isEmpty { if let prettyPlatform {
self.label(icon: device.symbol, text: device.title) self.label(icon: device.symbol, text: "\(device.title) · \(prettyPlatform)")
} else {
self.label(icon: device.symbol, text: device.title)
}
} else if let prettyPlatform, let platform = inst.platform {
self.label(icon: self.platformIcon(platform), text: prettyPlatform)
} }
} else if let prettyPlatform, let platform = inst.platform {
self.label(icon: self.platformIcon(platform), text: prettyPlatform)
} }
// Last local input is helpful for interactive nodes, but noisy/meaningless for the gateway. // Last local input is helpful for interactive nodes, but noisy/meaningless for the gateway.