From 6ba8342d43ecca29b0a8a2131937536bbf363b09 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sat, 14 Jun 2025 21:53:55 -0700 Subject: feat: Development commit --- Sora/Views/Post/Grid/PostGridThumbnailView.swift | 41 +++++++++++++++--------- project.yml | 2 +- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/Sora/Views/Post/Grid/PostGridThumbnailView.swift b/Sora/Views/Post/Grid/PostGridThumbnailView.swift index 4973c1e..ae9dbcb 100644 --- a/Sora/Views/Post/Grid/PostGridThumbnailView.swift +++ b/Sora/Views/Post/Grid/PostGridThumbnailView.swift @@ -19,30 +19,39 @@ struct PostGridThumbnailView: View { } } + @ViewBuilder + private func imageContent(image: Image) -> some View { + let isFiltered = + settings.blurRatings.contains(post.rating) + && manager.selectedPost?.id != post.id + + image + .resizable() + .aspectRatio(contentMode: .fit) + .blur(radius: isFiltered ? 8 : 0) + .clipped() + .animation(.default, value: isFiltered) + .clipShape(RoundedRectangle(cornerRadius: 8)) + } + var body: some View { VStack { NetworkImage( url: thumbnailURL, transaction: Transaction(animation: .default) ) { image in - let isFiltered = - settings.blurRatings.contains(post.rating) - && manager.selectedPost?.id != post.id - - image - .resizable() - .aspectRatio(contentMode: .fit) - .onScrollVisibilityChange { visible in - if post == posts.last, !manager.endOfData, visible { - Task { - manager.loadNextPage() + if #available(iOS 18.0, *) { + imageContent(image: image) + .onScrollVisibilityChange { visible in + if post == posts.last, !manager.endOfData, visible { + Task { + manager.loadNextPage() + } } } - } - .blur(radius: isFiltered ? 8 : 0) - .clipped() - .animation(.default, value: isFiltered) - .clipShape(RoundedRectangle(cornerRadius: 8)) + } else { + imageContent(image: image) + } } placeholder: { ProgressView() .padding() diff --git a/project.yml b/project.yml index f4d50a0..c10df0f 100644 --- a/project.yml +++ b/project.yml @@ -61,7 +61,7 @@ targets: INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]: UIStatusBarStyleDefault INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad: UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone: UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight - IPHONEOS_DEPLOYMENT_TARGET: 18.2 + IPHONEOS_DEPLOYMENT_TARGET: 17.0 MACOSX_DEPLOYMENT_TARGET: 15.2 MARKETING_VERSION: 1.0 SDKROOT: auto -- cgit v1.2.3