mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-19 09:41:29 +00:00
Fix action button layout
This commit is contained in:
parent
119db20d25
commit
183db2a8e4
@ -1286,10 +1286,12 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
needsForwardBackground = true
|
needsForwardBackground = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let baseWidth = params.width - params.leftInset - params.rightInset
|
||||||
|
|
||||||
var maxContentWidth = imageSize.width
|
var maxContentWidth = imageSize.width
|
||||||
var actionButtonsFinalize: ((CGFloat) -> (CGSize, (_ animation: ListViewItemUpdateAnimation) -> ChatMessageActionButtonsNode))?
|
var actionButtonsFinalize: ((CGFloat) -> (CGSize, (_ animation: ListViewItemUpdateAnimation) -> ChatMessageActionButtonsNode))?
|
||||||
if let replyMarkup = replyMarkup {
|
if let replyMarkup = replyMarkup {
|
||||||
let (minWidth, buttonsLayout) = actionButtonsLayout(item.context, item.presentationData.theme, item.presentationData.chatBubbleCorners, item.presentationData.strings, item.controllerInteraction.presentationContext.backgroundNode, replyMarkup, [:], item.message, maxContentWidth)
|
let (minWidth, buttonsLayout) = actionButtonsLayout(item.context, item.presentationData.theme, item.presentationData.chatBubbleCorners, item.presentationData.strings, item.controllerInteraction.presentationContext.backgroundNode, replyMarkup, [:], item.message, baseWidth)
|
||||||
maxContentWidth = max(maxContentWidth, minWidth)
|
maxContentWidth = max(maxContentWidth, minWidth)
|
||||||
actionButtonsFinalize = buttonsLayout
|
actionButtonsFinalize = buttonsLayout
|
||||||
} else if incoming, let attribute = item.message.attributes.first(where: { $0 is SuggestedPostMessageAttribute }) as? SuggestedPostMessageAttribute, attribute.state == nil {
|
} else if incoming, let attribute = item.message.attributes.first(where: { $0 is SuggestedPostMessageAttribute }) as? SuggestedPostMessageAttribute, attribute.state == nil {
|
||||||
@ -1325,7 +1327,7 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
],
|
],
|
||||||
flags: [],
|
flags: [],
|
||||||
placeholder: nil
|
placeholder: nil
|
||||||
), customIcons, item.message, maxContentWidth)
|
), customIcons, item.message, baseWidth)
|
||||||
maxContentWidth = max(maxContentWidth, minWidth)
|
maxContentWidth = max(maxContentWidth, minWidth)
|
||||||
actionButtonsFinalize = buttonsLayout
|
actionButtonsFinalize = buttonsLayout
|
||||||
}
|
}
|
||||||
@ -1377,7 +1379,6 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
layoutSize.height += 4.0 + reactionButtonsSizeAndApply.0.height
|
layoutSize.height += 4.0 + reactionButtonsSizeAndApply.0.height
|
||||||
}
|
}
|
||||||
|
|
||||||
let baseWidth = params.width - params.leftInset - params.rightInset
|
|
||||||
var suggestedPostInfoNodeLayout: (CGSize, () -> ChatMessageSuggestedPostInfoNode)?
|
var suggestedPostInfoNodeLayout: (CGSize, () -> ChatMessageSuggestedPostInfoNode)?
|
||||||
for attribute in item.message.attributes {
|
for attribute in item.message.attributes {
|
||||||
if let _ = attribute as? SuggestedPostMessageAttribute {
|
if let _ = attribute as? SuggestedPostMessageAttribute {
|
||||||
|
@ -2838,7 +2838,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||||||
],
|
],
|
||||||
flags: [],
|
flags: [],
|
||||||
placeholder: nil
|
placeholder: nil
|
||||||
), customIcons, item.message, maximumNodeWidth)
|
), customIcons, item.message, baseWidth)
|
||||||
maxContentWidth = max(maxContentWidth, minWidth)
|
maxContentWidth = max(maxContentWidth, minWidth)
|
||||||
actionButtonsFinalize = buttonsLayout
|
actionButtonsFinalize = buttonsLayout
|
||||||
|
|
||||||
|
@ -847,10 +847,12 @@ public class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||||||
needsForwardBackground = true
|
needsForwardBackground = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let baseWidth = params.width - params.leftInset - params.rightInset
|
||||||
|
|
||||||
var maxContentWidth = imageSize.width
|
var maxContentWidth = imageSize.width
|
||||||
var actionButtonsFinalize: ((CGFloat) -> (CGSize, (_ animation: ListViewItemUpdateAnimation) -> ChatMessageActionButtonsNode))?
|
var actionButtonsFinalize: ((CGFloat) -> (CGSize, (_ animation: ListViewItemUpdateAnimation) -> ChatMessageActionButtonsNode))?
|
||||||
if let replyMarkup = replyMarkup {
|
if let replyMarkup = replyMarkup {
|
||||||
let (minWidth, buttonsLayout) = actionButtonsLayout(item.context, item.presentationData.theme, item.presentationData.chatBubbleCorners, item.presentationData.strings, item.controllerInteraction.presentationContext.backgroundNode, replyMarkup, [:], item.message, maxContentWidth)
|
let (minWidth, buttonsLayout) = actionButtonsLayout(item.context, item.presentationData.theme, item.presentationData.chatBubbleCorners, item.presentationData.strings, item.controllerInteraction.presentationContext.backgroundNode, replyMarkup, [:], item.message, baseWidth)
|
||||||
maxContentWidth = max(maxContentWidth, minWidth)
|
maxContentWidth = max(maxContentWidth, minWidth)
|
||||||
actionButtonsFinalize = buttonsLayout
|
actionButtonsFinalize = buttonsLayout
|
||||||
} else if incoming, let attribute = item.message.attributes.first(where: { $0 is SuggestedPostMessageAttribute }) as? SuggestedPostMessageAttribute, attribute.state == nil {
|
} else if incoming, let attribute = item.message.attributes.first(where: { $0 is SuggestedPostMessageAttribute }) as? SuggestedPostMessageAttribute, attribute.state == nil {
|
||||||
@ -886,7 +888,7 @@ public class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||||||
],
|
],
|
||||||
flags: [],
|
flags: [],
|
||||||
placeholder: nil
|
placeholder: nil
|
||||||
), customIcons, item.message, maxContentWidth)
|
), customIcons, item.message, baseWidth)
|
||||||
maxContentWidth = max(maxContentWidth, minWidth)
|
maxContentWidth = max(maxContentWidth, minWidth)
|
||||||
actionButtonsFinalize = buttonsLayout
|
actionButtonsFinalize = buttonsLayout
|
||||||
}
|
}
|
||||||
@ -942,7 +944,6 @@ public class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||||||
layoutSize.height += actionButtonsSizeAndApply.0.height
|
layoutSize.height += actionButtonsSizeAndApply.0.height
|
||||||
}
|
}
|
||||||
|
|
||||||
let baseWidth = params.width - params.leftInset - params.rightInset
|
|
||||||
var suggestedPostInfoNodeLayout: (CGSize, () -> ChatMessageSuggestedPostInfoNode)?
|
var suggestedPostInfoNodeLayout: (CGSize, () -> ChatMessageSuggestedPostInfoNode)?
|
||||||
for attribute in item.message.attributes {
|
for attribute in item.message.attributes {
|
||||||
if let _ = attribute as? SuggestedPostMessageAttribute {
|
if let _ = attribute as? SuggestedPostMessageAttribute {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user