From ed70ceb2c4e64d3ead5476d5df4a51d026285f7e Mon Sep 17 00:00:00 2001 From: Satindar Dhillon Date: Mon, 27 Jun 2022 16:06:56 -0700 Subject: [PATCH] apply delete label alert on macOS --- .../Sources/App/Views/Labels/LabelsView.swift | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsView.swift b/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsView.swift index 0aa79b49e..26b127f4c 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsView.swift @@ -17,21 +17,6 @@ struct LabelsView: View { #if os(iOS) Form { innerBody - .alert("Are you sure you want to delete this label?", isPresented: $showDeleteConfirmation) { - Button("Delete Label", role: .destructive) { - if let label = labelToRemove { - withAnimation { - viewModel.deleteLabel( - dataService: dataService, - labelID: label.unwrappedID, - name: label.unwrappedName - ) - } - } - self.labelToRemove = nil - } - Button("Cancel", role: .cancel) { self.labelToRemove = nil } - } } #elseif os(macOS) List { @@ -39,6 +24,21 @@ struct LabelsView: View { } #endif } + .alert("Are you sure you want to delete this label?", isPresented: $showDeleteConfirmation) { + Button("Delete Label", role: .destructive) { + if let label = labelToRemove { + withAnimation { + viewModel.deleteLabel( + dataService: dataService, + labelID: label.unwrappedID, + name: label.unwrappedName + ) + } + } + self.labelToRemove = nil + } + Button("Cancel", role: .cancel) { self.labelToRemove = nil } + } .sheet(isPresented: $viewModel.showCreateLabelModal) { CreateLabelView(viewModel: viewModel) }