Add order tail flows and migrate queue, message, settlement, and audit modules.
Wire deposit orders, historical shooting, and multi-travel uploads into Orders, and replace home placeholders for queue management, message center, scenic settlement, and withdrawal audit. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -9,6 +9,7 @@ import SwiftUI
|
||||
|
||||
/// App 根视图,负责创建全局依赖并根据登录状态切换登录页和主界面。
|
||||
struct RootView: View {
|
||||
@Environment(\.scenePhase) private var scenePhase
|
||||
@State private var appSession = AppSession()
|
||||
@State private var accountContext = AccountContext()
|
||||
@State private var permissionContext = PermissionContext()
|
||||
@ -28,6 +29,10 @@ struct RootView: View {
|
||||
@State private var paymentAPI: PaymentAPI
|
||||
@State private var walletAPI: WalletAPI
|
||||
@State private var scenicPermissionAPI: ScenicPermissionAPI
|
||||
@State private var scenicSettlementAPI: ScenicSettlementAPI
|
||||
@State private var messageCenterAPI: MessageCenterAPI
|
||||
@State private var scenicQueueAPI: ScenicQueueAPI
|
||||
@State private var scenicQueueRuntime = ScenicQueueRuntime()
|
||||
@State private var taskAPI: TaskAPI
|
||||
@State private var projectAPI: ProjectAPI
|
||||
@State private var scheduleAPI: ScheduleAPI
|
||||
@ -56,6 +61,9 @@ struct RootView: View {
|
||||
_paymentAPI = State(initialValue: PaymentAPI(client: apiClient))
|
||||
_walletAPI = State(initialValue: WalletAPI(client: apiClient))
|
||||
_scenicPermissionAPI = State(initialValue: ScenicPermissionAPI(client: apiClient))
|
||||
_scenicSettlementAPI = State(initialValue: ScenicSettlementAPI(client: apiClient))
|
||||
_messageCenterAPI = State(initialValue: MessageCenterAPI(client: apiClient))
|
||||
_scenicQueueAPI = State(initialValue: ScenicQueueAPI(client: apiClient))
|
||||
_taskAPI = State(initialValue: TaskAPI(client: apiClient))
|
||||
_projectAPI = State(initialValue: ProjectAPI(client: apiClient))
|
||||
_scheduleAPI = State(initialValue: ScheduleAPI(client: apiClient))
|
||||
@ -101,6 +109,10 @@ struct RootView: View {
|
||||
.environment(paymentAPI)
|
||||
.environment(walletAPI)
|
||||
.environment(scenicPermissionAPI)
|
||||
.environment(scenicSettlementAPI)
|
||||
.environment(messageCenterAPI)
|
||||
.environment(scenicQueueAPI)
|
||||
.environment(scenicQueueRuntime)
|
||||
.environment(taskAPI)
|
||||
.environment(projectAPI)
|
||||
.environment(scheduleAPI)
|
||||
@ -132,6 +144,28 @@ struct RootView: View {
|
||||
api: accountContextAPI
|
||||
)
|
||||
}
|
||||
.onChange(of: scenePhase) { _, newPhase in
|
||||
if appSession.isLoggedIn {
|
||||
scenicQueueRuntime.update(
|
||||
api: scenicQueueAPI,
|
||||
userId: accountContext.profile?.userId,
|
||||
scenicId: accountContext.currentScenic?.id,
|
||||
scenePhase: newPhase
|
||||
)
|
||||
} else {
|
||||
scenicQueueRuntime.stop()
|
||||
}
|
||||
}
|
||||
.onChange(of: accountContext.currentScenic?.id) { _, _ in
|
||||
if appSession.isLoggedIn {
|
||||
scenicQueueRuntime.update(
|
||||
api: scenicQueueAPI,
|
||||
userId: accountContext.profile?.userId,
|
||||
scenicId: accountContext.currentScenic?.id,
|
||||
scenePhase: scenePhase
|
||||
)
|
||||
}
|
||||
}
|
||||
.onChange(of: appSession.phase) { _, phase in
|
||||
guard phase == .loggedOut else { return }
|
||||
accountContext.reset()
|
||||
|
||||
Reference in New Issue
Block a user