模块化 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

@ -24,8 +24,8 @@ final class HomeLocationStateStore {
init(store: AppStore = .shared) {
self.store = store
reminderMinutes = store.locationReminderMinutes
isOnline = store.onlineStatus
reminderMinutes = store.location.reminderMinutes
isOnline = store.location.onlineStatus
}
deinit {
@ -44,18 +44,18 @@ final class HomeLocationStateStore {
/// 线
func restoreStateIfNeeded() {
reminderMinutes = store.locationReminderMinutes
guard store.onlineStatus else {
reminderMinutes = store.location.reminderMinutes
guard store.location.onlineStatus else {
isOnline = false
stopCountdown()
notifyChange()
return
}
let lastTime = store.lastLocationReportTime
let lastTime = store.location.lastReportTime
guard lastTime > 0 else {
isOnline = false
store.onlineStatus = false
store.clearLastLocationReportTime()
store.location.onlineStatus = false
store.location.clearLastReportTime()
stopCountdown()
notifyChange()
return
@ -65,7 +65,7 @@ final class HomeLocationStateStore {
let elapsed = now - lastTime
if elapsed >= Self.onlineDurationMillis {
updateOnlineStatus(false)
store.clearLastLocationReportTime()
store.location.clearLastReportTime()
notifyChange()
return
}
@ -81,10 +81,10 @@ final class HomeLocationStateStore {
/// 线
func updateOnlineStatus(_ online: Bool) {
isOnline = online
store.onlineStatus = online
store.location.onlineStatus = online
if !online {
stopCountdown()
store.clearLastLocationReportTime()
store.location.clearLastReportTime()
}
notifyChange()
}
@ -92,16 +92,16 @@ final class HomeLocationStateStore {
///
func updateReminderMinutes(_ minutes: Int) {
reminderMinutes = minutes
store.locationReminderMinutes = minutes
store.location.reminderMinutes = minutes
notifyChange()
}
///
func startLocationReport(at timestamp: Int64 = Int64(Date().timeIntervalSince1970 * 1000)) {
anchorTimestamp = timestamp
store.lastLocationReportTime = timestamp
store.location.lastReportTime = timestamp
isOnline = true
store.onlineStatus = true
store.location.onlineStatus = true
elapsedSeconds = 0
nextReportCountdownSeconds = Self.onlineDurationMillis / 1000
startCountdown(anchorTime: timestamp)
@ -156,7 +156,7 @@ final class HomeLocationStateStore {
if remaining <= 0 {
self.nextReportCountdownSeconds = 0
self.updateOnlineStatus(false)
self.store.clearLastLocationReportTime()
self.store.location.clearLastReportTime()
return
}
self.nextReportCountdownSeconds = max(0, remaining / 1000)