fix(ios): unify toolbar controls and release build 3
This commit is contained in:
@@ -2,5 +2,5 @@ public enum AppMetadata {
|
||||
public static let name = "MultiSimAdmin"
|
||||
public static let bundleIdentifier = "fun.chick.multi-simadmin"
|
||||
public static let marketingVersion = "0.2.0"
|
||||
public static let buildVersion = "2"
|
||||
public static let buildVersion = "3"
|
||||
}
|
||||
|
||||
@@ -118,28 +118,19 @@ struct FleetView: View {
|
||||
}
|
||||
} else {
|
||||
ToolbarItemGroup(placement: .primaryAction) {
|
||||
Button {
|
||||
AIIconButton("管理分组", systemImage: "folder.badge.gearshape") {
|
||||
model.showingGroupManager = true
|
||||
} label: {
|
||||
Image(systemName: "folder.badge.gearshape")
|
||||
}
|
||||
.accessibilityLabel("管理分组")
|
||||
.disabled(model.isLoading)
|
||||
|
||||
Button {
|
||||
AIIconButton("批量选择", systemImage: "checklist") {
|
||||
model.selectionMode = true
|
||||
} label: {
|
||||
Image(systemName: "checklist")
|
||||
}
|
||||
.accessibilityLabel("批量选择")
|
||||
.disabled(model.visibleRows.isEmpty)
|
||||
|
||||
Button {
|
||||
AIIconButton("添加实例", systemImage: "plus") {
|
||||
model.showingForm = true
|
||||
} label: {
|
||||
Image(systemName: "plus")
|
||||
}
|
||||
.accessibilityLabel("添加实例")
|
||||
.disabled(model.isLoading)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ public struct AIButtonStyle: ButtonStyle {
|
||||
case compact
|
||||
case regular
|
||||
case large
|
||||
case icon
|
||||
case toolbar
|
||||
case toolbarInline
|
||||
}
|
||||
@@ -67,6 +68,7 @@ public struct AIButtonStyle: ButtonStyle {
|
||||
switch size {
|
||||
case .compact: AITheme.compactButtonHeight
|
||||
case .large: AITheme.largeButtonHeight
|
||||
case .icon: AITheme.iconButtonSize
|
||||
case .regular: AITheme.buttonHeight
|
||||
case .toolbar: AITheme.toolbarButtonHeight
|
||||
case .toolbarInline: AITheme.toolbarButtonHeight
|
||||
@@ -129,11 +131,12 @@ public struct AIButtonStyle: ButtonStyle {
|
||||
case .compact: return AITheme.compactButtonMinWidth
|
||||
case .regular: return AITheme.regularButtonMinWidth
|
||||
case .large: return 92
|
||||
case .icon: return AITheme.iconButtonSize
|
||||
case .toolbar, .toolbarInline: return AITheme.toolbarButtonMinWidth
|
||||
}
|
||||
}
|
||||
|
||||
private var fixedWidth: CGFloat? {
|
||||
fixedWidthRequest ?? (size == .toolbar ? AITheme.toolbarButtonWidth : nil)
|
||||
fixedWidthRequest ?? (size == .icon ? AITheme.iconButtonSize : (size == .toolbar ? AITheme.toolbarButtonWidth : nil))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -697,3 +697,33 @@ public struct AIToolbarButton: View {
|
||||
.accessibilityLabel(title)
|
||||
}
|
||||
}
|
||||
|
||||
public struct AIIconButton: View {
|
||||
private let title: String
|
||||
private let systemImage: String
|
||||
private let kind: AIButtonStyle.Kind
|
||||
private let action: () -> Void
|
||||
|
||||
public init(
|
||||
_ title: String,
|
||||
systemImage: String,
|
||||
kind: AIButtonStyle.Kind = .secondary,
|
||||
action: @escaping () -> Void
|
||||
) {
|
||||
self.title = title
|
||||
self.systemImage = systemImage
|
||||
self.kind = kind
|
||||
self.action = action
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
Button {
|
||||
action()
|
||||
} label: {
|
||||
Image(systemName: systemImage)
|
||||
.font(.system(size: 16, weight: .semibold))
|
||||
}
|
||||
.buttonStyle(AIButtonStyle(kind: kind, size: .icon))
|
||||
.accessibilityLabel(title)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,6 @@ final class AppMetadataTests: XCTestCase {
|
||||
XCTAssertEqual(AppMetadata.name, "MultiSimAdmin")
|
||||
XCTAssertEqual(AppMetadata.bundleIdentifier, "fun.chick.multi-simadmin")
|
||||
XCTAssertEqual(AppMetadata.marketingVersion, "0.2.0")
|
||||
XCTAssertEqual(AppMetadata.buildVersion, "2")
|
||||
XCTAssertEqual(AppMetadata.buildVersion, "3")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ final class SettingsViewModelTests: XCTestCase {
|
||||
|
||||
XCTAssertEqual(model.runtime?.appName, "MultiSimAdmin")
|
||||
XCTAssertEqual(model.runtime?.marketingVersion, "0.2.0")
|
||||
XCTAssertEqual(model.runtime?.buildVersion, "2")
|
||||
XCTAssertEqual(model.runtime?.buildVersion, "3")
|
||||
XCTAssertEqual(model.runtime?.platform, "iOS")
|
||||
XCTAssertTrue(model.runtime?.deviceModel.isEmpty == false)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user