summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2025-03-02 04:59:00 -0800
committerFuwn <[email protected]>2025-03-02 04:59:00 -0800
commitec6f6e766b878ec7f11f4f404570768c37486ad5 (patch)
tree45cbf47f3f7b9ee48f50fd1649ea46b09bebda6b
parentfeat: Development commit (diff)
downloadsora-testing-ec6f6e766b878ec7f11f4f404570768c37486ad5.tar.xz
sora-testing-ec6f6e766b878ec7f11f4f404570768c37486ad5.zip
feat: Development commit
-rw-r--r--Localizable.xcstrings18
-rw-r--r--Sora/Views/BookmarksView.swift21
-rw-r--r--Sora/Views/GenericItemView.swift10
-rw-r--r--Sora/Views/Post/Grid/PostGridSearchHistoryView.swift21
4 files changed, 59 insertions, 11 deletions
diff --git a/Localizable.xcstrings b/Localizable.xcstrings
index a3390cc..e30ef69 100644
--- a/Localizable.xcstrings
+++ b/Localizable.xcstrings
@@ -7,6 +7,12 @@
"Add to current search query" : {
},
+ "Are you sure you want to remove all bookmarks? This action cannot be undone." : {
+
+ },
+ "Are you sure you want to remove all searches? This action cannot be undone." : {
+
+ },
"Blur Content Ratings" : {
},
@@ -178,6 +184,18 @@
"Refresh" : {
},
+ "Remove" : {
+
+ },
+ "Remove All Bookmarks" : {
+
+ },
+ "Remove All Search History" : {
+
+ },
+ "Remove All Searches" : {
+
+ },
"Reset to Defaults" : {
"localizations" : {
"ja" : {
diff --git a/Sora/Views/BookmarksView.swift b/Sora/Views/BookmarksView.swift
index fa9ca5d..ccef3f1 100644
--- a/Sora/Views/BookmarksView.swift
+++ b/Sora/Views/BookmarksView.swift
@@ -5,6 +5,7 @@ struct BookmarksView: View {
@EnvironmentObject var manager: BooruManager
@Binding var selectedTab: Int
@State private var bookmarksSearchText: String = ""
+ @State private var isShowingRemoveAllConfirmation = false
var filteredBookmarks: [SettingsBookmark] {
guard !bookmarksSearchText.isEmpty else {
@@ -58,14 +59,28 @@ struct BookmarksView: View {
}
.onDelete(perform: settings.removeBookmark)
}
- #if os(macOS)
- .listStyle(.plain)
- #endif
}
}
}
.navigationTitle("Bookmarks")
.searchable(text: $bookmarksSearchText)
+ .toolbar {
+ ToolbarItem {
+ Button(action: {
+ isShowingRemoveAllConfirmation = true
+ }) {
+ Label("Remove All Bookmarks", systemImage: "trash")
+ }
+ }
+ }
+ .confirmationDialog(
+ "Are you sure you want to remove all bookmarks? This action cannot be undone.",
+ isPresented: $isShowingRemoveAllConfirmation
+ ) {
+ Button("Remove All Bookmarks") {
+ settings.bookmarks.removeAll()
+ }
+ }
}
}
diff --git a/Sora/Views/GenericItemView.swift b/Sora/Views/GenericItemView.swift
index 34ce88a..ec8deaa 100644
--- a/Sora/Views/GenericItemView.swift
+++ b/Sora/Views/GenericItemView.swift
@@ -16,17 +16,17 @@ struct GenericItemView<T: ItemViewModel>: View {
Text("On \(item.date.formatted()) from \(item.provider.rawValue)")
.font(.caption)
.foregroundStyle(Color.secondary)
- }
-
- Spacer()
+ Spacer()
+ }
+ }
+ .contextMenu {
Button {
removeAction(item.id)
} label: {
- Image(systemName: "trash")
+ Label("Remove", systemImage: "trash")
}
}
- .padding()
#else
VStack(alignment: .leading) {
Text(item.tags.joined(separator: ", ").lowercased())
diff --git a/Sora/Views/Post/Grid/PostGridSearchHistoryView.swift b/Sora/Views/Post/Grid/PostGridSearchHistoryView.swift
index e306839..30f7808 100644
--- a/Sora/Views/Post/Grid/PostGridSearchHistoryView.swift
+++ b/Sora/Views/Post/Grid/PostGridSearchHistoryView.swift
@@ -6,6 +6,7 @@ struct PostGridSearchHistoryView: View {
@State private var searchText: String = ""
@Binding var selectedTab: Int
@Binding var isPresented: Bool
+ @State private var isShowingRemoveAllConfirmation = false
var filteredHistory: [BooruSearchQuery] {
guard !searchText.isEmpty else {
@@ -64,14 +65,28 @@ struct PostGridSearchHistoryView: View {
}
.onDelete(perform: settings.removeSearchHistoryEntry)
}
- #if os(macOS)
- .listStyle(.plain)
- #endif
}
}
}
.navigationTitle("Search History")
.searchable(text: $searchText)
+ .toolbar {
+ ToolbarItem {
+ Button(action: {
+ isShowingRemoveAllConfirmation = true
+ }) {
+ Label("Remove All Search History", systemImage: "trash")
+ }
+ }
+ }
+ .confirmationDialog(
+ "Are you sure you want to remove all searches? This action cannot be undone.",
+ isPresented: $isShowingRemoveAllConfirmation
+ ) {
+ Button("Remove All Searches") {
+ settings.bookmarks.removeAll()
+ }
+ }
}
}