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:
2026-06-26 10:16:35 +08:00
parent c32a610ee0
commit 26f4d0e671
127 changed files with 2320 additions and 1465 deletions

View File

@ -9,13 +9,13 @@ import SwiftUI
/// 退
struct DepositOrderEntryView: View {
@Environment(AccountContext.self) private var accountContext
@Environment(OrdersAPI.self) private var ordersAPI
@Environment(RouterPath.self) private var router
@Environment(ToastCenter.self) private var toastCenter
@EnvironmentObject private var accountContext: AccountContext
@Environment(\.ordersAPI) private var ordersAPI
@EnvironmentObject private var router: RouterPath
@EnvironmentObject private var toastCenter: ToastCenter
@Environment(\.globalLoading) private var globalLoading
@State private var viewModel = DepositOrderListViewModel()
@StateObject private var viewModel = DepositOrderListViewModel()
@State private var orderNumber = ""
@State private var pendingWriteOff: DepositOrderListItem?
@State private var pendingRefund: DepositOrderListItem?
@ -36,7 +36,7 @@ struct DepositOrderEntryView: View {
Section {
if viewModel.orders.isEmpty {
ContentUnavailableView("暂无押金订单", systemImage: "doc.text.magnifyingglass")
AppContentUnavailableView("暂无押金订单", systemImage: "doc.text.magnifyingglass")
.frame(maxWidth: .infinity, minHeight: 180)
} else {
ForEach(viewModel.orders) { item in
@ -239,13 +239,13 @@ private struct DepositOrderRow: View {
///
struct DepositOrderDetailView: View {
@Environment(AccountContext.self) private var accountContext
@Environment(OrdersAPI.self) private var ordersAPI
@Environment(RouterPath.self) private var router
@EnvironmentObject private var accountContext: AccountContext
@Environment(\.ordersAPI) private var ordersAPI
@EnvironmentObject private var router: RouterPath
@Environment(\.globalLoading) private var globalLoading
let orderNumber: String
@State private var viewModel = DepositOrderDetailViewModel()
@StateObject private var viewModel = DepositOrderDetailViewModel()
var body: some View {
List {
@ -275,7 +275,7 @@ struct DepositOrderDetailView: View {
Section("拍摄详情") {
let shootingList = detail.multiTravel?.shootingList ?? []
if shootingList.isEmpty {
ContentUnavailableView("暂无拍摄记录", systemImage: "photo.stack")
AppContentUnavailableView("暂无拍摄记录", systemImage: "photo.stack")
} else {
ForEach(shootingList) { item in
Button {
@ -296,7 +296,7 @@ struct DepositOrderDetailView: View {
}
} else {
Section {
ContentUnavailableView("暂无订单详情", systemImage: "doc.text.magnifyingglass")
AppContentUnavailableView("暂无订单详情", systemImage: "doc.text.magnifyingglass")
.frame(maxWidth: .infinity, minHeight: 220)
}
}
@ -363,15 +363,15 @@ private struct DepositShootingPointRow: View {
///
struct DepositOrderShootingInfoView: View {
@Environment(AccountContext.self) private var accountContext
@Environment(OrdersAPI.self) private var ordersAPI
@EnvironmentObject private var accountContext: AccountContext
@Environment(\.ordersAPI) private var ordersAPI
@Environment(\.globalLoading) private var globalLoading
let orderNumber: String
let scenicSpotId: Int
let photogUid: Int
@State private var viewModel = DepositOrderShootingInfoViewModel()
@StateObject private var viewModel = DepositOrderShootingInfoViewModel()
@State private var selectedTab: DepositShootingMediaTab = .negative
var body: some View {
@ -393,7 +393,7 @@ struct DepositOrderShootingInfoView: View {
.font(.system(size: AppMetrics.FontSize.subheadline))
.foregroundStyle(AppDesign.textSecondary)
} else {
ContentUnavailableView("暂无评价信息", systemImage: "star")
AppContentUnavailableView("暂无评价信息", systemImage: "star")
}
}
@ -410,7 +410,7 @@ struct DepositOrderShootingInfoView: View {
}
} else {
Section {
ContentUnavailableView("暂无拍摄信息", systemImage: "photo.stack")
AppContentUnavailableView("暂无拍摄信息", systemImage: "photo.stack")
.frame(maxWidth: .infinity, minHeight: 220)
}
}
@ -448,11 +448,11 @@ struct DepositOrderShootingInfoView: View {
///
struct HistoricalShootingInfoView: View {
@Environment(OrdersAPI.self) private var ordersAPI
@Environment(\.ordersAPI) private var ordersAPI
@Environment(\.globalLoading) private var globalLoading
let orderNumber: String
@State private var viewModel = HistoricalShootingInfoViewModel()
@StateObject private var viewModel = HistoricalShootingInfoViewModel()
var body: some View {
List {
@ -464,7 +464,7 @@ struct HistoricalShootingInfoView: View {
Section("历史拍摄") {
if viewModel.spots.isEmpty {
ContentUnavailableView("暂无历史拍摄信息", systemImage: "photo.on.rectangle")
AppContentUnavailableView("暂无历史拍摄信息", systemImage: "photo.on.rectangle")
.frame(maxWidth: .infinity, minHeight: 220)
} else {
ForEach(viewModel.spots) { spot in
@ -565,7 +565,7 @@ private struct OrderMediaGrid: View {
var body: some View {
if files.isEmpty {
ContentUnavailableView("暂无媒体文件", systemImage: "photo")
AppContentUnavailableView("暂无媒体文件", systemImage: "photo")
.frame(maxWidth: .infinity, minHeight: 140)
} else {
LazyVGrid(columns: columns, spacing: AppMetrics.Spacing.small) {