模块化 AppStore 并完善素材管理与个人空间设置。

将会话、权限、位置、收款与排队存储拆分为独立模块,同步更新各 ViewModel 与单元测试,并补充素材管理 UI 与个人空间设置交互。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-13 11:01:08 +08:00
parent ceca780ab3
commit 005349f8e6
128 changed files with 2953 additions and 1123 deletions

View File

@ -0,0 +1,57 @@
//
// AppLocationStore.swift
// suixinkan
//
import Foundation
///
final class AppLocationStore {
private enum Key: String, CaseIterable {
case onlineStatus = "key_online_status"
case lastReportTime = "key_last_location_report_time"
case reminderMinutes = "key_location_reminder_minutes"
}
private let defaults: UserDefaults
private let session: AppSessionStore
/// 使
init(defaults: UserDefaults, session: AppSessionStore) {
self.defaults = defaults
self.session = session
}
/// 线
var onlineStatus: Bool {
get { defaults.bool(forKey: scopedKey(.onlineStatus)) }
set { defaults.set(newValue, forKey: scopedKey(.onlineStatus)) }
}
///
var lastReportTime: Int64 {
get { Int64(defaults.integer(forKey: scopedKey(.lastReportTime))) }
set { defaults.set(Int(newValue), forKey: scopedKey(.lastReportTime)) }
}
/// 0
var reminderMinutes: Int {
get { defaults.integer(forKey: scopedKey(.reminderMinutes)) }
set { defaults.set(newValue, forKey: scopedKey(.reminderMinutes)) }
}
///
func clearLastReportTime() {
defaults.removeObject(forKey: scopedKey(.lastReportTime))
}
///
func clear() {
Key.allCases.forEach { defaults.removeObject(forKey: scopedKey($0)) }
}
private func scopedKey(_ key: Key) -> String {
"\(session.accountCachePrefix)_\(key.rawValue)"
}
}