From e56c662137ca3e3945aed174c90062601df092f5 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Mon, 3 Mar 2025 19:43:35 -0800 Subject: feat: Development commit --- Localizable.xcstrings | 11 ++++++++- Sora/Views/Bookmarks/BookmarksAddToView.swift | 7 ++++++ Sora/Views/Bookmarks/BookmarksView.swift | 29 +++++++++++++++++++++++ Sora/Views/BookmarksView.swift | 29 ----------------------- Sora/Views/Generic/GenericListView.swift | 8 ++++++- Sora/Views/Post/Details/PostDetailsTagsView.swift | 8 ++++++- 6 files changed, 60 insertions(+), 32 deletions(-) create mode 100644 Sora/Views/Bookmarks/BookmarksAddToView.swift create mode 100644 Sora/Views/Bookmarks/BookmarksView.swift delete mode 100644 Sora/Views/BookmarksView.swift diff --git a/Localizable.xcstrings b/Localizable.xcstrings index 8deab4f..df67de2 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -10,7 +10,7 @@ "Add Dummy Search History" : { }, - "Add to current search query" : { + "Add to Search" : { }, "Are you sure you want to remove all bookmarks? This action cannot be undone." : { @@ -31,6 +31,12 @@ } } } + }, + "Bookmark Tag" : { + + }, + "Bookmark Tag%@" : { + }, "Bookmarks" : { "localizations" : { @@ -41,6 +47,9 @@ } } } + }, + "BookmarksAddToView" : { + }, "Clear Cached Tags (%@)" : { diff --git a/Sora/Views/Bookmarks/BookmarksAddToView.swift b/Sora/Views/Bookmarks/BookmarksAddToView.swift new file mode 100644 index 0000000..3c8ad68 --- /dev/null +++ b/Sora/Views/Bookmarks/BookmarksAddToView.swift @@ -0,0 +1,7 @@ +import SwiftUI + +struct BookmarksAddToView: View { + var body: some View { + Text("BookmarksAddToView") + } +} diff --git a/Sora/Views/Bookmarks/BookmarksView.swift b/Sora/Views/Bookmarks/BookmarksView.swift new file mode 100644 index 0000000..fa7734e --- /dev/null +++ b/Sora/Views/Bookmarks/BookmarksView.swift @@ -0,0 +1,29 @@ +import SwiftUI + +struct BookmarksView: View { + @EnvironmentObject var settings: SettingsManager + @Binding var selectedTab: Int + + var body: some View { + GenericListView( + selectedTab: $selectedTab, + isPresented: .constant(false), + title: "Bookmarks", + emptyMessage: "No Bookmarks", + emptyIcon: "bookmark", + emptyDescription: "Tap the bookmark button on a search page to add a bookmark.", + removeAllMessage: + "Are you sure you want to remove all bookmarks? This action cannot be undone.", + removeAllButtonText: "Remove All Bookmarks", + items: settings.bookmarks, + removeAction: settings.removeBookmark, + removeActionUUID: settings.removeBookmark + ) { settings.bookmarks.removeAll() } + } +} + +#Preview { + BookmarksView(selectedTab: .constant(1)) + .environmentObject(SettingsManager()) + .environmentObject(BooruManager(.yandere)) +} diff --git a/Sora/Views/BookmarksView.swift b/Sora/Views/BookmarksView.swift deleted file mode 100644 index fa7734e..0000000 --- a/Sora/Views/BookmarksView.swift +++ /dev/null @@ -1,29 +0,0 @@ -import SwiftUI - -struct BookmarksView: View { - @EnvironmentObject var settings: SettingsManager - @Binding var selectedTab: Int - - var body: some View { - GenericListView( - selectedTab: $selectedTab, - isPresented: .constant(false), - title: "Bookmarks", - emptyMessage: "No Bookmarks", - emptyIcon: "bookmark", - emptyDescription: "Tap the bookmark button on a search page to add a bookmark.", - removeAllMessage: - "Are you sure you want to remove all bookmarks? This action cannot be undone.", - removeAllButtonText: "Remove All Bookmarks", - items: settings.bookmarks, - removeAction: settings.removeBookmark, - removeActionUUID: settings.removeBookmark - ) { settings.bookmarks.removeAll() } - } -} - -#Preview { - BookmarksView(selectedTab: .constant(1)) - .environmentObject(SettingsManager()) - .environmentObject(BooruManager(.yandere)) -} diff --git a/Sora/Views/Generic/GenericListView.swift b/Sora/Views/Generic/GenericListView.swift index 6ac9030..ee0b09e 100644 --- a/Sora/Views/Generic/GenericListView.swift +++ b/Sora/Views/Generic/GenericListView.swift @@ -106,7 +106,13 @@ struct GenericListView: View { manager.performSearch(settings: settings) isPresented.toggle() }) { - Label("Add to current search query", systemImage: "plus") + Label("Add to Search", systemImage: "plus") + } + + Button(action: { + settings.addBookmark(provider: settings.preferredBooru, tags: item.tags) + }) { + Label("Bookmark Tag\(item.tags.count == 1 ? "" : "s")", systemImage: "bookmark") } } #if os(macOS) diff --git a/Sora/Views/Post/Details/PostDetailsTagsView.swift b/Sora/Views/Post/Details/PostDetailsTagsView.swift index de25051..e2304a7 100644 --- a/Sora/Views/Post/Details/PostDetailsTagsView.swift +++ b/Sora/Views/Post/Details/PostDetailsTagsView.swift @@ -22,7 +22,13 @@ struct PostDetailsTagsView: View { search() }) { - Label("Add to current search query", systemImage: "plus") + Label("Add to Search", systemImage: "plus") + } + + Button(action: { + settings.addBookmark(provider: settings.preferredBooru, tags: [tag]) + }) { + Label("Bookmark Tag", systemImage: "bookmark") } } } -- cgit v1.2.3