Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios

This commit is contained in:
Ilya Laktyushin 2026-05-29 10:01:53 +02:00
commit 4b2a826682
59 changed files with 2031 additions and 1350 deletions

View file

@ -1116,8 +1116,14 @@ private func blockIsEntityExpressible(_ block: InstantPageBlock) -> Bool {
return richTextIsEntityExpressible(text)
case .preformatted(let text, _):
return richTextIsEntityExpressible(text)
case .blockQuote(let text, let caption):
return isEmptyRichText(caption) && richTextIsEntityExpressible(text)
case .blockQuote(let blocks, let caption):
guard isEmptyRichText(caption) else { return false }
return blocks.allSatisfy { child in
if case let .paragraph(text) = child {
return richTextIsEntityExpressible(text)
}
return false
}
case .anchor, .unsupported:
return true
case .divider:
@ -1392,24 +1398,17 @@ private func markdownBlocks(from node: MarkdownIntentNode, context: MarkdownConv
case .thematicBreak:
return [.divider]
case .blockQuote:
var result: [InstantPageBlock] = []
var childBlocks: [InstantPageBlock] = []
for child in node.children {
guard let childBlocks = markdownBlocks(from: child, context: context, depth: depth + 1) else {
guard let parsed = markdownBlocks(from: child, context: context, depth: depth + 1) else {
return nil
}
for childBlock in childBlocks {
switch childBlock {
case let .paragraph(text):
result.append(.blockQuote(text: text, caption: .empty))
default:
let plainText = markdownPlainText(from: childBlock, depth: depth + 1)
if !plainText.isEmpty {
result.append(.blockQuote(text: .plain(plainText), caption: .empty))
}
}
}
childBlocks.append(contentsOf: parsed)
}
return result
guard !childBlocks.isEmpty else {
return []
}
return [.blockQuote(blocks: childBlocks, caption: .empty)]
case .orderedList:
guard let items = markdownListItems(from: node.children, ordered: true, context: context, depth: depth + 1) else {
return nil
@ -2213,8 +2212,9 @@ private func markdownPlainText(from block: InstantPageBlock, depth: Int = 0) ->
return text.plainText
case let .footer(text):
return text.plainText
case let .blockQuote(text, caption):
return text.plainText.isEmpty ? caption.plainText : text.plainText
case let .blockQuote(blocks, caption):
let blocksText = blocks.map { markdownPlainText(from: $0, depth: depth + 1) }.joined(separator: "\n")
return blocksText.isEmpty ? caption.plainText : blocksText
case let .pullQuote(text, caption):
return text.plainText.isEmpty ? caption.plainText : text.plainText
case let .kicker(text):

View file

@ -849,7 +849,7 @@ private func parsePageBlocks(_ input: [Any], _ url: String, _ media: inout [Engi
case "pre":
result.append(.preformatted(text: .fixed(trim(parseRichText(item, &media))), language: nil))
case "blockquote":
result.append(.blockQuote(text: .italic(trim(parseRichText(item, &media))), caption: .empty))
result.append(.blockQuote(blocks: [.paragraph(.italic(trim(parseRichText(item, &media))))], caption: .empty))
case "img":
if let image = parseImage(item, &media) {
result.append(image)

View file

@ -39,8 +39,8 @@ private func markdownString(from block: InstantPageBlock) -> String? {
case let .preformatted(text, language):
let language = language ?? ""
return "```\(language)\n\(markdownInline(from: text))\n```"
case let .blockQuote(text, _):
return markdownBlockQuote(text)
case let .blockQuote(blocks, _):
return markdownBlockQuoteBlocks(blocks)
case let .pullQuote(text, _):
return markdownBlockQuote(text)
case let .list(items, ordered):
@ -69,6 +69,19 @@ private func markdownBlockQuote(_ text: RichText) -> String {
return lines.map { "> \($0)" }.joined(separator: "\n")
}
private func markdownBlockQuoteBlocks(_ blocks: [InstantPageBlock]) -> String {
var lines: [String] = []
for block in blocks {
guard let body = markdownString(from: block) else {
continue
}
for line in body.split(separator: "\n", omittingEmptySubsequences: false) {
lines.append("> \(String(line))")
}
}
return lines.joined(separator: "\n")
}
private func markdownInline(from richText: RichText) -> String {
switch richText {
case .empty:

View file

@ -501,40 +501,65 @@ public func layoutInstantPageBlock(webpage: TelegramMediaWebpage, userLocation:
}
}
return InstantPageLayout(origin: CGPoint(), contentSize: contentSize, items: listItems)
case let .blockQuote(text, caption):
case let .blockQuote(blocks, caption):
let lineInset: CGFloat = 20.0
let verticalInset: CGFloat = 4.0
var contentSize = CGSize(width: boundingWidth, height: verticalInset)
var items: [InstantPageItem] = []
let styleStack = InstantPageTextStyleStack()
setupStyleStack(styleStack, theme: theme, category: .paragraph, link: false)
styleStack.push(.italic)
let (_, textItems, textContentSize) = layoutTextItemWithString(attributedStringForRichText(text, styleStack: styleStack), boundingWidth: boundingWidth - horizontalInset * 2.0 - lineInset, offset: CGPoint(x: horizontalInset + lineInset, y: contentSize.height), media: media, webpage: webpage, fitToWidth: fitToWidth)
contentSize.height += textContentSize.height
items.append(contentsOf: textItems)
let innerBoundingWidth = boundingWidth - horizontalInset * 2.0 - lineInset
let innerHorizontalInset = horizontalInset + lineInset
if blocks.count == 1, case let .paragraph(text) = blocks[0] {
// Legacy single-paragraph fast path: italicized body (unchanged from prior behavior).
let styleStack = InstantPageTextStyleStack()
setupStyleStack(styleStack, theme: theme, category: .paragraph, link: false)
styleStack.push(.italic)
let (_, textItems, textContentSize) = layoutTextItemWithString(attributedStringForRichText(text, styleStack: styleStack), boundingWidth: innerBoundingWidth, offset: CGPoint(x: innerHorizontalInset, y: contentSize.height), media: media, webpage: webpage, fitToWidth: fitToWidth)
contentSize.height += textContentSize.height
items.append(contentsOf: textItems)
} else {
var previousChildItems: [InstantPageItem] = []
// Fixed, compact gap between a quote's child blocks (the full page-flow
// spacing around quotes is too airy when nested); the first child hugs
// the top (only verticalInset above it).
let childSpacing: CGFloat = 10.0
for (i, child) in blocks.enumerated() {
let childLayout = layoutInstantPageBlock(webpage: webpage, userLocation: userLocation, rtl: rtl, block: child, boundingWidth: innerBoundingWidth, horizontalInset: innerHorizontalInset, safeInset: safeInset, isCover: false, previousItems: previousChildItems, fillToSize: nil, media: media, mediaIndexCounter: &mediaIndexCounter, embedIndexCounter: &embedIndexCounter, detailsIndexCounter: &detailsIndexCounter, theme: theme, strings: strings, dateTimeFormat: dateTimeFormat, webEmbedHeights: webEmbedHeights, cachedMessageSyntaxHighlight: cachedMessageSyntaxHighlight, excludeCaptions: excludeCaptions, isLast: i == blocks.count - 1 && isLast, fitToWidth: fitToWidth)
let spacing: CGFloat = i == 0 ? 0.0 : childSpacing
contentSize.height += spacing
var childItems: [InstantPageItem] = []
for var item in childLayout.items {
item.frame = item.frame.offsetBy(dx: 0.0, dy: contentSize.height)
childItems.append(item)
}
items.append(contentsOf: childItems)
previousChildItems = childItems
contentSize.height += childLayout.contentSize.height
}
}
if case .empty = caption {
} else {
contentSize.height += 14.0
let styleStack = InstantPageTextStyleStack()
setupStyleStack(styleStack, theme: theme, category: .caption, link: false)
let (_, captionItems, captionContentSize) = layoutTextItemWithString(attributedStringForRichText(caption, styleStack: styleStack), boundingWidth: boundingWidth - horizontalInset * 2.0 - lineInset, offset: CGPoint(x: horizontalInset + lineInset, y: contentSize.height), media: media, webpage: webpage)
let (_, captionItems, captionContentSize) = layoutTextItemWithString(attributedStringForRichText(caption, styleStack: styleStack), boundingWidth: innerBoundingWidth, offset: CGPoint(x: innerHorizontalInset, y: contentSize.height), media: media, webpage: webpage)
contentSize.height += captionContentSize.height
items.append(contentsOf: captionItems)
}
contentSize.height += verticalInset
let shapeItem = InstantPageShapeItem(frame: CGRect(origin: CGPoint(x: horizontalInset, y: 0.0), size: CGSize(width: 3.0, height: contentSize.height)), shapeFrame: CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: 3.0, height: contentSize.height)), shape: .roundLine, color: theme.textCategories.paragraph.color)
items.append(shapeItem)
return InstantPageLayout(origin: CGPoint(), contentSize: contentSize, items: items)
case let .pullQuote(text, caption):
let verticalInset: CGFloat = 4.0

View file

@ -163,16 +163,28 @@ public final class InstantPageTheme {
}
func headingTextAttributes(level: Int32, link: Bool) -> InstantPageTextAttributes {
let clampedLevel = max(Int32(3), min(level, Int32(6)))
let subheaderAttributes = self.textCategories.subheader
guard clampedLevel > 3 else {
return subheaderAttributes.withUnderline(link)
let clampedLevel = max(Int32(1), min(level, Int32(6)))
// H1/H2 reuse the theme's existing big-text categories verbatim, so they
// pick up the theme color, line-spacing, and any dynamic-type scaling.
switch clampedLevel {
case 1:
return self.textCategories.header.withUnderline(link)
case 2:
return self.textCategories.subheader.withUnderline(link)
default:
break
}
// H3H6: serif at a per-level base size, scaled by the same dynamic-type
// multiplier the subheader category uses (subheader.size / 19.0).
let subheaderAttributes = self.textCategories.subheader
let baseSize: CGFloat
switch clampedLevel {
case 4:
case 3:
baseSize = 17.0
case 4:
baseSize = 16.0
case 5:
baseSize = 15.0
default:

View file

@ -437,7 +437,16 @@ public func lastTextLineFrameIfLastItemIsText(in layout: InstantPageV2Layout) ->
else {
return nil
}
let lineFrame = last.frame.offsetBy(dx: text.frame.minX, dy: text.frame.minY)
// The stored line frame always has minX = 0 alignment (center / right / natural-RTL) is
// applied at render time by `v2FrameForLine`. Apply the same correction here so the returned
// frame's `maxX` reflects the line's actual on-screen right edge, not just its width anchored
// at the textItem's left. Without this, a right-aligned or RTL last line whose visible right
// edge sits at `textItem.width`, all the way at the right text inset would feed the status
// node a `contentWidth` equal to just `lineWidth`. The trail/wrap decision would then think
// the date fits trailing the line, and place it directly on top of the line at the right text
// inset where the line itself ends. The width is unchanged; only `origin.x` shifts.
let displayedLineFrame = v2FrameForLine(last, boundingWidth: text.textItem.frame.width, alignment: text.textItem.alignment)
let lineFrame = displayedLineFrame.offsetBy(dx: text.frame.minX, dy: text.frame.minY)
var ascent: CGFloat = 0.0
var descent: CGFloat = 0.0
var leading: CGFloat = 0.0
@ -585,14 +594,14 @@ private func layoutBlock(
return layoutCodeBlock(text, language: language, boundingWidth: boundingWidth,
horizontalInset: horizontalInset, context: &context)
case let .blockQuote(text, caption):
return layoutBlockQuote(text: text, caption: caption, isPull: false,
case let .blockQuote(blocks, caption):
return layoutBlockQuote(blocks: blocks, caption: caption,
boundingWidth: boundingWidth, horizontalInset: horizontalInset,
context: &context)
isLast: isLast, context: &context)
case let .pullQuote(text, caption):
return layoutBlockQuote(text: text, caption: caption, isPull: true,
boundingWidth: boundingWidth, horizontalInset: horizontalInset,
context: &context)
return layoutQuoteText(text: text, caption: caption, isPull: true,
boundingWidth: boundingWidth, horizontalInset: horizontalInset,
context: &context)
case let .image(id, caption, url, webpageId):
if case let .image(image) = context.media[id], let largest = largestImageRepresentation(image.representations) {
@ -1892,6 +1901,86 @@ private func layoutCodeBlock(
// MARK: - Block quote / pull quote layout (ported from V1 InstantPageLayout.swift lines 517586)
private func layoutBlockQuote(
blocks: [InstantPageBlock],
caption: RichText,
boundingWidth: CGFloat,
horizontalInset: CGFloat,
isLast: Bool,
context: inout LayoutContext
) -> [InstantPageV2LaidOutItem] {
// Legacy single-paragraph fast path: preserve today's italicized body styling.
if blocks.count == 1, case let .paragraph(text) = blocks[0] {
return layoutQuoteText(text: text, caption: caption, isPull: false,
boundingWidth: boundingWidth, horizontalInset: horizontalInset,
context: &context)
}
let verticalInset: CGFloat = 4.0
let lineInset: CGFloat = 20.0
let barWidth: CGFloat = 3.0
let innerBoundingWidth = boundingWidth - horizontalInset * 2.0 - lineInset
let innerHorizontalInset = horizontalInset + lineInset
var result: [InstantPageV2LaidOutItem] = []
var contentHeight: CGFloat = verticalInset
// Fixed, compact gap between a quote's child blocks. The full page-flow spacing
// (spacingBetweenBlocks ~27pt around quotes) is too airy when nested; the first
// child hugs the top (only verticalInset above it).
let childSpacing: CGFloat = 10.0
for (i, child) in blocks.enumerated() {
let spacing: CGFloat = i == 0 ? 0.0 : childSpacing
let childItems = layoutBlock(
child,
boundingWidth: innerBoundingWidth,
horizontalInset: innerHorizontalInset,
isCover: false,
previousItems: result,
isLast: i == blocks.count - 1 && isLast,
context: &context
)
let dy = contentHeight + spacing
let offsetItems = childItems.map { $0.offsetBy(CGPoint(x: 0.0, y: dy)) }
let childMaxY = offsetItems.map { $0.frame.maxY }.max() ?? dy
contentHeight = max(contentHeight, childMaxY)
result.append(contentsOf: offsetItems)
}
// Optional caption (mirrors layoutQuoteText's caption branch).
if case .empty = caption {
// no caption
} else {
contentHeight += 14.0
let captionStyleStack = InstantPageTextStyleStack()
setupStyleStack(captionStyleStack, theme: context.theme, category: .caption, link: false)
let attributedCaption = attributedStringForRichText(caption, styleStack: captionStyleStack)
let (_, captionItems, captionSize) = layoutTextItem(
attributedCaption,
boundingWidth: innerBoundingWidth,
alignment: .natural,
offset: CGPoint(x: innerHorizontalInset, y: contentHeight),
fitToWidth: context.fitToWidth,
computeRevealCharacterRects: context.computeRevealCharacterRects
)
result.append(contentsOf: captionItems)
contentHeight += captionSize.height
}
contentHeight += verticalInset
// Vertical bar on the leading edge (matches the blockQuote branch of layoutQuoteText).
let bar = InstantPageV2BarItem(
frame: CGRect(x: horizontalInset, y: 0.0, width: barWidth, height: contentHeight),
color: context.theme.textCategories.paragraph.color,
cornerRadius: barWidth / 2.0
)
result.append(.blockQuoteBar(bar))
return result
}
private func layoutQuoteText(
text: RichText,
caption: RichText,
isPull: Bool,
@ -2005,21 +2094,17 @@ private func layoutList(
) -> [InstantPageV2LaidOutItem] {
// Determine marker characteristics.
var maxIndexWidth: CGFloat = 0.0
var hasTaskMarkers = false
// hasNums: at least one ordered item carries an explicit `num` in which case items
// without one fall back to a blank " " (preserves the source's numbering gaps) rather
// than auto-generated `(i + 1).`. Unordered lists never auto-generate numbers, so this
// flag is only meaningful when `ordered` is true. (`hasTaskMarkers` is no longer derived
// the uniform 8pt gap below replaced the per-list `indexSpacing` ternary that consumed
// it; column right-alignment handles mixed bullet/checkbox lists without flagging.)
var hasNums = false
if ordered {
for item in listItems {
if item.checked != nil {
hasTaskMarkers = true
} else if let num = item.num, !num.isEmpty {
if item.checked == nil, let num = item.num, !num.isEmpty {
hasNums = true
}
}
} else {
for item in listItems {
if item.checked != nil {
hasTaskMarkers = true
break
}
}
@ -2037,12 +2122,18 @@ private func layoutList(
stroke: context.theme.pageBackgroundColor,
border: context.theme.controlColor
)
// Track maxIndexWidth for ALL marker kinds (ordered + unordered, all three shapes), not
// just ordered as V1/older V2 did. With every kind contributing to the marker column width
// we can right-align every marker to a single shared column edge so in a mixed unordered
// list (bullets + checkboxes) both right-align flush to the same x, and the same uniform
// gap separates them from the text. The column width simply equals the widest marker; for
// a pure bullet list `maxIndexWidth == 6` and the bullet sits at `horizontalInset` (visually
// identical to the pre-change formula), and for a pure checkbox list `maxIndexWidth == 18`
// matches the previous left-aligned placement too.
var markerInfos: [MarkerInfo] = []
for (i, item) in listItems.enumerated() {
if let checked = item.checked {
if ordered {
maxIndexWidth = max(maxIndexWidth, checklistMarkerSize.width)
}
maxIndexWidth = max(maxIndexWidth, checklistMarkerSize.width)
markerInfos.append(MarkerInfo(kind: .checklist(checked: checked, colors: checkboxColors), naturalWidth: checklistMarkerSize.width))
} else if ordered {
let value: String
@ -2076,13 +2167,20 @@ private func layoutList(
markerInfos.append(MarkerInfo(kind: .number(value), naturalWidth: w))
} else {
// Bullet: 6×6 ellipse (matches V1 InstantPageShapeItem dimensions).
maxIndexWidth = max(maxIndexWidth, 6.0)
markerInfos.append(MarkerInfo(kind: .bullet, naturalWidth: 6.0))
}
}
// indexSpacing = gap between the right edge of markers and the text content.
// V1 values: ordered-task=16, ordered-num=12, unordered-task=24, unordered-bullet=20.
let indexSpacing: CGFloat = ordered ? (hasTaskMarkers ? 16.0 : 12.0) : (hasTaskMarkers ? 24.0 : 20.0)
// Uniform 8pt markertext gap across all four cases (ordered/unordered × bullet/number/
// checkbox). With markers right-aligned to a shared column of width `maxIndexWidth`, text
// starts at `horizontalInset + maxIndexWidth + indexSpacing` so `indexSpacing` IS the
// gap, regardless of marker shape. V1 used 12/16/20/24 (a mix of marker-area-width and
// gap-after-marker, depending on alignment); the four gaps came out to 12/16/14/6 far
// from uniform, and a 14pt bullet gap looked especially loose. 8pt is a standard iOS list
// gap; it tightens bullets (148), numbers (128) and ordered-checkbox (168), and only
// loosens unordered-checkbox very slightly (68) so all four kinds match.
let indexSpacing: CGFloat = 8.0
// Layout each item.
var result: [InstantPageV2LaidOutItem] = []
@ -2134,8 +2232,6 @@ private func layoutList(
naturalWidth: markerInfo.naturalWidth,
maxIndexWidth: maxIndexWidth,
horizontalInset: horizontalInset,
indexSpacing: indexSpacing,
ordered: ordered,
checklistMarkerSize: checklistMarkerSize,
lineMidY: lineMidY,
rtl: context.rtl,
@ -2198,22 +2294,22 @@ private func layoutList(
previousBlock = subBlock
}
// V1 alignment: number and bullet markers are positioned at originY (top of
// first sub-block); only checklist markers use firstBlockLineMidY for centering.
let markerLineMidY: CGFloat
switch markerInfo.kind {
case .checklist:
markerLineMidY = firstBlockLineMidY ?? originY
case .number, .bullet:
markerLineMidY = originY
}
// Mirror the .text case above (and what .checklist already does here): use the
// first text line's midY for centering. `originY` is the sub-block's TOP, NOT a
// line midpoint `markerFrameFor` then subtracts `size.height / 2`, so feeding
// `originY` placed the marker straddling the sub-block boundary, ½·marker-height
// ABOVE the first text line. V1 hid the same arithmetic under a 6×12 shape with a
// 3pt internal offset (matching ½·fontLineHeight for 17pt paragraph text), which
// by coincidence equals `firstBlockLineMidY`. Using firstBlockLineMidY directly
// makes the alignment explicit, unifies the three marker kinds, and matches the
// .text case exactly. Fallback to `originY` when no text is in the first sub-block
// (image-first lists are rare); mirrors the existing .checklist fallback.
let markerLineMidY: CGFloat = firstBlockLineMidY ?? originY
let markerFrame = markerFrameFor(
kind: markerInfo.kind,
naturalWidth: markerInfo.naturalWidth,
maxIndexWidth: maxIndexWidth,
horizontalInset: horizontalInset,
indexSpacing: indexSpacing,
ordered: ordered,
checklistMarkerSize: checklistMarkerSize,
lineMidY: markerLineMidY,
rtl: context.rtl,
@ -2235,57 +2331,39 @@ private func layoutList(
}
/// Computes the frame for a list marker, handling RTL and all three marker kinds.
///
/// All marker kinds are right-aligned within the shared `[horizontalInset, horizontalInset +
/// maxIndexWidth]` column (LTR) or left-aligned within the mirrored column on the right (RTL).
/// For a pure-kind list `maxIndexWidth == markerWidth`, so the marker lands at `horizontalInset`
/// exactly as before; for mixed unordered lists, bullets and checkboxes align flush at the
/// column's inner edge. Column right-alignment is the single rule across every marker shape
/// no `ordered` / `indexSpacing` split which is why those parameters dropped.
private func markerFrameFor(
kind: InstantPageV2ListMarkerKind,
naturalWidth: CGFloat,
maxIndexWidth: CGFloat,
horizontalInset: CGFloat,
indexSpacing: CGFloat,
ordered: Bool,
checklistMarkerSize: CGSize,
lineMidY: CGFloat,
rtl: Bool,
boundingWidth: CGFloat
) -> CGRect {
let size: CGSize
switch kind {
case .bullet:
// Bullet: 6×6 ellipse at vertically centred position.
let size = CGSize(width: 6.0, height: 6.0)
if rtl {
let x = boundingWidth - horizontalInset - maxIndexWidth - indexSpacing + (maxIndexWidth - size.width)
return CGRect(x: x, y: floorToScreenPixels(lineMidY - size.height / 2.0), width: size.width, height: size.height)
} else {
return CGRect(x: horizontalInset, y: floorToScreenPixels(lineMidY - size.height / 2.0), width: size.width, height: size.height)
}
size = CGSize(width: 6.0, height: 6.0)
case .number:
// Number: right-aligned within [horizontalInset, horizontalInset+maxIndexWidth].
let size = CGSize(width: naturalWidth, height: 20.0)
if rtl {
let x = boundingWidth - horizontalInset - maxIndexWidth
return CGRect(x: x, y: floorToScreenPixels(lineMidY - size.height / 2.0), width: size.width, height: size.height)
} else {
let x = horizontalInset + maxIndexWidth - naturalWidth
return CGRect(x: x, y: floorToScreenPixels(lineMidY - size.height / 2.0), width: size.width, height: size.height)
}
size = CGSize(width: naturalWidth, height: 20.0)
case .checklist:
let size = checklistMarkerSize
if ordered {
if rtl {
let x = boundingWidth - horizontalInset - maxIndexWidth
return CGRect(x: x, y: floorToScreenPixels(lineMidY - size.height / 2.0), width: size.width, height: size.height)
} else {
let x = horizontalInset + maxIndexWidth - size.width
return CGRect(x: x, y: floorToScreenPixels(lineMidY - size.height / 2.0), width: size.width, height: size.height)
}
} else {
if rtl {
let x = boundingWidth - horizontalInset - size.width
return CGRect(x: x, y: floorToScreenPixels(lineMidY - size.height / 2.0), width: size.width, height: size.height)
} else {
return CGRect(x: horizontalInset, y: floorToScreenPixels(lineMidY - size.height / 2.0), width: size.width, height: size.height)
}
}
size = checklistMarkerSize
}
let x: CGFloat
if rtl {
x = boundingWidth - horizontalInset - maxIndexWidth
} else {
x = horizontalInset + maxIndexWidth - size.width
}
return CGRect(x: x, y: floorToScreenPixels(lineMidY - size.height / 2.0), width: size.width, height: size.height)
}
// MARK: - Style helpers (ported from V1 InstantPageLayout.swift lines 3288)

View file

@ -146,7 +146,7 @@ public final class LegacyJoinLinkPreviewController: ViewController {
if strongSelf.isRequest {
strongSelf.present(UndoOverlayController(presentationData: strongSelf.presentationData, content: .inviteRequestSent(title: strongSelf.presentationData.strings.MemberRequests_RequestToJoinSent, text: strongSelf.isGroup ? strongSelf.presentationData.strings.MemberRequests_RequestToJoinSentDescriptionGroup : strongSelf.presentationData.strings.MemberRequests_RequestToJoinSentDescriptionChannel ), elevatedLayout: true, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
} else {
if let peer = peer {
if let peer {
strongSelf.navigateToPeer(peer, nil)
}
}

View file

@ -342,6 +342,13 @@ private final class OpenInOptionsSheetContentComponent: Component {
}
let optionInset: CGFloat = 2.0
var optionSpacing: CGFloat = 8.0
if component.options.count == 3 {
optionSpacing = 32.0
} else if component.options.count == 2 {
optionSpacing = 64.0
}
let optionSize = CGSize(width: 80.0, height: 112.0)
let scrollFrame = CGRect(origin: CGPoint(x: 0.0, y: 82.0), size: CGSize(width: availableSize.width, height: optionSize.height))
transition.setFrame(view: self.scrollView, frame: scrollFrame)
@ -366,9 +373,9 @@ private final class OpenInOptionsSheetContentComponent: Component {
let optionOriginX: CGFloat
if component.options.count < 5 {
optionOriginX = floorToScreenPixels(max(0.0, (availableSize.width - optionSize.width * CGFloat(component.options.count)) / 2.0))
optionOriginX = floorToScreenPixels(max(0.0, (availableSize.width - optionSize.width * CGFloat(component.options.count) - optionSpacing * CGFloat(component.options.count - 1)) / 2.0)) + CGFloat(index) * (optionSize.width + optionSpacing)
} else {
optionOriginX = optionInset + CGFloat(index) * optionSize.width
optionOriginX = optionInset + CGFloat(index) * (optionSize.width + optionSpacing)
}
transition.setFrame(view: optionView, frame: CGRect(
@ -388,7 +395,7 @@ private final class OpenInOptionsSheetContentComponent: Component {
if component.options.isEmpty {
optionsContentWidth = availableSize.width
} else {
optionsContentWidth = optionInset * 2.0 + CGFloat(component.options.count) * optionSize.width
optionsContentWidth = optionInset * 2.0 + CGFloat(component.options.count) * (optionSize.width + optionSpacing) - optionSpacing
}
self.scrollView.contentSize = CGSize(width: max(availableSize.width, optionsContentWidth), height: optionSize.height)

View file

@ -107,6 +107,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[894081801] = { return Api.BotInlineMessage.parse_botInlineMessageMediaInvoice($0) }
dict[-1970903652] = { return Api.BotInlineMessage.parse_botInlineMessageMediaVenue($0) }
dict[-2137335386] = { return Api.BotInlineMessage.parse_botInlineMessageMediaWebPage($0) }
dict[174161531] = { return Api.BotInlineMessage.parse_botInlineMessageRichMessage($0) }
dict[-1937807902] = { return Api.BotInlineMessage.parse_botInlineMessageText($0) }
dict[400266251] = { return Api.BotInlineResult.parse_botInlineMediaResult($0) }
dict[295067450] = { return Api.BotInlineResult.parse_botInlineResult($0) }
@ -259,7 +260,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[1815593308] = { return Api.DocumentAttribute.parse_documentAttributeImageSize($0) }
dict[1662637586] = { return Api.DocumentAttribute.parse_documentAttributeSticker($0) }
dict[1137015880] = { return Api.DocumentAttribute.parse_documentAttributeVideo($0) }
dict[-1743452271] = { return Api.DraftMessage.parse_draftMessage($0) }
dict[1627271828] = { return Api.DraftMessage.parse_draftMessage($0) }
dict[453805082] = { return Api.DraftMessage.parse_draftMessageEmpty($0) }
dict[-1764723459] = { return Api.EmailVerification.parse_emailVerificationApple($0) }
dict[-1842457175] = { return Api.EmailVerification.parse_emailVerificationCode($0) }
@ -339,6 +340,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-672693723] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageMediaInvoice($0) }
dict[1098628881] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageMediaVenue($0) }
dict[-1109605104] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageMediaWebPage($0) }
dict[-1271007892] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageRichMessage($0) }
dict[1036876423] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageText($0) }
dict[-1995686519] = { return Api.InputBotInlineMessageID.parse_inputBotInlineMessageID($0) }
dict[-1227287081] = { return Api.InputBotInlineMessageID.parse_inputBotInlineMessageID64($0) }
@ -443,8 +445,6 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[1548122514] = { return Api.InputNotifyPeer.parse_inputNotifyForumTopic($0) }
dict[-1195615476] = { return Api.InputNotifyPeer.parse_inputNotifyPeer($0) }
dict[423314455] = { return Api.InputNotifyPeer.parse_inputNotifyUsers($0) }
dict[2105227266] = { return Api.InputPageListOrderedItem.parse_inputPageListOrderedItemBlocks($0) }
dict[-1682665696] = { return Api.InputPageListOrderedItem.parse_inputPageListOrderedItemText($0) }
dict[1528613672] = { return Api.InputPasskeyCredential.parse_inputPasskeyCredentialFirebasePNV($0) }
dict[1009235855] = { return Api.InputPasskeyCredential.parse_inputPasskeyCredentialPublicKey($0) }
dict[-1021329078] = { return Api.InputPasskeyResponse.parse_inputPasskeyResponseLogin($0) }
@ -756,11 +756,11 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[1001931436] = { return Api.OutboxReadDate.parse_outboxReadDate($0) }
dict[-1738178803] = { return Api.Page.parse_page($0) }
dict[1464557951] = { return Api.PageBlock.parse_inputPageBlockMap($0) }
dict[-1186155733] = { return Api.PageBlock.parse_inputPageBlockOrderedList($0) }
dict[-837994576] = { return Api.PageBlock.parse_pageBlockAnchor($0) }
dict[-2143067670] = { return Api.PageBlock.parse_pageBlockAudio($0) }
dict[-1162877472] = { return Api.PageBlock.parse_pageBlockAuthorDate($0) }
dict[641563686] = { return Api.PageBlock.parse_pageBlockBlockquote($0) }
dict[242108356] = { return Api.PageBlock.parse_pageBlockBlockquoteBlocks($0) }
dict[-283684427] = { return Api.PageBlock.parse_pageBlockChannel($0) }
dict[1705048653] = { return Api.PageBlock.parse_pageBlockCollage($0) }
dict[972174080] = { return Api.PageBlock.parse_pageBlockCover($0) }
@ -780,7 +780,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-454524911] = { return Api.PageBlock.parse_pageBlockList($0) }
dict[-1538310410] = { return Api.PageBlock.parse_pageBlockMap($0) }
dict[1493699616] = { return Api.PageBlock.parse_pageBlockMath($0) }
dict[-1702174239] = { return Api.PageBlock.parse_pageBlockOrderedList($0) }
dict[534181569] = { return Api.PageBlock.parse_pageBlockOrderedList($0) }
dict[1182402406] = { return Api.PageBlock.parse_pageBlockParagraph($0) }
dict[391759200] = { return Api.PageBlock.parse_pageBlockPhoto($0) }
dict[-1066346178] = { return Api.PageBlock.parse_pageBlockPreformatted($0) }
@ -797,8 +797,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[1869903447] = { return Api.PageCaption.parse_pageCaption($0) }
dict[1674209194] = { return Api.PageListItem.parse_pageListItemBlocks($0) }
dict[794323004] = { return Api.PageListItem.parse_pageListItemText($0) }
dict[1109995988] = { return Api.PageListOrderedItem.parse_pageListOrderedItemBlocks($0) }
dict[-851533770] = { return Api.PageListOrderedItem.parse_pageListOrderedItemText($0) }
dict[-1879910928] = { return Api.PageListOrderedItem.parse_pageListOrderedItemBlocks($0) }
dict[352522633] = { return Api.PageListOrderedItem.parse_pageListOrderedItemText($0) }
dict[-1282352120] = { return Api.PageRelatedArticle.parse_pageRelatedArticle($0) }
dict[878078826] = { return Api.PageTableCell.parse_pageTableCell($0) }
dict[-524237339] = { return Api.PageTableRow.parse_pageTableRow($0) }
@ -2042,8 +2042,6 @@ public extension Api {
_1.serialize(buffer, boxed)
case let _1 as Api.InputNotifyPeer:
_1.serialize(buffer, boxed)
case let _1 as Api.InputPageListOrderedItem:
_1.serialize(buffer, boxed)
case let _1 as Api.InputPasskeyCredential:
_1.serialize(buffer, boxed)
case let _1 as Api.InputPasskeyResponse:

View file

@ -1451,131 +1451,85 @@ public extension Api {
}
}
public extension Api {
indirect enum InputPageListOrderedItem: TypeConstructorDescription {
public class Cons_inputPageListOrderedItemBlocks: TypeConstructorDescription {
public var flags: Int32
public var blocks: [Api.PageBlock]
public var value: Int32?
public var type: String?
public init(flags: Int32, blocks: [Api.PageBlock], value: Int32?, type: String?) {
self.flags = flags
self.blocks = blocks
self.value = value
self.type = type
enum InputPasskeyCredential: TypeConstructorDescription {
public class Cons_inputPasskeyCredentialFirebasePNV: TypeConstructorDescription {
public var pnvToken: String
public init(pnvToken: String) {
self.pnvToken = pnvToken
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("inputPageListOrderedItemBlocks", [("flags", ConstructorParameterDescription(self.flags)), ("blocks", ConstructorParameterDescription(self.blocks)), ("value", ConstructorParameterDescription(self.value)), ("type", ConstructorParameterDescription(self.type))])
return ("inputPasskeyCredentialFirebasePNV", [("pnvToken", ConstructorParameterDescription(self.pnvToken))])
}
}
public class Cons_inputPageListOrderedItemText: TypeConstructorDescription {
public var flags: Int32
public var text: Api.RichText
public var value: Int32?
public var type: String?
public init(flags: Int32, text: Api.RichText, value: Int32?, type: String?) {
self.flags = flags
self.text = text
self.value = value
self.type = type
public class Cons_inputPasskeyCredentialPublicKey: TypeConstructorDescription {
public var id: String
public var rawId: String
public var response: Api.InputPasskeyResponse
public init(id: String, rawId: String, response: Api.InputPasskeyResponse) {
self.id = id
self.rawId = rawId
self.response = response
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("inputPageListOrderedItemText", [("flags", ConstructorParameterDescription(self.flags)), ("text", ConstructorParameterDescription(self.text)), ("value", ConstructorParameterDescription(self.value)), ("type", ConstructorParameterDescription(self.type))])
return ("inputPasskeyCredentialPublicKey", [("id", ConstructorParameterDescription(self.id)), ("rawId", ConstructorParameterDescription(self.rawId)), ("response", ConstructorParameterDescription(self.response))])
}
}
case inputPageListOrderedItemBlocks(Cons_inputPageListOrderedItemBlocks)
case inputPageListOrderedItemText(Cons_inputPageListOrderedItemText)
case inputPasskeyCredentialFirebasePNV(Cons_inputPasskeyCredentialFirebasePNV)
case inputPasskeyCredentialPublicKey(Cons_inputPasskeyCredentialPublicKey)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputPageListOrderedItemBlocks(let _data):
case .inputPasskeyCredentialFirebasePNV(let _data):
if boxed {
buffer.appendInt32(2105227266)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.blocks.count))
for item in _data.blocks {
item.serialize(buffer, true)
}
if Int(_data.flags) & Int(1 << 2) != 0 {
serializeInt32(_data.value!, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 3) != 0 {
serializeString(_data.type!, buffer: buffer, boxed: false)
buffer.appendInt32(1528613672)
}
serializeString(_data.pnvToken, buffer: buffer, boxed: false)
break
case .inputPageListOrderedItemText(let _data):
case .inputPasskeyCredentialPublicKey(let _data):
if boxed {
buffer.appendInt32(-1682665696)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
_data.text.serialize(buffer, true)
if Int(_data.flags) & Int(1 << 2) != 0 {
serializeInt32(_data.value!, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 3) != 0 {
serializeString(_data.type!, buffer: buffer, boxed: false)
buffer.appendInt32(1009235855)
}
serializeString(_data.id, buffer: buffer, boxed: false)
serializeString(_data.rawId, buffer: buffer, boxed: false)
_data.response.serialize(buffer, true)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .inputPageListOrderedItemBlocks(let _data):
return ("inputPageListOrderedItemBlocks", [("flags", ConstructorParameterDescription(_data.flags)), ("blocks", ConstructorParameterDescription(_data.blocks)), ("value", ConstructorParameterDescription(_data.value)), ("type", ConstructorParameterDescription(_data.type))])
case .inputPageListOrderedItemText(let _data):
return ("inputPageListOrderedItemText", [("flags", ConstructorParameterDescription(_data.flags)), ("text", ConstructorParameterDescription(_data.text)), ("value", ConstructorParameterDescription(_data.value)), ("type", ConstructorParameterDescription(_data.type))])
case .inputPasskeyCredentialFirebasePNV(let _data):
return ("inputPasskeyCredentialFirebasePNV", [("pnvToken", ConstructorParameterDescription(_data.pnvToken))])
case .inputPasskeyCredentialPublicKey(let _data):
return ("inputPasskeyCredentialPublicKey", [("id", ConstructorParameterDescription(_data.id)), ("rawId", ConstructorParameterDescription(_data.rawId)), ("response", ConstructorParameterDescription(_data.response))])
}
}
public static func parse_inputPageListOrderedItemBlocks(_ reader: BufferReader) -> InputPageListOrderedItem? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.PageBlock]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PageBlock.self)
}
var _3: Int32?
if Int(_1 ?? 0) & Int(1 << 2) != 0 {
_3 = reader.readInt32()
}
var _4: String?
if Int(_1 ?? 0) & Int(1 << 3) != 0 {
_4 = parseString(reader)
}
public static func parse_inputPasskeyCredentialFirebasePNV(_ reader: BufferReader) -> InputPasskeyCredential? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1 ?? 0) & Int(1 << 2) == 0) || _3 != nil
let _c4 = (Int(_1 ?? 0) & Int(1 << 3) == 0) || _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.InputPageListOrderedItem.inputPageListOrderedItemBlocks(Cons_inputPageListOrderedItemBlocks(flags: _1!, blocks: _2!, value: _3, type: _4))
if _c1 {
return Api.InputPasskeyCredential.inputPasskeyCredentialFirebasePNV(Cons_inputPasskeyCredentialFirebasePNV(pnvToken: _1!))
}
else {
return nil
}
}
public static func parse_inputPageListOrderedItemText(_ reader: BufferReader) -> InputPageListOrderedItem? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.RichText?
public static func parse_inputPasskeyCredentialPublicKey(_ reader: BufferReader) -> InputPasskeyCredential? {
var _1: String?
_1 = parseString(reader)
var _2: String?
_2 = parseString(reader)
var _3: Api.InputPasskeyResponse?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.RichText
}
var _3: Int32?
if Int(_1 ?? 0) & Int(1 << 2) != 0 {
_3 = reader.readInt32()
}
var _4: String?
if Int(_1 ?? 0) & Int(1 << 3) != 0 {
_4 = parseString(reader)
_3 = Api.parse(reader, signature: signature) as? Api.InputPasskeyResponse
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1 ?? 0) & Int(1 << 2) == 0) || _3 != nil
let _c4 = (Int(_1 ?? 0) & Int(1 << 3) == 0) || _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.InputPageListOrderedItem.inputPageListOrderedItemText(Cons_inputPageListOrderedItemText(flags: _1!, text: _2!, value: _3, type: _4))
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.InputPasskeyCredential.inputPasskeyCredentialPublicKey(Cons_inputPasskeyCredentialPublicKey(id: _1!, rawId: _2!, response: _3!))
}
else {
return nil

View file

@ -1,90 +1,3 @@
public extension Api {
enum InputPasskeyCredential: TypeConstructorDescription {
public class Cons_inputPasskeyCredentialFirebasePNV: TypeConstructorDescription {
public var pnvToken: String
public init(pnvToken: String) {
self.pnvToken = pnvToken
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("inputPasskeyCredentialFirebasePNV", [("pnvToken", ConstructorParameterDescription(self.pnvToken))])
}
}
public class Cons_inputPasskeyCredentialPublicKey: TypeConstructorDescription {
public var id: String
public var rawId: String
public var response: Api.InputPasskeyResponse
public init(id: String, rawId: String, response: Api.InputPasskeyResponse) {
self.id = id
self.rawId = rawId
self.response = response
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("inputPasskeyCredentialPublicKey", [("id", ConstructorParameterDescription(self.id)), ("rawId", ConstructorParameterDescription(self.rawId)), ("response", ConstructorParameterDescription(self.response))])
}
}
case inputPasskeyCredentialFirebasePNV(Cons_inputPasskeyCredentialFirebasePNV)
case inputPasskeyCredentialPublicKey(Cons_inputPasskeyCredentialPublicKey)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputPasskeyCredentialFirebasePNV(let _data):
if boxed {
buffer.appendInt32(1528613672)
}
serializeString(_data.pnvToken, buffer: buffer, boxed: false)
break
case .inputPasskeyCredentialPublicKey(let _data):
if boxed {
buffer.appendInt32(1009235855)
}
serializeString(_data.id, buffer: buffer, boxed: false)
serializeString(_data.rawId, buffer: buffer, boxed: false)
_data.response.serialize(buffer, true)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .inputPasskeyCredentialFirebasePNV(let _data):
return ("inputPasskeyCredentialFirebasePNV", [("pnvToken", ConstructorParameterDescription(_data.pnvToken))])
case .inputPasskeyCredentialPublicKey(let _data):
return ("inputPasskeyCredentialPublicKey", [("id", ConstructorParameterDescription(_data.id)), ("rawId", ConstructorParameterDescription(_data.rawId)), ("response", ConstructorParameterDescription(_data.response))])
}
}
public static func parse_inputPasskeyCredentialFirebasePNV(_ reader: BufferReader) -> InputPasskeyCredential? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.InputPasskeyCredential.inputPasskeyCredentialFirebasePNV(Cons_inputPasskeyCredentialFirebasePNV(pnvToken: _1!))
}
else {
return nil
}
}
public static func parse_inputPasskeyCredentialPublicKey(_ reader: BufferReader) -> InputPasskeyCredential? {
var _1: String?
_1 = parseString(reader)
var _2: String?
_2 = parseString(reader)
var _3: Api.InputPasskeyResponse?
if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.InputPasskeyResponse
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.InputPasskeyCredential.inputPasskeyCredentialPublicKey(Cons_inputPasskeyCredentialPublicKey(id: _1!, rawId: _2!, response: _3!))
}
else {
return nil
}
}
}
}
public extension Api {
enum InputPasskeyResponse: TypeConstructorDescription {
public class Cons_inputPasskeyResponseLogin: TypeConstructorDescription {
@ -969,3 +882,246 @@ public extension Api {
}
}
}
public extension Api {
enum InputPrivacyRule: TypeConstructorDescription {
public class Cons_inputPrivacyValueAllowChatParticipants: TypeConstructorDescription {
public var chats: [Int64]
public init(chats: [Int64]) {
self.chats = chats
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("inputPrivacyValueAllowChatParticipants", [("chats", ConstructorParameterDescription(self.chats))])
}
}
public class Cons_inputPrivacyValueAllowUsers: TypeConstructorDescription {
public var users: [Api.InputUser]
public init(users: [Api.InputUser]) {
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("inputPrivacyValueAllowUsers", [("users", ConstructorParameterDescription(self.users))])
}
}
public class Cons_inputPrivacyValueDisallowChatParticipants: TypeConstructorDescription {
public var chats: [Int64]
public init(chats: [Int64]) {
self.chats = chats
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("inputPrivacyValueDisallowChatParticipants", [("chats", ConstructorParameterDescription(self.chats))])
}
}
public class Cons_inputPrivacyValueDisallowUsers: TypeConstructorDescription {
public var users: [Api.InputUser]
public init(users: [Api.InputUser]) {
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("inputPrivacyValueDisallowUsers", [("users", ConstructorParameterDescription(self.users))])
}
}
case inputPrivacyValueAllowAll
case inputPrivacyValueAllowBots
case inputPrivacyValueAllowChatParticipants(Cons_inputPrivacyValueAllowChatParticipants)
case inputPrivacyValueAllowCloseFriends
case inputPrivacyValueAllowContacts
case inputPrivacyValueAllowPremium
case inputPrivacyValueAllowUsers(Cons_inputPrivacyValueAllowUsers)
case inputPrivacyValueDisallowAll
case inputPrivacyValueDisallowBots
case inputPrivacyValueDisallowChatParticipants(Cons_inputPrivacyValueDisallowChatParticipants)
case inputPrivacyValueDisallowContacts
case inputPrivacyValueDisallowUsers(Cons_inputPrivacyValueDisallowUsers)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputPrivacyValueAllowAll:
if boxed {
buffer.appendInt32(407582158)
}
break
case .inputPrivacyValueAllowBots:
if boxed {
buffer.appendInt32(1515179237)
}
break
case .inputPrivacyValueAllowChatParticipants(let _data):
if boxed {
buffer.appendInt32(-2079962673)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.chats.count))
for item in _data.chats {
serializeInt64(item, buffer: buffer, boxed: false)
}
break
case .inputPrivacyValueAllowCloseFriends:
if boxed {
buffer.appendInt32(793067081)
}
break
case .inputPrivacyValueAllowContacts:
if boxed {
buffer.appendInt32(218751099)
}
break
case .inputPrivacyValueAllowPremium:
if boxed {
buffer.appendInt32(2009975281)
}
break
case .inputPrivacyValueAllowUsers(let _data):
if boxed {
buffer.appendInt32(320652927)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
break
case .inputPrivacyValueDisallowAll:
if boxed {
buffer.appendInt32(-697604407)
}
break
case .inputPrivacyValueDisallowBots:
if boxed {
buffer.appendInt32(-991594219)
}
break
case .inputPrivacyValueDisallowChatParticipants(let _data):
if boxed {
buffer.appendInt32(-380694650)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.chats.count))
for item in _data.chats {
serializeInt64(item, buffer: buffer, boxed: false)
}
break
case .inputPrivacyValueDisallowContacts:
if boxed {
buffer.appendInt32(195371015)
}
break
case .inputPrivacyValueDisallowUsers(let _data):
if boxed {
buffer.appendInt32(-1877932953)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .inputPrivacyValueAllowAll:
return ("inputPrivacyValueAllowAll", [])
case .inputPrivacyValueAllowBots:
return ("inputPrivacyValueAllowBots", [])
case .inputPrivacyValueAllowChatParticipants(let _data):
return ("inputPrivacyValueAllowChatParticipants", [("chats", ConstructorParameterDescription(_data.chats))])
case .inputPrivacyValueAllowCloseFriends:
return ("inputPrivacyValueAllowCloseFriends", [])
case .inputPrivacyValueAllowContacts:
return ("inputPrivacyValueAllowContacts", [])
case .inputPrivacyValueAllowPremium:
return ("inputPrivacyValueAllowPremium", [])
case .inputPrivacyValueAllowUsers(let _data):
return ("inputPrivacyValueAllowUsers", [("users", ConstructorParameterDescription(_data.users))])
case .inputPrivacyValueDisallowAll:
return ("inputPrivacyValueDisallowAll", [])
case .inputPrivacyValueDisallowBots:
return ("inputPrivacyValueDisallowBots", [])
case .inputPrivacyValueDisallowChatParticipants(let _data):
return ("inputPrivacyValueDisallowChatParticipants", [("chats", ConstructorParameterDescription(_data.chats))])
case .inputPrivacyValueDisallowContacts:
return ("inputPrivacyValueDisallowContacts", [])
case .inputPrivacyValueDisallowUsers(let _data):
return ("inputPrivacyValueDisallowUsers", [("users", ConstructorParameterDescription(_data.users))])
}
}
public static func parse_inputPrivacyValueAllowAll(_ reader: BufferReader) -> InputPrivacyRule? {
return Api.InputPrivacyRule.inputPrivacyValueAllowAll
}
public static func parse_inputPrivacyValueAllowBots(_ reader: BufferReader) -> InputPrivacyRule? {
return Api.InputPrivacyRule.inputPrivacyValueAllowBots
}
public static func parse_inputPrivacyValueAllowChatParticipants(_ reader: BufferReader) -> InputPrivacyRule? {
var _1: [Int64]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.InputPrivacyRule.inputPrivacyValueAllowChatParticipants(Cons_inputPrivacyValueAllowChatParticipants(chats: _1!))
}
else {
return nil
}
}
public static func parse_inputPrivacyValueAllowCloseFriends(_ reader: BufferReader) -> InputPrivacyRule? {
return Api.InputPrivacyRule.inputPrivacyValueAllowCloseFriends
}
public static func parse_inputPrivacyValueAllowContacts(_ reader: BufferReader) -> InputPrivacyRule? {
return Api.InputPrivacyRule.inputPrivacyValueAllowContacts
}
public static func parse_inputPrivacyValueAllowPremium(_ reader: BufferReader) -> InputPrivacyRule? {
return Api.InputPrivacyRule.inputPrivacyValueAllowPremium
}
public static func parse_inputPrivacyValueAllowUsers(_ reader: BufferReader) -> InputPrivacyRule? {
var _1: [Api.InputUser]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputUser.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.InputPrivacyRule.inputPrivacyValueAllowUsers(Cons_inputPrivacyValueAllowUsers(users: _1!))
}
else {
return nil
}
}
public static func parse_inputPrivacyValueDisallowAll(_ reader: BufferReader) -> InputPrivacyRule? {
return Api.InputPrivacyRule.inputPrivacyValueDisallowAll
}
public static func parse_inputPrivacyValueDisallowBots(_ reader: BufferReader) -> InputPrivacyRule? {
return Api.InputPrivacyRule.inputPrivacyValueDisallowBots
}
public static func parse_inputPrivacyValueDisallowChatParticipants(_ reader: BufferReader) -> InputPrivacyRule? {
var _1: [Int64]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.InputPrivacyRule.inputPrivacyValueDisallowChatParticipants(Cons_inputPrivacyValueDisallowChatParticipants(chats: _1!))
}
else {
return nil
}
}
public static func parse_inputPrivacyValueDisallowContacts(_ reader: BufferReader) -> InputPrivacyRule? {
return Api.InputPrivacyRule.inputPrivacyValueDisallowContacts
}
public static func parse_inputPrivacyValueDisallowUsers(_ reader: BufferReader) -> InputPrivacyRule? {
var _1: [Api.InputUser]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputUser.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.InputPrivacyRule.inputPrivacyValueDisallowUsers(Cons_inputPrivacyValueDisallowUsers(users: _1!))
}
else {
return nil
}
}
}
}

View file

@ -1,246 +1,3 @@
public extension Api {
enum InputPrivacyRule: TypeConstructorDescription {
public class Cons_inputPrivacyValueAllowChatParticipants: TypeConstructorDescription {
public var chats: [Int64]
public init(chats: [Int64]) {
self.chats = chats
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("inputPrivacyValueAllowChatParticipants", [("chats", ConstructorParameterDescription(self.chats))])
}
}
public class Cons_inputPrivacyValueAllowUsers: TypeConstructorDescription {
public var users: [Api.InputUser]
public init(users: [Api.InputUser]) {
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("inputPrivacyValueAllowUsers", [("users", ConstructorParameterDescription(self.users))])
}
}
public class Cons_inputPrivacyValueDisallowChatParticipants: TypeConstructorDescription {
public var chats: [Int64]
public init(chats: [Int64]) {
self.chats = chats
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("inputPrivacyValueDisallowChatParticipants", [("chats", ConstructorParameterDescription(self.chats))])
}
}
public class Cons_inputPrivacyValueDisallowUsers: TypeConstructorDescription {
public var users: [Api.InputUser]
public init(users: [Api.InputUser]) {
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("inputPrivacyValueDisallowUsers", [("users", ConstructorParameterDescription(self.users))])
}
}
case inputPrivacyValueAllowAll
case inputPrivacyValueAllowBots
case inputPrivacyValueAllowChatParticipants(Cons_inputPrivacyValueAllowChatParticipants)
case inputPrivacyValueAllowCloseFriends
case inputPrivacyValueAllowContacts
case inputPrivacyValueAllowPremium
case inputPrivacyValueAllowUsers(Cons_inputPrivacyValueAllowUsers)
case inputPrivacyValueDisallowAll
case inputPrivacyValueDisallowBots
case inputPrivacyValueDisallowChatParticipants(Cons_inputPrivacyValueDisallowChatParticipants)
case inputPrivacyValueDisallowContacts
case inputPrivacyValueDisallowUsers(Cons_inputPrivacyValueDisallowUsers)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputPrivacyValueAllowAll:
if boxed {
buffer.appendInt32(407582158)
}
break
case .inputPrivacyValueAllowBots:
if boxed {
buffer.appendInt32(1515179237)
}
break
case .inputPrivacyValueAllowChatParticipants(let _data):
if boxed {
buffer.appendInt32(-2079962673)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.chats.count))
for item in _data.chats {
serializeInt64(item, buffer: buffer, boxed: false)
}
break
case .inputPrivacyValueAllowCloseFriends:
if boxed {
buffer.appendInt32(793067081)
}
break
case .inputPrivacyValueAllowContacts:
if boxed {
buffer.appendInt32(218751099)
}
break
case .inputPrivacyValueAllowPremium:
if boxed {
buffer.appendInt32(2009975281)
}
break
case .inputPrivacyValueAllowUsers(let _data):
if boxed {
buffer.appendInt32(320652927)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
break
case .inputPrivacyValueDisallowAll:
if boxed {
buffer.appendInt32(-697604407)
}
break
case .inputPrivacyValueDisallowBots:
if boxed {
buffer.appendInt32(-991594219)
}
break
case .inputPrivacyValueDisallowChatParticipants(let _data):
if boxed {
buffer.appendInt32(-380694650)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.chats.count))
for item in _data.chats {
serializeInt64(item, buffer: buffer, boxed: false)
}
break
case .inputPrivacyValueDisallowContacts:
if boxed {
buffer.appendInt32(195371015)
}
break
case .inputPrivacyValueDisallowUsers(let _data):
if boxed {
buffer.appendInt32(-1877932953)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .inputPrivacyValueAllowAll:
return ("inputPrivacyValueAllowAll", [])
case .inputPrivacyValueAllowBots:
return ("inputPrivacyValueAllowBots", [])
case .inputPrivacyValueAllowChatParticipants(let _data):
return ("inputPrivacyValueAllowChatParticipants", [("chats", ConstructorParameterDescription(_data.chats))])
case .inputPrivacyValueAllowCloseFriends:
return ("inputPrivacyValueAllowCloseFriends", [])
case .inputPrivacyValueAllowContacts:
return ("inputPrivacyValueAllowContacts", [])
case .inputPrivacyValueAllowPremium:
return ("inputPrivacyValueAllowPremium", [])
case .inputPrivacyValueAllowUsers(let _data):
return ("inputPrivacyValueAllowUsers", [("users", ConstructorParameterDescription(_data.users))])
case .inputPrivacyValueDisallowAll:
return ("inputPrivacyValueDisallowAll", [])
case .inputPrivacyValueDisallowBots:
return ("inputPrivacyValueDisallowBots", [])
case .inputPrivacyValueDisallowChatParticipants(let _data):
return ("inputPrivacyValueDisallowChatParticipants", [("chats", ConstructorParameterDescription(_data.chats))])
case .inputPrivacyValueDisallowContacts:
return ("inputPrivacyValueDisallowContacts", [])
case .inputPrivacyValueDisallowUsers(let _data):
return ("inputPrivacyValueDisallowUsers", [("users", ConstructorParameterDescription(_data.users))])
}
}
public static func parse_inputPrivacyValueAllowAll(_ reader: BufferReader) -> InputPrivacyRule? {
return Api.InputPrivacyRule.inputPrivacyValueAllowAll
}
public static func parse_inputPrivacyValueAllowBots(_ reader: BufferReader) -> InputPrivacyRule? {
return Api.InputPrivacyRule.inputPrivacyValueAllowBots
}
public static func parse_inputPrivacyValueAllowChatParticipants(_ reader: BufferReader) -> InputPrivacyRule? {
var _1: [Int64]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.InputPrivacyRule.inputPrivacyValueAllowChatParticipants(Cons_inputPrivacyValueAllowChatParticipants(chats: _1!))
}
else {
return nil
}
}
public static func parse_inputPrivacyValueAllowCloseFriends(_ reader: BufferReader) -> InputPrivacyRule? {
return Api.InputPrivacyRule.inputPrivacyValueAllowCloseFriends
}
public static func parse_inputPrivacyValueAllowContacts(_ reader: BufferReader) -> InputPrivacyRule? {
return Api.InputPrivacyRule.inputPrivacyValueAllowContacts
}
public static func parse_inputPrivacyValueAllowPremium(_ reader: BufferReader) -> InputPrivacyRule? {
return Api.InputPrivacyRule.inputPrivacyValueAllowPremium
}
public static func parse_inputPrivacyValueAllowUsers(_ reader: BufferReader) -> InputPrivacyRule? {
var _1: [Api.InputUser]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputUser.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.InputPrivacyRule.inputPrivacyValueAllowUsers(Cons_inputPrivacyValueAllowUsers(users: _1!))
}
else {
return nil
}
}
public static func parse_inputPrivacyValueDisallowAll(_ reader: BufferReader) -> InputPrivacyRule? {
return Api.InputPrivacyRule.inputPrivacyValueDisallowAll
}
public static func parse_inputPrivacyValueDisallowBots(_ reader: BufferReader) -> InputPrivacyRule? {
return Api.InputPrivacyRule.inputPrivacyValueDisallowBots
}
public static func parse_inputPrivacyValueDisallowChatParticipants(_ reader: BufferReader) -> InputPrivacyRule? {
var _1: [Int64]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.InputPrivacyRule.inputPrivacyValueDisallowChatParticipants(Cons_inputPrivacyValueDisallowChatParticipants(chats: _1!))
}
else {
return nil
}
}
public static func parse_inputPrivacyValueDisallowContacts(_ reader: BufferReader) -> InputPrivacyRule? {
return Api.InputPrivacyRule.inputPrivacyValueDisallowContacts
}
public static func parse_inputPrivacyValueDisallowUsers(_ reader: BufferReader) -> InputPrivacyRule? {
var _1: [Api.InputUser]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputUser.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.InputPrivacyRule.inputPrivacyValueDisallowUsers(Cons_inputPrivacyValueDisallowUsers(users: _1!))
}
else {
return nil
}
}
}
}
public extension Api {
enum InputQuickReplyShortcut: TypeConstructorDescription {
public class Cons_inputQuickReplyShortcut: TypeConstructorDescription {
@ -1559,3 +1316,160 @@ public extension Api {
}
}
}
public extension Api {
enum InputStickerSetItem: TypeConstructorDescription {
public class Cons_inputStickerSetItem: TypeConstructorDescription {
public var flags: Int32
public var document: Api.InputDocument
public var emoji: String
public var maskCoords: Api.MaskCoords?
public var keywords: String?
public init(flags: Int32, document: Api.InputDocument, emoji: String, maskCoords: Api.MaskCoords?, keywords: String?) {
self.flags = flags
self.document = document
self.emoji = emoji
self.maskCoords = maskCoords
self.keywords = keywords
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("inputStickerSetItem", [("flags", ConstructorParameterDescription(self.flags)), ("document", ConstructorParameterDescription(self.document)), ("emoji", ConstructorParameterDescription(self.emoji)), ("maskCoords", ConstructorParameterDescription(self.maskCoords)), ("keywords", ConstructorParameterDescription(self.keywords))])
}
}
case inputStickerSetItem(Cons_inputStickerSetItem)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputStickerSetItem(let _data):
if boxed {
buffer.appendInt32(853188252)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
_data.document.serialize(buffer, true)
serializeString(_data.emoji, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 0) != 0 {
_data.maskCoords!.serialize(buffer, true)
}
if Int(_data.flags) & Int(1 << 1) != 0 {
serializeString(_data.keywords!, buffer: buffer, boxed: false)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .inputStickerSetItem(let _data):
return ("inputStickerSetItem", [("flags", ConstructorParameterDescription(_data.flags)), ("document", ConstructorParameterDescription(_data.document)), ("emoji", ConstructorParameterDescription(_data.emoji)), ("maskCoords", ConstructorParameterDescription(_data.maskCoords)), ("keywords", ConstructorParameterDescription(_data.keywords))])
}
}
public static func parse_inputStickerSetItem(_ reader: BufferReader) -> InputStickerSetItem? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.InputDocument?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.InputDocument
}
var _3: String?
_3 = parseString(reader)
var _4: Api.MaskCoords?
if Int(_1 ?? 0) & Int(1 << 0) != 0 {
if let signature = reader.readInt32() {
_4 = Api.parse(reader, signature: signature) as? Api.MaskCoords
}
}
var _5: String?
if Int(_1 ?? 0) & Int(1 << 1) != 0 {
_5 = parseString(reader)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1 ?? 0) & Int(1 << 0) == 0) || _4 != nil
let _c5 = (Int(_1 ?? 0) & Int(1 << 1) == 0) || _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.InputStickerSetItem.inputStickerSetItem(Cons_inputStickerSetItem(flags: _1!, document: _2!, emoji: _3!, maskCoords: _4, keywords: _5))
}
else {
return nil
}
}
}
}
public extension Api {
enum InputStickeredMedia: TypeConstructorDescription {
public class Cons_inputStickeredMediaDocument: TypeConstructorDescription {
public var id: Api.InputDocument
public init(id: Api.InputDocument) {
self.id = id
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("inputStickeredMediaDocument", [("id", ConstructorParameterDescription(self.id))])
}
}
public class Cons_inputStickeredMediaPhoto: TypeConstructorDescription {
public var id: Api.InputPhoto
public init(id: Api.InputPhoto) {
self.id = id
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("inputStickeredMediaPhoto", [("id", ConstructorParameterDescription(self.id))])
}
}
case inputStickeredMediaDocument(Cons_inputStickeredMediaDocument)
case inputStickeredMediaPhoto(Cons_inputStickeredMediaPhoto)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputStickeredMediaDocument(let _data):
if boxed {
buffer.appendInt32(70813275)
}
_data.id.serialize(buffer, true)
break
case .inputStickeredMediaPhoto(let _data):
if boxed {
buffer.appendInt32(1251549527)
}
_data.id.serialize(buffer, true)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .inputStickeredMediaDocument(let _data):
return ("inputStickeredMediaDocument", [("id", ConstructorParameterDescription(_data.id))])
case .inputStickeredMediaPhoto(let _data):
return ("inputStickeredMediaPhoto", [("id", ConstructorParameterDescription(_data.id))])
}
}
public static func parse_inputStickeredMediaDocument(_ reader: BufferReader) -> InputStickeredMedia? {
var _1: Api.InputDocument?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputDocument
}
let _c1 = _1 != nil
if _c1 {
return Api.InputStickeredMedia.inputStickeredMediaDocument(Cons_inputStickeredMediaDocument(id: _1!))
}
else {
return nil
}
}
public static func parse_inputStickeredMediaPhoto(_ reader: BufferReader) -> InputStickeredMedia? {
var _1: Api.InputPhoto?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputPhoto
}
let _c1 = _1 != nil
if _c1 {
return Api.InputStickeredMedia.inputStickeredMediaPhoto(Cons_inputStickeredMediaPhoto(id: _1!))
}
else {
return nil
}
}
}
}

