From 359986570eff4784aac72d95da7d725417248bd9 Mon Sep 17 00:00:00 2001 From: Ethan Pippin Date: Wed, 12 Jan 2022 17:27:04 -0700 Subject: [PATCH] reimplement NukeUI --- Shared/Views/ImageView.swift | 15 ++++---- Swiftfin.xcodeproj/project.pbxproj | 21 ++++++++++-- .../xcshareddata/swiftpm/Package.resolved | 34 ++++++++++++++----- 3 files changed, 51 insertions(+), 19 deletions(-) diff --git a/Shared/Views/ImageView.swift b/Shared/Views/ImageView.swift index 8fb14bdf..911e932b 100644 --- a/Shared/Views/ImageView.swift +++ b/Shared/Views/ImageView.swift @@ -6,6 +6,7 @@ // Copyright (c) 2022 Jellyfin & Jellyfin Contributors // +import NukeUI import SwiftUI struct ImageView: View { @@ -40,17 +41,12 @@ struct ImageView: View { } var body: some View { - AsyncImage(url: source, transaction: Transaction(animation: .easeInOut)) { phase in - switch phase { - case let .success(image): + LazyImage(source: source) { state in + if let image = state.image { image - .resizable() - .aspectRatio(contentMode: .fill) - case .failure: + } else if state.error != nil { failureImage - default: - // TODO: remove once placeholder hash image fixed - + } else { #if os(tvOS) ZStack { Color.black.ignoresSafeArea() @@ -66,5 +62,6 @@ struct ImageView: View { #endif } } + .pipeline(ImagePipeline(configuration: .withDataCache)) } } diff --git a/Swiftfin.xcodeproj/project.pbxproj b/Swiftfin.xcodeproj/project.pbxproj index 8ec7e1f9..fa5223e3 100644 --- a/Swiftfin.xcodeproj/project.pbxproj +++ b/Swiftfin.xcodeproj/project.pbxproj @@ -291,6 +291,7 @@ E131691726C583BC0074BFEE /* LogConstructor.swift in Sources */ = {isa = PBXBuildFile; fileRef = E131691626C583BC0074BFEE /* LogConstructor.swift */; }; E131691826C583BC0074BFEE /* LogConstructor.swift in Sources */ = {isa = PBXBuildFile; fileRef = E131691626C583BC0074BFEE /* LogConstructor.swift */; }; E131691926C583BC0074BFEE /* LogConstructor.swift in Sources */ = {isa = PBXBuildFile; fileRef = E131691626C583BC0074BFEE /* LogConstructor.swift */; }; + E1361DA7278FA7A300BEC523 /* NukeUI in Frameworks */ = {isa = PBXBuildFile; productRef = E1361DA6278FA7A300BEC523 /* NukeUI */; }; E1384944278036C70024FB48 /* VLCPlayerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1384943278036C70024FB48 /* VLCPlayerViewController.swift */; }; E13849452780370B0024FB48 /* PlaybackSpeed.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1C812B4277A8E5D00918266 /* PlaybackSpeed.swift */; }; E13DD3BF27163DD7009D4DAF /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E13DD3BE27163DD7009D4DAF /* AppDelegate.swift */; }; @@ -799,6 +800,7 @@ buildActionMask = 2147483647; files = ( E13DD3D327168E65009D4DAF /* Defaults in Frameworks */, + E1361DA7278FA7A300BEC523 /* NukeUI in Frameworks */, 53649AAD269CFAEA00A2D8B7 /* Puppy in Frameworks */, E10EAA4D277BB716000269ED /* Sliders in Frameworks */, 62C29E9C26D0FE4200C1D2E7 /* Stinsen in Frameworks */, @@ -1752,6 +1754,7 @@ E10EAA44277BB646000269ED /* JellyfinAPI */, E10EAA4C277BB716000269ED /* Sliders */, E1AE8E7B2789135A00FBDDAA /* Nuke */, + E1361DA6278FA7A300BEC523 /* NukeUI */, ); productName = JellyfinPlayer; productReference = 5377CBF1263B596A003A4E83 /* Swiftfin iOS.app */; @@ -1844,6 +1847,7 @@ E10EAA43277BB646000269ED /* XCRemoteSwiftPackageReference "jellyfin-sdk-swift" */, E10EAA4B277BB716000269ED /* XCRemoteSwiftPackageReference "swiftui-sliders" */, E1AE8E7A2789135A00FBDDAA /* XCRemoteSwiftPackageReference "Nuke" */, + E1361DA5278FA7A300BEC523 /* XCRemoteSwiftPackageReference "NukeUI" */, ); productRefGroup = 5377CBF2263B596A003A4E83 /* Products */; projectDirPath = ""; @@ -3024,6 +3028,14 @@ minimumVersion = 1.0.0; }; }; + E1361DA5278FA7A300BEC523 /* XCRemoteSwiftPackageReference "NukeUI" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/kean/NukeUI"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 0.7.0; + }; + }; E13DD3C42716499E009D4DAF /* XCRemoteSwiftPackageReference "CoreStore" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/JohnEstropia/CoreStore.git"; @@ -3044,8 +3056,8 @@ isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/kean/Nuke"; requirement = { - kind = upToNextMinorVersion; - minimumVersion = 9.6.0; + kind = upToNextMajorVersion; + minimumVersion = 10.0.0; }; }; E1C16B89271A2180009A5D25 /* XCRemoteSwiftPackageReference "SwiftyJSON" */ = { @@ -3139,6 +3151,11 @@ package = E1267D42271A212C003C492E /* XCRemoteSwiftPackageReference "CombineExt" */; productName = CombineExt; }; + E1361DA6278FA7A300BEC523 /* NukeUI */ = { + isa = XCSwiftPackageProductDependency; + package = E1361DA5278FA7A300BEC523 /* XCRemoteSwiftPackageReference "NukeUI" */; + productName = NukeUI; + }; E13DD3C52716499E009D4DAF /* CoreStore */ = { isa = XCSwiftPackageProductDependency; package = E13DD3C42716499E009D4DAF /* XCRemoteSwiftPackageReference "CoreStore" */; diff --git a/Swiftfin.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Swiftfin.xcworkspace/xcshareddata/swiftpm/Package.resolved index 3ed0ea18..00182b81 100644 --- a/Swiftfin.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Swiftfin.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -24,8 +24,8 @@ "repositoryURL": "https://github.com/CombineCommunity/CombineExt", "state": { "branch": null, - "revision": "0880829102152185190064fd17847a7c681d2127", - "version": "1.5.1" + "revision": "8ca006df5e3cc6bb176b70238e2b0014bbc3a235", + "version": "1.0.0" } }, { @@ -42,8 +42,17 @@ "repositoryURL": "https://github.com/sindresorhus/Defaults", "state": { "branch": null, - "revision": "55f3302c3ab30a8760f10042d0ebc0a6907f865a", - "version": "6.1.0" + "revision": "8a6e4a96fd38504a05903d136c85634b65fd7c4d", + "version": "6.0.0" + } + }, + { + "package": "Gifu", + "repositoryURL": "https://github.com/kaishin/Gifu", + "state": { + "branch": null, + "revision": "51f2eab32903e336f590c013267cfa4d7f8b06c4", + "version": "3.3.1" } }, { @@ -60,8 +69,17 @@ "repositoryURL": "https://github.com/kean/Nuke", "state": { "branch": null, - "revision": "7f73ceaeacd5df75a7994cd82e165ad9ff1815db", - "version": "9.6.1" + "revision": "6be3e778f1663b16dd645b7e8a0a01f73b5ed7f3", + "version": "10.6.1" + } + }, + { + "package": "NukeUI", + "repositoryURL": "https://github.com/kean/NukeUI", + "state": { + "branch": null, + "revision": "08e953d8d80b409bebcd95ba0635fdd748934ce0", + "version": "0.7.0" } }, { @@ -78,8 +96,8 @@ "repositoryURL": "https://github.com/sushichop/Puppy", "state": { "branch": null, - "revision": "95ce04b0e778b8d7c351876bc98bbf68328dfc9b", - "version": "0.3.1" + "revision": "dc82e65c749cee431ffbb8c0913680b61ccd7e08", + "version": "0.2.0" } }, {