diff options
| author | Fuwn <[email protected]> | 2025-06-14 21:53:55 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-06-14 21:53:55 -0700 |
| commit | 6ba8342d43ecca29b0a8a2131937536bbf363b09 (patch) | |
| tree | f7747739526597173cd4507d7d0d52cacb75463b | |
| parent | feat: Development commit (diff) | |
| download | sora-testing-6ba8342d43ecca29b0a8a2131937536bbf363b09.tar.xz sora-testing-6ba8342d43ecca29b0a8a2131937536bbf363b09.zip | |
feat: Development commit
| -rw-r--r-- | Sora/Views/Post/Grid/PostGridThumbnailView.swift | 41 | ||||
| -rw-r--r-- | 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 |