View file

@ -1,160 +1,3 @@
public extension Api {
enum InputStickerSetItem: TypeConstructorDescription {
public class Cons_inputStickerSetItem: TypeConstructorDescription {
public var flags: Int32
public var document: Api.InputDocument
public var emoji: String
public var maskCoords: Api.MaskCoords?
public var keywords: String?
public init(flags: Int32, document: Api.InputDocument, emoji: String, maskCoords: Api.MaskCoords?, keywords: String?) {
self.flags = flags
self.document = document
self.emoji = emoji
self.maskCoords = maskCoords
self.keywords = keywords
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("inputStickerSetItem", [("flags", ConstructorParameterDescription(self.flags)), ("document", ConstructorParameterDescription(self.document)), ("emoji", ConstructorParameterDescription(self.emoji)), ("maskCoords", ConstructorParameterDescription(self.maskCoords)), ("keywords", ConstructorParameterDescription(self.keywords))])
}
}
case inputStickerSetItem(Cons_inputStickerSetItem)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputStickerSetItem(let _data):
if boxed {
buffer.appendInt32(853188252)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
_data.document.serialize(buffer, true)
serializeString(_data.emoji, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 0) != 0 {
_data.maskCoords!.serialize(buffer, true)
}
if Int(_data.flags) & Int(1 << 1) != 0 {
serializeString(_data.keywords!, buffer: buffer, boxed: false)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .inputStickerSetItem(let _data):
return ("inputStickerSetItem", [("flags", ConstructorParameterDescription(_data.flags)), ("document", ConstructorParameterDescription(_data.document)), ("emoji", ConstructorParameterDescription(_data.emoji)), ("maskCoords", ConstructorParameterDescription(_data.maskCoords)), ("keywords", ConstructorParameterDescription(_data.keywords))])
}
}
public static func parse_inputStickerSetItem(_ reader: BufferReader) -> InputStickerSetItem? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.InputDocument?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.InputDocument
}
var _3: String?
_3 = parseString(reader)
var _4: Api.MaskCoords?
if Int(_1 ?? 0) & Int(1 << 0) != 0 {
if let signature = reader.readInt32() {
_4 = Api.parse(reader, signature: signature) as? Api.MaskCoords
}
}
var _5: String?
if Int(_1 ?? 0) & Int(1 << 1) != 0 {
_5 = parseString(reader)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1 ?? 0) & Int(1 << 0) == 0) || _4 != nil
let _c5 = (Int(_1 ?? 0) & Int(1 << 1) == 0) || _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.InputStickerSetItem.inputStickerSetItem(Cons_inputStickerSetItem(flags: _1!, document: _2!, emoji: _3!, maskCoords: _4, keywords: _5))
}
else {
return nil
}
}
}
}
public extension Api {
enum InputStickeredMedia: TypeConstructorDescription {
public class Cons_inputStickeredMediaDocument: TypeConstructorDescription {
public var id: Api.InputDocument
public init(id: Api.InputDocument) {
self.id = id
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("inputStickeredMediaDocument", [("id", ConstructorParameterDescription(self.id))])
}
}
public class Cons_inputStickeredMediaPhoto: TypeConstructorDescription {
public var id: Api.InputPhoto
public init(id: Api.InputPhoto) {
self.id = id
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("inputStickeredMediaPhoto", [("id", ConstructorParameterDescription(self.id))])
}
}
case inputStickeredMediaDocument(Cons_inputStickeredMediaDocument)
case inputStickeredMediaPhoto(Cons_inputStickeredMediaPhoto)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputStickeredMediaDocument(let _data):
if boxed {
buffer.appendInt32(70813275)
}
_data.id.serialize(buffer, true)
break
case .inputStickeredMediaPhoto(let _data):
if boxed {
buffer.appendInt32(1251549527)
}
_data.id.serialize(buffer, true)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .inputStickeredMediaDocument(let _data):
return ("inputStickeredMediaDocument", [("id", ConstructorParameterDescription(_data.id))])
case .inputStickeredMediaPhoto(let _data):
return ("inputStickeredMediaPhoto", [("id", ConstructorParameterDescription(_data.id))])
}
}
public static func parse_inputStickeredMediaDocument(_ reader: BufferReader) -> InputStickeredMedia? {
var _1: Api.InputDocument?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputDocument
}
let _c1 = _1 != nil
if _c1 {
return Api.InputStickeredMedia.inputStickeredMediaDocument(Cons_inputStickeredMediaDocument(id: _1!))
}
else {
return nil
}
}
public static func parse_inputStickeredMediaPhoto(_ reader: BufferReader) -> InputStickeredMedia? {
var _1: Api.InputPhoto?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputPhoto
}
let _c1 = _1 != nil
if _c1 {
return Api.InputStickeredMedia.inputStickeredMediaPhoto(Cons_inputStickeredMediaPhoto(id: _1!))
}
else {
return nil
}
}
}
}
public extension Api {
indirect enum InputStorePaymentPurpose: TypeConstructorDescription {
public class Cons_inputStorePaymentAuthCode: TypeConstructorDescription {
@ -1699,3 +1542,80 @@ public extension Api {
}
}
}
public extension Api {
enum JoinChatBotResult: TypeConstructorDescription {
public class Cons_joinChatBotResultWebView: TypeConstructorDescription {
public var url: String
public init(url: String) {
self.url = url
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("joinChatBotResultWebView", [("url", ConstructorParameterDescription(self.url))])
}
}
case joinChatBotResultApproved
case joinChatBotResultDeclined
case joinChatBotResultQueued
case joinChatBotResultWebView(Cons_joinChatBotResultWebView)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .joinChatBotResultApproved:
if boxed {
buffer.appendInt32(-1374344599)
}
break
case .joinChatBotResultDeclined:
if boxed {
buffer.appendInt32(251265428)
}
break
case .joinChatBotResultQueued:
if boxed {
buffer.appendInt32(-1734105024)
}
break
case .joinChatBotResultWebView(let _data):
if boxed {
buffer.appendInt32(-689719277)
}
serializeString(_data.url, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .joinChatBotResultApproved:
return ("joinChatBotResultApproved", [])
case .joinChatBotResultDeclined:
return ("joinChatBotResultDeclined", [])
case .joinChatBotResultQueued:
return ("joinChatBotResultQueued", [])
case .joinChatBotResultWebView(let _data):
return ("joinChatBotResultWebView", [("url", ConstructorParameterDescription(_data.url))])
}
}
public static func parse_joinChatBotResultApproved(_ reader: BufferReader) -> JoinChatBotResult? {
return Api.JoinChatBotResult.joinChatBotResultApproved
}
public static func parse_joinChatBotResultDeclined(_ reader: BufferReader) -> JoinChatBotResult? {
return Api.JoinChatBotResult.joinChatBotResultDeclined
}
public static func parse_joinChatBotResultQueued(_ reader: BufferReader) -> JoinChatBotResult? {
return Api.JoinChatBotResult.joinChatBotResultQueued
}
public static func parse_joinChatBotResultWebView(_ reader: BufferReader) -> JoinChatBotResult? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.JoinChatBotResult.joinChatBotResultWebView(Cons_joinChatBotResultWebView(url: _1!))
}
else {
return nil
}
}
}
}

