Migrate from iOS 17 Observation to iOS 16-compatible Combine architecture.
Lower deployment target to iOS 16, replace @Observable with ObservableObject, add navigation and UI compatibility shims, and include login smoke UI tests. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -6,21 +6,20 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Observation
|
||||
import Combine
|
||||
|
||||
@MainActor
|
||||
@Observable
|
||||
/// 数据统计页面 ViewModel,管理时间段、汇总数据、每日明细和分页状态。
|
||||
final class StatisticsViewModel {
|
||||
var selectedPeriod: StatisticsPeriod = .today
|
||||
private(set) var loading = false
|
||||
private(set) var loadingMore = false
|
||||
private(set) var summary = StatisticsSummaryResponse()
|
||||
private(set) var dailyItems: [StatisticsDailyItem] = []
|
||||
private(set) var totalDailyCount = 0
|
||||
private(set) var lastRefreshAt: Date?
|
||||
final class StatisticsViewModel: ObservableObject {
|
||||
@Published var selectedPeriod: StatisticsPeriod = .today
|
||||
@Published private(set) var loading = false
|
||||
@Published private(set) var loadingMore = false
|
||||
@Published private(set) var summary = StatisticsSummaryResponse()
|
||||
@Published private(set) var dailyItems: [StatisticsDailyItem] = []
|
||||
@Published private(set) var totalDailyCount = 0
|
||||
@Published private(set) var lastRefreshAt: Date?
|
||||
|
||||
private var page = 1
|
||||
@Published private var page = 1
|
||||
private let pageSize = 15
|
||||
|
||||
/// 当前日数据是否还有下一页。
|
||||
|
||||
Reference in New Issue
Block a user