summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Sora/Views/PlatformSpecificToolbarItem.swift8
-rw-r--r--Sora/Views/Post/Grid/PostGridView.swift14
2 files changed, 16 insertions, 6 deletions
diff --git a/Sora/Views/PlatformSpecificToolbarItem.swift b/Sora/Views/PlatformSpecificToolbarItem.swift
index 4a44db0..578affe 100644
--- a/Sora/Views/PlatformSpecificToolbarItem.swift
+++ b/Sora/Views/PlatformSpecificToolbarItem.swift
@@ -5,13 +5,17 @@ struct PlatformSpecificToolbarItem<Content: View>: ToolbarContent {
let content: () -> Content
init(
- placement: ToolbarItemPlacement?,
+ placement: ToolbarItemPlacement? = nil,
@ViewBuilder content: @escaping () -> Content
) {
#if os(macOS)
self.placement = .automatic
#else
- self.placement = placement ?? .bottomBar
+ if #available(iOS 26, *) {
+ self.placement = placement ?? .secondaryAction
+ } else {
+ self.placement = placement ?? .bottomBar
+ }
#endif
self.content = content
diff --git a/Sora/Views/Post/Grid/PostGridView.swift b/Sora/Views/Post/Grid/PostGridView.swift
index 39cd7da..6d40c7e 100644
--- a/Sora/Views/Post/Grid/PostGridView.swift
+++ b/Sora/Views/Post/Grid/PostGridView.swift
@@ -127,23 +127,23 @@ struct PostGridView: View {
#endif
#if !os(macOS)
- ToolbarItem(placement: .secondaryAction) {
+ PlatformSpecificToolbarItem {
Button(action: { Task { isSearchHistoryPresented.toggle() } }) {
Label("Search History", systemImage: "clock.arrow.circlepath")
}
}
- if manager.isLoading || manager.isNavigatingHistory {
+ if #available(iOS 26, *), manager.isLoading || manager.isNavigatingHistory {
ToolbarItem(placement: .status) { ProgressView() }
}
#endif
- PlatformSpecificToolbarItem(placement: .secondaryAction) {
+ PlatformSpecificToolbarItem {
PostGridBookmarkButtonView()
.disabled(manager.tags.isEmpty)
}
- PlatformSpecificToolbarItem(placement: .secondaryAction) {
+ PlatformSpecificToolbarItem {
Button(action: { Task { manager.loadNextPage() } }) {
Label(
"Manually Load Next Page",
@@ -153,6 +153,12 @@ struct PostGridView: View {
.disabled(manager.isLoading || manager.endOfData)
}
+ #if !os(macOS)
+ if #unavailable(iOS 26), manager.isLoading || manager.isNavigatingHistory {
+ ToolbarItem(placement: .topBarTrailing) { ProgressView() }
+ }
+ #endif
+
PlatformSpecificToolbarItem(placement: .navigation) {
Button(action: { manager.goBackInHistory() }) {
Label("Previous Search", systemImage: "chevron.left")