From d3fc15dfdfa675ce627cc3451a5e0c6f1a4f44e5 Mon Sep 17 00:00:00 2001 From: Qiu Yuzhou Date: Thu, 15 Oct 2026 23:03:15 +0800 Subject: [PATCH] refactor(ui): remove home quick action card --- .../App/Resources/Localizable.xcstrings | 51 ------------- ShadowsocksX-NG2/App/UI/Home/HomeView.swift | 5 +- .../App/UI/Home/QuickActionCard.swift | 74 ------------------- 3 files changed, 2 insertions(+), 128 deletions(-) delete mode 100644 ShadowsocksX-NG2/App/UI/Home/QuickActionCard.swift diff --git a/ShadowsocksX-NG2/App/Resources/Localizable.xcstrings b/ShadowsocksX-NG2/App/Resources/Localizable.xcstrings index 1bcd49ff..ac5a5168 100644 --- a/ShadowsocksX-NG2/App/Resources/Localizable.xcstrings +++ b/ShadowsocksX-NG2/App/Resources/Localizable.xcstrings @@ -5134,23 +5134,6 @@ } } }, - "快速操作": { - "extractionState": "manual", - "localizations": { - "zh-Hans": { - "stringUnit": { - "state": "translated", - "value": "快速操作" - } - }, - "en": { - "stringUnit": { - "state": "translated", - "value": "Quick actions" - } - } - } - }, "所有系统代理流量通过本地 SOCKS 与 HTTP 入口转发,不使用规则分流。": { "extractionState": "manual", "localizations": { @@ -5814,23 +5797,6 @@ } } }, - "更新全部订阅": { - "extractionState": "manual", - "localizations": { - "zh-Hans": { - "stringUnit": { - "state": "translated", - "value": "更新全部订阅" - } - }, - "en": { - "stringUnit": { - "state": "translated", - "value": "Refresh All Subscriptions" - } - } - } - }, "有 %lld 台服务器因 UUID 缺失、无效、重复或冲突而生成了新身份。": { "extractionState": "manual", "localizations": { @@ -6421,23 +6387,6 @@ } } }, - "正在更新…": { - "extractionState": "manual", - "localizations": { - "zh-Hans": { - "stringUnit": { - "state": "translated", - "value": "正在更新…" - } - }, - "en": { - "stringUnit": { - "state": "translated", - "value": "Refreshing…" - } - } - } - }, "此操作不可撤销。": { "extractionState": "manual", "localizations": { diff --git a/ShadowsocksX-NG2/App/UI/Home/HomeView.swift b/ShadowsocksX-NG2/App/UI/Home/HomeView.swift index 9745db97..f265e2e2 100644 --- a/ShadowsocksX-NG2/App/UI/Home/HomeView.swift +++ b/ShadowsocksX-NG2/App/UI/Home/HomeView.swift @@ -1,7 +1,7 @@ import SwiftUI -/// 首页分区:代理模式切换、运行控制、终端代理环境变量 -/// 命令与快速操作。模式与两个开关(agent/系统代理)走代理控制 +/// 首页分区:代理模式切换、运行控制、终端代理环境变量命令。 +/// 模式与两个开关(agent/系统代理)走代理控制 /// 工作流的整体 snapshot;命令复制是 UI 副作用。三种模式(规则/全局/直连) /// 与规则子选项共用同一快照。 struct HomeView: View { @@ -26,7 +26,6 @@ struct HomeView: View { RuntimeControlCard(control: control) ModeCard(control: control) TerminalProxyEnvironmentCard(control: control, clipboard: clipboard, errors: errors) - QuickActionCard(workflow: workflow) } .frame(width: 400) } diff --git a/ShadowsocksX-NG2/App/UI/Home/QuickActionCard.swift b/ShadowsocksX-NG2/App/UI/Home/QuickActionCard.swift deleted file mode 100644 index e5406cca..00000000 --- a/ShadowsocksX-NG2/App/UI/Home/QuickActionCard.swift +++ /dev/null @@ -1,74 +0,0 @@ -import SwiftUI - -/// 「快速操作」卡:更新全部订阅。 -struct QuickActionCard: View { - @ObservedObject var workflow: CatalogWorkflow - - @State private var isRefreshingAll = false - - var body: some View { - HomeCard( - title: String(localized: "快速操作"), - subtitle: nil, - trailing: { EmptyView() }, - content: { - VStack(spacing: 10) { - QuickActionButton( - icon: "arrow.triangle.2.circlepath", - title: isRefreshingAll ? String(localized: "正在更新…") : String(localized: "更新全部订阅"), - help: nil, - action: refreshAll - ) - .disabled(workflow.subscriptions.isEmpty || isRefreshingAll) - if isRefreshingAll { - ProgressView() - .controlSize(.small) - .frame(maxWidth: .infinity, alignment: .leading) - } - } - .padding(.top, 6) - }) - } - - private func refreshAll() { - isRefreshingAll = true - Task { - await workflow.refreshAllSubscriptions() - isRefreshingAll = false - } - } - -} - -/// 快速操作行按钮。 -struct QuickActionButton: View { - let icon: String - let title: String - var help: String? - let action: () -> Void - - var body: some View { - Button(action: action) { - HStack(spacing: 10) { - Image(systemName: icon) - .foregroundStyle(.tint) - Text(title) - .font(.callout.weight(.medium)) - .foregroundStyle(.primary) - .lineLimit(1) - Spacer(minLength: 0) - Image(systemName: "arrow.right") - .font(.caption.weight(.semibold)) - .foregroundStyle(.tertiary) - } - .padding(.horizontal, 12) - .padding(.vertical, 10) - .contentShape(Rectangle()) - } - .buttonStyle(.plain) - .background( - .quaternary.opacity(0.5), in: RoundedRectangle(cornerRadius: 8, style: .continuous) - ) - .help(help ?? title) - } -}