Update API

This commit is contained in:
Ilya Laktyushin 2024-09-13 13:53:15 +04:00
parent 3a9cacfa68
commit f18f337f2c
21 changed files with 102 additions and 37 deletions

View File

@ -245,7 +245,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-1744710921] = { return Api.DocumentAttribute.parse_documentAttributeHasStickers($0) }
dict[1815593308] = { return Api.DocumentAttribute.parse_documentAttributeImageSize($0) }
dict[1662637586] = { return Api.DocumentAttribute.parse_documentAttributeSticker($0) }
dict[389652397] = { return Api.DocumentAttribute.parse_documentAttributeVideo($0) }
dict[1137015880] = { return Api.DocumentAttribute.parse_documentAttributeVideo($0) }
dict[761606687] = { return Api.DraftMessage.parse_draftMessage($0) }
dict[453805082] = { return Api.DraftMessage.parse_draftMessageEmpty($0) }
dict[-1764723459] = { return Api.EmailVerification.parse_emailVerificationApple($0) }
@ -500,6 +500,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-1560655744] = { return Api.KeyboardButton.parse_keyboardButton($0) }
dict[-1344716869] = { return Api.KeyboardButton.parse_keyboardButtonBuy($0) }
dict[901503851] = { return Api.KeyboardButton.parse_keyboardButtonCallback($0) }
dict[1976723854] = { return Api.KeyboardButton.parse_keyboardButtonCopy($0) }
dict[1358175439] = { return Api.KeyboardButton.parse_keyboardButtonGame($0) }
dict[-59151553] = { return Api.KeyboardButton.parse_keyboardButtonRequestGeoLocation($0) }
dict[1406648280] = { return Api.KeyboardButton.parse_keyboardButtonRequestPeer($0) }
@ -603,7 +604,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[1313731771] = { return Api.MessageFwdHeader.parse_messageFwdHeader($0) }
dict[1882335561] = { return Api.MessageMedia.parse_messageMediaContact($0) }
dict[1065280907] = { return Api.MessageMedia.parse_messageMediaDice($0) }
dict[1291114285] = { return Api.MessageMedia.parse_messageMediaDocument($0) }
dict[-581497899] = { return Api.MessageMedia.parse_messageMediaDocument($0) }
dict[1038967584] = { return Api.MessageMedia.parse_messageMediaEmpty($0) }
dict[-38694904] = { return Api.MessageMedia.parse_messageMediaGame($0) }
dict[1457575028] = { return Api.MessageMedia.parse_messageMediaGeo($0) }

View File

