mirror of
https://github.com/shadowsocks/ShadowsocksX-NG.git
synced 2026-11-22 05:25:41 +00:00
App/ 根目录原有 73 个散落源文件,已无法从目录读出任何分组信息。 按「目录即分层」重组为 Composition / Application / Presentation / UI / PlatformEffects / Resources 六个目录,UI 层再按子视图分目录(Workspace、 Home、Servers(含 Plugin)、Subscriptions、Rules、Settings、Diagnostics、 StatusMenu)。纯移动:类型名、模块名与 import 均未改动,App/ 根层不再有 散落文件。 配套改动: - project.yml:Core 测试镜像的 excludes 由裸文件名改为 `**/` 递归形式。 XcodeGen 的 exclude 不跨 `/`,裸名只匹配 App 根层;MainApp.swift 下移后 旧写法会静默失效,把 @main 组合根编进测试镜像。info.path 与 entitlements.path 指向 App/Resources/;并排除 `**/*.md`——App/ 下任何 非源码文件都会被 XcodeGen 收进 Resources 阶段并封进签名后的 bundle。 - SkeletonTests 的架构守卫由「默认扫描全部 App/ + 7 个豁免文件 + 1 个豁免 前缀 + 4 个豁免目录」改为正面圈定 App/UI/,豁免登记全部删除;新增运行时 适配器放进 Application/ 即自动落在扫描范围外,无需再登记。 - README 工程结构说明同步;根 .gitignore 的生成物路径随 Resources/ 归位。 验证:clean build 0 error;task test 1022 用例全通过(含两个架构守卫); task format 无改动(证明纯移动);task lint 与移动前同为 21 条内容型 warning;packaging-gate.sh ALL CHECKS PASSED,确认 plist/entitlements 归位 后签名与 entitlements 语义不变。 注意:迁移时须先删旧的生成物再 xcodegen generate,否则遗留的 App/Info.plist 会被当作普通资源扫进 Resources 阶段。
86 lines
3.5 KiB
Swift
86 lines
3.5 KiB
Swift
import Foundation
|
|
|
|
/// Localized management feedback shared by the list and editor.
|
|
enum PluginManagementCopy {
|
|
static func error(_ error: Error) -> String {
|
|
guard let issue = error as? PluginMappingError else {
|
|
return String(localized: "无法保存插件配置,请检查配置文件的访问权限后重试。")
|
|
}
|
|
switch issue {
|
|
case .unreadable, .unsupportedVersion:
|
|
return String(localized: "无法读取插件配置。请修复配置文件后重试读取。")
|
|
case .invalidName:
|
|
return String(localized: "请输入插件名称;已保存的名称不能修改。")
|
|
case .nameExists:
|
|
return String(localized: "已有同名用户插件,请编辑现有条目或使用其他名称。")
|
|
case .invalidPath:
|
|
return String(localized: "请输入可执行文件的绝对路径。")
|
|
case .unavailableFile:
|
|
return String(localized: "文件不存在或不可执行,请选择可执行文件。")
|
|
case .nameMissing:
|
|
return String(localized: "该用户插件已不存在,请关闭表单后重试。")
|
|
}
|
|
}
|
|
|
|
static func source(_ entry: PluginCatalogSnapshot.Entry) -> String {
|
|
if entry.source == .managed { return String(localized: "内置") }
|
|
return ManagedPluginCatalog.info(forProgram: entry.program) == nil
|
|
? String(localized: "用户添加") : String(localized: "用户覆盖")
|
|
}
|
|
|
|
static func availability(_ value: PluginCatalogSnapshot.Availability) -> String? {
|
|
switch value {
|
|
case .available: nil
|
|
case .missing: String(localized: "插件文件不存在。")
|
|
case .notExecutable: String(localized: "插件文件不可执行。")
|
|
case .unreadable: String(localized: "无法读取插件文件。")
|
|
}
|
|
}
|
|
|
|
static func securitySummary(_ facts: PluginSecurityFacts) -> String? {
|
|
if facts.policy == .rejected {
|
|
return String(localized: "macOS 安全策略检查未通过,运行可能受到限制。")
|
|
}
|
|
if facts.quarantine == .present {
|
|
return String(localized: "文件带有下载隔离标记,运行时可能需要 macOS 授权。")
|
|
}
|
|
if facts.signature == .invalid {
|
|
return String(localized: "文件签名无效,运行可能受到 macOS 限制。")
|
|
}
|
|
if facts.signature == .unsigned {
|
|
return String(localized: "文件未签名,运行可能受到 macOS 限制。")
|
|
}
|
|
if facts.quarantine == .unknown || facts.signature == .unknown || facts.policy == .unknown {
|
|
return String(localized: "无法完成安全检查。")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
static func quarantine(_ value: PluginSecurityFacts.Quarantine) -> String {
|
|
switch value {
|
|
case .present: String(localized: "隔离标记:存在")
|
|
case .absent: String(localized: "隔离标记:无")
|
|
case .unknown: String(localized: "隔离标记:无法判断")
|
|
}
|
|
}
|
|
|
|
static func signature(_ value: PluginSecurityFacts.Signature) -> String {
|
|
switch value {
|
|
case .valid: String(localized: "签名:有效")
|
|
case .unsigned: String(localized: "签名:未签名")
|
|
case .invalid: String(localized: "签名:无效")
|
|
case .notApplicable: String(localized: "签名:不适用")
|
|
case .unknown: String(localized: "签名:无法判断")
|
|
}
|
|
}
|
|
|
|
static func policy(_ value: PluginSecurityFacts.Policy) -> String {
|
|
switch value {
|
|
case .accepted: String(localized: "安全策略:检查通过")
|
|
case .rejected: String(localized: "安全策略:检查未通过")
|
|
case .notApplicable: String(localized: "安全策略:不适用")
|
|
case .unknown: String(localized: "安全策略:无法判断")
|
|
}
|
|
}
|
|
}
|