fix: 安全审查 P3 问题修复(10项)
无障碍与用户体验: - 补全 OnboardingView/ProcessingView/ResultView/WallpaperGuideView 无障碍标注 - ContentView 添加后台切换截屏保护(模糊覆盖层) - EditorView iPad 右侧面板改为响应式宽度(minWidth:320, maxWidth:420) - ResultView CelebrationParticles 改用 Task 替代 DispatchQueue 延迟 - DesignSystem accessibility key 从中文改为英文 - EditorView/WallpaperGuideView 生成按钮 accentColor 统一为设计系统 - OnboardingView 第四页添加相册权限预告提示 核心库优化: - LivePhotoLogger 添加日志安全注释 - CacheManager.makeWorkPaths 添加磁盘空间预检查(<500MB 报错) - ImageFormatConverter BGRA/ARGB 转换改用 vImagePermuteChannels 加速 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -260,6 +260,18 @@ public struct CacheManager: Sendable {
|
||||
}
|
||||
|
||||
public func makeWorkPaths(workId: UUID) throws -> LivePhotoWorkPaths {
|
||||
// 检查可用磁盘空间(视频处理需要约 500MB 临时空间)
|
||||
let resourceValues = try baseDirectory.resourceValues(forKeys: [.volumeAvailableCapacityForImportantUsageKey])
|
||||
if let availableCapacity = resourceValues.volumeAvailableCapacityForImportantUsage,
|
||||
availableCapacity < 500_000_000 {
|
||||
throw AppError(
|
||||
code: "LPB-001",
|
||||
stage: .normalize,
|
||||
message: String(localized: "error.insufficientDiskSpace"),
|
||||
suggestedActions: [String(localized: "error.clearCache"), String(localized: "error.freeSpace")]
|
||||
)
|
||||
}
|
||||
|
||||
let workDir = baseDirectory.appendingPathComponent(workId.uuidString, isDirectory: true)
|
||||
try FileManager.default.createDirectory(at: workDir, withIntermediateDirectories: true)
|
||||
return LivePhotoWorkPaths(
|
||||
@@ -291,10 +303,14 @@ public struct LivePhotoLogger: Sendable {
|
||||
self.logger = os.Logger(subsystem: subsystem, category: category)
|
||||
}
|
||||
|
||||
/// 记录信息级别日志
|
||||
/// - Important: 日志使用 .public 隐私级别,不要在消息中包含用户输入内容、个人信息或文件路径中的用户名
|
||||
public func info(_ message: String) {
|
||||
logger.info("\(message, privacy: .public)")
|
||||
}
|
||||
|
||||
/// 记录错误级别日志
|
||||
/// - Important: 日志使用 .public 隐私级别,不要在消息中包含用户输入内容、个人信息或文件路径中的用户名
|
||||
public func error(_ message: String) {
|
||||
logger.error("\(message, privacy: .public)")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user