@ -674,6 +674,7 @@ public extension Api {
case keyboardButton(text: String)
case keyboardButtonBuy(text: String)
case keyboardButtonCallback(flags: Int32, text: String, data: Buffer)
case keyboardButtonCopy(text: String, copyText: String)
case keyboardButtonGame(text: String)
case keyboardButtonRequestGeoLocation(text: String)
case keyboardButtonRequestPeer(text: String, buttonId: Int32, peerType: Api.RequestPeerType, maxQuantity: Int32)
@ -735,6 +736,13 @@ public extension Api {
serializeString(text, buffer: buffer, boxed: false)
serializeBytes(data, buffer: buffer, boxed: false)
break
case .keyboardButtonCopy(let text, let copyText):
if boxed {
buffer.appendInt32(1976723854)
}
serializeString(text, buffer: buffer, boxed: false)
serializeString(copyText, buffer: buffer, boxed: false)
break
case .keyboardButtonGame(let text):
if boxed {
buffer.appendInt32(1358175439)
@ -838,6 +846,8 @@ public extension Api {
return ("keyboardButtonBuy", [("text", text as Any)])
case .keyboardButtonCallback(let flags, let text, let data):
return ("keyboardButtonCallback", [("flags", flags as Any), ("text", text as Any), ("data", data as Any)])
case .keyboardButtonCopy(let text, let copyText):
return ("keyboardButtonCopy", [("text", text as Any), ("copyText", copyText as Any)])
case .keyboardButtonGame(let text):
return ("keyboardButtonGame", [("text", text as Any)])
case .keyboardButtonRequestGeoLocation(let text):
@ -968,6 +978,20 @@ public extension Api {
return nil
}
}
public static func parse_keyboardButtonCopy(_ reader: BufferReader) -> KeyboardButton? {
var _1: String?
_1 = parseString(reader)
var _2: String?
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.KeyboardButton.keyboardButtonCopy(text: _1!, copyText: _2!)
}
else {
return nil
}
}
public static func parse_keyboardButtonGame(_ reader: BufferReader) -> KeyboardButton? {
var _1: String?
_1 = parseString(reader)

View File

@ -710,7 +710,7 @@ public extension Api {
indirect enum MessageMedia: TypeConstructorDescription {
case messageMediaContact(phoneNumber: String, firstName: String, lastName: String, vcard: String, userId: Int64)
case messageMediaDice(value: Int32, emoticon: String)
case messageMediaDocument(flags: Int32, document: Api.Document?, altDocument: Api.Document?, ttlSeconds: Int32?)
case messageMediaDocument(flags: Int32, document: Api.Document?, altDocuments: [Api.Document]?, ttlSeconds: Int32?)
case messageMediaEmpty
case messageMediaGame(game: Api.Game)
case messageMediaGeo(geo: Api.GeoPoint)
@ -745,13 +745,17 @@ public extension Api {
serializeInt32(value, buffer: buffer, boxed: false)
serializeString(emoticon, buffer: buffer, boxed: false)
break
case .messageMediaDocument(let flags, let document, let altDocument, let ttlSeconds):
case .messageMediaDocument(let flags, let document, let altDocuments, let ttlSeconds):
if boxed {
buffer.appendInt32(1291114285)
buffer.appendInt32(-581497899)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {document!.serialize(buffer, true)}
if Int(flags) & Int(1 << 5) != 0 {altDocument!.serialize(buffer, true)}
if Int(flags) & Int(1 << 5) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(altDocuments!.count))
for item in altDocuments! {
item.serialize(buffer, true)
}}
if Int(flags) & Int(1 << 2) != 0 {serializeInt32(ttlSeconds!, buffer: buffer, boxed: false)}
break
case .messageMediaEmpty:
@ -905,8 +909,8 @@ public extension Api {
return ("messageMediaContact", [("phoneNumber", phoneNumber as Any), ("firstName", firstName as Any), ("lastName", lastName as Any), ("vcard", vcard as Any), ("userId", userId as Any)])
case .messageMediaDice(let value, let emoticon):
return ("messageMediaDice", [("value", value as Any), ("emoticon", emoticon as Any)])
case .messageMediaDocument(let flags, let document, let altDocument, let ttlSeconds):
return ("messageMediaDocument", [("flags", flags as Any), ("document", document as Any), ("altDocument", altDocument as Any), ("ttlSeconds", ttlSeconds as Any)])
case .messageMediaDocument(let flags, let document, let altDocuments, let ttlSeconds):
return ("messageMediaDocument", [("flags", flags as Any), ("document", document as Any), ("altDocuments", altDocuments as Any), ("ttlSeconds", ttlSeconds as Any)])
case .messageMediaEmpty:
return ("messageMediaEmpty", [])
case .messageMediaGame(let game):
@ -982,9 +986,9 @@ public extension Api {
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.Document
} }
var _3: Api.Document?
if Int(_1!) & Int(1 << 5) != 0 {if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.Document
var _3: [Api.Document]?
if Int(_1!) & Int(1 << 5) != 0 {if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Document.self)
} }
var _4: Int32?
if Int(_1!) & Int(1 << 2) != 0 {_4 = reader.readInt32() }
@ -993,7 +997,7 @@ public extension Api {
let _c3 = (Int(_1!) & Int(1 << 5) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.MessageMedia.messageMediaDocument(flags: _1!, document: _2, altDocument: _3, ttlSeconds: _4)
return Api.MessageMedia.messageMediaDocument(flags: _1!, document: _2, altDocuments: _3, ttlSeconds: _4)
}
else {
return nil

View File

@ -2608,12 +2608,13 @@ public extension Api.functions.channels {
}
}
public extension Api.functions.channels {
static func clickSponsoredMessage(channel: Api.InputChannel, randomId: Buffer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
static func clickSponsoredMessage(flags: Int32, channel: Api.InputChannel, randomId: Buffer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(414170259)
buffer.appendInt32(21257589)
serializeInt32(flags, buffer: buffer, boxed: false)
channel.serialize(buffer, true)
serializeBytes(randomId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "channels.clickSponsoredMessage", parameters: [("channel", String(describing: channel)), ("randomId", String(describing: randomId))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
return (FunctionDescription(name: "channels.clickSponsoredMessage", parameters: [("flags", String(describing: flags)), ("channel", String(describing: channel)), ("randomId", String(describing: randomId))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {

View File

@ -1473,7 +1473,7 @@ public extension Api {
case documentAttributeHasStickers
case documentAttributeImageSize(w: Int32, h: Int32)
case documentAttributeSticker(flags: Int32, alt: String, stickerset: Api.InputStickerSet, maskCoords: Api.MaskCoords?)
case documentAttributeVideo(flags: Int32, duration: Double, w: Int32, h: Int32, preloadPrefixSize: Int32?, videoStartTs: Double?)
case documentAttributeVideo(flags: Int32, duration: Double, w: Int32, h: Int32, preloadPrefixSize: Int32?, videoStartTs: Double?, videoCodec: String?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
@ -1529,9 +1529,9 @@ public extension Api {
stickerset.serialize(buffer, true)
if Int(flags) & Int(1 << 0) != 0 {maskCoords!.serialize(buffer, true)}
break
case .documentAttributeVideo(let flags, let duration, let w, let h, let preloadPrefixSize, let videoStartTs):
case .documentAttributeVideo(let flags, let duration, let w, let h, let preloadPrefixSize, let videoStartTs, let videoCodec):
if boxed {
buffer.appendInt32(389652397)
buffer.appendInt32(1137015880)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeDouble(duration, buffer: buffer, boxed: false)
@ -1539,6 +1539,7 @@ public extension Api {
serializeInt32(h, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 2) != 0 {serializeInt32(preloadPrefixSize!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 4) != 0 {serializeDouble(videoStartTs!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 5) != 0 {serializeString(videoCodec!, buffer: buffer, boxed: false)}
break
}
}
@ -1559,8 +1560,8 @@ public extension Api {
return ("documentAttributeImageSize", [("w", w as Any), ("h", h as Any)])
case .documentAttributeSticker(let flags, let alt, let stickerset, let maskCoords):
return ("documentAttributeSticker", [("flags", flags as Any), ("alt", alt as Any), ("stickerset", stickerset as Any), ("maskCoords", maskCoords as Any)])
case .documentAttributeVideo(let flags, let duration, let w, let h, let preloadPrefixSize, let videoStartTs):
return ("documentAttributeVideo", [("flags", flags as Any), ("duration", duration as Any), ("w", w as Any), ("h", h as Any), ("preloadPrefixSize", preloadPrefixSize as Any), ("videoStartTs", videoStartTs as Any)])
case .documentAttributeVideo(let flags, let duration, let w, let h, let preloadPrefixSize, let videoStartTs, let videoCodec):
return ("documentAttributeVideo", [("flags", flags as Any), ("duration", duration as Any), ("w", w as Any), ("h", h as Any), ("preloadPrefixSize", preloadPrefixSize as Any), ("videoStartTs", videoStartTs as Any), ("videoCodec", videoCodec as Any)])
}
}
@ -1674,14 +1675,17 @@ public extension Api {
if Int(_1!) & Int(1 << 2) != 0 {_5 = reader.readInt32() }
var _6: Double?
if Int(_1!) & Int(1 << 4) != 0 {_6 = reader.readDouble() }
var _7: String?
if Int(_1!) & Int(1 << 5) != 0 {_7 = parseString(reader) }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 4) == 0) || _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.DocumentAttribute.documentAttributeVideo(flags: _1!, duration: _2!, w: _3!, h: _4!, preloadPrefixSize: _5, videoStartTs: _6)
let _c7 = (Int(_1!) & Int(1 << 5) == 0) || _7 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
return Api.DocumentAttribute.documentAttributeVideo(flags: _1!, duration: _2!, w: _3!, h: _4!, preloadPrefixSize: _5, videoStartTs: _6, videoCodec: _7)
}
else {
return nil

View File

@ -89,6 +89,8 @@ extension ReplyMarkupButton {
))
}
self.init(title: text, titleWhenForwarded: nil, action: .requestPeer(peerType: mappedPeerType, buttonId: buttonId, maxQuantity: maxQuantity))
case let .keyboardButtonCopy(text, payload):
self.init(title: text, titleWhenForwarded: nil, action: .copyText(payload: payload))
}
}
}

View File

@ -99,7 +99,8 @@ func telegramMediaFileAttributesFromApiAttributes(_ attributes: [Api.DocumentAtt
result.append(.ImageSize(size: PixelDimensions(width: w, height: h)))
case .documentAttributeAnimated:
result.append(.Animated)
case let .documentAttributeVideo(flags, duration, w, h, preloadSize, videoStart):
case let .documentAttributeVideo(flags, duration, w, h, preloadSize, videoStart, codec):
let _ = codec
var videoFlags = TelegramMediaVideoFlags()
if (flags & (1 << 0)) != 0 {
videoFlags.insert(.instantRoundVideo)

View File

@ -720,7 +720,7 @@ func inputDocumentAttributesFromFileAttributes(_ fileAttributes: [TelegramMediaF
if let coverTime = coverTime, coverTime > 0.0 {
flags |= (1 << 4)
}
attributes.append(.documentAttributeVideo(flags: flags, duration: duration, w: Int32(size.width), h: Int32(size.height), preloadPrefixSize: preloadSize, videoStartTs: coverTime))
attributes.append(.documentAttributeVideo(flags: flags, duration: duration, w: Int32(size.width), h: Int32(size.height), preloadPrefixSize: preloadSize, videoStartTs: coverTime, videoCodec: nil))
case let .Audio(isVoice, duration, title, performer, waveform):
var flags: Int32 = 0
if isVoice {

View File

@ -210,7 +210,7 @@ public class BoxedMessage: NSObject {
public class Serialization: NSObject, MTSerialization {
public func currentLayer() -> UInt {
return 187
return 188
}
public func parseMessage(_ data: Data!) -> Any! {

View File

@ -232,6 +232,7 @@ public enum ReplyMarkupButtonAction: PostboxCoding, Equatable {
case openUserProfile(peerId: PeerId)
case openWebView(url: String, simple: Bool)
case requestPeer(peerType: ReplyMarkupButtonRequestPeerType, buttonId: Int32, maxQuantity: Int32)
case copyText(payload: String)
public init(decoder: PostboxDecoder) {
switch decoder.decodeInt32ForKey("v", orElse: 0) {
@ -261,6 +262,8 @@ public enum ReplyMarkupButtonAction: PostboxCoding, Equatable {
self = .openWebView(url: decoder.decodeStringForKey("u", orElse: ""), simple: decoder.decodeInt32ForKey("s", orElse: 0) != 0)
case 12:
self = .requestPeer(peerType: decoder.decode(ReplyMarkupButtonRequestPeerType.self, forKey: "pt") ?? ReplyMarkupButtonRequestPeerType.user(ReplyMarkupButtonRequestPeerType.User(isBot: nil, isPremium: nil)), buttonId: decoder.decodeInt32ForKey("b", orElse: 0), maxQuantity: decoder.decodeInt32ForKey("q", orElse: 1))
case 13:
self = .copyText(payload: decoder.decodeStringForKey("p", orElse: ""))
default:
self = .text
}
@ -313,6 +316,9 @@ public enum ReplyMarkupButtonAction: PostboxCoding, Equatable {
encoder.encodeInt32(buttonId, forKey: "b")
encoder.encode(peerType, forKey: "pt")
encoder.encodeInt32(maxQuantity, forKey: "q")
case let .copyText(payload):
encoder.encodeInt32(13, forKey: "v")
encoder.encodeString(payload, forKey: "p")
}
}
}

View File

@ -531,8 +531,8 @@ private class AdMessagesHistoryContextImpl {
self.maskAsSeenDisposables.set(signal.start(), forKey: opaqueId)
}
func markAction(opaqueId: Data) {
_internal_markAdAction(account: self.account, peerId: self.peerId, opaqueId: opaqueId)
func markAction(opaqueId: Data, media: Bool, fullscreen: Bool) {
_internal_markAdAction(account: self.account, peerId: self.peerId, opaqueId: opaqueId, media: media, fullscreen: fullscreen)
}
func remove(opaqueId: Data) {
@ -593,9 +593,9 @@ public class AdMessagesHistoryContext {
}
}
public func markAction(opaqueId: Data) {
public func markAction(opaqueId: Data, media: Bool, fullscreen: Bool) {
self.impl.with { impl in
impl.markAction(opaqueId: opaqueId)
impl.markAction(opaqueId: opaqueId, media: media, fullscreen: fullscreen)
}
}
@ -607,7 +607,7 @@ public class AdMessagesHistoryContext {
}
func _internal_markAdAction(account: Account, peerId: EnginePeer.Id, opaqueId: Data) {
func _internal_markAdAction(account: Account, peerId: EnginePeer.Id, opaqueId: Data, media: Bool, fullscreen: Bool) {
let signal: Signal<Never, NoError> = account.postbox.transaction { transaction -> Api.InputChannel? in
return transaction.getPeer(peerId).flatMap(apiInputChannel)
}
@ -615,7 +615,14 @@ func _internal_markAdAction(account: Account, peerId: EnginePeer.Id, opaqueId: D
guard let inputChannel = inputChannel else {
return .complete()
}
return account.network.request(Api.functions.channels.clickSponsoredMessage(channel: inputChannel, randomId: Buffer(data: opaqueId)))
var flags: Int32 = 0
if media {
flags |= (1 << 0)
}
if fullscreen {
flags |= (1 << 1)
}
return account.network.request(Api.functions.channels.clickSponsoredMessage(flags: flags, channel: inputChannel, randomId: Buffer(data: opaqueId)))
|> `catch` { _ -> Signal<Api.Bool, NoError> in
return .single(.boolFalse)
}

View File

@ -2096,7 +2096,7 @@ extension Stories.StoredItem {
var parsedAlternativeMedia: Media?
switch media {
case let .messageMediaDocument(_, _, altDocument, _):
if let altDocument = altDocument {
if let altDocument = altDocument?.first {
parsedAlternativeMedia = telegramMediaFileFromApiDocument(altDocument)
}
default:

View File

@ -1466,8 +1466,9 @@ public extension TelegramEngine {
public func updateExtendedMedia(messageIds: [EngineMessage.Id]) -> Signal<Never, NoError> {
return _internal_updateExtendedMedia(account: self.account, messageIds: messageIds)
}
public func markAdAction(peerId: EnginePeer.Id, opaqueId: Data) {
_internal_markAdAction(account: self.account, peerId: peerId, opaqueId: opaqueId)
public func markAdAction(peerId: EnginePeer.Id, opaqueId: Data, media: Bool, fullscreen: Bool) {
_internal_markAdAction(account: self.account, peerId: peerId, opaqueId: opaqueId, media: media, fullscreen: fullscreen)
}
public func getAllLocalChannels(count: Int) -> Signal<[EnginePeer.Id], NoError> {

View File

@ -80,7 +80,7 @@ func _internal_uploadSticker(account: Account, peer: Peer, resource: MediaResour
var attributes: [Api.DocumentAttribute] = []
attributes.append(.documentAttributeSticker(flags: 0, alt: alt, stickerset: .inputStickerSetEmpty, maskCoords: nil))
if let duration {
attributes.append(.documentAttributeVideo(flags: 0, duration: duration, w: dimensions.width, h: dimensions.height, preloadPrefixSize: nil, videoStartTs: nil))
attributes.append(.documentAttributeVideo(flags: 0, duration: duration, w: dimensions.width, h: dimensions.height, preloadPrefixSize: nil, videoStartTs: nil, videoCodec: nil))
}
attributes.append(.documentAttributeImageSize(w: dimensions.width, h: dimensions.height))
return account.network.request(Api.functions.messages.uploadMedia(flags: 0, businessConnectionId: nil, peer: inputPeer, media: Api.InputMedia.inputMediaUploadedDocument(flags: flags, file: file, thumb: thumbnailFile, mimeType: mimeType, attributes: attributes, stickers: nil, ttlSeconds: nil)))

View File

@ -543,6 +543,7 @@ public final class PrincipalThemeAdditionalGraphics {
public let chatBubbleActionButtonIncomingProfileIconImage: UIImage
public let chatBubbleActionButtonIncomingAddToChatIconImage: UIImage
public let chatBubbleActionButtonIncomingWebAppIconImage: UIImage
public let chatBubbleActionButtonIncomingCopyIconImage: UIImage
public let chatBubbleActionButtonOutgoingMessageIconImage: UIImage
public let chatBubbleActionButtonOutgoingLinkIconImage: UIImage
@ -553,6 +554,7 @@ public final class PrincipalThemeAdditionalGraphics {
public let chatBubbleActionButtonOutgoingProfileIconImage: UIImage
public let chatBubbleActionButtonOutgoingAddToChatIconImage: UIImage
public let chatBubbleActionButtonOutgoingWebAppIconImage: UIImage
public let chatBubbleActionButtonOutgoingCopyIconImage: UIImage
public let chatEmptyItemLockIcon: UIImage
public let emptyChatListCheckIcon: UIImage
@ -598,6 +600,8 @@ public final class PrincipalThemeAdditionalGraphics {
self.chatBubbleActionButtonIncomingProfileIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotProfile"), color: bubbleVariableColor(variableColor: theme.message.incoming.actionButtonsTextColor, wallpaper: wallpaper))!
self.chatBubbleActionButtonIncomingAddToChatIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotAddToChat"), color: bubbleVariableColor(variableColor: theme.message.incoming.actionButtonsTextColor, wallpaper: wallpaper))!
self.chatBubbleActionButtonIncomingWebAppIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotWebApp"), color: bubbleVariableColor(variableColor: theme.message.incoming.actionButtonsTextColor, wallpaper: wallpaper))!
self.chatBubbleActionButtonIncomingCopyIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotCopy"), color: bubbleVariableColor(variableColor: theme.message.incoming.actionButtonsTextColor, wallpaper: wallpaper))!
self.chatBubbleActionButtonOutgoingMessageIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotMessage"), color: bubbleVariableColor(variableColor: theme.message.outgoing.actionButtonsTextColor, wallpaper: wallpaper))!
self.chatBubbleActionButtonOutgoingLinkIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotLink"), color: bubbleVariableColor(variableColor: theme.message.outgoing.actionButtonsTextColor, wallpaper: wallpaper))!
self.chatBubbleActionButtonOutgoingShareIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotShare"), color: bubbleVariableColor(variableColor: theme.message.outgoing.actionButtonsTextColor, wallpaper: wallpaper))!
@ -607,6 +611,7 @@ public final class PrincipalThemeAdditionalGraphics {
self.chatBubbleActionButtonOutgoingProfileIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotProfile"), color: bubbleVariableColor(variableColor: theme.message.outgoing.actionButtonsTextColor, wallpaper: wallpaper))!
self.chatBubbleActionButtonOutgoingAddToChatIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotAddToChat"), color: bubbleVariableColor(variableColor: theme.message.outgoing.actionButtonsTextColor, wallpaper: wallpaper))!
self.chatBubbleActionButtonOutgoingWebAppIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotWebApp"), color: bubbleVariableColor(variableColor: theme.message.outgoing.actionButtonsTextColor, wallpaper: wallpaper))!
self.chatBubbleActionButtonOutgoingCopyIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotCopy"), color: bubbleVariableColor(variableColor: theme.message.outgoing.actionButtonsTextColor, wallpaper: wallpaper))!
self.chatEmptyItemLockIcon = generateImage(CGSize(width: 9.0, height: 13.0), rotatedContext: { size, context in
context.clear(CGRect(origin: CGPoint(), size: size))

View File

@ -438,6 +438,8 @@ public final class ChatButtonKeyboardInputNode: ChatInputNode {
if let message = self.message {
self.controllerInteraction.openRequestedPeerSelection(message.id, peerType, buttonId, maxQuantity)
}
case let .copyText(payload):
self.controllerInteraction.copyText(payload)
}
if dismissIfOnce {
if let message = self.message {

View File

@ -215,6 +215,8 @@ private final class ChatMessageActionButtonNode: ASDisplayNode {
iconImage = incoming ? graphics.chatBubbleActionButtonIncomingProfileIconImage : graphics.chatBubbleActionButtonOutgoingProfileIconImage
case .openWebView:
iconImage = incoming ? graphics.chatBubbleActionButtonIncomingWebAppIconImage : graphics.chatBubbleActionButtonOutgoingWebAppIconImage
case .copyText:
iconImage = incoming ? graphics.chatBubbleActionButtonIncomingCopyIconImage : graphics.chatBubbleActionButtonOutgoingCopyIconImage
default:
iconImage = nil
}

View File

@ -205,6 +205,7 @@ private func contentNodeMessagesAndClassesForItem(_ item: ChatMessageItem) -> ([
result.append((message, ChatMessageGiftBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .text, neighborSpacing: .default)))
} else if case .giftStars = action.action {
result.append((message, ChatMessageGiftBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .text, neighborSpacing: .default)))
skipText = true
} else if case .suggestedProfilePhoto = action.action {
result.append((message, ChatMessageProfilePhotoSuggestionContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .text, neighborSpacing: .default)))
} else if case .setChatWallpaper = action.action {

View File

@ -863,6 +863,8 @@ open class ChatMessageItemView: ListViewItemNode, ChatMessageItemNodeProtocol {
item.controllerInteraction.openWebView(button.title, url, simple, .generic)
case .requestPeer:
break
case let .copyText(payload):
item.controllerInteraction.copyText(payload)
}
}
}

View File

@ -2589,7 +2589,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}
if let message, let adAttribute = message.attributes.first(where: { $0 is AdMessageAttribute }) as? AdMessageAttribute {
strongSelf.chatDisplayNode.historyNode.adMessagesContext?.markAction(opaqueId: adAttribute.opaqueId)
strongSelf.chatDisplayNode.historyNode.adMessagesContext?.markAction(opaqueId: adAttribute.opaqueId, media: false, fullscreen: false)
}
if let performOpenURL = strongSelf.performOpenURL {
@ -3917,7 +3917,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}
}
self.chatDisplayNode.historyNode.adMessagesContext?.markAction(opaqueId: adAttribute.opaqueId)
self.chatDisplayNode.historyNode.adMessagesContext?.markAction(opaqueId: adAttribute.opaqueId, media: false, fullscreen: false)
self.controllerInteraction?.openUrl(ChatControllerInteraction.OpenUrl(url: adAttribute.url, concealed: false, external: true, progress: progress))
}, openRequestedPeerSelection: { [weak self] messageId, peerType, buttonId, maxQuantity in
guard let self else {

View File

@ -971,6 +971,8 @@ final class ChatPinnedMessageTitlePanelNode: ChatTitleAccessoryPanelNode {
controllerInteraction.openWebView(button.title, url, simple, .generic)
case .requestPeer:
break
case let .copyText(payload):
controllerInteraction.copyText(payload)
}
break