从 iOS 17 Observation 迁移至 iOS 16 兼容的 Combine 架构
将最低部署版本降至 iOS 16,以 ObservableObject 替换 @Observable,新增导航与 UI 兼容层,并补充登录冒烟 UI 测试。 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