升级 AppStore 缓存 Key 并在覆盖安装时强制重新登录。
统一账号作用域 Key 对齐 Android,新增缓存 schema 迁移清理旧数据,并同步更新相关模块与单元测试。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -16,12 +16,14 @@ final class HomeCommonMenuStore {
|
||||
|
||||
/// 读取已保存的常用 URI;无记录时返回空数组。
|
||||
func savedCommonURIs(accountScope: String, roleCode: String) -> [String] {
|
||||
defaults.stringArray(forKey: storageKey(accountScope: accountScope, roleCode: roleCode)) ?? []
|
||||
guard let key = storageKey(accountScope: accountScope, roleCode: roleCode) else { return [] }
|
||||
return defaults.stringArray(forKey: key) ?? []
|
||||
}
|
||||
|
||||
/// 保存常用 URI 列表。
|
||||
func saveCommonURIs(_ uris: [String], accountScope: String, roleCode: String) {
|
||||
defaults.set(uris, forKey: storageKey(accountScope: accountScope, roleCode: roleCode))
|
||||
guard let key = storageKey(accountScope: accountScope, roleCode: roleCode) else { return }
|
||||
defaults.set(uris, forKey: key)
|
||||
}
|
||||
|
||||
/// 根据权限生成默认常用 URI(最多 4 个)。
|
||||
@ -54,7 +56,10 @@ final class HomeCommonMenuStore {
|
||||
return (common, more)
|
||||
}
|
||||
|
||||
private func storageKey(accountScope: String, roleCode: String) -> String {
|
||||
"\(accountScope)_role_\(roleCode)_common_uris"
|
||||
private func storageKey(accountScope: String, roleCode: String) -> String? {
|
||||
let normalizedScope = accountScope.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
let normalizedRoleCode = roleCode.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
guard !normalizedScope.isEmpty, !normalizedRoleCode.isEmpty else { return nil }
|
||||
return "\(normalizedScope)_role_\(normalizedRoleCode)_common_uris"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user