View file

@ -1,80 +1,3 @@
public extension Api {
enum JoinChatBotResult: TypeConstructorDescription {
public class Cons_joinChatBotResultWebView: TypeConstructorDescription {
public var url: String
public init(url: String) {
self.url = url
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("joinChatBotResultWebView", [("url", ConstructorParameterDescription(self.url))])
}
}
case joinChatBotResultApproved
case joinChatBotResultDeclined
case joinChatBotResultQueued
case joinChatBotResultWebView(Cons_joinChatBotResultWebView)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .joinChatBotResultApproved:
if boxed {
buffer.appendInt32(-1374344599)
}
break
case .joinChatBotResultDeclined:
if boxed {
buffer.appendInt32(251265428)
}
break
case .joinChatBotResultQueued:
if boxed {
buffer.appendInt32(-1734105024)
}
break
case .joinChatBotResultWebView(let _data):
if boxed {
buffer.appendInt32(-689719277)
}
serializeString(_data.url, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .joinChatBotResultApproved:
return ("joinChatBotResultApproved", [])
case .joinChatBotResultDeclined:
return ("joinChatBotResultDeclined", [])
case .joinChatBotResultQueued:
return ("joinChatBotResultQueued", [])
case .joinChatBotResultWebView(let _data):
return ("joinChatBotResultWebView", [("url", ConstructorParameterDescription(_data.url))])
}
}
public static func parse_joinChatBotResultApproved(_ reader: BufferReader) -> JoinChatBotResult? {
return Api.JoinChatBotResult.joinChatBotResultApproved
}
public static func parse_joinChatBotResultDeclined(_ reader: BufferReader) -> JoinChatBotResult? {
return Api.JoinChatBotResult.joinChatBotResultDeclined
}
public static func parse_joinChatBotResultQueued(_ reader: BufferReader) -> JoinChatBotResult? {
return Api.JoinChatBotResult.joinChatBotResultQueued
}
public static func parse_joinChatBotResultWebView(_ reader: BufferReader) -> JoinChatBotResult? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.JoinChatBotResult.joinChatBotResultWebView(Cons_joinChatBotResultWebView(url: _1!))
}
else {
return nil
}
}
}
}
public extension Api {
indirect enum KeyboardButton: TypeConstructorDescription {
public class Cons_inputKeyboardButtonRequestPeer: TypeConstructorDescription {

View file

@ -430,21 +430,6 @@ public extension Api {
return ("inputPageBlockMap", [("geo", ConstructorParameterDescription(self.geo)), ("zoom", ConstructorParameterDescription(self.zoom)), ("w", ConstructorParameterDescription(self.w)), ("h", ConstructorParameterDescription(self.h)), ("caption", ConstructorParameterDescription(self.caption))])
}
}
public class Cons_inputPageBlockOrderedList: TypeConstructorDescription {
public var flags: Int32
public var items: [Api.InputPageListOrderedItem]
public var start: Int32?
public var type: String?
public init(flags: Int32, items: [Api.InputPageListOrderedItem], start: Int32?, type: String?) {
self.flags = flags
self.items = items
self.start = start
self.type = type
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("inputPageBlockOrderedList", [("flags", ConstructorParameterDescription(self.flags)), ("items", ConstructorParameterDescription(self.items)), ("start", ConstructorParameterDescription(self.start)), ("type", ConstructorParameterDescription(self.type))])
}
}
public class Cons_pageBlockAnchor: TypeConstructorDescription {
public var name: String
public init(name: String) {
@ -487,6 +472,17 @@ public extension Api {
return ("pageBlockBlockquote", [("text", ConstructorParameterDescription(self.text)), ("caption", ConstructorParameterDescription(self.caption))])
}
}
public class Cons_pageBlockBlockquoteBlocks: TypeConstructorDescription {
public var blocks: [Api.PageBlock]
public var caption: Api.RichText
public init(blocks: [Api.PageBlock], caption: Api.RichText) {
self.blocks = blocks
self.caption = caption
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("pageBlockBlockquoteBlocks", [("blocks", ConstructorParameterDescription(self.blocks)), ("caption", ConstructorParameterDescription(self.caption))])
}
}
public class Cons_pageBlockChannel: TypeConstructorDescription {
public var channel: Api.Chat
public init(channel: Api.Chat) {
@ -688,12 +684,18 @@ public extension Api {
}
}
public class Cons_pageBlockOrderedList: TypeConstructorDescription {
public var flags: Int32
public var items: [Api.PageListOrderedItem]
public init(items: [Api.PageListOrderedItem]) {
public var start: Int32?
public var type: String?
public init(flags: Int32, items: [Api.PageListOrderedItem], start: Int32?, type: String?) {
self.flags = flags
self.items = items
self.start = start
self.type = type
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("pageBlockOrderedList", [("items", ConstructorParameterDescription(self.items))])
return ("pageBlockOrderedList", [("flags", ConstructorParameterDescription(self.flags)), ("items", ConstructorParameterDescription(self.items)), ("start", ConstructorParameterDescription(self.start)), ("type", ConstructorParameterDescription(self.type))])
}
}
public class Cons_pageBlockParagraph: TypeConstructorDescription {
@ -829,11 +831,11 @@ public extension Api {
}
}
case inputPageBlockMap(Cons_inputPageBlockMap)
case inputPageBlockOrderedList(Cons_inputPageBlockOrderedList)
case pageBlockAnchor(Cons_pageBlockAnchor)
case pageBlockAudio(Cons_pageBlockAudio)
case pageBlockAuthorDate(Cons_pageBlockAuthorDate)
case pageBlockBlockquote(Cons_pageBlockBlockquote)
case pageBlockBlockquoteBlocks(Cons_pageBlockBlockquoteBlocks)
case pageBlockChannel(Cons_pageBlockChannel)
case pageBlockCollage(Cons_pageBlockCollage)
case pageBlockCover(Cons_pageBlockCover)
@ -880,23 +882,6 @@ public extension Api {
serializeInt32(_data.h, buffer: buffer, boxed: false)
_data.caption.serialize(buffer, true)
break
case .inputPageBlockOrderedList(let _data):
if boxed {
buffer.appendInt32(-1186155733)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.items.count))
for item in _data.items {
item.serialize(buffer, true)
}
if Int(_data.flags) & Int(1 << 0) != 0 {
serializeInt32(_data.start!, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 1) != 0 {
serializeString(_data.type!, buffer: buffer, boxed: false)
}
break
case .pageBlockAnchor(let _data):
if boxed {
buffer.appendInt32(-837994576)
@ -924,6 +909,17 @@ public extension Api {
_data.text.serialize(buffer, true)
_data.caption.serialize(buffer, true)
break
case .pageBlockBlockquoteBlocks(let _data):
if boxed {
buffer.appendInt32(242108356)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.blocks.count))
for item in _data.blocks {
item.serialize(buffer, true)
}
_data.caption.serialize(buffer, true)
break
case .pageBlockChannel(let _data):
if boxed {
buffer.appendInt32(-283684427)
@ -1084,13 +1080,20 @@ public extension Api {
break
case .pageBlockOrderedList(let _data):
if boxed {
buffer.appendInt32(-1702174239)
buffer.appendInt32(534181569)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.items.count))
for item in _data.items {
item.serialize(buffer, true)
}
if Int(_data.flags) & Int(1 << 0) != 0 {
serializeInt32(_data.start!, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 1) != 0 {
serializeString(_data.type!, buffer: buffer, boxed: false)
}
break
case .pageBlockParagraph(let _data):
if boxed {
@ -1204,8 +1207,6 @@ public extension Api {
switch self {
case .inputPageBlockMap(let _data):
return ("inputPageBlockMap", [("geo", ConstructorParameterDescription(_data.geo)), ("zoom", ConstructorParameterDescription(_data.zoom)), ("w", ConstructorParameterDescription(_data.w)), ("h", ConstructorParameterDescription(_data.h)), ("caption", ConstructorParameterDescription(_data.caption))])
case .inputPageBlockOrderedList(let _data):
return ("inputPageBlockOrderedList", [("flags", ConstructorParameterDescription(_data.flags)), ("items", ConstructorParameterDescription(_data.items)), ("start", ConstructorParameterDescription(_data.start)), ("type", ConstructorParameterDescription(_data.type))])
case .pageBlockAnchor(let _data):
return ("pageBlockAnchor", [("name", ConstructorParameterDescription(_data.name))])
case .pageBlockAudio(let _data):
@ -1214,6 +1215,8 @@ public extension Api {
return ("pageBlockAuthorDate", [("author", ConstructorParameterDescription(_data.author)), ("publishedDate", ConstructorParameterDescription(_data.publishedDate))])
case .pageBlockBlockquote(let _data):
return ("pageBlockBlockquote", [("text", ConstructorParameterDescription(_data.text)), ("caption", ConstructorParameterDescription(_data.caption))])
case .pageBlockBlockquoteBlocks(let _data):
return ("pageBlockBlockquoteBlocks", [("blocks", ConstructorParameterDescription(_data.blocks)), ("caption", ConstructorParameterDescription(_data.caption))])
case .pageBlockChannel(let _data):
return ("pageBlockChannel", [("channel", ConstructorParameterDescription(_data.channel))])
case .pageBlockCollage(let _data):
@ -1253,7 +1256,7 @@ public extension Api {
case .pageBlockMath(let _data):
return ("pageBlockMath", [("source", ConstructorParameterDescription(_data.source))])
case .pageBlockOrderedList(let _data):
return ("pageBlockOrderedList", [("items", ConstructorParameterDescription(_data.items))])
return ("pageBlockOrderedList", [("flags", ConstructorParameterDescription(_data.flags)), ("items", ConstructorParameterDescription(_data.items)), ("start", ConstructorParameterDescription(_data.start)), ("type", ConstructorParameterDescription(_data.type))])
case .pageBlockParagraph(let _data):
return ("pageBlockParagraph", [("text", ConstructorParameterDescription(_data.text))])
case .pageBlockPhoto(let _data):
@ -1310,32 +1313,6 @@ public extension Api {
return nil
}
}
public static func parse_inputPageBlockOrderedList(_ reader: BufferReader) -> PageBlock? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.InputPageListOrderedItem]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputPageListOrderedItem.self)
}
var _3: Int32?
if Int(_1 ?? 0) & Int(1 << 0) != 0 {
_3 = reader.readInt32()
}
var _4: String?
if Int(_1 ?? 0) & Int(1 << 1) != 0 {
_4 = parseString(reader)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1 ?? 0) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1 ?? 0) & Int(1 << 1) == 0) || _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.PageBlock.inputPageBlockOrderedList(Cons_inputPageBlockOrderedList(flags: _1!, items: _2!, start: _3, type: _4))
}
else {
return nil
}
}
public static func parse_pageBlockAnchor(_ reader: BufferReader) -> PageBlock? {
var _1: String?
_1 = parseString(reader)
@ -1397,6 +1374,24 @@ public extension Api {
return nil
}
}
public static func parse_pageBlockBlockquoteBlocks(_ reader: BufferReader) -> PageBlock? {
var _1: [Api.PageBlock]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PageBlock.self)
}
var _2: Api.RichText?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.RichText
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.PageBlock.pageBlockBlockquoteBlocks(Cons_pageBlockBlockquoteBlocks(blocks: _1!, caption: _2!))
}
else {
return nil
}
}
public static func parse_pageBlockChannel(_ reader: BufferReader) -> PageBlock? {
var _1: Api.Chat?
if let signature = reader.readInt32() {
@ -1708,13 +1703,26 @@ public extension Api {
}
}
public static func parse_pageBlockOrderedList(_ reader: BufferReader) -> PageBlock? {
var _1: [Api.PageListOrderedItem]?
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.PageListOrderedItem]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PageListOrderedItem.self)
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PageListOrderedItem.self)
}
var _3: Int32?
if Int(_1 ?? 0) & Int(1 << 0) != 0 {
_3 = reader.readInt32()
}
var _4: String?
if Int(_1 ?? 0) & Int(1 << 1) != 0 {
_4 = parseString(reader)
}
let _c1 = _1 != nil
if _c1 {
return Api.PageBlock.pageBlockOrderedList(Cons_pageBlockOrderedList(items: _1!))
let _c2 = _2 != nil
let _c3 = (Int(_1 ?? 0) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1 ?? 0) & Int(1 << 1) == 0) || _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.PageBlock.pageBlockOrderedList(Cons_pageBlockOrderedList(flags: _1!, items: _2!, start: _3, type: _4))
}
else {
return nil

View file

@ -759,6 +759,19 @@ public extension Api {
return ("botInlineMessageMediaWebPage", [("flags", ConstructorParameterDescription(self.flags)), ("message", ConstructorParameterDescription(self.message)), ("entities", ConstructorParameterDescription(self.entities)), ("url", ConstructorParameterDescription(self.url)), ("replyMarkup", ConstructorParameterDescription(self.replyMarkup))])
}
}
public class Cons_botInlineMessageRichMessage: TypeConstructorDescription {
public var flags: Int32
public var replyMarkup: Api.ReplyMarkup?
public var richMessage: Api.RichMessage
public init(flags: Int32, replyMarkup: Api.ReplyMarkup?, richMessage: Api.RichMessage) {
self.flags = flags
self.replyMarkup = replyMarkup
self.richMessage = richMessage
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("botInlineMessageRichMessage", [("flags", ConstructorParameterDescription(self.flags)), ("replyMarkup", ConstructorParameterDescription(self.replyMarkup)), ("richMessage", ConstructorParameterDescription(self.richMessage))])
}
}
public class Cons_botInlineMessageText: TypeConstructorDescription {
public var flags: Int32
public var message: String
@ -780,6 +793,7 @@ public extension Api {
case botInlineMessageMediaInvoice(Cons_botInlineMessageMediaInvoice)
case botInlineMessageMediaVenue(Cons_botInlineMessageMediaVenue)
case botInlineMessageMediaWebPage(Cons_botInlineMessageMediaWebPage)
case botInlineMessageRichMessage(Cons_botInlineMessageRichMessage)
case botInlineMessageText(Cons_botInlineMessageText)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
@ -882,6 +896,16 @@ public extension Api {
_data.replyMarkup!.serialize(buffer, true)
}
break
case .botInlineMessageRichMessage(let _data):
if boxed {
buffer.appendInt32(174161531)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 2) != 0 {
_data.replyMarkup!.serialize(buffer, true)
}
_data.richMessage.serialize(buffer, true)
break
case .botInlineMessageText(let _data):
if boxed {
buffer.appendInt32(-1937807902)
@ -916,6 +940,8 @@ public extension Api {
return ("botInlineMessageMediaVenue", [("flags", ConstructorParameterDescription(_data.flags)), ("geo", ConstructorParameterDescription(_data.geo)), ("title", ConstructorParameterDescription(_data.title)), ("address", ConstructorParameterDescription(_data.address)), ("provider", ConstructorParameterDescription(_data.provider)), ("venueId", ConstructorParameterDescription(_data.venueId)), ("venueType", ConstructorParameterDescription(_data.venueType)), ("replyMarkup", ConstructorParameterDescription(_data.replyMarkup))])
case .botInlineMessageMediaWebPage(let _data):
return ("botInlineMessageMediaWebPage", [("flags", ConstructorParameterDescription(_data.flags)), ("message", ConstructorParameterDescription(_data.message)), ("entities", ConstructorParameterDescription(_data.entities)), ("url", ConstructorParameterDescription(_data.url)), ("replyMarkup", ConstructorParameterDescription(_data.replyMarkup))])
case .botInlineMessageRichMessage(let _data):
return ("botInlineMessageRichMessage", [("flags", ConstructorParameterDescription(_data.flags)), ("replyMarkup", ConstructorParameterDescription(_data.replyMarkup)), ("richMessage", ConstructorParameterDescription(_data.richMessage))])
case .botInlineMessageText(let _data):
return ("botInlineMessageText", [("flags", ConstructorParameterDescription(_data.flags)), ("message", ConstructorParameterDescription(_data.message)), ("entities", ConstructorParameterDescription(_data.entities)), ("replyMarkup", ConstructorParameterDescription(_data.replyMarkup))])
}
@ -1123,6 +1149,29 @@ public extension Api {
return nil
}
}
public static func parse_botInlineMessageRichMessage(_ reader: BufferReader) -> BotInlineMessage? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.ReplyMarkup?
if Int(_1 ?? 0) & Int(1 << 2) != 0 {
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.ReplyMarkup
}
}
var _3: Api.RichMessage?
if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.RichMessage
}
let _c1 = _1 != nil
let _c2 = (Int(_1 ?? 0) & Int(1 << 2) == 0) || _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.BotInlineMessage.botInlineMessageRichMessage(Cons_botInlineMessageRichMessage(flags: _1!, replyMarkup: _2, richMessage: _3!))
}
else {
return nil
}
}
public static func parse_botInlineMessageText(_ reader: BufferReader) -> BotInlineMessage? {
var _1: Int32?
_1 = reader.readInt32()

View file

@ -149,28 +149,36 @@ public extension Api {
indirect enum PageListOrderedItem: TypeConstructorDescription {
public class Cons_pageListOrderedItemBlocks: TypeConstructorDescription {
public var flags: Int32
public var num: String
public var num: String?
public var blocks: [Api.PageBlock]
public init(flags: Int32, num: String, blocks: [Api.PageBlock]) {
public var value: Int32?
public var type: String?
public init(flags: Int32, num: String?, blocks: [Api.PageBlock], value: Int32?, type: String?) {
self.flags = flags
self.num = num
self.blocks = blocks
self.value = value
self.type = type
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("pageListOrderedItemBlocks", [("flags", ConstructorParameterDescription(self.flags)), ("num", ConstructorParameterDescription(self.num)), ("blocks", ConstructorParameterDescription(self.blocks))])
return ("pageListOrderedItemBlocks", [("flags", ConstructorParameterDescription(self.flags)), ("num", ConstructorParameterDescription(self.num)), ("blocks", ConstructorParameterDescription(self.blocks)), ("value", ConstructorParameterDescription(self.value)), ("type", ConstructorParameterDescription(self.type))])
}
}
public class Cons_pageListOrderedItemText: TypeConstructorDescription {
public var flags: Int32
public var num: String
public var num: String?
public var text: Api.RichText
public init(flags: Int32, num: String, text: Api.RichText) {
public var value: Int32?
public var type: String?
public init(flags: Int32, num: String?, text: Api.RichText, value: Int32?, type: String?) {
self.flags = flags
self.num = num
self.text = text
self.value = value
self.type = type
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("pageListOrderedItemText", [("flags", ConstructorParameterDescription(self.flags)), ("num", ConstructorParameterDescription(self.num)), ("text", ConstructorParameterDescription(self.text))])
return ("pageListOrderedItemText", [("flags", ConstructorParameterDescription(self.flags)), ("num", ConstructorParameterDescription(self.num)), ("text", ConstructorParameterDescription(self.text)), ("value", ConstructorParameterDescription(self.value)), ("type", ConstructorParameterDescription(self.type))])
}
}
case pageListOrderedItemBlocks(Cons_pageListOrderedItemBlocks)
@ -180,23 +188,39 @@ public extension Api {
switch self {
case .pageListOrderedItemBlocks(let _data):
if boxed {
buffer.appendInt32(1109995988)
buffer.appendInt32(-1879910928)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
serializeString(_data.num, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 2) != 0 {
serializeString(_data.num!, buffer: buffer, boxed: false)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.blocks.count))
for item in _data.blocks {
item.serialize(buffer, true)
}
if Int(_data.flags) & Int(1 << 3) != 0 {
serializeInt32(_data.value!, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 4) != 0 {
serializeString(_data.type!, buffer: buffer, boxed: false)
}
break
case .pageListOrderedItemText(let _data):
if boxed {
buffer.appendInt32(-851533770)
buffer.appendInt32(352522633)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
serializeString(_data.num, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 2) != 0 {
serializeString(_data.num!, buffer: buffer, boxed: false)
}
_data.text.serialize(buffer, true)
if Int(_data.flags) & Int(1 << 3) != 0 {
serializeInt32(_data.value!, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 4) != 0 {
serializeString(_data.type!, buffer: buffer, boxed: false)
}
break
}
}
@ -204,9 +228,9 @@ public extension Api {
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .pageListOrderedItemBlocks(let _data):
return ("pageListOrderedItemBlocks", [("flags", ConstructorParameterDescription(_data.flags)), ("num", ConstructorParameterDescription(_data.num)), ("blocks", ConstructorParameterDescription(_data.blocks))])
return ("pageListOrderedItemBlocks", [("flags", ConstructorParameterDescription(_data.flags)), ("num", ConstructorParameterDescription(_data.num)), ("blocks", ConstructorParameterDescription(_data.blocks)), ("value", ConstructorParameterDescription(_data.value)), ("type", ConstructorParameterDescription(_data.type))])
case .pageListOrderedItemText(let _data):
return ("pageListOrderedItemText", [("flags", ConstructorParameterDescription(_data.flags)), ("num", ConstructorParameterDescription(_data.num)), ("text", ConstructorParameterDescription(_data.text))])
return ("pageListOrderedItemText", [("flags", ConstructorParameterDescription(_data.flags)), ("num", ConstructorParameterDescription(_data.num)), ("text", ConstructorParameterDescription(_data.text)), ("value", ConstructorParameterDescription(_data.value)), ("type", ConstructorParameterDescription(_data.type))])
}
}
@ -214,16 +238,28 @@ public extension Api {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
if Int(_1 ?? 0) & Int(1 << 2) != 0 {
_2 = parseString(reader)
}
var _3: [Api.PageBlock]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PageBlock.self)
}
var _4: Int32?
if Int(_1 ?? 0) & Int(1 << 3) != 0 {
_4 = reader.readInt32()
}
var _5: String?
if Int(_1 ?? 0) & Int(1 << 4) != 0 {
_5 = parseString(reader)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c2 = (Int(_1 ?? 0) & Int(1 << 2) == 0) || _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.PageListOrderedItem.pageListOrderedItemBlocks(Cons_pageListOrderedItemBlocks(flags: _1!, num: _2!, blocks: _3!))
let _c4 = (Int(_1 ?? 0) & Int(1 << 3) == 0) || _4 != nil
let _c5 = (Int(_1 ?? 0) & Int(1 << 4) == 0) || _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.PageListOrderedItem.pageListOrderedItemBlocks(Cons_pageListOrderedItemBlocks(flags: _1!, num: _2, blocks: _3!, value: _4, type: _5))
}
else {
return nil
@ -233,16 +269,28 @@ public extension Api {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
if Int(_1 ?? 0) & Int(1 << 2) != 0 {
_2 = parseString(reader)
}
var _3: Api.RichText?
if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.RichText
}
var _4: Int32?
if Int(_1 ?? 0) & Int(1 << 3) != 0 {
_4 = reader.readInt32()
}
var _5: String?
if Int(_1 ?? 0) & Int(1 << 4) != 0 {
_5 = parseString(reader)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c2 = (Int(_1 ?? 0) & Int(1 << 2) == 0) || _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.PageListOrderedItem.pageListOrderedItemText(Cons_pageListOrderedItemText(flags: _1!, num: _2!, text: _3!))
let _c4 = (Int(_1 ?? 0) & Int(1 << 3) == 0) || _4 != nil
let _c5 = (Int(_1 ?? 0) & Int(1 << 4) == 0) || _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.PageListOrderedItem.pageListOrderedItemText(Cons_pageListOrderedItemText(flags: _1!, num: _2, text: _3!, value: _4, type: _5))
}
else {
return nil

View file

@ -553,8 +553,8 @@ public extension Api {
public var date: Int32
public var effect: Int64?
public var suggestedPost: Api.SuggestedPost?
public var richMessage: Api.InputRichMessage?
public init(flags: Int32, replyTo: Api.InputReplyTo?, message: String, entities: [Api.MessageEntity]?, media: Api.InputMedia?, date: Int32, effect: Int64?, suggestedPost: Api.SuggestedPost?, richMessage: Api.InputRichMessage?) {
public var richMessage: Api.RichMessage?
public init(flags: Int32, replyTo: Api.InputReplyTo?, message: String, entities: [Api.MessageEntity]?, media: Api.InputMedia?, date: Int32, effect: Int64?, suggestedPost: Api.SuggestedPost?, richMessage: Api.RichMessage?) {
self.flags = flags
self.replyTo = replyTo
self.message = message
@ -587,7 +587,7 @@ public extension Api {
switch self {
case .draftMessage(let _data):
if boxed {
buffer.appendInt32(-1743452271)
buffer.appendInt32(1627271828)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 4) != 0 {
@ -671,10 +671,10 @@ public extension Api {
_8 = Api.parse(reader, signature: signature) as? Api.SuggestedPost
}
}
var _9: Api.InputRichMessage?
var _9: Api.RichMessage?
if Int(_1 ?? 0) & Int(1 << 9) != 0 {
if let signature = reader.readInt32() {
_9 = Api.parse(reader, signature: signature) as? Api.InputRichMessage
_9 = Api.parse(reader, signature: signature) as? Api.RichMessage
}
}
let _c1 = _1 != nil

View file

@ -997,6 +997,19 @@ public extension Api {
return ("inputBotInlineMessageMediaWebPage", [("flags", ConstructorParameterDescription(self.flags)), ("message", ConstructorParameterDescription(self.message)), ("entities", ConstructorParameterDescription(self.entities)), ("url", ConstructorParameterDescription(self.url)), ("replyMarkup", ConstructorParameterDescription(self.replyMarkup))])
}
}
public class Cons_inputBotInlineMessageRichMessage: TypeConstructorDescription {
public var flags: Int32
public var replyMarkup: Api.ReplyMarkup?
public var richMessage: Api.InputRichMessage
public init(flags: Int32, replyMarkup: Api.ReplyMarkup?, richMessage: Api.InputRichMessage) {
self.flags = flags
self.replyMarkup = replyMarkup
self.richMessage = richMessage
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("inputBotInlineMessageRichMessage", [("flags", ConstructorParameterDescription(self.flags)), ("replyMarkup", ConstructorParameterDescription(self.replyMarkup)), ("richMessage", ConstructorParameterDescription(self.richMessage))])
}
}
public class Cons_inputBotInlineMessageText: TypeConstructorDescription {
public var flags: Int32
public var message: String
@ -1019,6 +1032,7 @@ public extension Api {
case inputBotInlineMessageMediaInvoice(Cons_inputBotInlineMessageMediaInvoice)
case inputBotInlineMessageMediaVenue(Cons_inputBotInlineMessageMediaVenue)
case inputBotInlineMessageMediaWebPage(Cons_inputBotInlineMessageMediaWebPage)
case inputBotInlineMessageRichMessage(Cons_inputBotInlineMessageRichMessage)
case inputBotInlineMessageText(Cons_inputBotInlineMessageText)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
@ -1132,6 +1146,16 @@ public extension Api {
_data.replyMarkup!.serialize(buffer, true)
}
break
case .inputBotInlineMessageRichMessage(let _data):
if boxed {
buffer.appendInt32(-1271007892)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 2) != 0 {
_data.replyMarkup!.serialize(buffer, true)
}
_data.richMessage.serialize(buffer, true)
break
case .inputBotInlineMessageText(let _data):
if boxed {
buffer.appendInt32(1036876423)
@ -1168,6 +1192,8 @@ public extension Api {
return ("inputBotInlineMessageMediaVenue", [("flags", ConstructorParameterDescription(_data.flags)), ("geoPoint", ConstructorParameterDescription(_data.geoPoint)), ("title", ConstructorParameterDescription(_data.title)), ("address", ConstructorParameterDescription(_data.address)), ("provider", ConstructorParameterDescription(_data.provider)), ("venueId", ConstructorParameterDescription(_data.venueId)), ("venueType", ConstructorParameterDescription(_data.venueType)), ("replyMarkup", ConstructorParameterDescription(_data.replyMarkup))])
case .inputBotInlineMessageMediaWebPage(let _data):
return ("inputBotInlineMessageMediaWebPage", [("flags", ConstructorParameterDescription(_data.flags)), ("message", ConstructorParameterDescription(_data.message)), ("entities", ConstructorParameterDescription(_data.entities)), ("url", ConstructorParameterDescription(_data.url)), ("replyMarkup", ConstructorParameterDescription(_data.replyMarkup))])
case .inputBotInlineMessageRichMessage(let _data):
return ("inputBotInlineMessageRichMessage", [("flags", ConstructorParameterDescription(_data.flags)), ("replyMarkup", ConstructorParameterDescription(_data.replyMarkup)), ("richMessage", ConstructorParameterDescription(_data.richMessage))])
case .inputBotInlineMessageText(let _data):
return ("inputBotInlineMessageText", [("flags", ConstructorParameterDescription(_data.flags)), ("message", ConstructorParameterDescription(_data.message)), ("entities", ConstructorParameterDescription(_data.entities)), ("replyMarkup", ConstructorParameterDescription(_data.replyMarkup))])
}
@ -1403,6 +1429,29 @@ public extension Api {
return nil
}
}
public static func parse_inputBotInlineMessageRichMessage(_ reader: BufferReader) -> InputBotInlineMessage? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.ReplyMarkup?
if Int(_1 ?? 0) & Int(1 << 2) != 0 {
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.ReplyMarkup
}
}
var _3: Api.InputRichMessage?
if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.InputRichMessage
}
let _c1 = _1 != nil
let _c2 = (Int(_1 ?? 0) & Int(1 << 2) == 0) || _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.InputBotInlineMessage.inputBotInlineMessageRichMessage(Cons_inputBotInlineMessageRichMessage(flags: _1!, replyMarkup: _2, richMessage: _3!))
}
else {
return nil
}
}
public static func parse_inputBotInlineMessageText(_ reader: BufferReader) -> InputBotInlineMessage? {
var _1: Int32?
_1 = reader.readInt32()

View file

@ -91,8 +91,9 @@ table InstantPageBlock_List {
}
table InstantPageBlock_BlockQuote {
text:RichText (id: 0, required);
text:RichText (id: 0);
caption:RichText (id: 1, required);
blocks:[InstantPageBlock] (id: 2);
}
table InstantPageBlock_PullQuote {

View file

@ -11,7 +11,7 @@ public enum ChatContextResultMessage: PostboxCoding, Equatable, Codable {
}
case auto(caption: String, entities: TextEntitiesMessageAttribute?, replyMarkup: ReplyMarkupMessageAttribute?)
case text(text: String, entities: TextEntitiesMessageAttribute?, disableUrlPreview: Bool, previewParameters: WebpagePreviewMessageAttribute?, replyMarkup: ReplyMarkupMessageAttribute?)
case text(text: String, entities: TextEntitiesMessageAttribute?, richText: RichTextMessageAttribute?, disableUrlPreview: Bool, previewParameters: WebpagePreviewMessageAttribute?, replyMarkup: ReplyMarkupMessageAttribute?)
case mapLocation(media: TelegramMediaMap, replyMarkup: ReplyMarkupMessageAttribute?)
case contact(media: TelegramMediaContact, replyMarkup: ReplyMarkupMessageAttribute?)
case invoice(media: TelegramMediaInvoice, replyMarkup: ReplyMarkupMessageAttribute?)
@ -22,7 +22,7 @@ public enum ChatContextResultMessage: PostboxCoding, Equatable, Codable {
case 0:
self = .auto(caption: decoder.decodeStringForKey("c", orElse: ""), entities: decoder.decodeObjectForKey("e") as? TextEntitiesMessageAttribute, replyMarkup: decoder.decodeObjectForKey("m") as? ReplyMarkupMessageAttribute)
case 1:
self = .text(text: decoder.decodeStringForKey("t", orElse: ""), entities: decoder.decodeObjectForKey("e") as? TextEntitiesMessageAttribute, disableUrlPreview: decoder.decodeInt32ForKey("du", orElse: 0) != 0, previewParameters: decoder.decodeObjectForKey("prp") as? WebpagePreviewMessageAttribute, replyMarkup: decoder.decodeObjectForKey("m") as? ReplyMarkupMessageAttribute)
self = .text(text: decoder.decodeStringForKey("t", orElse: ""), entities: decoder.decodeObjectForKey("e") as? TextEntitiesMessageAttribute, richText: decoder.decodeObjectForKey("rt", decoder: { RichTextMessageAttribute(decoder: $0) }) as? RichTextMessageAttribute, disableUrlPreview: decoder.decodeInt32ForKey("du", orElse: 0) != 0, previewParameters: decoder.decodeObjectForKey("prp") as? WebpagePreviewMessageAttribute, replyMarkup: decoder.decodeObjectForKey("m") as? ReplyMarkupMessageAttribute)
case 2:
self = .mapLocation(media: decoder.decodeObjectForKey("l") as! TelegramMediaMap, replyMarkup: decoder.decodeObjectForKey("m") as? ReplyMarkupMessageAttribute)
case 3:
@ -51,7 +51,7 @@ public enum ChatContextResultMessage: PostboxCoding, Equatable, Codable {
} else {
encoder.encodeNil(forKey: "m")
}
case let .text(text, entities, disableUrlPreview, previewParameters, replyMarkup):
case let .text(text, entities, richText, disableUrlPreview, previewParameters, replyMarkup):
encoder.encodeInt32(1, forKey: "_v")
encoder.encodeString(text, forKey: "t")
if let entities = entities {
@ -59,6 +59,11 @@ public enum ChatContextResultMessage: PostboxCoding, Equatable, Codable {
} else {
encoder.encodeNil(forKey: "e")
}
if let richText {
encoder.encodeObject(richText, forKey: "rt")
} else {
encoder.encodeNil(forKey: "rt")
}
encoder.encodeInt32(disableUrlPreview ? 1 : 0, forKey: "du")
if let previewParameters = previewParameters {
encoder.encodeObject(previewParameters, forKey: "prp")
@ -148,14 +153,17 @@ public enum ChatContextResultMessage: PostboxCoding, Equatable, Codable {
} else {
return false
}
case let .text(lhsText, lhsEntities, lhsDisableUrlPreview, lhsPreviewParameters, lhsReplyMarkup):
if case let .text(rhsText, rhsEntities, rhsDisableUrlPreview, rhsPreviewParameters, rhsReplyMarkup) = rhs {
case let .text(lhsText, lhsEntities, lhsRichText, lhsDisableUrlPreview, lhsPreviewParameters, lhsReplyMarkup):
if case let .text(rhsText, rhsEntities, rhsRichText, rhsDisableUrlPreview, rhsPreviewParameters, rhsReplyMarkup) = rhs {
if lhsText != rhsText {
return false
}
if lhsEntities != rhsEntities {
return false
}
if lhsRichText != rhsRichText {
return false
}
if lhsDisableUrlPreview != rhsDisableUrlPreview {
return false
}
@ -508,12 +516,18 @@ extension ChatContextResultMessage {
parsedReplyMarkup = ReplyMarkupMessageAttribute(apiMarkup: replyMarkup)
}
let leadingPreview = (flags & (1 << 3)) != 0
self = .text(text: message, entities: parsedEntities, disableUrlPreview: (flags & (1 << 0)) != 0, previewParameters: WebpagePreviewMessageAttribute(
self = .text(text: message, entities: parsedEntities, richText: nil, disableUrlPreview: (flags & (1 << 0)) != 0, previewParameters: WebpagePreviewMessageAttribute(
leadingPreview: leadingPreview,
forceLargeMedia: nil,
isManuallyAdded: false,
isSafe: false
), replyMarkup: parsedReplyMarkup)
case let .botInlineMessageRichMessage(botInlineMessageRichMessage):
var parsedReplyMarkup: ReplyMarkupMessageAttribute?
if let replyMarkup = botInlineMessageRichMessage.replyMarkup {
parsedReplyMarkup = ReplyMarkupMessageAttribute(apiMarkup: replyMarkup)
}
self = .text(text: "", entities: nil, richText: RichTextMessageAttribute(apiRichMessage: botInlineMessageRichMessage.richMessage), disableUrlPreview: false, previewParameters: nil, replyMarkup: parsedReplyMarkup)
case let .botInlineMessageMediaGeo(botInlineMessageMediaGeoData):
let (_, geo, heading, period, proximityNotificationRadius, replyMarkup) = (botInlineMessageMediaGeoData.flags, botInlineMessageMediaGeoData.geo, botInlineMessageMediaGeoData.heading, botInlineMessageMediaGeoData.period, botInlineMessageMediaGeoData.proximityNotificationRadius, botInlineMessageMediaGeoData.replyMarkup)
let media = telegramMediaMapFromApiGeoPoint(geo, title: nil, address: nil, provider: nil, venueId: nil, venueType: nil, liveBroadcastingTimeout: period, liveProximityNotificationRadius: proximityNotificationRadius, heading: heading)

View file

@ -89,30 +89,25 @@ extension InstantPageListItem {
}
}
func apiInputPageOrderedListItem() -> Api.InputPageListOrderedItem {
func apiInputPageOrderedListItem() -> Api.PageListOrderedItem {
switch self {
case let .text(value, num, checked):
var flags: Int32 = InstantPageListItem.apiFlags(fromChecked: checked)
var inputNum: Int32?
if let num, let numValue = Int32(num) {
inputNum = numValue
if num != nil {
flags |= (1 << 2)
}
return .inputPageListOrderedItemText(Api.InputPageListOrderedItem.Cons_inputPageListOrderedItemText(flags: flags, text: value.apiRichText(), value: inputNum, type: nil))
return .pageListOrderedItemText(Api.PageListOrderedItem.Cons_pageListOrderedItemText(flags: flags, num: num, text: value.apiRichText(), value: nil, type: nil))
case let .blocks(blocks, num, checked):
var flags: Int32 = InstantPageListItem.apiFlags(fromChecked: checked)
var inputNum: Int32?
if let num, let numValue = Int32(num) {
inputNum = numValue
if num != nil {
flags |= (1 << 2)
}
return .inputPageListOrderedItemBlocks(Api.InputPageListOrderedItem.Cons_inputPageListOrderedItemBlocks(flags: flags, blocks: blocks.compactMap { $0.apiInputBlock() }, value: inputNum, type: nil))
return .pageListOrderedItemBlocks(Api.PageListOrderedItem.Cons_pageListOrderedItemBlocks(flags: flags, num: num, blocks: blocks.compactMap { $0.apiInputBlock() }, value: nil, type: nil))
case .unknown:
return .inputPageListOrderedItemText(Api.InputPageListOrderedItem.Cons_inputPageListOrderedItemText(flags: 0, text: .textPlain(Api.RichText.Cons_textPlain(text: "")), value: nil, type: nil))
return .pageListOrderedItemText(Api.PageListOrderedItem.Cons_pageListOrderedItemText(flags: 0, num: nil, text: .textPlain(Api.RichText.Cons_textPlain(text: "")), value: nil, type: nil))
}
}
}
@ -251,7 +246,9 @@ extension InstantPageBlock {
self = .anchor(name)
case let .pageBlockBlockquote(pageBlockBlockquoteData):
let (text, caption) = (pageBlockBlockquoteData.text, pageBlockBlockquoteData.caption)
self = .blockQuote(text: RichText(apiText: text), caption: RichText(apiText: caption))
self = .blockQuote(blocks: [.paragraph(RichText(apiText: text))], caption: RichText(apiText: caption))
case let .pageBlockBlockquoteBlocks(pageBlockBlockquoteBlocksData):
self = .blockQuote(blocks: pageBlockBlockquoteBlocksData.blocks.map { InstantPageBlock(apiBlock: $0) }, caption: RichText(apiText: pageBlockBlockquoteBlocksData.caption))
case let .pageBlockPullquote(pageBlockPullquoteData):
let (text, caption) = (pageBlockPullquoteData.text, pageBlockPullquoteData.caption)
self = .pullQuote(text: RichText(apiText: text), caption: RichText(apiText: caption))
@ -331,7 +328,7 @@ extension InstantPageBlock {
self = .heading(text: RichText(apiText: pageBlockHeading6.text), level: 6)
case let .pageBlockMath(pageBlockMath):
self = .formula(latex: pageBlockMath.source)
case .inputPageBlockMap, .inputPageBlockOrderedList, .pageBlockThinking:
case .inputPageBlockMap, .pageBlockThinking:
self = .unsupported
}
}
@ -371,12 +368,18 @@ extension InstantPageBlock {
return .pageBlockAnchor(Api.PageBlock.Cons_pageBlockAnchor(name: value))
case let .list(items, ordered):
if ordered {
return .inputPageBlockOrderedList(Api.PageBlock.Cons_inputPageBlockOrderedList(flags: 0, items: items.map { $0.apiInputPageOrderedListItem() }, start: nil, type: nil))
return .pageBlockOrderedList(Api.PageBlock.Cons_pageBlockOrderedList(flags: 0, items: items.map { $0.apiInputPageOrderedListItem() }, start: nil, type: nil))
} else {
return .pageBlockList(Api.PageBlock.Cons_pageBlockList(items: items.map { $0.apiInputPageListItem() }))
}
case let .blockQuote(text, caption):
return .pageBlockBlockquote(Api.PageBlock.Cons_pageBlockBlockquote(text: text.apiRichText(), caption: caption.apiRichText()))
case let .blockQuote(blocks, caption):
if blocks.isEmpty {
return .pageBlockBlockquote(Api.PageBlock.Cons_pageBlockBlockquote(text: RichText.empty.apiRichText(), caption: caption.apiRichText()))
}
if blocks.count == 1, case let .paragraph(text) = blocks[0] {
return .pageBlockBlockquote(Api.PageBlock.Cons_pageBlockBlockquote(text: text.apiRichText(), caption: caption.apiRichText()))
}
return .pageBlockBlockquoteBlocks(Api.PageBlock.Cons_pageBlockBlockquoteBlocks(blocks: blocks.compactMap { $0.apiInputBlock() }, caption: caption.apiRichText()))
case let .pullQuote(text, caption):
return .pageBlockPullquote(Api.PageBlock.Cons_pageBlockPullquote(text: text.apiRichText(), caption: caption.apiRichText()))
case let .image(id, caption, url, webpageId):

View file

@ -70,7 +70,7 @@ public indirect enum InstantPageBlock: PostboxCoding, Equatable {
case divider
case anchor(String)
case list(items: [InstantPageListItem], ordered: Bool)
case blockQuote(text: RichText, caption: RichText)
case blockQuote(blocks: [InstantPageBlock], caption: RichText)
case pullQuote(text: RichText, caption: RichText)
case image(id: MediaId, caption: InstantPageCaption, url: String?, webpageId: MediaId?)
case video(id: MediaId, caption: InstantPageCaption, autoplay: Bool, loop: Bool)
@ -121,7 +121,13 @@ public indirect enum InstantPageBlock: PostboxCoding, Equatable {
case InstantPageBlockType.list.rawValue:
self = .list(items: decodeListItems(decoder), ordered: decoder.decodeOptionalInt32ForKey("o") != 0)
case InstantPageBlockType.blockQuote.rawValue:
self = .blockQuote(text: decoder.decodeObjectForKey("t", decoder: { RichText(decoder: $0) }) as! RichText, caption: decoder.decodeObjectForKey("c", decoder: { RichText(decoder: $0) }) as! RichText)
let caption = decoder.decodeObjectForKey("c", decoder: { RichText(decoder: $0) }) as! RichText
if let legacyText = decoder.decodeObjectForKey("t", decoder: { RichText(decoder: $0) }) as? RichText {
self = .blockQuote(blocks: [.paragraph(legacyText)], caption: caption)
} else {
let blocks: [InstantPageBlock] = decoder.decodeObjectArrayWithDecoderForKey("b")
self = .blockQuote(blocks: blocks, caption: caption)
}
case InstantPageBlockType.pullQuote.rawValue:
self = .pullQuote(text: decoder.decodeObjectForKey("t", decoder: { RichText(decoder: $0) }) as! RichText, caption: decoder.decodeObjectForKey("c", decoder: { RichText(decoder: $0) }) as! RichText)
case InstantPageBlockType.image.rawValue:
@ -225,9 +231,9 @@ public indirect enum InstantPageBlock: PostboxCoding, Equatable {
encoder.encodeInt32(InstantPageBlockType.list.rawValue, forKey: "r")
encoder.encodeObjectArray(items, forKey: "ml")
encoder.encodeInt32(ordered ? 1 : 0, forKey: "o")
case let .blockQuote(text, caption):
case let .blockQuote(blocks, caption):
encoder.encodeInt32(InstantPageBlockType.blockQuote.rawValue, forKey: "r")
encoder.encodeObject(text, forKey: "t")
encoder.encodeObjectArray(blocks, forKey: "b")
encoder.encodeObject(caption, forKey: "c")
case let .pullQuote(text, caption):
encoder.encodeInt32(InstantPageBlockType.pullQuote.rawValue, forKey: "r")
@ -445,8 +451,8 @@ public indirect enum InstantPageBlock: PostboxCoding, Equatable {
} else {
return false
}
case let .blockQuote(text, caption):
if case .blockQuote(text, caption) = rhs {
case let .blockQuote(lhsBlocks, lhsCaption):
if case let .blockQuote(rhsBlocks, rhsCaption) = rhs, lhsBlocks == rhsBlocks, lhsCaption == rhsCaption {
return true
} else {
return false
@ -621,7 +627,15 @@ public indirect enum InstantPageBlock: PostboxCoding, Equatable {
guard let value = flatBuffersObject.value(type: TelegramCore_InstantPageBlock_BlockQuote.self) else {
throw FlatBuffersError.missingRequiredField()
}
self = .blockQuote(text: try RichText(flatBuffersObject: value.text), caption: try RichText(flatBuffersObject: value.caption))
let caption = try RichText(flatBuffersObject: value.caption)
if value.blocksCount > 0 {
let blocks = try (0 ..< value.blocksCount).map { try InstantPageBlock(flatBuffersObject: value.blocks(at: $0)!) }
self = .blockQuote(blocks: blocks, caption: caption)
} else if let legacyText = value.text {
self = .blockQuote(blocks: [.paragraph(try RichText(flatBuffersObject: legacyText))], caption: caption)
} else {
self = .blockQuote(blocks: [], caption: caption)
}
case .instantpageblockPullquote:
guard let value = flatBuffersObject.value(type: TelegramCore_InstantPageBlock_PullQuote.self) else {
throw FlatBuffersError.missingRequiredField()
@ -796,12 +810,13 @@ public indirect enum InstantPageBlock: PostboxCoding, Equatable {
TelegramCore_InstantPageBlock_List.addVectorOf(items: itemsOffset, &builder)
TelegramCore_InstantPageBlock_List.add(ordered: ordered, &builder)
offset = TelegramCore_InstantPageBlock_List.endInstantPageBlock_List(&builder, start: start)
case let .blockQuote(text, caption):
case let .blockQuote(blocks, caption):
valueType = .instantpageblockBlockquote
let textOffset = text.encodeToFlatBuffers(builder: &builder)
let blocksOffsets = blocks.map { $0.encodeToFlatBuffers(builder: &builder) }
let blocksOffset = builder.createVector(ofOffsets: blocksOffsets, len: blocksOffsets.count)
let captionOffset = caption.encodeToFlatBuffers(builder: &builder)
let start = TelegramCore_InstantPageBlock_BlockQuote.startInstantPageBlock_BlockQuote(&builder)
TelegramCore_InstantPageBlock_BlockQuote.add(text: textOffset, &builder)
TelegramCore_InstantPageBlock_BlockQuote.addVectorOf(blocks: blocksOffset, &builder)
TelegramCore_InstantPageBlock_BlockQuote.add(caption: captionOffset, &builder)
offset = TelegramCore_InstantPageBlock_BlockQuote.endInstantPageBlock_BlockQuote(&builder, start: start)
case let .pullQuote(text, caption):

View file

@ -145,9 +145,13 @@ func _internal_outgoingMessageWithChatContextResult(to peerId: PeerId, threadId:
return .message(text: caption, attributes: attributes, inlineStickers: [:], mediaReference: nil, threadId: threadId, replyToMessageId: replyToMessageId, replyToStoryId: replyToStoryId, localGroupingKey: nil, correlationId: correlationId, bubbleUpEmojiOrStickersets: [])
}
}
case let .text(text, entities, disableUrlPreview, previewParameters, replyMarkup):
if let entities = entities {
attributes.append(entities)
case let .text(text, entities, richText, disableUrlPreview, previewParameters, replyMarkup):
if let richText {
attributes.append(richText)
} else {
if let entities = entities {
attributes.append(entities)
}
}
if let replyMarkup = replyMarkup {
attributes.append(replyMarkup)

View file

@ -123,8 +123,9 @@ extension InstantPageBlock {
result.append(item.previewText())
}
return result
case let .blockQuote(text, caption):
return text.previewText() + caption.previewText()
case let .blockQuote(blocks, caption):
let body = blocks.map { $0.previewText() }.joined(separator: " ")
return body + caption.previewText()
case let .pullQuote(text, caption):
return text.previewText() + caption.previewText()
case .image(_, _, _, _):

View file

@ -281,6 +281,9 @@ public func messageTextWithAttributes(message: EngineMessage) -> NSAttributedStr
}
let range = NSRange(location: entity.range.lowerBound, length: entity.range.upperBound - entity.range.lowerBound)
if range.upperBound >= updatedString.length {
continue
}
let currentDict = updatedString.attributes(at: range.lowerBound, effectiveRange: nil)
var updatedAttributes: [NSAttributedString.Key: Any] = currentDict

View file

@ -576,7 +576,15 @@ public class ChatMessageRichDataBubbleContentNode: ChatMessageBubbleContentNode
isReplyThread = true
}
let trailingWidthToMeasure: CGFloat = lastTextLineFrame?.width ?? 10000.0
// Measure trailing extent from the line's actual visible RIGHT EDGE (after
// alignment, in page coords) not just its intrinsic width. A right-aligned
// or RTL last line has `lineWidth` worth of glyphs but sits all the way at
// the right text inset (lineFrame.maxX == text.frame.minX + textItem.width).
// Feeding the status node just `lineWidth` would let the trail/wrap decision
// place the date inline with the line on top of it. `pageHorizontalInset`
// is the offset between page-coords and status-node-local coords (the status
// node sits at x=pageHorizontalInset in self, and pageView sits at self-x 0).
let trailingWidthToMeasure: CGFloat = lastTextLineFrame.map { $0.maxX - pageHorizontalInset } ?? 10000.0
let dateLayoutInput: ChatMessageDateAndStatusNode.LayoutInput = .trailingContent(contentWidth: trailingWidthToMeasure, reactionSettings: ChatMessageDateAndStatusNode.TrailingReactionSettings(displayInline: shouldDisplayInlineDateReactions(message: EngineMessage(item.message), isPremium: item.associatedData.isPremium, forceInline: item.associatedData.forceInlineReactions), preferAdditionalInset: false))

View file

@ -451,11 +451,18 @@ public final class PeerChannelMemberCategoriesContextsManager {
return engine.peers.joinChannel(peerId: peerId, hash: hash)
|> deliverOnMainQueue
|> beforeNext { [weak self] result in
if let strongSelf = self, case let .joined(updated) = result, let updated {
strongSelf.impl.with { impl in
if let self {
self.impl.with { impl in
for (contextPeerId, context) in impl.contexts {
if peerId == contextPeerId {
context.replayUpdates([(nil, updated, nil)])
switch result {
case let .joined(participant):
if let participant {
context.replayUpdates([(nil, participant, nil)])
}
case .webView:
break
}
}
}
}

View file

@ -19,6 +19,12 @@ final class PeerNameColorChatPreviewItem: ListViewItem, ItemListItem, ListItemCo
if lhs.text != rhs.text {
return false
}
if lhs.entities != rhs.entities {
return false
}
if lhs.richText != rhs.richText {
return false
}
if lhs.media.count != rhs.media.count {
return false
}
@ -35,6 +41,7 @@ final class PeerNameColorChatPreviewItem: ListViewItem, ItemListItem, ListItemCo
let text: String
let entities: TextEntitiesMessageAttribute?
let richText: RichTextMessageAttribute?
let media: [EngineRawMedia]
let replyMarkup: ReplyMarkupMessageAttribute?
let botAddress: String
@ -207,6 +214,9 @@ final class PeerNameColorChatPreviewItemNode: ListViewItemNode {
if let entities = messageItem.entities {
attributes.append(entities)
}
if let richText = messageItem.richText {
attributes.append(richText)
}
if let replyMarkup = messageItem.replyMarkup {
attributes.append(replyMarkup)
}

View file

@ -137,6 +137,7 @@ private final class SheetContent: CombinedComponent {
var text: String = ""
var entities: TextEntitiesMessageAttribute?
var richText: RichTextMessageAttribute?
var media: [EngineRawMedia] = []
var replyMarkup: ReplyMarkupMessageAttribute?
@ -152,8 +153,9 @@ private final class SheetContent: CombinedComponent {
media = [image]
}
replyMarkup = replyMarkupValue
case let .text(textValue, entitiesValue, disableUrlPreview, previewParameters, replyMarkupValue):
case let .text(textValue, entitiesValue, richTextValue, disableUrlPreview, previewParameters, replyMarkupValue):
text = textValue
richText = richTextValue
entities = entitiesValue
let _ = disableUrlPreview
let _ = previewParameters
@ -181,9 +183,10 @@ private final class SheetContent: CombinedComponent {
media = [content]
}
replyMarkup = replyMarkupValue
case let .text(textValue, entitiesValue, disableUrlPreview, previewParameters, replyMarkupValue):
case let .text(textValue, entitiesValue, richTextValue, disableUrlPreview, previewParameters, replyMarkupValue):
text = textValue
entities = entitiesValue
richText = richTextValue
let _ = disableUrlPreview
let _ = previewParameters
replyMarkup = replyMarkupValue
@ -206,6 +209,7 @@ private final class SheetContent: CombinedComponent {
let messageItem = PeerNameColorChatPreviewItem.MessageItem(
text: text,
entities: entities,
richText: richText,
media: media,
replyMarkup: replyMarkup,
botAddress: component.botAddress