feat(ios): refine native ui controls

This commit is contained in:
chick
2026-09-09 11:14:39 +08:00
parent c568e496b2
commit 995206ac23
18 changed files with 397 additions and 212 deletions
@@ -31,7 +31,6 @@ struct SettingsView: View {
runtimeCard
storageCard
securityCard
backgroundCard
}
.padding(16)
}
@@ -71,10 +70,8 @@ struct SettingsView: View {
VStack(alignment: .leading, spacing: 12) {
sectionTitle("应用信息", systemImage: "info.circle")
if let runtime = model.runtime {
infoRow("名称", runtime.appName)
infoRow("版本", "\(runtime.marketingVersion) (\(runtime.buildVersion))")
infoRow("标识符", AppMetadata.bundleIdentifier)
infoRow("设备", "\(runtime.platform) · \(runtime.deviceModel)")
infoRow("设备", runtime.deviceModel)
} else {
Text("正在读取应用信息…")
.font(.subheadline)
@@ -88,15 +85,15 @@ struct SettingsView: View {
AICard {
VStack(alignment: .leading, spacing: 12) {
sectionTitle("本地数据", systemImage: "externaldrive")
infoRow("实例配置", "App Documents/instances.json")
infoRow("日志中心", "App Documents/log-center.json")
infoRow("日志数量", model.storageLabel)
infoRow("存储位置", "仅保存在本机应用沙盒")
infoRow("当前占用", model.storageLabel)
Button {
showsClearDialog = true
} label: {
Label("清除运行日志", systemImage: "trash")
}
.buttonStyle(AIButtonStyle(kind: .danger, size: .regular))
.frame(maxWidth: .infinity)
.buttonStyle(AIButtonStyle(kind: .danger, size: .large))
}
}
}
@@ -107,25 +104,6 @@ struct SettingsView: View {
sectionTitle("安全与登录", systemImage: "lock.shield")
infoRow("实例密码", "保存在 iOS 钥匙串")
infoRow("登录会话", "仅保存在内存")
infoRow("访问密码", "已停用")
}
}
}
private var backgroundCard: some View {
AICard {
VStack(alignment: .leading, spacing: 12) {
sectionTitle("后台能力", systemImage: "clock.badge.exclamationmark")
Text(model.serverCapabilitiesNotice)
.font(.subheadline)
.foregroundStyle(AITheme.muted)
if model.serverCapabilities.isEmpty {
AITag("无后台任务", tint: AITheme.muted)
} else {
ForEach(model.serverCapabilities) { capability in
infoRow(capability.name, capability.detail)
}
}
}
}
}
@@ -9,19 +9,11 @@ struct SettingsRuntime: Equatable {
let deviceModel: String
}
struct ServerCapability: Equatable, Identifiable {
let id: String
let name: String
let detail: String
}
@MainActor
final class SettingsViewModel: ObservableObject {
@Published private(set) var runtime: SettingsRuntime?
@Published private(set) var serverCapabilities: [ServerCapability] = []
@Published private(set) var isLoading = false
@Published var storageLabel = "--"
@Published var serverCapabilitiesNotice = ""
@Published var notice: String?
@Published var errorMessage: String?
@@ -42,8 +34,6 @@ final class SettingsViewModel: ObservableObject {
platform: "iOS",
deviceModel: Self.deviceModel()
)
serverCapabilities = []
serverCapabilitiesNotice = "定时任务与后台刷新已在 iOS 版停用。"
await loadStorageLabel()
isLoading = false