From 7f1dbc6d94d5896345869bd031b487aadb7d78cd Mon Sep 17 00:00:00 2001 From: Qiu Yuzhou Date: Sun, 4 Oct 2026 12:37:06 +0800 Subject: [PATCH] =?UTF-8?q?refactor(ui):=20=E7=B3=BB=E7=BB=9F=E4=BB=A3?= =?UTF-8?q?=E7=90=86=E6=9A=82=E5=81=9C=E4=B8=8E=E4=B8=8D=E5=8F=AF=E8=AF=BB?= =?UTF-8?q?=E6=96=87=E6=A1=88=E6=94=B6=E6=88=90=E5=8D=95=E4=B8=80=E5=91=88?= =?UTF-8?q?=E7=8E=B0=E5=B8=B8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ShadowsocksX-NG2/App/ErrorPresentation+Runtime.swift | 8 +++++++- ShadowsocksX-NG2/App/RuntimeControlCard.swift | 5 +++-- ShadowsocksX-NG2/App/StatusMenuModel.swift | 5 +++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ShadowsocksX-NG2/App/ErrorPresentation+Runtime.swift b/ShadowsocksX-NG2/App/ErrorPresentation+Runtime.swift index 1ef91fc8..2077b6e3 100644 --- a/ShadowsocksX-NG2/App/ErrorPresentation+Runtime.swift +++ b/ShadowsocksX-NG2/App/ErrorPresentation+Runtime.swift @@ -3,6 +3,12 @@ import Foundation // MARK: - 运行时失败事实的呈现(RuntimeFailureFacts / 系统代理应用态) extension AppPresentation { + /// 系统代理暂停的统一文案:状态菜单、运行控制卡与错误呈现边三面共用。 + static let systemProxyPausedNotice = "后台代理不可用,已清除系统代理配置。恢复后将自动应用。" + + /// 系统代理配置不可读的统一前缀:状态菜单与运行控制卡差异区共用。 + static let systemProxyUnreadablePrefix = "无法读取网络接口的代理配置:" + static func message(for failure: RuntimeFailureFacts) -> String { switch failure { case .firewallBlocked(let facts): @@ -27,7 +33,7 @@ extension AppPresentation { case .changed: return "系统代理配置已改变" case .applying: return "系统代理应用中" case .repairing: return "系统代理修复中" - case .paused: return "后台代理不可用,已清除系统代理配置。恢复后将自动应用。" + case .paused: return systemProxyPausedNotice } } diff --git a/ShadowsocksX-NG2/App/RuntimeControlCard.swift b/ShadowsocksX-NG2/App/RuntimeControlCard.swift index 092148fc..f194a3d4 100644 --- a/ShadowsocksX-NG2/App/RuntimeControlCard.swift +++ b/ShadowsocksX-NG2/App/RuntimeControlCard.swift @@ -103,7 +103,7 @@ struct RuntimeControlCard: View { case .failed, .repairFailed, .clearFailed: "操作失败,原因见下方" case .paused: - "后台代理不可用,已清除系统代理配置。恢复后将自动应用。" + AppPresentation.systemProxyPausedNotice case .changed: "当前系统代理配置与预期存在差异" case .unreadable: @@ -146,7 +146,8 @@ private struct SystemProxyDifferenceView: View { control.snapshot.systemProxyApplication != .unreadable(failure) { Text( - "无法读取网络接口的代理配置:\(AppPresentation.message(for: RuntimeFailureFacts.systemProxy(failure)))" + AppPresentation.systemProxyUnreadablePrefix + + AppPresentation.message(for: RuntimeFailureFacts.systemProxy(failure)) ) .font(.caption) .foregroundStyle(.orange) diff --git a/ShadowsocksX-NG2/App/StatusMenuModel.swift b/ShadowsocksX-NG2/App/StatusMenuModel.swift index e903cc13..50065c36 100644 --- a/ShadowsocksX-NG2/App/StatusMenuModel.swift +++ b/ShadowsocksX-NG2/App/StatusMenuModel.swift @@ -97,11 +97,12 @@ enum StatusMenuModel { case .applying: return ("应用中", nil) case .repairing: return ("修复中", nil) case .paused: - return ("已暂停", "后台代理不可用,已清除系统代理配置。恢复后将自动应用。") + return ("已暂停", AppPresentation.systemProxyPausedNotice) case .unreadable(let facts): return ( "无法检查", - "无法读取网络接口的代理配置:\(AppPresentation.message(for: RuntimeFailureFacts.systemProxy(facts)))" + AppPresentation.systemProxyUnreadablePrefix + + AppPresentation.message(for: RuntimeFailureFacts.systemProxy(facts)) ) case .repairFailed(let facts): return (