summaryrefslogtreecommitdiff
path: root/Sora/Views/Post/Grid/PostGridView.swift
diff options
context:
space:
mode:
authorFuwn <[email protected]>2025-08-28 15:23:28 -0700
committerFuwn <[email protected]>2025-08-28 15:23:28 -0700
commitd7af80d2d1edcc45c043bb237c098c4cb0c026fa (patch)
treec9775296945ce4b38e611d59e586000675f3d44c /Sora/Views/Post/Grid/PostGridView.swift
parentfeat: Development commit (diff)
downloadsora-testing-d7af80d2d1edcc45c043bb237c098c4cb0c026fa.tar.xz
sora-testing-d7af80d2d1edcc45c043bb237c098c4cb0c026fa.zip
feat: Development commit
Diffstat (limited to 'Sora/Views/Post/Grid/PostGridView.swift')
-rw-r--r--Sora/Views/Post/Grid/PostGridView.swift46
1 files changed, 29 insertions, 17 deletions
diff --git a/Sora/Views/Post/Grid/PostGridView.swift b/Sora/Views/Post/Grid/PostGridView.swift
index ebeac31..4205309 100644
--- a/Sora/Views/Post/Grid/PostGridView.swift
+++ b/Sora/Views/Post/Grid/PostGridView.swift
@@ -24,7 +24,7 @@ struct PostGridView: View { // swiftlint:disable:this type_body_length
@State private var localError: Error?
init(
- selectedTab: Binding<Int>, initialTag: String? = nil, navigationPath: Binding<NavigationPath>
+ selectedTab: Binding<Int>, navigationPath: Binding<NavigationPath>, initialTag: String? = nil
) {
self._selectedTab = selectedTab
self.initialTag = initialTag
@@ -50,12 +50,12 @@ struct PostGridView: View { // swiftlint:disable:this type_body_length
get: { localSearchText },
set: { localSearchText = $0 }
)
- } else {
- return Binding(
- get: { manager.searchText },
- set: { manager.searchText = $0 }
- )
}
+
+ return Binding(
+ get: { manager.searchText },
+ set: { manager.searchText = $0 }
+ )
}
@ViewBuilder private var gridContent: some View {
@@ -230,7 +230,7 @@ struct PostGridView: View { // swiftlint:disable:this type_body_length
}
}
.onAppear {
- if let initialTag = initialTag {
+ if let initialTag {
localSearchText = initialTag
Task(priority: .userInitiated) {
@@ -246,9 +246,11 @@ struct PostGridView: View { // swiftlint:disable:this type_body_length
if initialTag != nil {
await fetchLocalPosts(
page: 1,
- tags: localSearchText.components(separatedBy: .whitespaces).filter {
- !$0.isEmpty
- }, replace: true)
+ tags: localSearchText.components(separatedBy: .whitespaces).filter { component in
+ !component.isEmpty
+ },
+ replace: true
+ )
} else {
await manager.fetchPosts(page: 1, tags: manager.tags, replace: true)
}
@@ -275,7 +277,9 @@ struct PostGridView: View { // swiftlint:disable:this type_body_length
PlatformSpecificToolbarItem {
PostGridBookmarkButtonView(
tags: initialTag != nil
- ? localSearchText.components(separatedBy: .whitespaces).filter { !$0.isEmpty }
+ ? localSearchText.components(separatedBy: .whitespaces).filter { component in
+ !component.isEmpty
+ }
: manager.tags,
provider: manager.provider
)
@@ -361,8 +365,11 @@ struct PostGridView: View { // swiftlint:disable:this type_body_length
if initialTag != nil {
await fetchLocalPosts(
page: 1,
- tags: localSearchText.components(separatedBy: .whitespaces).filter { !$0.isEmpty },
- replace: true)
+ tags: localSearchText.components(separatedBy: .whitespaces).filter { component in
+ !component.isEmpty
+ },
+ replace: true
+ )
} else {
manager.clearCachedPages()
Task(priority: .userInitiated) {
@@ -405,8 +412,9 @@ struct PostGridView: View { // swiftlint:disable:this type_body_length
}
private func waterfallGridContent(post: BooruPost) -> some View {
- NavigationLink(value: PostWithContext(post: post, posts: initialTag != nil ? localPosts : nil))
- {
+ NavigationLink(
+ value: PostWithContext(post: post, posts: initialTag != nil ? localPosts : nil)
+ ) {
PostGridThumbnailView(
post: post,
posts: activePosts,
@@ -440,7 +448,9 @@ struct PostGridView: View { // swiftlint:disable:this type_body_length
// MARK: - Local Search Methods
private func performLocalSearch() async {
- let inputTags = localSearchText.components(separatedBy: .whitespaces).filter { !$0.isEmpty }
+ let inputTags = localSearchText.components(separatedBy: .whitespaces).filter { component in
+ !component.isEmpty
+ }
await fetchLocalPosts(page: 1, tags: inputTags, replace: true)
}
@@ -450,7 +460,9 @@ struct PostGridView: View { // swiftlint:disable:this type_body_length
localCurrentPage += 1
- let inputTags = localSearchText.components(separatedBy: .whitespaces).filter { !$0.isEmpty }
+ let inputTags = localSearchText.components(separatedBy: .whitespaces).filter { component in
+ !component.isEmpty
+ }
await fetchLocalPosts(page: localCurrentPage, tags: inputTags, replace: false)
}