mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-17 11:50:56 +00:00
no message
This commit is contained in:
parent
86b74992f7
commit
f6c2a515df
@ -1141,10 +1141,10 @@ private func resolveAssociatedMessages(account: Account, state: AccountMutableSt
|
|||||||
if let peer = state.peers[peerId] {
|
if let peer = state.peers[peerId] {
|
||||||
var signal: Signal<Api.messages.Messages, MTRpcError>?
|
var signal: Signal<Api.messages.Messages, MTRpcError>?
|
||||||
if peerId.namespace == Namespaces.Peer.CloudUser || peerId.namespace == Namespaces.Peer.CloudGroup {
|
if peerId.namespace == Namespaces.Peer.CloudUser || peerId.namespace == Namespaces.Peer.CloudGroup {
|
||||||
signal = account.network.request(Api.functions.messages.getMessages(id: messageIds.map({ $0.id })))
|
signal = account.network.request(Api.functions.messages.getMessages(id: messageIds.map({ Api.InputMessage.inputMessageID(id: $0.id) })))
|
||||||
} else if peerId.namespace == Namespaces.Peer.CloudChannel {
|
} else if peerId.namespace == Namespaces.Peer.CloudChannel {
|
||||||
if let inputChannel = apiInputChannel(peer) {
|
if let inputChannel = apiInputChannel(peer) {
|
||||||
signal = account.network.request(Api.functions.channels.getMessages(channel: inputChannel, id: messageIds.map({ $0.id })))
|
signal = account.network.request(Api.functions.channels.getMessages(channel: inputChannel, id: messageIds.map({ Api.InputMessage.inputMessageID(id: $0.id) })))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let signal = signal {
|
if let signal = signal {
|
||||||
|
|||||||
@ -54,7 +54,7 @@ func accountStateReset(postbox: Postbox, network: Network) -> Signal<Void, NoErr
|
|||||||
switch dialog {
|
switch dialog {
|
||||||
case let .dialog(_, peer, _, _, _, _, _, _, _, _):
|
case let .dialog(_, peer, _, _, _, _, _, _, _, _):
|
||||||
itemIds.append(.peer(peer.peerId))
|
itemIds.append(.peer(peer.peerId))
|
||||||
case let .dialogFeed(_, _, _, feedId, _, _, _, _):
|
case let .dialogFeed(_, _, _, feedId, _, _, _, _, _):
|
||||||
itemIds.append(.group(PeerGroupId(rawValue: feedId)))
|
itemIds.append(.group(PeerGroupId(rawValue: feedId)))
|
||||||
continue loop
|
continue loop
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,9 +54,9 @@ private func fetchWebpage(account: Account, messageId: MessageId) -> Signal<Void
|
|||||||
let messages: Signal<Api.messages.Messages, MTRpcError>
|
let messages: Signal<Api.messages.Messages, MTRpcError>
|
||||||
switch inputPeer {
|
switch inputPeer {
|
||||||
case let .inputPeerChannel(channelId, accessHash):
|
case let .inputPeerChannel(channelId, accessHash):
|
||||||
messages = account.network.request(Api.functions.channels.getMessages(channel: Api.InputChannel.inputChannel(channelId: channelId, accessHash: accessHash), id: [messageId.id]))
|
messages = account.network.request(Api.functions.channels.getMessages(channel: Api.InputChannel.inputChannel(channelId: channelId, accessHash: accessHash), id: [Api.InputMessage.inputMessageID(id: messageId.id)]))
|
||||||
default:
|
default:
|
||||||
messages = account.network.request(Api.functions.messages.getMessages(id: [messageId.id]))
|
messages = account.network.request(Api.functions.messages.getMessages(id: [Api.InputMessage.inputMessageID(id: messageId.id)]))
|
||||||
}
|
}
|
||||||
return messages
|
return messages
|
||||||
|> retryRequest
|
|> retryRequest
|
||||||
|
|||||||
@ -126,7 +126,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[129960444] = { return Api.UserStatus.parse_userStatusLastWeek($0) }
|
dict[129960444] = { return Api.UserStatus.parse_userStatusLastWeek($0) }
|
||||||
dict[2011940674] = { return Api.UserStatus.parse_userStatusLastMonth($0) }
|
dict[2011940674] = { return Api.UserStatus.parse_userStatusLastMonth($0) }
|
||||||
dict[-455150117] = { return Api.Dialog.parse_dialog($0) }
|
dict[-455150117] = { return Api.Dialog.parse_dialog($0) }
|
||||||
dict[906521922] = { return Api.Dialog.parse_dialogFeed($0) }
|
dict[-1871228700] = { return Api.Dialog.parse_dialogFeed($0) }
|
||||||
dict[1330637553] = { return Api.FeedBroadcasts.parse_feedBroadcasts($0) }
|
dict[1330637553] = { return Api.FeedBroadcasts.parse_feedBroadcasts($0) }
|
||||||
dict[-1704428358] = { return Api.FeedBroadcasts.parse_feedBroadcastsUngrouped($0) }
|
dict[-1704428358] = { return Api.FeedBroadcasts.parse_feedBroadcastsUngrouped($0) }
|
||||||
dict[381645902] = { return Api.SendMessageAction.parse_sendMessageTypingAction($0) }
|
dict[381645902] = { return Api.SendMessageAction.parse_sendMessageTypingAction($0) }
|
||||||
@ -311,7 +311,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[1694474197] = { return Api.messages.Chats.parse_chats($0) }
|
dict[1694474197] = { return Api.messages.Chats.parse_chats($0) }
|
||||||
dict[-1663561404] = { return Api.messages.Chats.parse_chatsSlice($0) }
|
dict[-1663561404] = { return Api.messages.Chats.parse_chatsSlice($0) }
|
||||||
dict[1348066419] = { return Api.FeedPosition.parse_feedPosition($0) }
|
dict[1348066419] = { return Api.FeedPosition.parse_feedPosition($0) }
|
||||||
dict[834420005] = { return Api.InputSingleMedia.parse_inputSingleMedia($0) }
|
dict[482797855] = { return Api.InputSingleMedia.parse_inputSingleMedia($0) }
|
||||||
dict[218751099] = { return Api.InputPrivacyRule.parse_inputPrivacyValueAllowContacts($0) }
|
dict[218751099] = { return Api.InputPrivacyRule.parse_inputPrivacyValueAllowContacts($0) }
|
||||||
dict[407582158] = { return Api.InputPrivacyRule.parse_inputPrivacyValueAllowAll($0) }
|
dict[407582158] = { return Api.InputPrivacyRule.parse_inputPrivacyValueAllowAll($0) }
|
||||||
dict[320652927] = { return Api.InputPrivacyRule.parse_inputPrivacyValueAllowUsers($0) }
|
dict[320652927] = { return Api.InputPrivacyRule.parse_inputPrivacyValueAllowUsers($0) }
|
||||||
@ -396,6 +396,9 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[-914167110] = { return Api.CdnPublicKey.parse_cdnPublicKey($0) }
|
dict[-914167110] = { return Api.CdnPublicKey.parse_cdnPublicKey($0) }
|
||||||
dict[53231223] = { return Api.InputGame.parse_inputGameID($0) }
|
dict[53231223] = { return Api.InputGame.parse_inputGameID($0) }
|
||||||
dict[-1020139510] = { return Api.InputGame.parse_inputGameShortName($0) }
|
dict[-1020139510] = { return Api.InputGame.parse_inputGameShortName($0) }
|
||||||
|
dict[-1502174430] = { return Api.InputMessage.parse_inputMessageID($0) }
|
||||||
|
dict[-1160215659] = { return Api.InputMessage.parse_inputMessageReplyTo($0) }
|
||||||
|
dict[-2037963464] = { return Api.InputMessage.parse_inputMessagePinned($0) }
|
||||||
dict[-1564789301] = { return Api.PhoneCallProtocol.parse_phoneCallProtocol($0) }
|
dict[-1564789301] = { return Api.PhoneCallProtocol.parse_phoneCallProtocol($0) }
|
||||||
dict[-860866985] = { return Api.WallPaper.parse_wallPaper($0) }
|
dict[-860866985] = { return Api.WallPaper.parse_wallPaper($0) }
|
||||||
dict[1662091044] = { return Api.WallPaper.parse_wallPaperSolid($0) }
|
dict[1662091044] = { return Api.WallPaper.parse_wallPaperSolid($0) }
|
||||||
@ -572,6 +575,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[-2132731265] = { return Api.MessageAction.parse_messageActionPhoneCall($0) }
|
dict[-2132731265] = { return Api.MessageAction.parse_messageActionPhoneCall($0) }
|
||||||
dict[1200788123] = { return Api.MessageAction.parse_messageActionScreenshotTaken($0) }
|
dict[1200788123] = { return Api.MessageAction.parse_messageActionScreenshotTaken($0) }
|
||||||
dict[-85549226] = { return Api.MessageAction.parse_messageActionCustomAction($0) }
|
dict[-85549226] = { return Api.MessageAction.parse_messageActionCustomAction($0) }
|
||||||
|
dict[-1410748418] = { return Api.MessageAction.parse_messageActionBotAllowed($0) }
|
||||||
dict[1399245077] = { return Api.PhoneCall.parse_phoneCallEmpty($0) }
|
dict[1399245077] = { return Api.PhoneCall.parse_phoneCallEmpty($0) }
|
||||||
dict[462375633] = { return Api.PhoneCall.parse_phoneCallWaiting($0) }
|
dict[462375633] = { return Api.PhoneCall.parse_phoneCallWaiting($0) }
|
||||||
dict[-2089411356] = { return Api.PhoneCall.parse_phoneCallRequested($0) }
|
dict[-2089411356] = { return Api.PhoneCall.parse_phoneCallRequested($0) }
|
||||||
@ -614,6 +618,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[1990644519] = { return Api.MessageEntity.parse_messageEntityTextUrl($0) }
|
dict[1990644519] = { return Api.MessageEntity.parse_messageEntityTextUrl($0) }
|
||||||
dict[892193368] = { return Api.MessageEntity.parse_messageEntityMentionName($0) }
|
dict[892193368] = { return Api.MessageEntity.parse_messageEntityMentionName($0) }
|
||||||
dict[546203849] = { return Api.MessageEntity.parse_inputMessageEntityMentionName($0) }
|
dict[546203849] = { return Api.MessageEntity.parse_inputMessageEntityMentionName($0) }
|
||||||
|
dict[-1687559349] = { return Api.MessageEntity.parse_messageEntityPhone($0) }
|
||||||
|
dict[1280209983] = { return Api.MessageEntity.parse_messageEntityCashtag($0) }
|
||||||
dict[483901197] = { return Api.InputPhoto.parse_inputPhotoEmpty($0) }
|
dict[483901197] = { return Api.InputPhoto.parse_inputPhotoEmpty($0) }
|
||||||
dict[-74070332] = { return Api.InputPhoto.parse_inputPhoto($0) }
|
dict[-74070332] = { return Api.InputPhoto.parse_inputPhoto($0) }
|
||||||
dict[-567906571] = { return Api.contacts.TopPeers.parse_topPeersNotModified($0) }
|
dict[-567906571] = { return Api.contacts.TopPeers.parse_topPeersNotModified($0) }
|
||||||
@ -923,6 +929,8 @@ public struct Api {
|
|||||||
_1.serialize(buffer, boxed)
|
_1.serialize(buffer, boxed)
|
||||||
case let _1 as Api.InputGame:
|
case let _1 as Api.InputGame:
|
||||||
_1.serialize(buffer, boxed)
|
_1.serialize(buffer, boxed)
|
||||||
|
case let _1 as Api.InputMessage:
|
||||||
|
_1.serialize(buffer, boxed)
|
||||||
case let _1 as Api.PhoneCallProtocol:
|
case let _1 as Api.PhoneCallProtocol:
|
||||||
_1.serialize(buffer, boxed)
|
_1.serialize(buffer, boxed)
|
||||||
case let _1 as Api.WallPaper:
|
case let _1 as Api.WallPaper:
|
||||||
@ -4824,7 +4832,7 @@ public struct Api {
|
|||||||
|
|
||||||
public enum Dialog {
|
public enum Dialog {
|
||||||
case dialog(flags: Int32, peer: Api.Peer, topMessage: Int32, readInboxMaxId: Int32, readOutboxMaxId: Int32, unreadCount: Int32, unreadMentionsCount: Int32, notifySettings: Api.PeerNotifySettings, pts: Int32?, draft: Api.DraftMessage?)
|
case dialog(flags: Int32, peer: Api.Peer, topMessage: Int32, readInboxMaxId: Int32, readOutboxMaxId: Int32, unreadCount: Int32, unreadMentionsCount: Int32, notifySettings: Api.PeerNotifySettings, pts: Int32?, draft: Api.DraftMessage?)
|
||||||
case dialogFeed(flags: Int32, peer: Api.Peer, topMessage: Int32, feedId: Int32, feedOtherChannels: [Int32], readMaxPosition: Api.FeedPosition?, unreadCount: Int32, unreadMutedCount: Int32)
|
case dialogFeed(flags: Int32, peer: Api.Peer, topMessage: Int32, feedId: Int32, feedOtherChannels: [Int32], readMaxPosition: Api.FeedPosition?, unreadCount: Int32, unreadMutedCount: Int32, sourcesHash: Int32)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
@ -4843,9 +4851,9 @@ public struct Api {
|
|||||||
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(pts!, buffer: buffer, boxed: false)}
|
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(pts!, buffer: buffer, boxed: false)}
|
||||||
if Int(flags) & Int(1 << 1) != 0 {draft!.serialize(buffer, true)}
|
if Int(flags) & Int(1 << 1) != 0 {draft!.serialize(buffer, true)}
|
||||||
break
|
break
|
||||||
case .dialogFeed(let flags, let peer, let topMessage, let feedId, let feedOtherChannels, let readMaxPosition, let unreadCount, let unreadMutedCount):
|
case .dialogFeed(let flags, let peer, let topMessage, let feedId, let feedOtherChannels, let readMaxPosition, let unreadCount, let unreadMutedCount, let sourcesHash):
|
||||||
if boxed {
|
if boxed {
|
||||||
buffer.appendInt32(906521922)
|
buffer.appendInt32(-1871228700)
|
||||||
}
|
}
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
peer.serialize(buffer, true)
|
peer.serialize(buffer, true)
|
||||||
@ -4859,6 +4867,7 @@ public struct Api {
|
|||||||
if Int(flags) & Int(1 << 3) != 0 {readMaxPosition!.serialize(buffer, true)}
|
if Int(flags) & Int(1 << 3) != 0 {readMaxPosition!.serialize(buffer, true)}
|
||||||
serializeInt32(unreadCount, buffer: buffer, boxed: false)
|
serializeInt32(unreadCount, buffer: buffer, boxed: false)
|
||||||
serializeInt32(unreadMutedCount, buffer: buffer, boxed: false)
|
serializeInt32(unreadMutedCount, buffer: buffer, boxed: false)
|
||||||
|
serializeInt32(sourcesHash, buffer: buffer, boxed: false)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4930,6 +4939,8 @@ public struct Api {
|
|||||||
_7 = reader.readInt32()
|
_7 = reader.readInt32()
|
||||||
var _8: Int32?
|
var _8: Int32?
|
||||||
_8 = reader.readInt32()
|
_8 = reader.readInt32()
|
||||||
|
var _9: Int32?
|
||||||
|
_9 = reader.readInt32()
|
||||||
let _c1 = _1 != nil
|
let _c1 = _1 != nil
|
||||||
let _c2 = _2 != nil
|
let _c2 = _2 != nil
|
||||||
let _c3 = _3 != nil
|
let _c3 = _3 != nil
|
||||||
@ -4938,8 +4949,9 @@ public struct Api {
|
|||||||
let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil
|
let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil
|
||||||
let _c7 = _7 != nil
|
let _c7 = _7 != nil
|
||||||
let _c8 = _8 != nil
|
let _c8 = _8 != nil
|
||||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
|
let _c9 = _9 != nil
|
||||||
return Api.Dialog.dialogFeed(flags: _1!, peer: _2!, topMessage: _3!, feedId: _4!, feedOtherChannels: _5!, readMaxPosition: _6, unreadCount: _7!, unreadMutedCount: _8!)
|
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
|
||||||
|
return Api.Dialog.dialogFeed(flags: _1!, peer: _2!, topMessage: _3!, feedId: _4!, feedOtherChannels: _5!, readMaxPosition: _6, unreadCount: _7!, unreadMutedCount: _8!, sourcesHash: _9!)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return nil
|
return nil
|
||||||
@ -9253,16 +9265,16 @@ public struct Api {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public enum InputSingleMedia {
|
public enum InputSingleMedia {
|
||||||
case inputSingleMedia(media: Api.InputMedia, flags: Int32, randomId: Int64, message: String, entities: [Api.MessageEntity]?)
|
case inputSingleMedia(flags: Int32, media: Api.InputMedia, randomId: Int64, message: String, entities: [Api.MessageEntity]?)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .inputSingleMedia(let media, let flags, let randomId, let message, let entities):
|
case .inputSingleMedia(let flags, let media, let randomId, let message, let entities):
|
||||||
if boxed {
|
if boxed {
|
||||||
buffer.appendInt32(834420005)
|
buffer.appendInt32(482797855)
|
||||||
}
|
}
|
||||||
media.serialize(buffer, true)
|
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
|
media.serialize(buffer, true)
|
||||||
serializeInt64(randomId, buffer: buffer, boxed: false)
|
serializeInt64(randomId, buffer: buffer, boxed: false)
|
||||||
serializeString(message, buffer: buffer, boxed: false)
|
serializeString(message, buffer: buffer, boxed: false)
|
||||||
if Int(flags) & Int(1 << 0) != 0 {buffer.appendInt32(481674261)
|
if Int(flags) & Int(1 << 0) != 0 {buffer.appendInt32(481674261)
|
||||||
@ -9275,27 +9287,27 @@ public struct Api {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fileprivate static func parse_inputSingleMedia(_ reader: BufferReader) -> InputSingleMedia? {
|
fileprivate static func parse_inputSingleMedia(_ reader: BufferReader) -> InputSingleMedia? {
|
||||||
var _1: Api.InputMedia?
|
var _1: Int32?
|
||||||
|
_1 = reader.readInt32()
|
||||||
|
var _2: Api.InputMedia?
|
||||||
if let signature = reader.readInt32() {
|
if let signature = reader.readInt32() {
|
||||||
_1 = Api.parse(reader, signature: signature) as? Api.InputMedia
|
_2 = Api.parse(reader, signature: signature) as? Api.InputMedia
|
||||||
}
|
}
|
||||||
var _2: Int32?
|
|
||||||
_2 = reader.readInt32()
|
|
||||||
var _3: Int64?
|
var _3: Int64?
|
||||||
_3 = reader.readInt64()
|
_3 = reader.readInt64()
|
||||||
var _4: String?
|
var _4: String?
|
||||||
_4 = parseString(reader)
|
_4 = parseString(reader)
|
||||||
var _5: [Api.MessageEntity]?
|
var _5: [Api.MessageEntity]?
|
||||||
if Int(_2!) & Int(1 << 0) != 0 {if let _ = reader.readInt32() {
|
if Int(_1!) & Int(1 << 0) != 0 {if let _ = reader.readInt32() {
|
||||||
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self)
|
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self)
|
||||||
} }
|
} }
|
||||||
let _c1 = _1 != nil
|
let _c1 = _1 != nil
|
||||||
let _c2 = _2 != nil
|
let _c2 = _2 != nil
|
||||||
let _c3 = _3 != nil
|
let _c3 = _3 != nil
|
||||||
let _c4 = _4 != nil
|
let _c4 = _4 != nil
|
||||||
let _c5 = (Int(_2!) & Int(1 << 0) == 0) || _5 != nil
|
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
|
||||||
if _c1 && _c2 && _c3 && _c4 && _c5 {
|
if _c1 && _c2 && _c3 && _c4 && _c5 {
|
||||||
return Api.InputSingleMedia.inputSingleMedia(media: _1!, flags: _2!, randomId: _3!, message: _4!, entities: _5)
|
return Api.InputSingleMedia.inputSingleMedia(flags: _1!, media: _2!, randomId: _3!, message: _4!, entities: _5)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return nil
|
return nil
|
||||||
@ -10992,6 +11004,62 @@ public struct Api {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum InputMessage {
|
||||||
|
case inputMessageID(id: Int32)
|
||||||
|
case inputMessageReplyTo(id: Int32)
|
||||||
|
case inputMessagePinned
|
||||||
|
|
||||||
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
|
switch self {
|
||||||
|
case .inputMessageID(let id):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-1502174430)
|
||||||
|
}
|
||||||
|
serializeInt32(id, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
case .inputMessageReplyTo(let id):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-1160215659)
|
||||||
|
}
|
||||||
|
serializeInt32(id, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
case .inputMessagePinned:
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-2037963464)
|
||||||
|
}
|
||||||
|
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fileprivate static func parse_inputMessageID(_ reader: BufferReader) -> InputMessage? {
|
||||||
|
var _1: Int32?
|
||||||
|
_1 = reader.readInt32()
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
if _c1 {
|
||||||
|
return Api.InputMessage.inputMessageID(id: _1!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fileprivate static func parse_inputMessageReplyTo(_ reader: BufferReader) -> InputMessage? {
|
||||||
|
var _1: Int32?
|
||||||
|
_1 = reader.readInt32()
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
if _c1 {
|
||||||
|
return Api.InputMessage.inputMessageReplyTo(id: _1!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fileprivate static func parse_inputMessagePinned(_ reader: BufferReader) -> InputMessage? {
|
||||||
|
return Api.InputMessage.inputMessagePinned
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public enum PhoneCallProtocol {
|
public enum PhoneCallProtocol {
|
||||||
case phoneCallProtocol(flags: Int32, minLayer: Int32, maxLayer: Int32)
|
case phoneCallProtocol(flags: Int32, minLayer: Int32, maxLayer: Int32)
|
||||||
|
|
||||||
@ -14482,6 +14550,7 @@ public struct Api {
|
|||||||
case messageActionPhoneCall(flags: Int32, callId: Int64, reason: Api.PhoneCallDiscardReason?, duration: Int32?)
|
case messageActionPhoneCall(flags: Int32, callId: Int64, reason: Api.PhoneCallDiscardReason?, duration: Int32?)
|
||||||
case messageActionScreenshotTaken
|
case messageActionScreenshotTaken
|
||||||
case messageActionCustomAction(message: String)
|
case messageActionCustomAction(message: String)
|
||||||
|
case messageActionBotAllowed(domain: String)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
@ -14620,6 +14689,12 @@ public struct Api {
|
|||||||
}
|
}
|
||||||
serializeString(message, buffer: buffer, boxed: false)
|
serializeString(message, buffer: buffer, boxed: false)
|
||||||
break
|
break
|
||||||
|
case .messageActionBotAllowed(let domain):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-1410748418)
|
||||||
|
}
|
||||||
|
serializeString(domain, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -14843,6 +14918,17 @@ public struct Api {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fileprivate static func parse_messageActionBotAllowed(_ reader: BufferReader) -> MessageAction? {
|
||||||
|
var _1: String?
|
||||||
|
_1 = parseString(reader)
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
if _c1 {
|
||||||
|
return Api.MessageAction.messageActionBotAllowed(domain: _1!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -15544,6 +15630,8 @@ public struct Api {
|
|||||||
case messageEntityTextUrl(offset: Int32, length: Int32, url: String)
|
case messageEntityTextUrl(offset: Int32, length: Int32, url: String)
|
||||||
case messageEntityMentionName(offset: Int32, length: Int32, userId: Int32)
|
case messageEntityMentionName(offset: Int32, length: Int32, userId: Int32)
|
||||||
case inputMessageEntityMentionName(offset: Int32, length: Int32, userId: Api.InputUser)
|
case inputMessageEntityMentionName(offset: Int32, length: Int32, userId: Api.InputUser)
|
||||||
|
case messageEntityPhone(offset: Int32, length: Int32)
|
||||||
|
case messageEntityCashtag(offset: Int32, length: Int32)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
@ -15642,6 +15730,20 @@ public struct Api {
|
|||||||
serializeInt32(length, buffer: buffer, boxed: false)
|
serializeInt32(length, buffer: buffer, boxed: false)
|
||||||
userId.serialize(buffer, true)
|
userId.serialize(buffer, true)
|
||||||
break
|
break
|
||||||
|
case .messageEntityPhone(let offset, let length):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-1687559349)
|
||||||
|
}
|
||||||
|
serializeInt32(offset, buffer: buffer, boxed: false)
|
||||||
|
serializeInt32(length, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
case .messageEntityCashtag(let offset, let length):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(1280209983)
|
||||||
|
}
|
||||||
|
serializeInt32(offset, buffer: buffer, boxed: false)
|
||||||
|
serializeInt32(length, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -15841,6 +15943,34 @@ public struct Api {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fileprivate static func parse_messageEntityPhone(_ reader: BufferReader) -> MessageEntity? {
|
||||||
|
var _1: Int32?
|
||||||
|
_1 = reader.readInt32()
|
||||||
|
var _2: Int32?
|
||||||
|
_2 = reader.readInt32()
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
if _c1 && _c2 {
|
||||||
|
return Api.MessageEntity.messageEntityPhone(offset: _1!, length: _2!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fileprivate static func parse_messageEntityCashtag(_ reader: BufferReader) -> MessageEntity? {
|
||||||
|
var _1: Int32?
|
||||||
|
_1 = reader.readInt32()
|
||||||
|
var _2: Int32?
|
||||||
|
_2 = reader.readInt32()
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
if _c1 && _c2 {
|
||||||
|
return Api.MessageEntity.messageEntityCashtag(offset: _1!, length: _2!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18820,24 +18950,6 @@ public struct Api {
|
|||||||
|
|
||||||
public struct functions {
|
public struct functions {
|
||||||
public struct messages {
|
public struct messages {
|
||||||
public static func getMessages(id: [Int32]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Messages?) {
|
|
||||||
let buffer = Buffer()
|
|
||||||
buffer.appendInt32(1109588596)
|
|
||||||
buffer.appendInt32(481674261)
|
|
||||||
buffer.appendInt32(Int32(id.count))
|
|
||||||
for item in id {
|
|
||||||
serializeInt32(item, buffer: buffer, boxed: false)
|
|
||||||
}
|
|
||||||
return (FunctionDescription({return "(messages.getMessages id: \(id))"}), buffer, { (buffer: Buffer) -> Api.messages.Messages? in
|
|
||||||
let reader = BufferReader(buffer)
|
|
||||||
var result: Api.messages.Messages?
|
|
||||||
if let signature = reader.readInt32() {
|
|
||||||
result = Api.parse(reader, signature: signature) as? Api.messages.Messages
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
public static func getHistory(peer: Api.InputPeer, offsetId: Int32, offsetDate: Int32, addOffset: Int32, limit: Int32, maxId: Int32, minId: Int32, hash: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Messages?) {
|
public static func getHistory(peer: Api.InputPeer, offsetId: Int32, offsetDate: Int32, addOffset: Int32, limit: Int32, maxId: Int32, minId: Int32, hash: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Messages?) {
|
||||||
let buffer = Buffer()
|
let buffer = Buffer()
|
||||||
buffer.appendInt32(-591691168)
|
buffer.appendInt32(-591691168)
|
||||||
@ -20293,6 +20405,24 @@ public struct Api {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static func getMessages(id: [Api.InputMessage]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Messages?) {
|
||||||
|
let buffer = Buffer()
|
||||||
|
buffer.appendInt32(1673946374)
|
||||||
|
buffer.appendInt32(481674261)
|
||||||
|
buffer.appendInt32(Int32(id.count))
|
||||||
|
for item in id {
|
||||||
|
item.serialize(buffer, true)
|
||||||
|
}
|
||||||
|
return (FunctionDescription({return "(messages.getMessages id: \(id))"}), buffer, { (buffer: Buffer) -> Api.messages.Messages? in
|
||||||
|
let reader = BufferReader(buffer)
|
||||||
|
var result: Api.messages.Messages?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
result = Api.parse(reader, signature: signature) as? Api.messages.Messages
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
public static func getDialogs(flags: Int32, feedId: Int32?, offsetDate: Int32, offsetId: Int32, offsetPeer: Api.InputPeer, limit: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Dialogs?) {
|
public static func getDialogs(flags: Int32, feedId: Int32?, offsetDate: Int32, offsetId: Int32, offsetPeer: Api.InputPeer, limit: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Dialogs?) {
|
||||||
let buffer = Buffer()
|
let buffer = Buffer()
|
||||||
buffer.appendInt32(96533218)
|
buffer.appendInt32(96533218)
|
||||||
@ -20492,25 +20622,6 @@ public struct Api {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func getMessages(channel: Api.InputChannel, id: [Int32]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Messages?) {
|
|
||||||
let buffer = Buffer()
|
|
||||||
buffer.appendInt32(-1814580409)
|
|
||||||
channel.serialize(buffer, true)
|
|
||||||
buffer.appendInt32(481674261)
|
|
||||||
buffer.appendInt32(Int32(id.count))
|
|
||||||
for item in id {
|
|
||||||
serializeInt32(item, buffer: buffer, boxed: false)
|
|
||||||
}
|
|
||||||
return (FunctionDescription({return "(channels.getMessages channel: \(channel), id: \(id))"}), buffer, { (buffer: Buffer) -> Api.messages.Messages? in
|
|
||||||
let reader = BufferReader(buffer)
|
|
||||||
var result: Api.messages.Messages?
|
|
||||||
if let signature = reader.readInt32() {
|
|
||||||
result = Api.parse(reader, signature: signature) as? Api.messages.Messages
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
public static func getParticipant(channel: Api.InputChannel, userId: Api.InputUser) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.channels.ChannelParticipant?) {
|
public static func getParticipant(channel: Api.InputChannel, userId: Api.InputUser) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.channels.ChannelParticipant?) {
|
||||||
let buffer = Buffer()
|
let buffer = Buffer()
|
||||||
buffer.appendInt32(1416484774)
|
buffer.appendInt32(1416484774)
|
||||||
@ -20955,6 +21066,25 @@ public struct Api {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static func getMessages(channel: Api.InputChannel, id: [Api.InputMessage]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Messages?) {
|
||||||
|
let buffer = Buffer()
|
||||||
|
buffer.appendInt32(-1383294429)
|
||||||
|
channel.serialize(buffer, true)
|
||||||
|
buffer.appendInt32(481674261)
|
||||||
|
buffer.appendInt32(Int32(id.count))
|
||||||
|
for item in id {
|
||||||
|
item.serialize(buffer, true)
|
||||||
|
}
|
||||||
|
return (FunctionDescription({return "(channels.getMessages channel: \(channel), id: \(id))"}), buffer, { (buffer: Buffer) -> Api.messages.Messages? in
|
||||||
|
let reader = BufferReader(buffer)
|
||||||
|
var result: Api.messages.Messages?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
result = Api.parse(reader, signature: signature) as? Api.messages.Messages
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
public static func getFeed(flags: Int32, feedId: Int32, offsetPosition: Api.FeedPosition?, addOffset: Int32, limit: Int32, maxPosition: Api.FeedPosition?, minPosition: Api.FeedPosition?, sourcesHash: Int32, hash: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.FeedMessages?) {
|
public static func getFeed(flags: Int32, feedId: Int32, offsetPosition: Api.FeedPosition?, addOffset: Int32, limit: Int32, maxPosition: Api.FeedPosition?, minPosition: Api.FeedPosition?, sourcesHash: Int32, hash: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.FeedMessages?) {
|
||||||
let buffer = Buffer()
|
let buffer = Buffer()
|
||||||
buffer.appendInt32(403799538)
|
buffer.appendInt32(403799538)
|
||||||
|
|||||||
@ -106,7 +106,7 @@ private func parseDialogs(apiDialogs: [Api.Dialog], apiMessages: [Api.Message],
|
|||||||
}
|
}
|
||||||
|
|
||||||
notificationSettings[peerId] = TelegramPeerNotificationSettings(apiSettings: apiNotificationSettings)
|
notificationSettings[peerId] = TelegramPeerNotificationSettings(apiSettings: apiNotificationSettings)
|
||||||
case let .dialogFeed(_, _, _, feedId, _, _, _, _):
|
case let .dialogFeed(_, _, _, feedId, _, _, _, _, _):
|
||||||
itemIds.append(.group(PeerGroupId(rawValue: feedId)))
|
itemIds.append(.group(PeerGroupId(rawValue: feedId)))
|
||||||
referencedFeeds.insert(PeerGroupId(rawValue: feedId))
|
referencedFeeds.insert(PeerGroupId(rawValue: feedId))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,10 +51,10 @@ public func getMessagesLoadIfNecessary(_ messageIds:[MessageId], postbox:Postbox
|
|||||||
if let peer = supportPeers[peerId] {
|
if let peer = supportPeers[peerId] {
|
||||||
var signal: Signal<Api.messages.Messages, MTRpcError>?
|
var signal: Signal<Api.messages.Messages, MTRpcError>?
|
||||||
if peerId.namespace == Namespaces.Peer.CloudUser || peerId.namespace == Namespaces.Peer.CloudGroup {
|
if peerId.namespace == Namespaces.Peer.CloudUser || peerId.namespace == Namespaces.Peer.CloudGroup {
|
||||||
signal = network.request(Api.functions.messages.getMessages(id: messageIds.map({ $0.id })))
|
signal = network.request(Api.functions.messages.getMessages(id: messageIds.map({ Api.InputMessage.inputMessageID(id: $0.id) })))
|
||||||
} else if peerId.namespace == Namespaces.Peer.CloudChannel {
|
} else if peerId.namespace == Namespaces.Peer.CloudChannel {
|
||||||
if let inputChannel = apiInputChannel(peer) {
|
if let inputChannel = apiInputChannel(peer) {
|
||||||
signal = network.request(Api.functions.channels.getMessages(channel: inputChannel, id: messageIds.map({ $0.id })))
|
signal = network.request(Api.functions.channels.getMessages(channel: inputChannel, id: messageIds.map({ Api.InputMessage.inputMessageID(id: $0.id) })))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let signal = signal {
|
if let signal = signal {
|
||||||
|
|||||||
@ -16,13 +16,13 @@ public func loadedPeerFromMessage(account: Account, peerId: PeerId, messageId: M
|
|||||||
} else {
|
} else {
|
||||||
let messageSignal: Signal<Api.messages.Messages?, NoError>?
|
let messageSignal: Signal<Api.messages.Messages?, NoError>?
|
||||||
if messageId.peerId.namespace == Namespaces.Peer.CloudUser || messageId.peerId.namespace == Namespaces.Peer.CloudGroup {
|
if messageId.peerId.namespace == Namespaces.Peer.CloudUser || messageId.peerId.namespace == Namespaces.Peer.CloudGroup {
|
||||||
messageSignal = account.network.request(Api.functions.messages.getMessages(id: [messageId.id]))
|
messageSignal = account.network.request(Api.functions.messages.getMessages(id: [Api.InputMessage.inputMessageID(id: messageId.id)]))
|
||||||
|> map { Optional($0) }
|
|> map { Optional($0) }
|
||||||
|> `catch` { _ -> Signal<Api.messages.Messages?, NoError> in
|
|> `catch` { _ -> Signal<Api.messages.Messages?, NoError> in
|
||||||
return .single(nil)
|
return .single(nil)
|
||||||
}
|
}
|
||||||
} else if messageId.peerId.namespace == Namespaces.Peer.CloudChannel, let channelPeer = modifier.getPeer(messageId.peerId), let inputChannel = apiInputChannel(channelPeer) {
|
} else if messageId.peerId.namespace == Namespaces.Peer.CloudChannel, let channelPeer = modifier.getPeer(messageId.peerId), let inputChannel = apiInputChannel(channelPeer) {
|
||||||
messageSignal = account.network.request(Api.functions.channels.getMessages(channel: inputChannel, id: [messageId.id]))
|
messageSignal = account.network.request(Api.functions.channels.getMessages(channel: inputChannel, id: [Api.InputMessage.inputMessageID(id: messageId.id)]))
|
||||||
|> map { Optional($0) }
|
|> map { Optional($0) }
|
||||||
|> `catch` { _ -> Signal<Api.messages.Messages?, NoError> in
|
|> `catch` { _ -> Signal<Api.messages.Messages?, NoError> in
|
||||||
return .single(nil)
|
return .single(nil)
|
||||||
|
|||||||
@ -100,7 +100,7 @@ private func fetchReadStateNext(network: Network, groupId: PeerGroupId) -> Signa
|
|||||||
switch result {
|
switch result {
|
||||||
case let .peerDialogs(dialogs, messages, _, _, _):
|
case let .peerDialogs(dialogs, messages, _, _, _):
|
||||||
for dialog in dialogs {
|
for dialog in dialogs {
|
||||||
if case let .dialogFeed(_, _, topMessage, feedId, _, resultMaxReadPosition, _, _) = dialog {
|
if case let .dialogFeed(_, _, topMessage, feedId, _, resultMaxReadPosition, _, _, _) = dialog {
|
||||||
assert(feedId == groupId.rawValue)
|
assert(feedId == groupId.rawValue)
|
||||||
if let resultMaxReadPosition = resultMaxReadPosition {
|
if let resultMaxReadPosition = resultMaxReadPosition {
|
||||||
switch resultMaxReadPosition {
|
switch resultMaxReadPosition {
|
||||||
|
|||||||
@ -185,7 +185,7 @@ private func synchronizePinnedChats(modifier: Modifier, postbox: Postbox, networ
|
|||||||
apiUnreadCount = unreadCount
|
apiUnreadCount = unreadCount
|
||||||
apiNotificationSettings = peerNotificationSettings
|
apiNotificationSettings = peerNotificationSettings
|
||||||
apiChannelPts = pts
|
apiChannelPts = pts
|
||||||
case let .dialogFeed(_, _, _, feedId, _, _, _, _):
|
case let .dialogFeed(_, _, _, feedId, _, _, _, _, _):
|
||||||
remoteItemIds.append(.group(PeerGroupId(rawValue: feedId)))
|
remoteItemIds.append(.group(PeerGroupId(rawValue: feedId)))
|
||||||
continue loop
|
continue loop
|
||||||
}
|
}
|
||||||
|
|||||||
@ -453,8 +453,8 @@ private final class MultipartFetchManager {
|
|||||||
|
|
||||||
self.rangesDisposable = (ranges |> deliverOn(self.queue)).start(next: { [weak self] ranges in
|
self.rangesDisposable = (ranges |> deliverOn(self.queue)).start(next: { [weak self] ranges in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
if let currentRanges = strongSelf.currentRanges {
|
if let _ = strongSelf.currentRanges {
|
||||||
let updatedRanges = currentRanges.subtracting(strongSelf.currentFilledRanges)
|
let updatedRanges = ranges.subtracting(strongSelf.currentFilledRanges)
|
||||||
strongSelf.currentRanges = updatedRanges
|
strongSelf.currentRanges = updatedRanges
|
||||||
strongSelf.checkState()
|
strongSelf.checkState()
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -564,7 +564,7 @@ public final class PendingMessageManager {
|
|||||||
singleFlags |= 1 << 0
|
singleFlags |= 1 << 0
|
||||||
}
|
}
|
||||||
|
|
||||||
singleMedias.append(.inputSingleMedia(media: inputMedia, flags: singleFlags, randomId: uniqueId, message: text, entities: messageEntities))
|
singleMedias.append(.inputSingleMedia(flags: singleFlags, media: inputMedia, randomId: uniqueId, message: text, entities: messageEntities))
|
||||||
default:
|
default:
|
||||||
return .complete()
|
return .complete()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -174,12 +174,12 @@ public func downloadMessage(account: Account, messageId: MessageId) -> Signal<Me
|
|||||||
let signal: Signal<Api.messages.Messages, MTRpcError>
|
let signal: Signal<Api.messages.Messages, MTRpcError>
|
||||||
if messageId.peerId.namespace == Namespaces.Peer.CloudChannel {
|
if messageId.peerId.namespace == Namespaces.Peer.CloudChannel {
|
||||||
if let channel = apiInputChannel(peer) {
|
if let channel = apiInputChannel(peer) {
|
||||||
signal = account.network.request(Api.functions.channels.getMessages(channel: channel, id: [messageId.id]))
|
signal = account.network.request(Api.functions.channels.getMessages(channel: channel, id: [Api.InputMessage.inputMessageID(id: messageId.id)]))
|
||||||
} else {
|
} else {
|
||||||
signal = .complete()
|
signal = .complete()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
signal = account.network.request(Api.functions.messages.getMessages(id: [messageId.id]))
|
signal = account.network.request(Api.functions.messages.getMessages(id: [Api.InputMessage.inputMessageID(id: messageId.id)]))
|
||||||
}
|
}
|
||||||
|
|
||||||
return signal |> mapError {_ in} |> mapToSignal { result -> Signal<Message?, Void> in
|
return signal |> mapError {_ in} |> mapToSignal { result -> Signal<Message?, Void> in
|
||||||
|
|||||||
@ -35,10 +35,10 @@ private func fetchMessage(modifier: Modifier, account: Account, messageId: Messa
|
|||||||
if let peer = modifier.getPeer(messageId.peerId) {
|
if let peer = modifier.getPeer(messageId.peerId) {
|
||||||
var signal: Signal<Api.messages.Messages, MTRpcError>?
|
var signal: Signal<Api.messages.Messages, MTRpcError>?
|
||||||
if messageId.peerId.namespace == Namespaces.Peer.CloudUser || messageId.peerId.namespace == Namespaces.Peer.CloudGroup {
|
if messageId.peerId.namespace == Namespaces.Peer.CloudUser || messageId.peerId.namespace == Namespaces.Peer.CloudGroup {
|
||||||
signal = account.network.request(Api.functions.messages.getMessages(id: [messageId.id]))
|
signal = account.network.request(Api.functions.messages.getMessages(id: [Api.InputMessage.inputMessageID(id: messageId.id)]))
|
||||||
} else if messageId.peerId.namespace == Namespaces.Peer.CloudChannel {
|
} else if messageId.peerId.namespace == Namespaces.Peer.CloudChannel {
|
||||||
if let inputChannel = apiInputChannel(peer) {
|
if let inputChannel = apiInputChannel(peer) {
|
||||||
signal = account.network.request(Api.functions.channels.getMessages(channel: inputChannel, id: [messageId.id]))
|
signal = account.network.request(Api.functions.channels.getMessages(channel: inputChannel, id: [Api.InputMessage.inputMessageID(id: messageId.id)]))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let signal = signal {
|
if let signal = signal {
|
||||||
|
|||||||
@ -205,7 +205,7 @@ extension Api.Message {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch action {
|
switch action {
|
||||||
case .messageActionChannelCreate, .messageActionChatDeletePhoto, .messageActionChatEditPhoto, .messageActionChatEditTitle, .messageActionEmpty, .messageActionPinMessage, .messageActionHistoryClear, .messageActionGameScore, .messageActionPaymentSent, .messageActionPaymentSentMe, .messageActionPhoneCall, .messageActionScreenshotTaken, .messageActionCustomAction:
|
case .messageActionChannelCreate, .messageActionChatDeletePhoto, .messageActionChatEditPhoto, .messageActionChatEditTitle, .messageActionEmpty, .messageActionPinMessage, .messageActionHistoryClear, .messageActionGameScore, .messageActionPaymentSent, .messageActionPaymentSentMe, .messageActionPhoneCall, .messageActionScreenshotTaken, .messageActionCustomAction, .messageActionBotAllowed:
|
||||||
break
|
break
|
||||||
case let .messageActionChannelMigrateFrom(_, chatId):
|
case let .messageActionChannelMigrateFrom(_, chatId):
|
||||||
result.append(PeerId(namespace: Namespaces.Peer.CloudGroup, id: chatId))
|
result.append(PeerId(namespace: Namespaces.Peer.CloudGroup, id: chatId))
|
||||||
@ -351,6 +351,10 @@ func messageTextEntitiesFromApiEntities(_ entities: [Api.MessageEntity]) -> [Mes
|
|||||||
result.append(MessageTextEntity(range: Int(offset) ..< Int(offset + length), type: .TextUrl(url: url)))
|
result.append(MessageTextEntity(range: Int(offset) ..< Int(offset + length), type: .TextUrl(url: url)))
|
||||||
case let .messageEntityMentionName(offset, length, userId):
|
case let .messageEntityMentionName(offset, length, userId):
|
||||||
result.append(MessageTextEntity(range: Int(offset) ..< Int(offset + length), type: .TextMention(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: userId))))
|
result.append(MessageTextEntity(range: Int(offset) ..< Int(offset + length), type: .TextMention(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: userId))))
|
||||||
|
case let .messageEntityPhone(offset, length):
|
||||||
|
result.append(MessageTextEntity(range: Int(offset) ..< Int(offset + length), type: .PhoneNumber))
|
||||||
|
case let .messageEntityCashtag(offset, length):
|
||||||
|
result.append(MessageTextEntity(range: Int(offset) ..< Int(offset + length), type: .Hashtag))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
|||||||
@ -30,6 +30,7 @@ public enum TelegramMediaActionType: PostboxCoding, Equatable {
|
|||||||
case phoneCall(callId: Int64, discardReason: PhoneCallDiscardReason?, duration: Int32?)
|
case phoneCall(callId: Int64, discardReason: PhoneCallDiscardReason?, duration: Int32?)
|
||||||
case paymentSent(currency: String, totalAmount: Int64)
|
case paymentSent(currency: String, totalAmount: Int64)
|
||||||
case customText(text: String, entities: [MessageTextEntity])
|
case customText(text: String, entities: [MessageTextEntity])
|
||||||
|
case botDomainAccessGranted(domain: String)
|
||||||
|
|
||||||
public init(decoder: PostboxDecoder) {
|
public init(decoder: PostboxDecoder) {
|
||||||
let rawValue: Int32 = decoder.decodeInt32ForKey("_rawValue", orElse: 0)
|
let rawValue: Int32 = decoder.decodeInt32ForKey("_rawValue", orElse: 0)
|
||||||
@ -70,6 +71,8 @@ public enum TelegramMediaActionType: PostboxCoding, Equatable {
|
|||||||
self = .paymentSent(currency: decoder.decodeStringForKey("currency", orElse: ""), totalAmount: decoder.decodeInt64ForKey("ta", orElse: 0))
|
self = .paymentSent(currency: decoder.decodeStringForKey("currency", orElse: ""), totalAmount: decoder.decodeInt64ForKey("ta", orElse: 0))
|
||||||
case 16:
|
case 16:
|
||||||
self = .customText(text: decoder.decodeStringForKey("text", orElse: ""), entities: decoder.decodeObjectArrayWithDecoderForKey("ent"))
|
self = .customText(text: decoder.decodeStringForKey("text", orElse: ""), entities: decoder.decodeObjectArrayWithDecoderForKey("ent"))
|
||||||
|
case 17:
|
||||||
|
self = .botDomainAccessGranted(domain: decoder.decodeStringForKey("do", orElse: ""))
|
||||||
default:
|
default:
|
||||||
self = .unknown
|
self = .unknown
|
||||||
}
|
}
|
||||||
@ -144,6 +147,9 @@ public enum TelegramMediaActionType: PostboxCoding, Equatable {
|
|||||||
encoder.encodeInt32(16, forKey: "_rawValue")
|
encoder.encodeInt32(16, forKey: "_rawValue")
|
||||||
encoder.encodeString(text, forKey: "text")
|
encoder.encodeString(text, forKey: "text")
|
||||||
encoder.encodeObjectArray(entities, forKey: "ent")
|
encoder.encodeObjectArray(entities, forKey: "ent")
|
||||||
|
case let .botDomainAccessGranted(domain):
|
||||||
|
encoder.encodeInt32(17, forKey: "_rawValue")
|
||||||
|
encoder.encodeString(domain, forKey: "do")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,6 +275,12 @@ public func ==(lhs: TelegramMediaActionType, rhs: TelegramMediaActionType) -> Bo
|
|||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
case let .botDomainAccessGranted(domain):
|
||||||
|
if case .botDomainAccessGranted(domain) = rhs {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -345,6 +357,8 @@ func telegramMediaActionFromApiAction(_ action: Api.MessageAction) -> TelegramMe
|
|||||||
return TelegramMediaAction(action: .historyScreenshot)
|
return TelegramMediaAction(action: .historyScreenshot)
|
||||||
case let .messageActionCustomAction(message):
|
case let .messageActionCustomAction(message):
|
||||||
return TelegramMediaAction(action: .customText(text: message, entities: []))
|
return TelegramMediaAction(action: .customText(text: message, entities: []))
|
||||||
|
case let .messageActionBotAllowed(domain):
|
||||||
|
return TelegramMediaAction(action: .botDomainAccessGranted(domain: domain))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user