summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Localizable.xcstrings15
-rw-r--r--Sora/Views/Post/Details/PostDetailsTagsView.swift25
-rw-r--r--Sora/Views/Post/Grid/PostGridView.swift4
3 files changed, 18 insertions, 26 deletions
diff --git a/Localizable.xcstrings b/Localizable.xcstrings
index 49acdbd..37cdbc3 100644
--- a/Localizable.xcstrings
+++ b/Localizable.xcstrings
@@ -28,10 +28,6 @@
"Add Dummy Search History" : {
},
- "Add to Favorites" : {
- "comment" : "A button label that adds a post to the user's favorites.",
- "isCommentAutoGenerated" : true
- },
"Add to Search" : {
},
@@ -69,9 +65,6 @@
"Bookmark Tag%@" : {
},
- "Bookmark to Collection" : {
-
- },
"Bookmarked" : {
},
@@ -186,10 +179,6 @@
"Favorite Details" : {
},
- "Favorite to Collection" : {
- "comment" : "A menu item that allows a user to move a favorite to a new collection.",
- "isCommentAutoGenerated" : true
- },
"Favorited" : {
"comment" : "A label indicating that an item is marked as \"favorited\".",
"isCommentAutoGenerated" : true
@@ -368,10 +357,6 @@
"Remove from Collection" : {
},
- "Remove from Favorites" : {
- "comment" : "A menu item that removes a favorite from a user's favorites list.",
- "isCommentAutoGenerated" : true
- },
"Rename" : {
},
diff --git a/Sora/Views/Post/Details/PostDetailsTagsView.swift b/Sora/Views/Post/Details/PostDetailsTagsView.swift
index 8eac11a..684422e 100644
--- a/Sora/Views/Post/Details/PostDetailsTagsView.swift
+++ b/Sora/Views/Post/Details/PostDetailsTagsView.swift
@@ -26,24 +26,25 @@ struct PostDetailsTagsView: View {
Button(action: {
Task { @MainActor in
if isNestedContext {
- let mainTokens = manager.tags
let baseTokens = (baseSearchText ?? "")
.components(separatedBy: .whitespaces)
.filter { !$0.isEmpty }
- var merged = Array(Set(mainTokens + baseTokens)).sorted()
+ var merged = Array(Set(baseTokens)).sorted()
if !merged.contains(tag) { merged.append(tag) }
- manager.searchText = merged.joined(separator: " ")
- navigationPath = NavigationPath()
- isPresented = false
+ let combinedSearchText = merged.joined(separator: " ")
- let localManager = manager
- let localSettings = settings
+ var newPath = navigationPath
- Task(priority: .userInitiated) {
- await localManager.performSearch(settings: localSettings)
+ if !newPath.isEmpty {
+ newPath.removeLast()
}
+
+ newPath.append(combinedSearchText)
+
+ navigationPath = newPath
+ isPresented = false
} else {
var tokens = manager.tags
@@ -63,7 +64,11 @@ struct PostDetailsTagsView: View {
}) {
Label("Add to Search", systemImage: "plus")
}
- .disabled(manager.tags.contains(tag))
+ .disabled(
+ isNestedContext
+ ? (baseSearchText?.components(separatedBy: .whitespaces).contains(tag) ?? false)
+ : manager.tags.contains(tag)
+ )
BookmarkMenuButtonView(
tags: [tag],
diff --git a/Sora/Views/Post/Grid/PostGridView.swift b/Sora/Views/Post/Grid/PostGridView.swift
index 62706c2..6d96bdc 100644
--- a/Sora/Views/Post/Grid/PostGridView.swift
+++ b/Sora/Views/Post/Grid/PostGridView.swift
@@ -241,7 +241,9 @@ struct PostGridView: View { // swiftlint:disable:this type_body_length
}
.onAppear {
if let initialTag {
- localSearchText = initialTag
+ if localSearchText.isEmpty || !hasAppearedBefore {
+ localSearchText = initialTag
+ }
if !hasAppearedBefore {
hasAppearedBefore = true