mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-22 16:31:00 +00:00
Status media: Fix video size
This commit is contained in:
parent
2c3705a1da
commit
0449120684
1 changed files with 15 additions and 30 deletions
|
@ -146,43 +146,28 @@ public struct StatusMediaPreviewView: View {
|
|||
@ViewBuilder
|
||||
private func makeFeaturedImagePreview(attachment: MediaAttachment) -> some View {
|
||||
ZStack(alignment: .bottomTrailing) {
|
||||
let size: CGSize = size(for: attachment) ?? .init(width: imageMaxHeight, height: imageMaxHeight)
|
||||
let newSize = imageSize(from: size,
|
||||
newWidth: availableWidth - appLayoutWidth)
|
||||
switch attachment.supportedType {
|
||||
case .image:
|
||||
if let size = size(for: attachment) {
|
||||
let newSize = imageSize(from: size,
|
||||
newWidth: availableWidth - appLayoutWidth)
|
||||
|
||||
LazyImage(url: attachment.url) { state in
|
||||
if let image = state.image {
|
||||
image
|
||||
.resizingMode(.aspectFill)
|
||||
.cornerRadius(4)
|
||||
.frame(width: newSize.width, height: newSize.height)
|
||||
} else {
|
||||
RoundedRectangle(cornerRadius: 4)
|
||||
.fill(Color.gray)
|
||||
.frame(width: newSize.width, height: newSize.height)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LazyImage(url: attachment.url) { state in
|
||||
if let image = state.image {
|
||||
image
|
||||
.resizingMode(.aspectFit)
|
||||
.frame(maxHeight: imageMaxHeight)
|
||||
.cornerRadius(4)
|
||||
} else {
|
||||
RoundedRectangle(cornerRadius: 4)
|
||||
.fill(Color.gray)
|
||||
.frame(maxHeight: imageMaxHeight)
|
||||
}
|
||||
LazyImage(url: attachment.url) { state in
|
||||
if let image = state.image {
|
||||
image
|
||||
.resizingMode(.aspectFill)
|
||||
.cornerRadius(4)
|
||||
.frame(width: newSize.width, height: newSize.height)
|
||||
} else {
|
||||
RoundedRectangle(cornerRadius: 4)
|
||||
.fill(Color.gray)
|
||||
.frame(width: newSize.width, height: newSize.height)
|
||||
}
|
||||
}
|
||||
|
||||
case .gifv, .video, .audio:
|
||||
if let url = attachment.url {
|
||||
VideoPlayerView(viewModel: .init(url: url))
|
||||
.frame(maxWidth: isNotifications ? imageMaxHeight : nil)
|
||||
.frame(height: imageMaxHeight)
|
||||
.frame(width: newSize.width, height: newSize.height)
|
||||
}
|
||||
case .none:
|
||||
EmptyView()
|
||||
|
|
Loading…
Reference in a new issue