Edit message media preview

This commit is contained in:
Isaac
2024-05-26 20:42:43 +04:00
parent 2456eba1b4
commit d6ebf1b4ff
12 changed files with 404 additions and 35 deletions

View File

@@ -250,7 +250,14 @@ private func contentNodeMessagesAndClassesForItem(_ item: ChatMessageItem) -> ([
messageWithCaptionToAdd = (message, itemAttributes)
skipText = true
} else {
if let _ = message.attributes.first(where: { $0 is InvertMediaMessageAttribute }) {
var isMediaInverted = false
if let updatingMedia = itemAttributes.updatingMedia {
isMediaInverted = updatingMedia.invertMediaAttribute != nil
} else if let _ = message.attributes.first(where: { $0 is InvertMediaMessageAttribute }) {
isMediaInverted = true
}
if isMediaInverted {
result.insert((message, ChatMessageTextBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .text, neighborSpacing: isFile ? .condensed : .default)), at: 0)
} else {
result.append((message, ChatMessageTextBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .text, neighborSpacing: isFile ? .condensed : .default)))
@@ -303,7 +310,14 @@ private func contentNodeMessagesAndClassesForItem(_ item: ChatMessageItem) -> ([
}
if let (messageWithCaptionToAdd, itemAttributes) = messageWithCaptionToAdd {
if let _ = messageWithCaptionToAdd.attributes.first(where: { $0 is InvertMediaMessageAttribute }) {
var isMediaInverted = false
if let updatingMedia = itemAttributes.updatingMedia {
isMediaInverted = updatingMedia.invertMediaAttribute != nil
} else if let _ = messageWithCaptionToAdd.attributes.first(where: { $0 is InvertMediaMessageAttribute }) {
isMediaInverted = true
}
if isMediaInverted {
if result.isEmpty {
needReactions = false
}