diff options
| -rw-r--r-- | Localizable.xcstrings | 3 | ||||
| -rw-r--r-- | Sora/Views/Generic/GenericListView.swift | 14 |
2 files changed, 15 insertions, 2 deletions
diff --git a/Localizable.xcstrings b/Localizable.xcstrings index 975e76a..37ea4bc 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -367,6 +367,9 @@ } } } + }, + "Unookmark Tag%@" : { + } }, "version" : "1.0" diff --git a/Sora/Views/Generic/GenericListView.swift b/Sora/Views/Generic/GenericListView.swift index acc8a6e..53f6bac 100644 --- a/Sora/Views/Generic/GenericListView.swift +++ b/Sora/Views/Generic/GenericListView.swift @@ -110,10 +110,20 @@ struct GenericListView<T: Identifiable & Hashable & GenericItem>: View { } if allowBookmarking { + let isBookmarked = settings.bookmarks.contains { $0.tags == item.tags } + Button(action: { - settings.addBookmark(provider: settings.preferredBooru, tags: item.tags) + if isBookmarked { + settings.removeBookmark(withTags: item.tags) + } else { + settings.addBookmark(provider: settings.preferredBooru, tags: item.tags) + } }) { - Label("Bookmark Tag\(item.tags.count == 1 ? "" : "s")", systemImage: "bookmark") + if isBookmarked { + Label("Unookmark Tag\(item.tags.count == 1 ? "" : "s")", systemImage: "bookmark.fill") + } else { + Label("Bookmark Tag\(item.tags.count == 1 ? "" : "s")", systemImage: "bookmark") + } } } |