从 iOS 17 Observation 迁移至 iOS 16 兼容的 Combine 架构

将最低部署版本降至 iOS 16,以 ObservableObject 替换 @Observable,新增导航与 UI 兼容层,并补充登录冒烟 UI 测试。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-26 10:16:35 +08:00
parent 0314033a7f
commit 703078352c
127 changed files with 2320 additions and 1465 deletions

View File

@ -10,14 +10,14 @@ import SwiftUI
/// 线
struct LocationReportView: View {
@Environment(AccountContext.self) private var accountContext
@Environment(AccountSnapshotStore.self) private var snapshotStore
@Environment(LocationReportAPI.self) private var locationReportAPI
@Environment(RouterPath.self) private var router
@Environment(ToastCenter.self) private var toastCenter
@EnvironmentObject private var accountContext: AccountContext
@Environment(\.accountSnapshotStore) private var snapshotStore
@Environment(\.locationReportAPI) private var locationReportAPI
@EnvironmentObject private var router: RouterPath
@EnvironmentObject private var toastCenter: ToastCenter
@Environment(\.globalLoading) private var globalLoading
@State private var viewModel = LocationReportViewModel()
@StateObject private var viewModel = LocationReportViewModel()
@State private var locationProvider = ForegroundLocationProvider()
private let timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect()
@ -242,12 +242,12 @@ struct LocationReportView: View {
///
struct LocationReportHistoryView: View {
@Environment(AccountSnapshotStore.self) private var snapshotStore
@Environment(LocationReportAPI.self) private var locationReportAPI
@Environment(ToastCenter.self) private var toastCenter
@Environment(\.accountSnapshotStore) private var snapshotStore
@Environment(\.locationReportAPI) private var locationReportAPI
@EnvironmentObject private var toastCenter: ToastCenter
@Environment(\.globalLoading) private var globalLoading
@State private var viewModel = LocationReportHistoryViewModel()
@StateObject private var viewModel = LocationReportHistoryViewModel()
var body: some View {
ScrollView {
@ -277,7 +277,7 @@ struct LocationReportHistoryView: View {
}
}
.pickerStyle(.segmented)
.onChange(of: viewModel.selectedType) { _, _ in
.onChange(of: viewModel.selectedType) { _ in
Task { await reload(showLoading: true) }
}