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 (