mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
76a2829361
@ -531,7 +531,7 @@ final class ChatMessageAttachedContentNode: ASDisplayNode {
|
|||||||
var additionalImageBadgeContent: ChatMessageInteractiveMediaBadgeContent?
|
var additionalImageBadgeContent: ChatMessageInteractiveMediaBadgeContent?
|
||||||
|
|
||||||
switch position {
|
switch position {
|
||||||
case .linear(_, .None), .linear(_, .Neighbour(true, _)):
|
case .linear(_, .None), .linear(_, .Neighbour(true, _, _)):
|
||||||
let imageMode = !((refineContentImageLayout == nil && refineContentFileLayout == nil && contentInstantVideoSizeAndApply == nil) || preferMediaBeforeText)
|
let imageMode = !((refineContentImageLayout == nil && refineContentFileLayout == nil && contentInstantVideoSizeAndApply == nil) || preferMediaBeforeText)
|
||||||
statusInText = !imageMode
|
statusInText = !imageMode
|
||||||
|
|
||||||
|
@ -46,9 +46,14 @@ enum ChatMessageBubbleRelativePosition {
|
|||||||
case freeform
|
case freeform
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum NeighbourSpacing {
|
||||||
|
case `default`
|
||||||
|
case condensed
|
||||||
|
}
|
||||||
|
|
||||||
case None(ChatMessageBubbleMergeStatus)
|
case None(ChatMessageBubbleMergeStatus)
|
||||||
case BubbleNeighbour
|
case BubbleNeighbour
|
||||||
case Neighbour(Bool, NeighbourType)
|
case Neighbour(Bool, NeighbourType, NeighbourSpacing)
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ChatMessageBubbleContentMosaicNeighbor {
|
enum ChatMessageBubbleContentMosaicNeighbor {
|
||||||
|
@ -32,6 +32,7 @@ enum InternalBubbleTapAction {
|
|||||||
private struct BubbleItemAttributes {
|
private struct BubbleItemAttributes {
|
||||||
var isAttachment: Bool
|
var isAttachment: Bool
|
||||||
var neighborType: ChatMessageBubbleRelativePosition.NeighbourType
|
var neighborType: ChatMessageBubbleRelativePosition.NeighbourType
|
||||||
|
var neighborSpacing: ChatMessageBubbleRelativePosition.NeighbourSpacing
|
||||||
}
|
}
|
||||||
|
|
||||||
private func contentNodeMessagesAndClassesForItem(_ item: ChatMessageItem) -> [(Message, AnyClass, ChatMessageEntryAttributes, BubbleItemAttributes)] {
|
private func contentNodeMessagesAndClassesForItem(_ item: ChatMessageItem) -> [(Message, AnyClass, ChatMessageEntryAttributes, BubbleItemAttributes)] {
|
||||||
@ -41,52 +42,61 @@ private func contentNodeMessagesAndClassesForItem(_ item: ChatMessageItem) -> [(
|
|||||||
var isUnsupportedMedia = false
|
var isUnsupportedMedia = false
|
||||||
var isAction = false
|
var isAction = false
|
||||||
|
|
||||||
|
var previousItemIsMusic = false
|
||||||
|
|
||||||
outer: for (message, itemAttributes) in item.content {
|
outer: for (message, itemAttributes) in item.content {
|
||||||
for attribute in message.attributes {
|
for attribute in message.attributes {
|
||||||
if let attribute = attribute as? RestrictedContentMessageAttribute, attribute.platformText(platform: "ios", contentSettings: item.context.currentContentSettings.with { $0 }) != nil {
|
if let attribute = attribute as? RestrictedContentMessageAttribute, attribute.platformText(platform: "ios", contentSettings: item.context.currentContentSettings.with { $0 }) != nil {
|
||||||
result.append((message, ChatMessageRestrictedBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform)))
|
result.append((message, ChatMessageRestrictedBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform, neighborSpacing: .default)))
|
||||||
break outer
|
break outer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inner: for media in message.media {
|
inner: for media in message.media {
|
||||||
|
var isMusic = false
|
||||||
if let _ = media as? TelegramMediaImage {
|
if let _ = media as? TelegramMediaImage {
|
||||||
result.append((message, ChatMessageMediaBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .media)))
|
result.append((message, ChatMessageMediaBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .media, neighborSpacing: .default)))
|
||||||
} else if let file = media as? TelegramMediaFile {
|
} else if let file = media as? TelegramMediaFile {
|
||||||
let isVideo = file.isVideo || (file.isAnimated && file.dimensions != nil)
|
let isVideo = file.isVideo || (file.isAnimated && file.dimensions != nil)
|
||||||
if isVideo {
|
if isVideo {
|
||||||
result.append((message, ChatMessageMediaBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .media)))
|
result.append((message, ChatMessageMediaBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .media, neighborSpacing: .default)))
|
||||||
} else {
|
} else {
|
||||||
result.append((message, ChatMessageFileBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform)))
|
var neighborSpacing: ChatMessageBubbleRelativePosition.NeighbourSpacing = .default
|
||||||
|
if previousItemIsMusic {
|
||||||
|
neighborSpacing = .condensed
|
||||||
|
}
|
||||||
|
isMusic = file.isMusic
|
||||||
|
result.append((message, ChatMessageFileBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform, neighborSpacing: neighborSpacing)))
|
||||||
}
|
}
|
||||||
} else if let action = media as? TelegramMediaAction {
|
} else if let action = media as? TelegramMediaAction {
|
||||||
isAction = true
|
isAction = true
|
||||||
if case .phoneCall = action.action {
|
if case .phoneCall = action.action {
|
||||||
result.append((message, ChatMessageCallBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform)))
|
result.append((message, ChatMessageCallBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform, neighborSpacing: .default)))
|
||||||
} else {
|
} else {
|
||||||
result.append((message, ChatMessageActionBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform)))
|
result.append((message, ChatMessageActionBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform, neighborSpacing: .default)))
|
||||||
}
|
}
|
||||||
} else if let _ = media as? TelegramMediaMap {
|
} else if let _ = media as? TelegramMediaMap {
|
||||||
result.append((message, ChatMessageMapBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform)))
|
result.append((message, ChatMessageMapBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform, neighborSpacing: .default)))
|
||||||
} else if let _ = media as? TelegramMediaGame {
|
} else if let _ = media as? TelegramMediaGame {
|
||||||
skipText = true
|
skipText = true
|
||||||
result.append((message, ChatMessageGameBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform)))
|
result.append((message, ChatMessageGameBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform, neighborSpacing: .default)))
|
||||||
break inner
|
break inner
|
||||||
} else if let _ = media as? TelegramMediaInvoice {
|
} else if let _ = media as? TelegramMediaInvoice {
|
||||||
skipText = true
|
skipText = true
|
||||||
result.append((message, ChatMessageInvoiceBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform)))
|
result.append((message, ChatMessageInvoiceBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform, neighborSpacing: .default)))
|
||||||
break inner
|
break inner
|
||||||
} else if let _ = media as? TelegramMediaContact {
|
} else if let _ = media as? TelegramMediaContact {
|
||||||
result.append((message, ChatMessageContactBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform)))
|
result.append((message, ChatMessageContactBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform, neighborSpacing: .default)))
|
||||||
} else if let _ = media as? TelegramMediaExpiredContent {
|
} else if let _ = media as? TelegramMediaExpiredContent {
|
||||||
result.removeAll()
|
result.removeAll()
|
||||||
result.append((message, ChatMessageActionBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform)))
|
result.append((message, ChatMessageActionBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform, neighborSpacing: .default)))
|
||||||
return result
|
return result
|
||||||
} else if let _ = media as? TelegramMediaPoll {
|
} else if let _ = media as? TelegramMediaPoll {
|
||||||
result.append((message, ChatMessagePollBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform)))
|
result.append((message, ChatMessagePollBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform, neighborSpacing: .default)))
|
||||||
} else if let _ = media as? TelegramMediaUnsupported {
|
} else if let _ = media as? TelegramMediaUnsupported {
|
||||||
isUnsupportedMedia = true
|
isUnsupportedMedia = true
|
||||||
}
|
}
|
||||||
|
previousItemIsMusic = isMusic
|
||||||
}
|
}
|
||||||
|
|
||||||
var messageText = message.text
|
var messageText = message.text
|
||||||
@ -100,7 +110,7 @@ private func contentNodeMessagesAndClassesForItem(_ item: ChatMessageItem) -> [(
|
|||||||
messageWithCaptionToAdd = (message, itemAttributes)
|
messageWithCaptionToAdd = (message, itemAttributes)
|
||||||
skipText = true
|
skipText = true
|
||||||
} else {
|
} else {
|
||||||
result.append((message, ChatMessageTextBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform)))
|
result.append((message, ChatMessageTextBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform, neighborSpacing: .default)))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if case .group = item.content {
|
if case .group = item.content {
|
||||||
@ -112,29 +122,29 @@ private func contentNodeMessagesAndClassesForItem(_ item: ChatMessageItem) -> [(
|
|||||||
inner: for media in message.media {
|
inner: for media in message.media {
|
||||||
if let webpage = media as? TelegramMediaWebpage {
|
if let webpage = media as? TelegramMediaWebpage {
|
||||||
if case .Loaded = webpage.content {
|
if case .Loaded = webpage.content {
|
||||||
result.append((message, ChatMessageWebpageBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform)))
|
result.append((message, ChatMessageWebpageBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform, neighborSpacing: .default)))
|
||||||
}
|
}
|
||||||
break inner
|
break inner
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if isUnsupportedMedia {
|
if isUnsupportedMedia {
|
||||||
result.append((message, ChatMessageUnsupportedBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform)))
|
result.append((message, ChatMessageUnsupportedBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform, neighborSpacing: .default)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let (messageWithCaptionToAdd, itemAttributes) = messageWithCaptionToAdd {
|
if let (messageWithCaptionToAdd, itemAttributes) = messageWithCaptionToAdd {
|
||||||
result.append((messageWithCaptionToAdd, ChatMessageTextBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform)))
|
result.append((messageWithCaptionToAdd, ChatMessageTextBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform, neighborSpacing: .default)))
|
||||||
}
|
}
|
||||||
|
|
||||||
if let additionalContent = item.additionalContent {
|
if let additionalContent = item.additionalContent {
|
||||||
switch additionalContent {
|
switch additionalContent {
|
||||||
case let .eventLogPreviousMessage(previousMessage):
|
case let .eventLogPreviousMessage(previousMessage):
|
||||||
result.append((previousMessage, ChatMessageEventLogPreviousMessageContentNode.self, ChatMessageEntryAttributes(), BubbleItemAttributes(isAttachment: false, neighborType: .freeform)))
|
result.append((previousMessage, ChatMessageEventLogPreviousMessageContentNode.self, ChatMessageEntryAttributes(), BubbleItemAttributes(isAttachment: false, neighborType: .freeform, neighborSpacing: .default)))
|
||||||
case let .eventLogPreviousDescription(previousMessage):
|
case let .eventLogPreviousDescription(previousMessage):
|
||||||
result.append((previousMessage, ChatMessageEventLogPreviousDescriptionContentNode.self, ChatMessageEntryAttributes(), BubbleItemAttributes(isAttachment: false, neighborType: .freeform)))
|
result.append((previousMessage, ChatMessageEventLogPreviousDescriptionContentNode.self, ChatMessageEntryAttributes(), BubbleItemAttributes(isAttachment: false, neighborType: .freeform, neighborSpacing: .default)))
|
||||||
case let .eventLogPreviousLink(previousMessage):
|
case let .eventLogPreviousLink(previousMessage):
|
||||||
result.append((previousMessage, ChatMessageEventLogPreviousLinkContentNode.self, ChatMessageEntryAttributes(), BubbleItemAttributes(isAttachment: false, neighborType: .freeform)))
|
result.append((previousMessage, ChatMessageEventLogPreviousLinkContentNode.self, ChatMessageEntryAttributes(), BubbleItemAttributes(isAttachment: false, neighborType: .freeform, neighborSpacing: .default)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,10 +177,10 @@ private func contentNodeMessagesAndClassesForItem(_ item: ChatMessageItem) -> [(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if canComment {
|
if canComment {
|
||||||
result.append((firstMessage, ChatMessageCommentFooterContentNode.self, ChatMessageEntryAttributes(), BubbleItemAttributes(isAttachment: true, neighborType: .freeform)))
|
result.append((firstMessage, ChatMessageCommentFooterContentNode.self, ChatMessageEntryAttributes(), BubbleItemAttributes(isAttachment: true, neighborType: .freeform, neighborSpacing: .default)))
|
||||||
}
|
}
|
||||||
} else if firstMessage.id.peerId.isReplies {
|
} else if firstMessage.id.peerId.isReplies {
|
||||||
result.append((firstMessage, ChatMessageCommentFooterContentNode.self, ChatMessageEntryAttributes(), BubbleItemAttributes(isAttachment: true, neighborType: .freeform)))
|
result.append((firstMessage, ChatMessageCommentFooterContentNode.self, ChatMessageEntryAttributes(), BubbleItemAttributes(isAttachment: true, neighborType: .freeform, neighborSpacing: .default)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1118,8 +1128,8 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePrevewItemNode
|
|||||||
let topPosition: ChatMessageBubbleRelativePosition
|
let topPosition: ChatMessageBubbleRelativePosition
|
||||||
let bottomPosition: ChatMessageBubbleRelativePosition
|
let bottomPosition: ChatMessageBubbleRelativePosition
|
||||||
|
|
||||||
var topBubbleAttributes = BubbleItemAttributes(isAttachment: false, neighborType: .freeform)
|
var topBubbleAttributes = BubbleItemAttributes(isAttachment: false, neighborType: .freeform, neighborSpacing: .default)
|
||||||
var bottomBubbleAttributes = BubbleItemAttributes(isAttachment: false, neighborType: .freeform)
|
var bottomBubbleAttributes = BubbleItemAttributes(isAttachment: false, neighborType: .freeform, neighborSpacing: .default)
|
||||||
if index != 0 {
|
if index != 0 {
|
||||||
topBubbleAttributes = contentPropertiesAndPrepareLayouts[index - 1].3
|
topBubbleAttributes = contentPropertiesAndPrepareLayouts[index - 1].3
|
||||||
}
|
}
|
||||||
@ -1127,8 +1137,8 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePrevewItemNode
|
|||||||
bottomBubbleAttributes = contentPropertiesAndPrepareLayouts[index + 1].3
|
bottomBubbleAttributes = contentPropertiesAndPrepareLayouts[index + 1].3
|
||||||
}
|
}
|
||||||
|
|
||||||
topPosition = .Neighbour(topBubbleAttributes.isAttachment, topBubbleAttributes.neighborType)
|
topPosition = .Neighbour(topBubbleAttributes.isAttachment, topBubbleAttributes.neighborType, topBubbleAttributes.neighborSpacing)
|
||||||
bottomPosition = .Neighbour(bottomBubbleAttributes.isAttachment, bottomBubbleAttributes.neighborType)
|
bottomPosition = .Neighbour(bottomBubbleAttributes.isAttachment, bottomBubbleAttributes.neighborType, bottomBubbleAttributes.neighborSpacing)
|
||||||
|
|
||||||
let prepareContentPosition: ChatMessageBubblePreparePosition
|
let prepareContentPosition: ChatMessageBubblePreparePosition
|
||||||
if let mosaicRange = mosaicRange, mosaicRange.contains(index) {
|
if let mosaicRange = mosaicRange, mosaicRange.contains(index) {
|
||||||
@ -1262,7 +1272,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePrevewItemNode
|
|||||||
|
|
||||||
let firstNodeTopPosition: ChatMessageBubbleRelativePosition
|
let firstNodeTopPosition: ChatMessageBubbleRelativePosition
|
||||||
if displayHeader {
|
if displayHeader {
|
||||||
firstNodeTopPosition = .Neighbour(false, .freeform)
|
firstNodeTopPosition = .Neighbour(false, .freeform, .default)
|
||||||
} else {
|
} else {
|
||||||
firstNodeTopPosition = .None(topNodeMergeStatus)
|
firstNodeTopPosition = .None(topNodeMergeStatus)
|
||||||
}
|
}
|
||||||
@ -1556,7 +1566,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePrevewItemNode
|
|||||||
if mosaicRange.upperBound - 1 == contentNodeCount - 1 {
|
if mosaicRange.upperBound - 1 == contentNodeCount - 1 {
|
||||||
lastMosaicBottomPosition = lastNodeTopPosition
|
lastMosaicBottomPosition = lastNodeTopPosition
|
||||||
} else {
|
} else {
|
||||||
lastMosaicBottomPosition = .Neighbour(false, .freeform)
|
lastMosaicBottomPosition = .Neighbour(false, .freeform, .default)
|
||||||
}
|
}
|
||||||
|
|
||||||
if position.contains(.bottom), case .Neighbour = lastMosaicBottomPosition {
|
if position.contains(.bottom), case .Neighbour = lastMosaicBottomPosition {
|
||||||
@ -1619,8 +1629,8 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePrevewItemNode
|
|||||||
let topPosition: ChatMessageBubbleRelativePosition
|
let topPosition: ChatMessageBubbleRelativePosition
|
||||||
let bottomPosition: ChatMessageBubbleRelativePosition
|
let bottomPosition: ChatMessageBubbleRelativePosition
|
||||||
|
|
||||||
var topBubbleAttributes = BubbleItemAttributes(isAttachment: false, neighborType: .freeform)
|
var topBubbleAttributes = BubbleItemAttributes(isAttachment: false, neighborType: .freeform, neighborSpacing: .default)
|
||||||
var bottomBubbleAttributes = BubbleItemAttributes(isAttachment: false, neighborType: .freeform)
|
var bottomBubbleAttributes = BubbleItemAttributes(isAttachment: false, neighborType: .freeform, neighborSpacing: .default)
|
||||||
if i != 0 {
|
if i != 0 {
|
||||||
topBubbleAttributes = contentPropertiesAndLayouts[i - 1].3
|
topBubbleAttributes = contentPropertiesAndLayouts[i - 1].3
|
||||||
}
|
}
|
||||||
@ -1631,19 +1641,19 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePrevewItemNode
|
|||||||
if i == 0 {
|
if i == 0 {
|
||||||
topPosition = firstNodeTopPosition
|
topPosition = firstNodeTopPosition
|
||||||
} else {
|
} else {
|
||||||
topPosition = .Neighbour(topBubbleAttributes.isAttachment, topBubbleAttributes.neighborType)
|
topPosition = .Neighbour(topBubbleAttributes.isAttachment, topBubbleAttributes.neighborType, topBubbleAttributes.neighborSpacing)
|
||||||
}
|
}
|
||||||
|
|
||||||
if i == contentNodeCount - 1 {
|
if i == contentNodeCount - 1 {
|
||||||
bottomPosition = lastNodeTopPosition
|
bottomPosition = lastNodeTopPosition
|
||||||
} else {
|
} else {
|
||||||
bottomPosition = .Neighbour(bottomBubbleAttributes.isAttachment, bottomBubbleAttributes.neighborType)
|
bottomPosition = .Neighbour(bottomBubbleAttributes.isAttachment, bottomBubbleAttributes.neighborType, bottomBubbleAttributes.neighborSpacing)
|
||||||
}
|
}
|
||||||
|
|
||||||
contentPosition = .linear(top: topPosition, bottom: bottomPosition)
|
contentPosition = .linear(top: topPosition, bottom: bottomPosition)
|
||||||
case .mosaic:
|
case .mosaic:
|
||||||
assertionFailure()
|
assertionFailure()
|
||||||
contentPosition = .linear(top: .Neighbour(false, .freeform), bottom: .Neighbour(false, .freeform))
|
contentPosition = .linear(top: .Neighbour(false, .freeform, .default), bottom: .Neighbour(false, .freeform, .default))
|
||||||
}
|
}
|
||||||
let (contentNodeWidth, contentNodeFinalize) = contentNodeLayout(CGSize(width: maximumNodeWidth, height: CGFloat.greatestFiniteMagnitude), contentPosition)
|
let (contentNodeWidth, contentNodeFinalize) = contentNodeLayout(CGSize(width: maximumNodeWidth, height: CGFloat.greatestFiniteMagnitude), contentPosition)
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
@ -106,7 +106,7 @@ final class ChatMessageCommentFooterContentNode: ChatMessageBubbleContentNode {
|
|||||||
|
|
||||||
let displaySeparator: Bool
|
let displaySeparator: Bool
|
||||||
let topOffset: CGFloat
|
let topOffset: CGFloat
|
||||||
if case let .linear(top, _) = preparePosition, case .Neighbour(_, .media) = top {
|
if case let .linear(top, _) = preparePosition, case .Neighbour(_, .media, _) = top {
|
||||||
displaySeparator = false
|
displaySeparator = false
|
||||||
topOffset = 2.0
|
topOffset = 2.0
|
||||||
} else {
|
} else {
|
||||||
|
@ -176,7 +176,7 @@ class ChatMessageContactBubbleContentNode: ChatMessageBubbleContentNode {
|
|||||||
|
|
||||||
let statusType: ChatMessageDateAndStatusType?
|
let statusType: ChatMessageDateAndStatusType?
|
||||||
switch position {
|
switch position {
|
||||||
case .linear(_, .None), .linear(_, .Neighbour(true, _)):
|
case .linear(_, .None), .linear(_, .Neighbour(true, _, _)):
|
||||||
if item.message.effectivelyIncoming(item.context.account.peerId) {
|
if item.message.effectivelyIncoming(item.context.account.peerId) {
|
||||||
statusType = .BubbleIncoming
|
statusType = .BubbleIncoming
|
||||||
} else {
|
} else {
|
||||||
|
@ -71,7 +71,7 @@ class ChatMessageFileBubbleContentNode: ChatMessageBubbleContentNode {
|
|||||||
let incoming = item.message.effectivelyIncoming(item.context.account.peerId)
|
let incoming = item.message.effectivelyIncoming(item.context.account.peerId)
|
||||||
let statusType: ChatMessageDateAndStatusType?
|
let statusType: ChatMessageDateAndStatusType?
|
||||||
switch preparePosition {
|
switch preparePosition {
|
||||||
case .linear(_, .None), .linear(_, .Neighbour(true, _)):
|
case .linear(_, .None), .linear(_, .Neighbour(true, _, _)):
|
||||||
if incoming {
|
if incoming {
|
||||||
statusType = .BubbleIncoming
|
statusType = .BubbleIncoming
|
||||||
} else {
|
} else {
|
||||||
@ -102,7 +102,7 @@ class ChatMessageFileBubbleContentNode: ChatMessageBubbleContentNode {
|
|||||||
var bottomInset = layoutConstants.file.bubbleInsets.bottom
|
var bottomInset = layoutConstants.file.bubbleInsets.bottom
|
||||||
|
|
||||||
if case let .linear(_, bottom) = position {
|
if case let .linear(_, bottom) = position {
|
||||||
if case .Neighbour = bottom {
|
if case .Neighbour(_, _, .condensed) = bottom {
|
||||||
bottomInset -= 24.0
|
bottomInset -= 24.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ class ChatMessageMapBubbleContentNode: ChatMessageBubbleContentNode {
|
|||||||
if activeLiveBroadcastingTimeout != nil || selectedMedia?.venue != nil {
|
if activeLiveBroadcastingTimeout != nil || selectedMedia?.venue != nil {
|
||||||
var relativePosition = position
|
var relativePosition = position
|
||||||
if case let .linear(top, _) = position {
|
if case let .linear(top, _) = position {
|
||||||
relativePosition = .linear(top: top, bottom: .Neighbour(false, .freeform))
|
relativePosition = .linear(top: top, bottom: .Neighbour(false, .freeform, .default))
|
||||||
}
|
}
|
||||||
imageCorners = chatMessageBubbleImageContentCorners(relativeContentPosition: relativePosition, normalRadius: layoutConstants.image.defaultCornerRadius, mergedRadius: layoutConstants.image.mergedCornerRadius, mergedWithAnotherContentRadius: layoutConstants.image.contentMergedCornerRadius, layoutConstants: layoutConstants, chatPresentationData: item.presentationData)
|
imageCorners = chatMessageBubbleImageContentCorners(relativeContentPosition: relativePosition, normalRadius: layoutConstants.image.defaultCornerRadius, mergedRadius: layoutConstants.image.mergedCornerRadius, mergedWithAnotherContentRadius: layoutConstants.image.contentMergedCornerRadius, layoutConstants: layoutConstants, chatPresentationData: item.presentationData)
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ class ChatMessageMapBubbleContentNode: ChatMessageBubbleContentNode {
|
|||||||
|
|
||||||
let statusType: ChatMessageDateAndStatusType?
|
let statusType: ChatMessageDateAndStatusType?
|
||||||
switch position {
|
switch position {
|
||||||
case .linear(_, .None), .linear(_, .Neighbour(true, _)):
|
case .linear(_, .None), .linear(_, .Neighbour(true, _, _)):
|
||||||
if selectedMedia?.venue != nil || activeLiveBroadcastingTimeout != nil {
|
if selectedMedia?.venue != nil || activeLiveBroadcastingTimeout != nil {
|
||||||
if item.message.effectivelyIncoming(item.context.account.peerId) {
|
if item.message.effectivelyIncoming(item.context.account.peerId) {
|
||||||
statusType = .BubbleIncoming
|
statusType = .BubbleIncoming
|
||||||
|
@ -207,7 +207,7 @@ class ChatMessageMediaBubbleContentNode: ChatMessageBubbleContentNode {
|
|||||||
|
|
||||||
let statusType: ChatMessageDateAndStatusType?
|
let statusType: ChatMessageDateAndStatusType?
|
||||||
switch position {
|
switch position {
|
||||||
case .linear(_, .None), .linear(_, .Neighbour(true, _)):
|
case .linear(_, .None), .linear(_, .Neighbour(true, _, _)):
|
||||||
if item.message.effectivelyIncoming(item.context.account.peerId) {
|
if item.message.effectivelyIncoming(item.context.account.peerId) {
|
||||||
statusType = .ImageIncoming
|
statusType = .ImageIncoming
|
||||||
} else {
|
} else {
|
||||||
|
@ -1054,7 +1054,7 @@ class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode {
|
|||||||
|
|
||||||
let statusType: ChatMessageDateAndStatusType?
|
let statusType: ChatMessageDateAndStatusType?
|
||||||
switch position {
|
switch position {
|
||||||
case .linear(_, .None), .linear(_, .Neighbour(true, _)):
|
case .linear(_, .None), .linear(_, .Neighbour(true, _, _)):
|
||||||
if incoming {
|
if incoming {
|
||||||
statusType = .BubbleIncoming
|
statusType = .BubbleIncoming
|
||||||
} else {
|
} else {
|
||||||
|
@ -85,7 +85,7 @@ class ChatMessageRestrictedBubbleContentNode: ChatMessageBubbleContentNode {
|
|||||||
|
|
||||||
let statusType: ChatMessageDateAndStatusType?
|
let statusType: ChatMessageDateAndStatusType?
|
||||||
switch position {
|
switch position {
|
||||||
case .linear(_, .None), .linear(_, .Neighbour(true, _)):
|
case .linear(_, .None), .linear(_, .Neighbour(true, _, _)):
|
||||||
if incoming {
|
if incoming {
|
||||||
statusType = .BubbleIncoming
|
statusType = .BubbleIncoming
|
||||||
} else {
|
} else {
|
||||||
|
@ -143,7 +143,7 @@ class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
|
|||||||
case let .linear(_, neighbor):
|
case let .linear(_, neighbor):
|
||||||
if case .None = neighbor {
|
if case .None = neighbor {
|
||||||
displayStatus = true
|
displayStatus = true
|
||||||
} else if case .Neighbour(true, _) = neighbor {
|
} else if case .Neighbour(true, _, _) = neighbor {
|
||||||
displayStatus = true
|
displayStatus = true
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user