Fix web preview

This commit is contained in:
Ali 2022-06-10 23:20:46 +04:00
parent 0608b573f9
commit 04003556f0
3 changed files with 23 additions and 12 deletions

View File

@ -811,7 +811,9 @@ public final class ListMessageSnippetItemNode: ListMessageNode {
if case .longTap = gesture { if case .longTap = gesture {
item.interaction.longTap(ChatControllerInteractionLongTapAction.url(url), message) item.interaction.longTap(ChatControllerInteractionLongTapAction.url(url), message)
} else if url == self.currentPrimaryUrl { } else if url == self.currentPrimaryUrl {
if !item.interaction.openMessage(message, .default) { if let webpage = self.currentMedia as? TelegramMediaWebpage, case let .Loaded(content) = webpage.content, content.instantPage != nil {
item.interaction.openInstantPage(message, nil)
} else {
item.interaction.openUrl(url, false, false, nil) item.interaction.openUrl(url, false, false, nil)
} }
} else { } else {

View File

@ -222,7 +222,7 @@
"decimalSeparator": ",", "decimalSeparator": ",",
"symbolOnLeft": false, "symbolOnLeft": false,
"spaceBetweenAmountAndSymbol": true, "spaceBetweenAmountAndSymbol": true,
"decimalDigits": 2 "decimalDigits": 0
}, },
"BZD": { "BZD": {
"code": "BZD", "code": "BZD",
@ -321,7 +321,7 @@
"decimalSeparator": ".", "decimalSeparator": ".",
"symbolOnLeft": true, "symbolOnLeft": true,
"spaceBetweenAmountAndSymbol": false, "spaceBetweenAmountAndSymbol": false,
"decimalDigits": 2 "decimalDigits": 0
}, },
"CZK": { "CZK": {
"code": "CZK", "code": "CZK",
@ -546,7 +546,7 @@
"decimalSeparator": ",", "decimalSeparator": ",",
"symbolOnLeft": true, "symbolOnLeft": true,
"spaceBetweenAmountAndSymbol": false, "spaceBetweenAmountAndSymbol": false,
"decimalDigits": 0 "decimalDigits": 2
}, },
"ILS": { "ILS": {
"code": "ILS", "code": "ILS",
@ -573,7 +573,7 @@
"decimalSeparator": ".", "decimalSeparator": ".",
"symbolOnLeft": true, "symbolOnLeft": true,
"spaceBetweenAmountAndSymbol": true, "spaceBetweenAmountAndSymbol": true,
"decimalDigits": 2 "decimalDigits": 3
}, },
"IRR": { "IRR": {
"code": "IRR", "code": "IRR",
@ -654,7 +654,7 @@
"decimalSeparator": ".", "decimalSeparator": ".",
"symbolOnLeft": false, "symbolOnLeft": false,
"spaceBetweenAmountAndSymbol": false, "spaceBetweenAmountAndSymbol": false,
"decimalDigits": 2 "decimalDigits": 0
}, },
"KPW": { "KPW": {
"code": "KPW", "code": "KPW",
@ -825,7 +825,7 @@
"decimalSeparator": ".", "decimalSeparator": ".",
"symbolOnLeft": false, "symbolOnLeft": false,
"spaceBetweenAmountAndSymbol": false, "spaceBetweenAmountAndSymbol": false,
"decimalDigits": 2 "decimalDigits": 1
}, },
"MTL": { "MTL": {
"code": "MTL", "code": "MTL",
@ -1014,7 +1014,7 @@
"decimalSeparator": ",", "decimalSeparator": ",",
"symbolOnLeft": true, "symbolOnLeft": true,
"spaceBetweenAmountAndSymbol": true, "spaceBetweenAmountAndSymbol": true,
"decimalDigits": 2 "decimalDigits": 0
}, },
"QAR": { "QAR": {
"code": "QAR", "code": "QAR",
@ -1059,7 +1059,7 @@
"decimalSeparator": ",", "decimalSeparator": ",",
"symbolOnLeft": true, "symbolOnLeft": true,
"spaceBetweenAmountAndSymbol": true, "spaceBetweenAmountAndSymbol": true,
"decimalDigits": 2 "decimalDigits": 0
}, },
"SAR": { "SAR": {
"code": "SAR", "code": "SAR",
@ -1302,7 +1302,7 @@
"decimalSeparator": ".", "decimalSeparator": ".",
"symbolOnLeft": true, "symbolOnLeft": true,
"spaceBetweenAmountAndSymbol": false, "spaceBetweenAmountAndSymbol": false,
"decimalDigits": 2 "decimalDigits": 0
}, },
"USD": { "USD": {
"code": "USD", "code": "USD",
@ -1401,7 +1401,7 @@
"decimalSeparator": ",", "decimalSeparator": ",",
"symbolOnLeft": false, "symbolOnLeft": false,
"spaceBetweenAmountAndSymbol": false, "spaceBetweenAmountAndSymbol": false,
"decimalDigits": 2 "decimalDigits": 0
}, },
"XPF": { "XPF": {
"code": "XPF", "code": "XPF",
@ -1410,7 +1410,7 @@
"decimalSeparator": ".", "decimalSeparator": ".",
"symbolOnLeft": false, "symbolOnLeft": false,
"spaceBetweenAmountAndSymbol": false, "spaceBetweenAmountAndSymbol": false,
"decimalDigits": 2 "decimalDigits": 0
}, },
"YER": { "YER": {
"code": "YER", "code": "YER",

View File

@ -826,6 +826,12 @@ final class ChatMessageAttachedContentNode: ASDisplayNode {
if let statusSizeAndApply = statusSizeAndApply { if let statusSizeAndApply = statusSizeAndApply {
adjustedBoundingSize.height += statusSizeAndApply.0.height adjustedBoundingSize.height += statusSizeAndApply.0.height
adjustedLineHeight += statusSizeAndApply.0.height adjustedLineHeight += statusSizeAndApply.0.height
if let imageFrame = imageFrame, statusSizeAndApply.0.height == 0.0 {
if statusInText {
adjustedBoundingSize.height = max(adjustedBoundingSize.height, imageFrame.maxY + 8.0 + 15.0)
}
}
} }
adjustedBoundingSize.width = max(boundingWidth, adjustedBoundingSize.width) adjustedBoundingSize.width = max(boundingWidth, adjustedBoundingSize.width)
@ -975,6 +981,9 @@ final class ChatMessageAttachedContentNode: ASDisplayNode {
var statusFrame = CGRect(origin: CGPoint(x: strongSelf.textNode.frame.minX, y: strongSelf.textNode.frame.maxY), size: statusSizeAndApply.0) var statusFrame = CGRect(origin: CGPoint(x: strongSelf.textNode.frame.minX, y: strongSelf.textNode.frame.maxY), size: statusSizeAndApply.0)
if let imageFrame = imageFrame { if let imageFrame = imageFrame {
statusFrame.origin.y = max(statusFrame.minY, imageFrame.maxY + 2.0) statusFrame.origin.y = max(statusFrame.minY, imageFrame.maxY + 2.0)
if statusFrame.height == 0.0 {
statusFrame.origin.y += 14.0
}
} }
if strongSelf.statusNode.supernode == nil { if strongSelf.statusNode.supernode == nil {
strongSelf.addSubnode(strongSelf.statusNode) strongSelf.addSubnode(strongSelf.statusNode)