feat: 更新依赖和项目配置,优化代码结构
- 在Package.swift中注释掉旧的swift-composable-architecture依赖,并添加swift-case-paths依赖。 - 在Podfile中将iOS平台版本更新至16.0,并移除QCloudCOSXML/Transfer依赖,改为使用QCloudCOSXML。 - 更新Podfile.lock以反映依赖变更,确保项目依赖的准确性。 - 新增架构分析需求文档,明确项目架构评估和改进建议。 - 在多个文件中实现async/await语法,提升异步操作的可读性和性能。 - 更新日志输出方法,确保在调试模式下提供一致的调试信息。 - 优化多个视图组件,提升用户体验和代码可维护性。
This commit is contained in:
@@ -12,10 +12,11 @@ import Security
|
||||
/// - 完善的错误处理
|
||||
/// - 线程安全操作
|
||||
/// - 可配置的访问控制级别
|
||||
@MainActor
|
||||
final class KeychainManager {
|
||||
|
||||
// MARK: - 单例
|
||||
static let shared = KeychainManager()
|
||||
@MainActor static let shared = KeychainManager()
|
||||
private init() {}
|
||||
|
||||
// MARK: - 配置常量
|
||||
@@ -108,7 +109,7 @@ final class KeychainManager {
|
||||
throw KeychainError.keychainOperationFailed(status)
|
||||
}
|
||||
|
||||
debugInfo("🔐 Keychain 存储成功: \(key)")
|
||||
debugInfoSync("🔐 Keychain 存储成功: \(key)")
|
||||
}
|
||||
|
||||
/// 从 Keychain 检索 Codable 对象
|
||||
@@ -137,7 +138,7 @@ final class KeychainManager {
|
||||
// 4. 解码数据
|
||||
do {
|
||||
let object = try JSONDecoder().decode(type, from: data)
|
||||
debugInfo("🔐 Keychain 读取成功: \(key)")
|
||||
debugInfoSync("🔐 Keychain 读取成功: \(key)")
|
||||
return object
|
||||
} catch {
|
||||
throw KeychainError.decodingFailed(error)
|
||||
@@ -176,7 +177,7 @@ final class KeychainManager {
|
||||
|
||||
switch status {
|
||||
case errSecSuccess:
|
||||
debugInfo("🔐 Keychain 更新成功: \(key)")
|
||||
debugInfoSync("🔐 Keychain 更新成功: \(key)")
|
||||
|
||||
case errSecItemNotFound:
|
||||
// 如果项目不存在,则创建新项目
|
||||
@@ -196,7 +197,7 @@ final class KeychainManager {
|
||||
|
||||
switch status {
|
||||
case errSecSuccess:
|
||||
debugInfo("🔐 Keychain 删除成功: \(key)")
|
||||
debugInfoSync("🔐 Keychain 删除成功: \(key)")
|
||||
|
||||
case errSecItemNotFound:
|
||||
// 项目不存在,视为删除成功
|
||||
@@ -231,7 +232,7 @@ final class KeychainManager {
|
||||
|
||||
switch status {
|
||||
case errSecSuccess, errSecItemNotFound:
|
||||
debugInfo("🔐 Keychain 清除完成")
|
||||
debugInfoSync("🔐 Keychain 清除完成")
|
||||
|
||||
default:
|
||||
throw KeychainError.keychainOperationFailed(status)
|
||||
@@ -353,10 +354,10 @@ extension KeychainManager {
|
||||
/// 打印所有存储的键(仅用于调试)
|
||||
func debugPrintAllKeys() {
|
||||
let keys = debugListAllKeys()
|
||||
debugInfo("🔐 Keychain 中存储的键:")
|
||||
debugInfoSync("🔐 Keychain 中存储的键:")
|
||||
for key in keys {
|
||||
debugInfo(" - \(key)")
|
||||
debugInfoSync(" - \(key)")
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user