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
4 changes: 2 additions & 2 deletions DockhandMobile.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
5 changes: 1 addition & 4 deletions DockhandMobile/Features/Settings/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
34 changes: 28 additions & 6 deletions DockhandMobile/Shared/EnvironmentHeaderBar.swift
Original file line number Diff line number Diff line change
@@ -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"

Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading