diff --git a/Packages/Status/Sources/Status/Row/Subviews/StatusRowMediaPreviewView.swift b/Packages/Status/Sources/Status/Row/Subviews/StatusRowMediaPreviewView.swift index 2569bd75..cef8fec9 100644 --- a/Packages/Status/Sources/Status/Row/Subviews/StatusRowMediaPreviewView.swift +++ b/Packages/Status/Sources/Status/Row/Subviews/StatusRowMediaPreviewView.swift @@ -141,12 +141,10 @@ private struct MediaPreview: View { switch displayData.type { case .image: LazyResizableImage(url: displayData.previewUrl) { state, proxy in - let width = isCompact ? imageMaxHeight : proxy.frame(in: .local).width if let image = state.image { image .resizable() .aspectRatio(contentMode: .fill) - .frame(maxWidth: width, maxHeight: imageMaxHeight) .overlay( RoundedRectangle(cornerRadius: 4) .stroke(.gray.opacity(0.35), lineWidth: 1) @@ -154,7 +152,6 @@ private struct MediaPreview: View { } else if state.isLoading { RoundedRectangle(cornerRadius: 4) .fill(Color.gray) - .frame(maxWidth: width, maxHeight: imageMaxHeight) } } .overlay { @@ -165,12 +162,11 @@ private struct MediaPreview: View { } case .av: MediaUIAttachmentVideoView(viewModel: .init(url: displayData.url)) - .frame(width: isCompact ? imageMaxHeight : proxy.frame(in: .local).width) - .frame(height: imageMaxHeight) .accessibilityAddTraits(.startsMediaSession) } } - .frame(width: imageMaxHeight / 1.5, height: imageMaxHeight) + .frame(width: displayData.isLandscape ? imageMaxHeight * 1.2 : imageMaxHeight / 1.5, + height: imageMaxHeight) .clipped() .cornerRadius(4) // #965: do not create overlapping tappable areas, when multiple images are shown @@ -407,6 +403,7 @@ private struct DisplayData: Identifiable, Hashable { let description: String? let type: DisplayType let accessibilityText: String + let isLandscape: Bool init?(from attachment: MediaAttachment) { guard let url = attachment.url else { return nil } @@ -418,6 +415,7 @@ private struct DisplayData: Identifiable, Hashable { description = attachment.description self.type = DisplayType(from: type) accessibilityText = Self.getAccessibilityString(from: attachment) + isLandscape = (attachment.meta?.original?.width ?? 0) > (attachment.meta?.original?.height ?? 0) } private static func getAccessibilityString(from attachment: MediaAttachment) -> String {