feat(updates): 使用 Sparkle 从发布 ZIP 下载并重启更新
This commit is contained in:
@@ -100,24 +100,22 @@ struct AppearanceSettingsView: View {
|
||||
Section {
|
||||
Toggle("updates.automatic", isOn: $updates.automatic)
|
||||
.toggleStyle(.checkbox)
|
||||
Text("updates.schedule").font(.callout).foregroundStyle(.secondary)
|
||||
HStack {
|
||||
Button("updates.check") { updates.check() }
|
||||
.disabled(updates.phase == .checking)
|
||||
switch updates.phase {
|
||||
case .idle: EmptyView()
|
||||
case .checking: Text("updates.checking").foregroundStyle(.secondary)
|
||||
case .failed: Text("updates.failed").foregroundStyle(.secondary)
|
||||
case .checked:
|
||||
if updates.available == nil { Text("updates.current").foregroundStyle(.secondary) }
|
||||
if let version = updates.version {
|
||||
Text("updates.new \(version.label)")
|
||||
} else if updates.phase == .current {
|
||||
Text("updates.current").foregroundStyle(.secondary)
|
||||
}
|
||||
Spacer()
|
||||
UpdateAction(phase: updates.phase, version: updates.version, action: updates.performAction)
|
||||
}
|
||||
if let release = updates.available {
|
||||
let display = release.build.map { "\(release.tagName) (\($0))" } ?? release.tagName
|
||||
LabeledContent {
|
||||
Link("updates.releasePage", destination: release.page)
|
||||
} label: {
|
||||
Text("updates.new \(display)")
|
||||
}
|
||||
if updates.phase == .downloading || updates.phase == .extracting {
|
||||
ProgressView(value: updates.fraction).progressViewStyle(.linear)
|
||||
}
|
||||
if let error = updates.errorMessage {
|
||||
Text(verbatim: error).font(.callout).foregroundStyle(.secondary)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user