升级 AppStore 缓存 Key 并在覆盖安装时强制重新登录。

统一账号作用域 Key 对齐 Android,新增缓存 schema 迁移清理旧数据,并同步更新相关模块与单元测试。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-14 09:35:55 +08:00
parent 05804ba7d6
commit c083f1d4b3
31 changed files with 852 additions and 123 deletions

View File

@ -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"
}
}