From 11e6e0ec638bfe18c7c973dcdd44b4eefe8b0d79 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sun, 15 Jun 2025 01:19:33 -0700 Subject: feat: Development commit --- Sora/Views/PlatformSpecificToolbarItem.swift | 8 ++++++-- Sora/Views/Post/Grid/PostGridView.swift | 14 ++++++++++---- 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: 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") -- cgit v1.2.3