|
|
|
@ -26,10 +26,15 @@ struct MessageInfoScreen: View {
|
|
|
|
|
VStack(
|
|
|
|
|
alignment: .leading,
|
|
|
|
|
spacing: 10
|
|
|
|
|
) {
|
|
|
|
|
VStack(
|
|
|
|
|
alignment: .leading,
|
|
|
|
|
spacing: 0
|
|
|
|
|
) {
|
|
|
|
|
// Message bubble snapshot
|
|
|
|
|
MessageBubble(
|
|
|
|
|
messageViewModel: messageViewModel,
|
|
|
|
|
attachmentOnly: false,
|
|
|
|
|
dependencies: dependencies
|
|
|
|
|
)
|
|
|
|
|
.background(
|
|
|
|
@ -78,9 +83,9 @@ struct MessageInfoScreen: View {
|
|
|
|
|
.padding(.horizontal, Values.largeSpacing)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if let attachments = messageViewModel.attachments,
|
|
|
|
|
messageViewModel.cellType == .mediaMessage
|
|
|
|
|
{
|
|
|
|
|
if let attachments = messageViewModel.attachments {
|
|
|
|
|
switch messageViewModel.cellType {
|
|
|
|
|
case .mediaMessage:
|
|
|
|
|
let attachment: Attachment = attachments[(index - 1 + attachments.count) % attachments.count]
|
|
|
|
|
|
|
|
|
|
ZStack(alignment: .bottomTrailing) {
|
|
|
|
@ -134,7 +139,36 @@ struct MessageInfoScreen: View {
|
|
|
|
|
}
|
|
|
|
|
.padding(.vertical, Values.verySmallSpacing)
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
MessageBubble(
|
|
|
|
|
messageViewModel: messageViewModel,
|
|
|
|
|
attachmentOnly: true,
|
|
|
|
|
dependencies: dependencies
|
|
|
|
|
)
|
|
|
|
|
.background(
|
|
|
|
|
RoundedRectangle(cornerRadius: Self.cornerRadius)
|
|
|
|
|
.fill(
|
|
|
|
|
themeColor: (messageViewModel.variant == .standardIncoming || messageViewModel.variant == .standardIncomingDeleted || messageViewModel.variant == .standardIncomingDeletedLocally ?
|
|
|
|
|
.messageBubble_incomingBackground :
|
|
|
|
|
.messageBubble_outgoingBackground)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
.frame(
|
|
|
|
|
maxWidth: .infinity,
|
|
|
|
|
maxHeight: .infinity,
|
|
|
|
|
alignment: .topLeading
|
|
|
|
|
)
|
|
|
|
|
.fixedSize(horizontal: false, vertical: true)
|
|
|
|
|
.padding(.bottom, Values.verySmallSpacing)
|
|
|
|
|
.padding(.horizontal, Values.largeSpacing)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Attachment Info
|
|
|
|
|
if let attachments = messageViewModel.attachments {
|
|
|
|
|
let attachment: Attachment = attachments[(index - 1 + attachments.count) % attachments.count]
|
|
|
|
|
|
|
|
|
|
ZStack {
|
|
|
|
|
VStack(
|
|
|
|
|
alignment: .leading,
|
|
|
|
@ -381,6 +415,7 @@ struct MessageBubble: View {
|
|
|
|
|
static private let inset: CGFloat = 12
|
|
|
|
|
|
|
|
|
|
let messageViewModel: MessageViewModel
|
|
|
|
|
let attachmentOnly: Bool
|
|
|
|
|
let dependencies: Dependencies
|
|
|
|
|
|
|
|
|
|
var bodyLabelTextColor: ThemeValue {
|
|
|
|
@ -397,6 +432,7 @@ struct MessageBubble: View {
|
|
|
|
|
alignment: .leading,
|
|
|
|
|
spacing: 0
|
|
|
|
|
) {
|
|
|
|
|
if !attachmentOnly {
|
|
|
|
|
// FIXME: We should support rendering link previews alongside quotes (bigger refactor)
|
|
|
|
|
if let linkPreview: LinkPreview = messageViewModel.linkPreview {
|
|
|
|
|
switch linkPreview.variant {
|
|
|
|
@ -441,7 +477,10 @@ struct MessageBubble: View {
|
|
|
|
|
.fixedSize(horizontal: false, vertical: true)
|
|
|
|
|
.padding(.top, Self.inset)
|
|
|
|
|
.padding(.horizontal, Self.inset)
|
|
|
|
|
.padding(.bottom, -Values.smallSpacing)
|
|
|
|
|
.padding(.bottom, (messageViewModel.body?.isEmpty == false ?
|
|
|
|
|
-Values.smallSpacing :
|
|
|
|
|
Self.inset
|
|
|
|
|
))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -456,7 +495,8 @@ struct MessageBubble: View {
|
|
|
|
|
AttributedText(bodyText)
|
|
|
|
|
.padding(.all, Self.inset)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
switch messageViewModel.cellType {
|
|
|
|
|
case .mediaMessage:
|
|
|
|
|
if let bodyText: NSAttributedString = VisibleMessageCell.getBodyAttributedText(
|
|
|
|
@ -520,6 +560,7 @@ struct MessageBubble: View {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct InfoBlock<Content>: View where Content: View {
|
|
|
|
|
let title: String
|
|
|
|
|