Add Lottie-based global loading overlay across key flows.
Introduce GlobalLoadingCenter with reference counting, wire it through RootView and major auth/order/profile screens, and add the loading animation asset plus unit tests. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -13,6 +13,7 @@ struct StoreOrderDetailView: View {
|
||||
@Environment(OrdersAPI.self) private var ordersAPI
|
||||
@Environment(RouterPath.self) private var router
|
||||
@Environment(ToastCenter.self) private var toastCenter
|
||||
@Environment(\.globalLoading) private var globalLoading
|
||||
|
||||
let item: OrderEntity
|
||||
@State private var viewModel: OrderDetailViewModel
|
||||
@ -25,16 +26,6 @@ struct StoreOrderDetailView: View {
|
||||
|
||||
var body: some View {
|
||||
List {
|
||||
if viewModel.loading {
|
||||
Section {
|
||||
HStack {
|
||||
Spacer()
|
||||
ProgressView("加载详情中...")
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let contextMessage = viewModel.contextMessage {
|
||||
Section {
|
||||
Label(contextMessage, systemImage: "info.circle")
|
||||
@ -117,7 +108,9 @@ struct StoreOrderDetailView: View {
|
||||
.navigationTitle("订单详情")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.task {
|
||||
await viewModel.load(api: ordersAPI, fallbackStoreId: accountContext.currentStore?.id)
|
||||
await globalLoading.withLoading(message: "加载详情中...") {
|
||||
await viewModel.load(api: ordersAPI, fallbackStoreId: accountContext.currentStore?.id)
|
||||
}
|
||||
}
|
||||
.alert("提示", isPresented: errorBinding) {
|
||||
Button("知道了", role: .cancel) {}
|
||||
|
||||
Reference in New Issue
Block a user