mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-23 00:40:59 +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,12 +146,11 @@ public struct StatusMediaPreviewView: View {
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
private func makeFeaturedImagePreview(attachment: MediaAttachment) -> some View {
|
private func makeFeaturedImagePreview(attachment: MediaAttachment) -> some View {
|
||||||
ZStack(alignment: .bottomTrailing) {
|
ZStack(alignment: .bottomTrailing) {
|
||||||
switch attachment.supportedType {
|
let size: CGSize = size(for: attachment) ?? .init(width: imageMaxHeight, height: imageMaxHeight)
|
||||||
case .image:
|
|
||||||
if let size = size(for: attachment) {
|
|
||||||
let newSize = imageSize(from: size,
|
let newSize = imageSize(from: size,
|
||||||
newWidth: availableWidth - appLayoutWidth)
|
newWidth: availableWidth - appLayoutWidth)
|
||||||
|
switch attachment.supportedType {
|
||||||
|
case .image:
|
||||||
LazyImage(url: attachment.url) { state in
|
LazyImage(url: attachment.url) { state in
|
||||||
if let image = state.image {
|
if let image = state.image {
|
||||||
image
|
image
|
||||||
|
@ -164,25 +163,11 @@ public struct StatusMediaPreviewView: View {
|
||||||
.frame(width: newSize.width, height: newSize.height)
|
.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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case .gifv, .video, .audio:
|
case .gifv, .video, .audio:
|
||||||
if let url = attachment.url {
|
if let url = attachment.url {
|
||||||
VideoPlayerView(viewModel: .init(url: url))
|
VideoPlayerView(viewModel: .init(url: url))
|
||||||
.frame(maxWidth: isNotifications ? imageMaxHeight : nil)
|
.frame(width: newSize.width, height: newSize.height)
|
||||||
.frame(height: imageMaxHeight)
|
|
||||||
}
|
}
|
||||||
case .none:
|
case .none:
|
||||||
EmptyView()
|
EmptyView()
|
||||||
|
|
Loading…
Reference in a new issue