fix document view swift ui

pull/874/head
Ryan Zhao 2 years ago
parent 2a10ab208a
commit a826fcb061

@ -5,6 +5,8 @@ import SessionUIKit
import SessionMessagingKit
struct DocumentView_SwiftUI: View {
static private let inset: CGFloat = 12
private let attachment: Attachment
private let textColor: ThemeValue
@ -21,20 +23,11 @@ struct DocumentView_SwiftUI: View {
ZStack {
Rectangle()
.foregroundColor(themeColor: .messageBubble_overlay)
.frame(
width: 24 + Values.mediumSpacing
)
Image(systemName: "doc")
.resizable()
.renderingMode(.template)
.font(.system(size: Values.largeFontSize))
.foregroundColor(themeColor: textColor)
.scaledToFit()
.frame(
width: 24,
height: 32
)
if attachment.isAudio {
Image(systemName: "music.note")
.resizable()
@ -48,6 +41,10 @@ struct DocumentView_SwiftUI: View {
)
}
}
.frame(
width: 24 + Values.mediumSpacing * 2,
height: 32 + Values.smallSpacing * 2
)
Spacer(minLength: 0)
@ -67,14 +64,9 @@ struct DocumentView_SwiftUI: View {
.padding(.horizontal, Values.mediumSpacing)
Image(systemName: (attachment.isAudio ? "play.fill" : "arrow.down"))
.resizable()
.renderingMode(.template)
.font(.system(size: Values.mediumFontSize))
.foregroundColor(themeColor: textColor)
.scaledToFit()
.frame(
width:24,
height: 24
)
.padding(.trailing, Self.inset)
}
}
}

@ -1101,6 +1101,8 @@ final class VisibleMessageCell: MessageCell, TappableLabelDelegate {
) -> NSMutableAttributedString?
{
guard
let body: String = cellViewModel.body,
!body.isEmpty,
let actualTextColor: UIColor = theme.color(for: textColor),
let backgroundPrimaryColor: UIColor = theme.color(for: .backgroundPrimary),
let textPrimaryColor: UIColor = theme.color(for: .textPrimary)
@ -1110,7 +1112,7 @@ final class VisibleMessageCell: MessageCell, TappableLabelDelegate {
let attributedText: NSMutableAttributedString = NSMutableAttributedString(
attributedString: MentionUtilities.highlightMentions(
in: (cellViewModel.body ?? ""),
in: body,
threadVariant: cellViewModel.threadVariant,
currentUserPublicKey: cellViewModel.currentUserPublicKey,
currentUserBlinded15PublicKey: cellViewModel.currentUserBlinded15PublicKey,

@ -53,7 +53,7 @@ struct MessageInfoView: View {
maxHeight: .infinity,
alignment: .topLeading
)
.fixedSize(horizontal: true, vertical: true)
.fixedSize()
.padding(.top, Values.smallSpacing)
.padding(.bottom, Values.verySmallSpacing)
.padding(.horizontal, Values.largeSpacing)
@ -85,7 +85,9 @@ struct MessageInfoView: View {
.padding(.horizontal, Values.largeSpacing)
}
if let attachments = messageViewModel.attachments {
if let attachments = messageViewModel.attachments,
messageViewModel.cellType == .mediaMessage
{
let attachment: Attachment = attachments[(index - 1 + attachments.count) % attachments.count]
ZStack(alignment: .bottomTrailing) {

Loading…
Cancel
Save