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:
@ -14,14 +14,14 @@ import UIKit
|
||||
|
||||
/// 相册云盘页面,展示文件夹浏览、筛选、上传、预览和文件操作。
|
||||
struct CloudStorageView: View {
|
||||
@Environment(AccountContext.self) private var accountContext
|
||||
@Environment(AssetsAPI.self) private var assetsAPI
|
||||
@Environment(OSSUploadService.self) private var uploadService
|
||||
@Environment(RouterPath.self) private var router
|
||||
@Environment(ToastCenter.self) private var toastCenter
|
||||
@EnvironmentObject private var accountContext: AccountContext
|
||||
@Environment(\.assetsAPI) private var assetsAPI
|
||||
@Environment(\.ossUploadService) private var uploadService
|
||||
@EnvironmentObject private var router: RouterPath
|
||||
@EnvironmentObject private var toastCenter: ToastCenter
|
||||
@Environment(\.globalLoading) private var globalLoading
|
||||
|
||||
@State private var viewModel = CloudStorageViewModel()
|
||||
@StateObject private var viewModel = CloudStorageViewModel()
|
||||
@State private var transferStore = CloudTransferStore.shared
|
||||
@State private var selectedItems: [PhotosPickerItem] = []
|
||||
@State private var actionItem: CloudDriveFile?
|
||||
@ -70,7 +70,7 @@ struct CloudStorageView: View {
|
||||
guard viewModel.files.isEmpty else { return }
|
||||
await reload(showLoading: true)
|
||||
}
|
||||
.onChange(of: selectedItems) { _, items in
|
||||
.onChange(of: selectedItems) { items in
|
||||
Task { await upload(items) }
|
||||
}
|
||||
.confirmationDialog("文件操作", isPresented: actionDialogBinding, presenting: actionItem) { item in
|
||||
@ -176,7 +176,7 @@ struct CloudStorageView: View {
|
||||
}
|
||||
}
|
||||
.pickerStyle(.segmented)
|
||||
.onChange(of: viewModel.selectedFilter) { _, _ in
|
||||
.onChange(of: viewModel.selectedFilter) { _ in
|
||||
Task { await reload(showLoading: true) }
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ struct CloudStorageView: View {
|
||||
}
|
||||
}
|
||||
.pickerStyle(.segmented)
|
||||
.onChange(of: viewModel.selectedSort) { _, _ in
|
||||
.onChange(of: viewModel.selectedSort) { _ in
|
||||
Task { await reload(showLoading: true) }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user