feat: Add a second confirmation when canceling a task

This commit is contained in:
X1a0He
2025-03-27 21:50:38 +08:00
parent a03590bc71
commit cfdd0ed696
6 changed files with 71 additions and 55 deletions

View File

@@ -31,7 +31,7 @@
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Release"
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"

View File

@@ -59,7 +59,7 @@ struct DownloadManagerView: View {
)
}
.background(Color(.clear))
.frame(width:800, height: 600)
.frame(width:750, height: 500)
}
}

View File

@@ -22,6 +22,7 @@ struct DownloadProgressView: View {
@State private var showCommandLineInstall = false
@State private var showCopiedAlert = false
@State private var showDeleteConfirmation = false
@State private var showCancelConfirmation = false
private var statusLabel: some View {
Text(task.status.description)
@@ -82,7 +83,7 @@ struct DownloadProgressView: View {
}
.buttonStyle(BeautifulButtonStyle(baseColor: .orange))
Button(action: onCancel) {
Button(action: { showCancelConfirmation = true }) {
Label("取消", systemImage: "xmark")
.font(.system(size: 13, weight: .medium))
.foregroundColor(.white)
@@ -97,7 +98,7 @@ struct DownloadProgressView: View {
}
.buttonStyle(BeautifulButtonStyle(baseColor: .blue))
Button(action: onCancel) {
Button(action: { showCancelConfirmation = true }) {
Label("取消", systemImage: "xmark")
.font(.system(size: 13, weight: .medium))
.foregroundColor(.white)
@@ -191,7 +192,7 @@ struct DownloadProgressView: View {
}
case .retrying:
Button(action: onCancel) {
Button(action: { showCancelConfirmation = true }) {
Label("取消", systemImage: "xmark")
.font(.system(size: 13, weight: .medium))
.foregroundColor(.white)
@@ -199,14 +200,22 @@ struct DownloadProgressView: View {
.buttonStyle(BeautifulButtonStyle(baseColor: .red))
}
}
.alert("确认删除", isPresented: $showDeleteConfirmation) {
.alert("确认你的操作", isPresented: $showDeleteConfirmation) {
Button("取消", role: .cancel) { }
Button("删除", role: .destructive) {
Button("确认", role: .destructive) {
onRemove()
}
} message: {
Text("确定要删除任务\(task.displayName)吗?")
}
.alert("请确认你的操作", isPresented: $showCancelConfirmation) {
Button("返回", role: .cancel) { }
Button("确认取消", role: .destructive) {
onCancel()
}
} message: {
Text("确定要取消\(task.displayName)的下载吗?")
}
.sheet(isPresented: $showInstallPrompt) {
if task.displayInstallButton {
VStack(spacing: 20) {
@@ -673,6 +682,15 @@ private struct PackageListView: View {
.buttonStyle(BeautifulButtonStyle(baseColor: .blue))
#endif
#if DEBUG
if case .completed = task.status, task.productId != "APRO" {
CommandLineInstallButton(
task: task,
showCommandLineInstall: $showCommandLineInstall,
showCopiedAlert: $showCopiedAlert
)
}
#else
if !ModifySetup.isSetupModified(), case .completed = task.status {
HStack {
Image(systemName: "exclamationmark.triangle.fill")
@@ -696,17 +714,7 @@ private struct PackageListView: View {
}
.padding(.top, 5)
}
if case .completed = task.status, task.productId != "APRO" {
if ModifySetup.isSetupModified() {
CommandLineInstallButton(
task: task,
showCommandLineInstall: $showCommandLineInstall,
showCopiedAlert: $showCopiedAlert
)
}
}
#endif
actionButtons
}

View File

@@ -89,7 +89,7 @@ struct ProductGridView: View {
HStack(spacing: 8) {
Capsule()
.fill(Color.secondary.opacity(0.2))
.fill(Color.green)
.frame(width: 6, height: 6)
Text("获取到 \(products.count) 款产品")
.font(.system(size: 12))

View File

@@ -135,7 +135,7 @@ private struct VersionListView: View {
HStack(spacing: 8) {
Capsule()
.fill(Color.secondary.opacity(0.2))
.fill(Color.green)
.frame(width: 6, height: 6)
Text("获取到 \(filteredVersions.count) 个版本")
.font(.system(size: 12))
@@ -144,7 +144,7 @@ private struct VersionListView: View {
.padding(.bottom, 16)
}
}
.background(Color(NSColor.windowBackgroundColor))
.background(Color(.clear))
}
private var filteredVersions: [(key: String, value: Product.Platform)] {
@@ -455,10 +455,7 @@ private struct DependenciesList: View {
.fill(Color.blue.opacity(0.1))
)
.foregroundColor(.blue.opacity(0.8))
}
.padding(.vertical, 2)
HStack(spacing: 10) {
if dependency.baseVersion != dependency.productVersion {
HStack(spacing: 3) {
Text("base:")
@@ -468,12 +465,17 @@ private struct DependenciesList: View {
.font(.system(size: 10, weight: .medium))
.foregroundColor(.secondary.opacity(0.9))
}
.padding(.horizontal, 4)
.padding(.horizontal, 5)
.padding(.vertical, 1)
.background(Color.secondary.opacity(0.07))
.cornerRadius(2)
.background(
RoundedRectangle(cornerRadius: 3)
.fill(Color.secondary.opacity(0.1))
)
}
}
.padding(.vertical, 2)
HStack(spacing: 10) {
if !dependency.buildGuid.isEmpty {
HStack(spacing: 3) {
Text("buildGuid:")

View File

@@ -26,9 +26,6 @@
}
}
}
},
"(可能导致处理失败)" : {
},
"(将导致无法使用安装功能)" : {
"extractionState" : "stale",
@@ -40,9 +37,6 @@
}
}
}
},
"(无法使用安装功能)" : {
},
"/" : {
@@ -154,6 +148,12 @@
}
}
}
},
"✅" : {
},
"❌" : {
},
"🔔 即将下载 %@ (%@) 版本 🔔" : {
"extractionState" : "stale",
@@ -308,7 +308,6 @@
},
"Debug 模式" : {
"extractionState" : "stale",
"localizations" : {
"en" : {
"stringUnit" : {
@@ -384,9 +383,6 @@
}
}
}
},
"Helper 未连接" : {
},
"Helper 状态: " : {
"extractionState" : "stale",
@@ -456,9 +452,15 @@
},
"macOS %@" : {
},
"Match:" : {
},
"OK" : {
},
"Reason:" : {
},
"Setup 组件安装成功" : {
"extractionState" : "stale",
@@ -490,9 +492,6 @@
}
}
}
},
"Setup 组件未处理,无法安装" : {
},
"Setup未备份提示" : {
"localizations" : {
@@ -503,6 +502,9 @@
}
}
}
},
"Target:" : {
},
"v%@" : {
@@ -1172,6 +1174,9 @@
}
}
}
},
"可选模块" : {
},
"命令已复制到剪贴板" : {
@@ -1474,7 +1479,6 @@
}
},
"将执行的命令:" : {
"extractionState" : "stale",
"localizations" : {
"en" : {
"stringUnit" : {
@@ -1518,7 +1522,6 @@
},
"展开全部" : {
"extractionState" : "stale",
"localizations" : {
"en" : {
"stringUnit" : {
@@ -1545,6 +1548,7 @@
},
"已处理" : {
"extractionState" : "stale",
"localizations" : {
"en" : {
"stringUnit" : {
@@ -1555,6 +1559,7 @@
}
},
"已备份" : {
"extractionState" : "stale",
"localizations" : {
"en" : {
"stringUnit" : {
@@ -1774,7 +1779,6 @@
}
},
"折叠全部" : {
"extractionState" : "stale",
"localizations" : {
"en" : {
"stringUnit" : {
@@ -2121,12 +2125,6 @@
}
}
}
},
"未处理" : {
},
"未备份" : {
},
"未安装" : {
"localizations" : {
@@ -2139,7 +2137,6 @@
}
},
"未对 Setup 组件进行处理或者 Setup 组件不存在,无法使用安装功能\n你可以通过设置页面再次对 Setup 组件进行处理" : {
"extractionState" : "stale",
"localizations" : {
"en" : {
"stringUnit" : {
@@ -2148,9 +2145,6 @@
}
}
}
},
"未对 Setup 组件进行处理或者 Setup 组件不存在,无法使用安装功能\n你可以通过设置页面对 Setup 组件进行处理" : {
},
"未找到 Setup 组件" : {
"localizations" : {
@@ -2231,6 +2225,9 @@
},
"查看" : {
},
"查看持久化文件" : {
},
"检查中" : {
"localizations" : {
@@ -2646,6 +2643,9 @@
},
"确定要删除任务%@吗?" : {
},
"确定要取消%@的下载吗?" : {
},
"确定要重新处理 Setup 组件吗?这将对 Setup 组件进行修改以启用安装功能。" : {
@@ -2680,7 +2680,7 @@
}
}
},
"确认删除" : {
"确认取消" : {
},
"确认处理" : {
@@ -2963,6 +2963,9 @@
}
}
}
},
"请确认你的操作" : {
},
"运行正常" : {
"localizations" : {
@@ -2973,6 +2976,9 @@
}
}
}
},
"返回" : {
},
"这将删除所选的 Adobe 相关文件,该操作不可撤销。清理过程不会影响 Adobe Downloader 的文件和下载数据。是否继续?" : {
"localizations" : {