fix gif caching

This commit is contained in:
leminlimez committed 2025-07-19 08:58:08 -04:00
1 parent 71b1d0a21d
commit 395cbe5e13
19 files changed
+728 -475

No files matched your search

@@ -7,7 +7,6 @@
import SwiftUI
import CachedAsyncImage
import Giffy
let MIN_SIZE: CGFloat = 165
@@ -57,33 +56,11 @@ struct ExploreView: View {
}) {
VStack(spacing: 0) {
if wallpaper.previewIsGif() {
CachedAsyncGiffy(url: cowabungaAPI.getPreviewURLForWallpaper(wallpaper: wallpaper), urlCache: .imageCache) { giffy in
giffy
.aspectRatio(contentMode: .fill)
.frame(maxWidth: .infinity)
.cornerRadius(10, corners: .topLeft)
.cornerRadius(10, corners: .topRight)
} placeholder: {
Color.gray
.frame(height: MIN_SIZE)
}
// Non-cached code:
// AsyncGiffy(url: cowabungaAPI.getPreviewURLForWallpaper(wallpaper: wallpaper)) { phase in
// switch phase {
// case .loading:
// Color.gray
// .frame(height: MIN_SIZE)
// case .error:
// Color.red
// .frame(height: MIN_SIZE)
// case .success(let giffy):
// giffy
// .aspectRatio(contentMode: .fill)
// .frame(maxWidth: .infinity)
// .cornerRadius(10, corners: .topLeft)
// .cornerRadius(10, corners: .topRight)
// }
// }
GIFImage(url: cowabungaAPI.getPreviewURLForWallpaper(wallpaper: wallpaper), animate: true, loop: true)
.aspectRatio(contentMode: .fill)
.frame(maxWidth: .infinity)
.cornerRadius(10, corners: .topLeft)
.cornerRadius(10, corners: .topRight)
} else {
CachedAsyncImage(url: cowabungaAPI.getPreviewURLForWallpaper(wallpaper: wallpaper), urlCache: .imageCache) { image in
image