feat(ios): refine native ui controls
This commit is contained in:
@@ -2,6 +2,7 @@ import SwiftUI
|
||||
|
||||
struct NotificationsView: View {
|
||||
@StateObject private var model: NotificationsViewModel
|
||||
@State private var pendingDeleteQueueID: String?
|
||||
|
||||
init(model: NotificationsViewModel? = nil) {
|
||||
_model = StateObject(wrappedValue: model ?? DefaultContainer.makeNotificationsModel())
|
||||
@@ -58,6 +59,24 @@ struct NotificationsView: View {
|
||||
.disabled(model.isLoading)
|
||||
}
|
||||
}
|
||||
.confirmationDialog(
|
||||
"删除这条通知队列记录?操作不可恢复。",
|
||||
isPresented: Binding(
|
||||
get: { pendingDeleteQueueID != nil },
|
||||
set: { if !$0 { pendingDeleteQueueID = nil } }
|
||||
),
|
||||
titleVisibility: .visible
|
||||
) {
|
||||
Button("删除队列记录", role: .destructive) {
|
||||
guard let id = pendingDeleteQueueID else { return }
|
||||
Task {
|
||||
if let item = model.overview?.queue.items.first(where: { $0.id == id }) {
|
||||
await model.deleteQueue(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
Button("取消", role: .cancel) {}
|
||||
}
|
||||
.refreshable {
|
||||
await model.refresh()
|
||||
}
|
||||
@@ -189,7 +208,7 @@ struct NotificationsView: View {
|
||||
.disabled(model.busyQueueID == item.id)
|
||||
|
||||
Button {
|
||||
Task { await model.deleteQueue(item) }
|
||||
pendingDeleteQueueID = item.id
|
||||
} label: {
|
||||
Label("删除", systemImage: "trash")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user