From 5832eab2bcecfd5226fad27e7eb45950f3ea15e7 Mon Sep 17 00:00:00 2001 From: Giovanny Aranda Date: Sun, 15 Nov 2026 20:41:02 +0100 Subject: [PATCH] feat: highlight the selected server and environment with a green check Bump build to 20. --- DockhandMobile.xcodeproj/project.pbxproj | 4 +-- .../Features/Settings/SettingsView.swift | 5 +-- .../Shared/EnvironmentHeaderBar.swift | 34 +++++++++++++++---- project.yml | 2 +- 4 files changed, 32 insertions(+), 13 deletions(-) diff --git a/DockhandMobile.xcodeproj/project.pbxproj b/DockhandMobile.xcodeproj/project.pbxproj index 16076ee..c150481 100644 --- a/DockhandMobile.xcodeproj/project.pbxproj +++ b/DockhandMobile.xcodeproj/project.pbxproj @@ -530,7 +530,7 @@ "ASSETCATALOG_COMPILER_APPICON_NAME" = "dockhand_glass"; "ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS" = NO; "CODE_SIGN_IDENTITY" = "iPhone Developer"; - "CURRENT_PROJECT_VERSION" = 19; + "CURRENT_PROJECT_VERSION" = 20; "DEVELOPMENT_TEAM" = 8DA225EN79; CODE_SIGN_ENTITLEMENTS = DockhandMobile/DockhandMobile.entitlements; "GENERATE_INFOPLIST_FILE" = NO; @@ -555,7 +555,7 @@ "ASSETCATALOG_COMPILER_APPICON_NAME" = "dockhand_glass"; "ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS" = NO; "CODE_SIGN_IDENTITY" = "iPhone Developer"; - "CURRENT_PROJECT_VERSION" = 19; + "CURRENT_PROJECT_VERSION" = 20; "DEVELOPMENT_TEAM" = 8DA225EN79; CODE_SIGN_ENTITLEMENTS = DockhandMobile/DockhandMobile.entitlements; "GENERATE_INFOPLIST_FILE" = NO; diff --git a/DockhandMobile/Features/Settings/SettingsView.swift b/DockhandMobile/Features/Settings/SettingsView.swift index 29c0752..89daea3 100644 --- a/DockhandMobile/Features/Settings/SettingsView.swift +++ b/DockhandMobile/Features/Settings/SettingsView.swift @@ -367,10 +367,7 @@ struct SettingsView: View { statusMessage = appModel.environmentError ?? String(localized: "Server changed") } } label: { - Label( - profile.name, - systemImage: appModel.selectedProfileID == profile.id ? "checkmark.circle.fill" : "server.rack" - ) + SelectableMenuLabel(title: profile.name, isSelected: appModel.selectedProfileID == profile.id, systemImage: "server.rack") } } } label: { diff --git a/DockhandMobile/Shared/EnvironmentHeaderBar.swift b/DockhandMobile/Shared/EnvironmentHeaderBar.swift index 09a305a..93707d3 100644 --- a/DockhandMobile/Shared/EnvironmentHeaderBar.swift +++ b/DockhandMobile/Shared/EnvironmentHeaderBar.swift @@ -1,11 +1,37 @@ import DockhandAPI import SwiftUI +import UIKit extension EnvironmentValues { /// False where the layout shows the header elsewhere, such as the iPad sidebar footer. @Entry var showsEnvironmentHeader = true } +/// Menu label for a picker item. The selected item shows a green check so it stands out at a glance; +/// system menus tint SF Symbols monochrome, so the color is baked into the image. +struct SelectableMenuLabel: View { + let title: String + let isSelected: Bool + var systemImage: String? + + var body: some View { + if isSelected { + Label { + Text(title) + } icon: { + Image(uiImage: Self.selectedImage) + } + } else if let systemImage { + Label(title, systemImage: systemImage) + } else { + Text(title) + } + } + + private static let selectedImage = UIImage(systemName: "checkmark.circle.fill")! + .withTintColor(.systemGreen, renderingMode: .alwaysOriginal) +} + struct EnvironmentHeaderBar: View { static let serverPickerKey = "showsServerPickerInHeader" @@ -92,11 +118,7 @@ struct EnvironmentHeaderBar: View { guard profile.id != appModel.selectedProfileID else { return } Task { await appModel.selectServerProfile(profile.id, forceEnvironmentReset: true) } } label: { - if appModel.selectedProfileID == profile.id { - Label(profile.name, systemImage: "checkmark") - } else { - Text(profile.name) - } + SelectableMenuLabel(title: profile.name, isSelected: appModel.selectedProfileID == profile.id) } } } label: { @@ -142,7 +164,7 @@ struct EnvironmentHeaderBar: View { Button { appModel.selectEnvironment(environment.id) } label: { - Label(environment.name, systemImage: appModel.selectedEnvironmentID == environment.id ? "checkmark.circle.fill" : "globe") + SelectableMenuLabel(title: environment.name, isSelected: appModel.selectedEnvironmentID == environment.id, systemImage: "globe") } } } label: { diff --git a/project.yml b/project.yml index b260d81..31f2787 100644 --- a/project.yml +++ b/project.yml @@ -32,7 +32,7 @@ targets: CODE_SIGN_ENTITLEMENTS: DockhandMobile/DockhandMobile.entitlements SWIFT_VERSION: 6.0 TARGETED_DEVICE_FAMILY: "1,2" - CURRENT_PROJECT_VERSION: 19 + CURRENT_PROJECT_VERSION: 20 GENERATE_INFOPLIST_FILE: NO INFOPLIST_FILE: DockhandMobile/Info.plist MARKETING_VERSION: 1.8.0