commit 1394122542b5258da1ffc8d2b0164bf8dfa3fe44
parent e89c025d9d6cc2bf26643d5f60deff1201fed4a8
Author: Swift <scoder1747@gmail.com>
Date: Tue, 25 Apr 2023 22:20:19 -0400
Add confirmation alert when clearing all bookmarks
Changelog-Added: Add confirmation alert when clearing all bookmarks
Closes: #1016
Diffstat:
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/damus/Views/BookmarksView.swift b/damus/Views/BookmarksView.swift
@@ -11,6 +11,7 @@ struct BookmarksView: View {
let state: DamusState
private let noneFilter: (NostrEvent) -> Bool = { _ in true }
private let bookmarksTitle = NSLocalizedString("Bookmarks", comment: "Title of bookmarks view")
+ @State private var clearAllAlert: Bool = false
@ObservedObject var manager: BookmarksManager
@@ -45,10 +46,17 @@ struct BookmarksView: View {
.toolbar {
if !bookmarks.isEmpty {
Button(NSLocalizedString("Clear All", comment: "Button for clearing bookmarks data.")) {
- manager.clearAll()
+ clearAllAlert = true
}
}
}
+ .alert(NSLocalizedString("Are you sure you want to delete all of your bookmarks?", comment: "Alert for deleting all of the bookmarks."), isPresented: $clearAllAlert) {
+ Button(NSLocalizedString("Cancel", comment: "Cancel deleting bookmarks."), role: .cancel) {
+ }
+ Button(NSLocalizedString("Continue", comment: "Continue with bookmarks.")) {
+ manager.clearAll()
+ }
+ }
}
}