diff options
| author | Fuwn <[email protected]> | 2025-03-23 06:29:39 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-03-23 06:29:39 -0700 |
| commit | c0e4857e7c236ad8dffc2783f714fccf966bc69e (patch) | |
| tree | 21f8e4a7a14b3423b7bc988a22d808e2a3a3f8fc | |
| parent | feat: Development commit (diff) | |
| download | sora-testing-c0e4857e7c236ad8dffc2783f714fccf966bc69e.tar.xz sora-testing-c0e4857e7c236ad8dffc2783f714fccf966bc69e.zip | |
feat: Development commit
| -rw-r--r-- | Localizable.xcstrings | 5 | ||||
| -rw-r--r-- | Sora/Views/Generic/GenericListView.swift | 2 | ||||
| -rw-r--r-- | Sora/Views/Post/Details/PostDetailsTagsView.swift | 26 |
3 files changed, 24 insertions, 9 deletions
diff --git a/Localizable.xcstrings b/Localizable.xcstrings index 37ea4bc..581f479 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -368,7 +368,10 @@ } } }, - "Unookmark Tag%@" : { + "Unbookmark Tag" : { + + }, + "Unbookmark Tag%@" : { } }, diff --git a/Sora/Views/Generic/GenericListView.swift b/Sora/Views/Generic/GenericListView.swift index 679b172..0207048 100644 --- a/Sora/Views/Generic/GenericListView.swift +++ b/Sora/Views/Generic/GenericListView.swift @@ -120,7 +120,7 @@ struct GenericListView<T: Identifiable & Hashable & GenericItem>: View { } }) { if isBookmarked { - Label("Unookmark Tag\(item.tags.count == 1 ? "" : "s")", systemImage: "bookmark.fill") + Label("Unbookmark Tag\(item.tags.count == 1 ? "" : "s")", systemImage: "bookmark.fill") } else { Label("Bookmark Tag\(item.tags.count == 1 ? "" : "s")", systemImage: "bookmark") } diff --git a/Sora/Views/Post/Details/PostDetailsTagsView.swift b/Sora/Views/Post/Details/PostDetailsTagsView.swift index a9ab6a4..7e603b4 100644 --- a/Sora/Views/Post/Details/PostDetailsTagsView.swift +++ b/Sora/Views/Post/Details/PostDetailsTagsView.swift @@ -17,18 +17,30 @@ struct PostDetailsTagsView: View { Text(tag) } .contextMenu { - Button(action: { - manager.searchText += " \(tag)" + if !manager.searchText.contains(tag) { + Button(action: { + manager.searchText += " \(tag)" - search() - }) { - Label("Add to Search", systemImage: "plus") + search() + }) { + Label("Add to Search", systemImage: "plus") + } } + let isBookmarked = settings.bookmarks.contains { $0.tags.contains(tag) } + Button(action: { - settings.addBookmark(provider: settings.preferredBooru, tags: [tag]) + if isBookmarked { + settings.removeBookmark(withTags: tags) + } else { + settings.addBookmark(provider: settings.preferredBooru, tags: [tag]) + } }) { - Label("Bookmark Tag", systemImage: "bookmark") + if isBookmarked { + Label("Unbookmark Tag", systemImage: "bookmark.fill") + } else { + Label("Bookmark Tag", systemImage: "bookmark") + } } } } |