完善任务流程、键盘适配与页面交互

This commit is contained in:
2026-07-10 15:56:15 +08:00
parent f88a85a807
commit ab5220e460
189 changed files with 16779 additions and 1038 deletions

View File

@ -57,11 +57,7 @@ final class TaskAddViewModel {
///
func updateCustomUrgentHourText(_ text: String) {
let trimmed = text.trimmingCharacters(in: .whitespacesAndNewlines)
guard let hour = Int(trimmed), hour > 0 else {
urgentHour = 1
notifyStateChange()
return
}
guard let hour = Int(trimmed), hour > 0 else { return }
urgentHour = hour
notifyStateChange()
}
@ -117,13 +113,38 @@ final class TaskAddViewModel {
notifyStateChange()
}
///
func prepareUpload(uploadTaskId: String, fileName: String, localPreviewData: Data?) {
selectedFiles = selectedFiles.map { item in
guard item.uploadTaskId == uploadTaskId else { return item }
var updated = item
updated.uploadFileName = fileName
updated.localPreviewData = localPreviewData
return updated
}
notifyStateChange()
}
/// URL
func markUploadSucceeded(uploadTaskId: String, fileURL: String, coverURL: String? = nil, autoRemarkWhenSingle: Bool) {
func markUploadSucceeded(
uploadTaskId: String,
fileURL: String,
fileName: String? = nil,
coverURL: String? = nil,
localPreviewData: Data? = nil,
autoRemarkWhenSingle: Bool
) {
selectedFiles = selectedFiles.map { item in
guard item.uploadTaskId == uploadTaskId else { return item }
var updated = item
updated.uploadFileUrl = fileURL
if let fileName, !fileName.isEmpty {
updated.uploadFileName = fileName
}
updated.uploadCoverUrl = coverURL
if let localPreviewData {
updated.localPreviewData = localPreviewData
}
updated.isUploading = false
updated.uploadProgress = 100
return updated