diff --git a/Sources/Screens/File/FileToolbar.swift b/Sources/Screens/File/FileToolbar.swift index 07186c0..0b30c61 100644 --- a/Sources/Screens/File/FileToolbar.swift +++ b/Sources/Screens/File/FileToolbar.swift @@ -104,7 +104,7 @@ struct FileToolbar: ViewModifier { fileStore.downloadIsPresented = true }, onDelete: { - fileStore.deleteIsPresented = true + fileStore.deleteConfirmationIsPresented = true }, onRename: { fileStore.renameIsPresented = true diff --git a/Sources/Screens/File/Menu/FileActions.swift b/Sources/Screens/File/Menu/FileActions.swift index 6c452cb..52500bb 100644 --- a/Sources/Screens/File/Menu/FileActions.swift +++ b/Sources/Screens/File/Menu/FileActions.swift @@ -44,7 +44,7 @@ struct FileActions: ViewModifier { fileStore.downloadIsPresented = true }, onDelete: { - fileStore.deleteIsPresented = true + fileStore.deleteConfirmationIsPresented = true }, onRename: { fileStore.renameIsPresented = true diff --git a/Sources/Screens/File/Sheet/FileSheetDelete.swift b/Sources/Screens/File/Sheet/FileSheetDelete.swift index 87abd20..224003f 100644 --- a/Sources/Screens/File/Sheet/FileSheetDelete.swift +++ b/Sources/Screens/File/Sheet/FileSheetDelete.swift @@ -12,6 +12,7 @@ import SwiftUI struct FileSheetDelete: ViewModifier { @ObservedObject private var fileStore: FileStore + @State private var deleteIsPresented: Bool = false init(fileStore: FileStore) { self.fileStore = fileStore @@ -19,7 +20,21 @@ struct FileSheetDelete: ViewModifier { func body(content: Content) -> some View { content - .sheet(isPresented: $fileStore.deleteIsPresented) { + .alert( + fileStore.selection.count > 1 ? "Delete (\(fileStore.selection.count)) Items" : "Delete Item", + isPresented: $fileStore.deleteConfirmationIsPresented + ) { + Button("Delete", role: .destructive) { + deleteIsPresented = true + } + } message: { + if fileStore.selection.count > 1 { + Text("Are you sure you want to delete these items?") + } else { + Text("Are you sure you want to delete this item?") + } + } + .sheet(isPresented: $deleteIsPresented) { if !fileStore.selection.isEmpty { FileDelete(fileStore: fileStore) }