升级 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

@ -23,16 +23,23 @@ final class AppPaymentStore {
///
var isOpenReceiveVoice: Bool {
get { defaults.bool(forKey: scopedKey(.isOpenReceiveVoice)) }
set { defaults.set(newValue, forKey: scopedKey(.isOpenReceiveVoice)) }
get {
guard let key = scopedKey(.isOpenReceiveVoice) else { return false }
return defaults.bool(forKey: key)
}
set {
guard let key = scopedKey(.isOpenReceiveVoice) else { return }
defaults.set(newValue, forKey: key)
}
}
///
func clear() {
Key.allCases.forEach { defaults.removeObject(forKey: scopedKey($0)) }
func clear(accountScope: String) {
guard !accountScope.isEmpty else { return }
Key.allCases.forEach { defaults.removeObject(forKey: "\(accountScope)_\($0.rawValue)") }
}
private func scopedKey(_ key: Key) -> String {
"\(session.accountCachePrefix)_\(key.rawValue)"
private func scopedKey(_ key: Key) -> String? {
session.accountScopedKey(key.rawValue)
}
}