从 iOS 17 Observation 迁移至 iOS 16 兼容的 Combine 架构

将最低部署版本降至 iOS 16,以 ObservableObject 替换 @Observable,新增导航与 UI 兼容层,并补充登录冒烟 UI 测试。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-26 10:16:35 +08:00
parent 0314033a7f
commit 703078352c
127 changed files with 2320 additions and 1465 deletions

View File

@ -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) }
}
}