mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-15 21:45:19 +00:00
Merge commit 'd92249deba7c728dcb01f3b8f905f6d607c03b7b'
This commit is contained in:
commit
ba352f9b6e
@ -89,9 +89,8 @@ extension ReplyMarkupButton {
|
||||
))
|
||||
}
|
||||
self.init(title: text, titleWhenForwarded: nil, action: .requestPeer(peerType: mappedPeerType, buttonId: buttonId, maxQuantity: maxQuantity))
|
||||
case let .keyboardButtonCopy(text, _):
|
||||
//TODO:release
|
||||
self.init(title: text, titleWhenForwarded: nil, action: .text)
|
||||
case let .keyboardButtonCopy(text, payload):
|
||||
self.init(title: text, titleWhenForwarded: nil, action: .copyText(payload: payload))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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(flags: 0, 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)
|
||||
}
|
||||
|
@ -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> {
|
||||
|
@ -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))
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
12
submodules/TelegramUI/Images.xcassets/Chat/Message/BotCopy.imageset/Contents.json
vendored
Normal file
12
submodules/TelegramUI/Images.xcassets/Chat/Message/BotCopy.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "copy_10.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
65
submodules/TelegramUI/Images.xcassets/Chat/Message/BotCopy.imageset/copy_10.pdf
vendored
Normal file
65
submodules/TelegramUI/Images.xcassets/Chat/Message/BotCopy.imageset/copy_10.pdf
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
%PDF-1.7
|
||||
|
||||
1 0 obj
|
||||
<< >>
|
||||
endobj
|
||||
|
||||
2 0 obj
|
||||
<< /Filter /FlateDecode
|
||||
/Length 3 0 R
|
||||
>>
|
||||
stream
|
||||
x<01>–ÍŽ$5„ïõ{F¢Öÿi_‰3ð]<5D>4³Z‰ççÛåòL<C3B2>uiw”3<E2809D>?‘áúüË—þz|ùýן>ýüÇñùþ÷ø~ü}øÓõç“»?®Õz·ëÕãõ¶|^||;™XògÙ¼é,,X.ìåÈgb£µËg-Îûz#åôÕµZ@|‰©qþQÎTb²‹ÎbßUZ0î̱˜y<CB9C>KöBªoÎ'ììrêO[áÓ†äÜZð7²’ØìâY,eoľ°¤¸J«·e²†Z‰¡¥dIH‰5Å@\-[*`5‚eWõ©ÅJò.Z Ä\Uå¾dSåÌÕçf`É×ä"»8¦¤’›<E28099>Yv®K¤E¹b—Ʋ)<½ôÄ>±ra¹cÝIënà<È®£ÓŽ]ÊÿÚ®4â•ÈH•²<E280A2>ôí*Èãˆ:FEªWÙâUÈ…„«ÜyÜÜZØtœÍ[ØjðB
ˆjãq,²ØMŸI(ªpQŒ¨D;»ˆ(;<òPðgº>Sz³[I¼ÜØJbCf+†•„|ÍHWÛb½šÛ—ƒµZN9ƒ‡cÞ¼Â[Èãøóøz|;~û¿²¯E¸ÿ-L Kþ,w¯w»¶µ{aÏI}”úGZ‹õjn_d‡GžŽye¼Ù-
|
||||
líÎ'Ôv¾lÅCü̲ÏÃYeT™ãÖ|ÒXɤ`GrjD³!ýìx#²Óy¦’¤¹é_˜Ç²†öé3[„0³Q¾ü˜ì¦ÉfÄ鮦_QiúY„¡ŠA<1A>Xô™•’È—”¤»ºÚt5Cmº'iRQ6Ò¤è±C[X"O±¿¤Ò)°ŒÝ/Q®ê)0ÇÄAtt<74>
|
||||
ñ“/ˆôÀLB¦Ê $‘G+-$]$ÕA”|ŽØŽazø?ÊX<C38A>°…P4Âu¶ÛÁ1
|
||||
JEuß<EFBFBD>L³tYŠQ½½=Z^&£D‚;Ä"3»tÎλçáÑÌÒ¼ÖÐ6¡Í{jóÊMÂ[G8ÓZ© ÑpH"q™+µß$z´'–Ø‚*1±-Ë—‰qkøÓ²QáKqÔ'û:bp‰¶Z&"4oÞ<07>jÌ™¢…B)–è<>·Jîì2Šâ~
|
||||
µ€@ÙN<-6×o¸|ÂåR%p)éžÊ§÷ ¡Uî’e‘kNPCU5n›ìÁJJº?_¸•
|
||||
wC’˜á`NÇx]tÏÊ€(„É
þÇÔP˜Ã–OŽ/F<>T¨ké!š
|
||||
°Ñ®sáUŸ^RC®ý"N)Ñ3³Ü/œL˜<ÊD½ø¤ðæš<18>öPLŽá§¼8Ð\'î#‰…ëm<C3AB>Úqľ)¾ôˆ™K9Þ`j=<™˜òžØÚ70‘Æ”7H£þƒXŒÊ8µÓ[ô£G}Oá~TÞ;cÉ®’vi »<C2A0>)0ˆ CŽAîÛwŠövGOõÞîñ©ÞÛmOu†z¯o*8Ô{!ô‚QT¯ý+D½&.ÈpcPy@6D"òþ«GRƒÜ—ÄG„”õ1>ú~‚´ˆÂùæ+i{÷-&ù£éTA‚(OI†Kõì²)»Ž<C2BB>ƒ©_L£–RÚþRªÊg‹œˆãÝš>B¡ÇÑÐs„óæ«t<06><><EFBFBD>4@®Äfª´|¤Ïœ<C38F>‚l_Ô$6ʶ!³´¡<>dC6»Õ¨íK|µsCfˉjÐ`C±/²¦èC.BMŠ1ʃv‹ˆ²ëäì4‡®Uv8!t Pu¡´Ð|×]©ñ×ú'Ô¿“ŸT
|
||||
endstream
|
||||
endobj
|
||||
|
||||
3 0 obj
|
||||
1308
|
||||
endobj
|
||||
|
||||
4 0 obj
|
||||
<< /Annots []
|
||||
/Type /Page
|
||||
/MediaBox [ 0.000000 0.000000 10.000000 10.000000 ]
|
||||
/Resources 1 0 R
|
||||
/Contents 2 0 R
|
||||
/Parent 5 0 R
|
||||
>>
|
||||
endobj
|
||||
|
||||
5 0 obj
|
||||
<< /Kids [ 4 0 R ]
|
||||
/Count 1
|
||||
/Type /Pages
|
||||
>>
|
||||
endobj
|
||||
|
||||
6 0 obj
|
||||
<< /Pages 5 0 R
|
||||
/Type /Catalog
|
||||
>>
|
||||
endobj
|
||||
|
||||
xref
|
||||
0 7
|
||||
0000000000 65535 f
|
||||
0000000010 00000 n
|
||||
0000000034 00000 n
|
||||
0000001426 00000 n
|
||||
0000001449 00000 n
|
||||
0000001622 00000 n
|
||||
0000001696 00000 n
|
||||
trailer
|
||||
<< /ID [ (some) (id) ]
|
||||
/Root 6 0 R
|
||||
/Size 7
|
||||
>>
|
||||
startxref
|
||||
1755
|
||||
%%EOF
|
@ -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 {
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user