From 425a4eef4fd5510861d471b0bd30940d261fe03f Mon Sep 17 00:00:00 2001 From: Alex Grebenyuk Date: Sat, 18 Feb 2023 01:25:10 -0500 Subject: [PATCH] Update to Nuke 12 (Beta 1) (#924) * Install Nuke from nuke-12 branch * Fixes --------- Co-authored-by: Thomas Ricouard --- .../xcshareddata/swiftpm/Package.resolved | 4 +-- .../Account/AccountDetailHeaderView.swift | 5 +++- .../Detail/ConversationMessageView.swift | 26 ++++++++++++------- Packages/DesignSystem/Package.swift | 2 +- .../StatusEditorAccessoryView.swift | 3 ++- .../Components/StatusEditorMediaView.swift | 3 ++- 6 files changed, 27 insertions(+), 16 deletions(-) diff --git a/IceCubesApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/IceCubesApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index cfcdc057..e00f3031 100644 --- a/IceCubesApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/IceCubesApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -50,8 +50,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/kean/Nuke", "state" : { - "revision" : "67bd45931180f652159e3342575277a7f197b3ab", - "version" : "11.6.2" + "branch" : "nuke-12", + "revision" : "1e3098adc210edb4b93f62d89c4687301e371a9a" } }, { diff --git a/Packages/Account/Sources/Account/AccountDetailHeaderView.swift b/Packages/Account/Sources/Account/AccountDetailHeaderView.swift index 67968451..48210319 100644 --- a/Packages/Account/Sources/Account/AccountDetailHeaderView.swift +++ b/Packages/Account/Sources/Account/AccountDetailHeaderView.swift @@ -42,8 +42,11 @@ struct AccountDetailHeaderView: View { LazyImage(url: account.header) { state in if let image = state.image { image - .resizingMode(.aspectFill) + .resizable() + .aspectRatio(contentMode: .fill) .overlay(account.haveHeader ? .black.opacity(0.50) : .clear) + .frame(height: Constants.headerHeight) + .clipped() } else if state.isLoading { theme.secondaryBackgroundColor .frame(height: Constants.headerHeight) diff --git a/Packages/Conversations/Sources/Conversations/Detail/ConversationMessageView.swift b/Packages/Conversations/Sources/Conversations/Detail/ConversationMessageView.swift index 4a90c8e8..42a38851 100644 --- a/Packages/Conversations/Sources/Conversations/Detail/ConversationMessageView.swift +++ b/Packages/Conversations/Sources/Conversations/Detail/ConversationMessageView.swift @@ -125,16 +125,22 @@ struct ConversationMessageView: View { } private func makeMediaView(_ attachement: MediaAttachment) -> some View { - LazyImage(url: attachement.url) { state in - if let image = state.image { - image - .resizingMode(.aspectFill) - .cornerRadius(8) - .padding(8) - } else if state.isLoading { - RoundedRectangle(cornerRadius: 8) - .fill(Color.gray) - .frame(height: 200) + GeometryReader { proxy in + LazyImage(url: attachement.url) { state in + if let image = state.image { + image + .resizable() + .aspectRatio(contentMode: .fill) + .frame(height: 200) + .frame(maxWidth: proxy.frame(in: .local).width) + .clipped() + .cornerRadius(8) + .padding(8) + } else if state.isLoading { + RoundedRectangle(cornerRadius: 8) + .fill(Color.gray) + .frame(height: 200) + } } } .frame(height: 200) diff --git a/Packages/DesignSystem/Package.swift b/Packages/DesignSystem/Package.swift index 3012abf5..a928d495 100644 --- a/Packages/DesignSystem/Package.swift +++ b/Packages/DesignSystem/Package.swift @@ -19,7 +19,7 @@ let package = Package( .package(name: "Models", path: "../Models"), .package(name: "Env", path: "../Env"), .package(url: "https://github.com/markiv/SwiftUI-Shimmer", exact: "1.1.0"), - .package(url: "https://github.com/kean/Nuke", from: "11.6.0"), + .package(url: "https://github.com/kean/Nuke", branch: "nuke-12"), .package(url: "https://github.com/divadretlaw/EmojiText", from: "1.1.0"), ], targets: [ diff --git a/Packages/Status/Sources/Status/Editor/Components/StatusEditorAccessoryView.swift b/Packages/Status/Sources/Status/Editor/Components/StatusEditorAccessoryView.swift index e8de2790..541518d1 100644 --- a/Packages/Status/Sources/Status/Editor/Components/StatusEditorAccessoryView.swift +++ b/Packages/Status/Sources/Status/Editor/Components/StatusEditorAccessoryView.swift @@ -243,7 +243,8 @@ struct StatusEditorAccessoryView: View { LazyImage(url: emoji.url) { state in if let image = state.image { image - .resizingMode(.aspectFit) + .resizable() + .aspectRatio(contentMode: .fill) .frame(width: 40, height: 40) } else if state.isLoading { Rectangle() diff --git a/Packages/Status/Sources/Status/Editor/Components/StatusEditorMediaView.swift b/Packages/Status/Sources/Status/Editor/Components/StatusEditorMediaView.swift index fc1f82ee..488c8cf1 100644 --- a/Packages/Status/Sources/Status/Editor/Components/StatusEditorMediaView.swift +++ b/Packages/Status/Sources/Status/Editor/Components/StatusEditorMediaView.swift @@ -100,7 +100,8 @@ struct StatusEditorMediaView: View { LazyImage(url: url) { state in if let image = state.image { image - .resizingMode(.aspectFill) + .resizable() + .aspectRatio(contentMode: .fill) .frame(width: 150, height: 150) } else { placeholderView