mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Comment improvements
This commit is contained in:
parent
8e9a0da24d
commit
1b8cd5e9e0
@ -696,7 +696,7 @@ public func channelAdminsController(context: AccountContext, peerId initialPeerI
|
|||||||
if let peer = peerView.peers[participant.peerId] {
|
if let peer = peerView.peers[participant.peerId] {
|
||||||
switch participant {
|
switch participant {
|
||||||
case .creator:
|
case .creator:
|
||||||
result.append(RenderedChannelParticipant(participant: .creator(id: peer.id, rank: nil), peer: peer))
|
result.append(RenderedChannelParticipant(participant: .creator(id: peer.id, adminInfo: nil, rank: nil), peer: peer))
|
||||||
case .admin:
|
case .admin:
|
||||||
var peers: [PeerId: Peer] = [:]
|
var peers: [PeerId: Peer] = [:]
|
||||||
peers[creator.id] = creator
|
peers[creator.id] = creator
|
||||||
|
@ -867,7 +867,7 @@ public final class ChannelMembersSearchContainerNode: SearchDisplayControllerCon
|
|||||||
let renderedParticipant: RenderedChannelParticipant
|
let renderedParticipant: RenderedChannelParticipant
|
||||||
switch participant {
|
switch participant {
|
||||||
case .creator:
|
case .creator:
|
||||||
renderedParticipant = RenderedChannelParticipant(participant: .creator(id: peer.id, rank: nil), peer: peer)
|
renderedParticipant = RenderedChannelParticipant(participant: .creator(id: peer.id, adminInfo: nil, rank: nil), peer: peer)
|
||||||
case .admin:
|
case .admin:
|
||||||
var peers: [PeerId: Peer] = [:]
|
var peers: [PeerId: Peer] = [:]
|
||||||
if let creator = creatorPeer {
|
if let creator = creatorPeer {
|
||||||
|
@ -216,7 +216,7 @@ class ChannelMembersSearchControllerNode: ASDisplayNode {
|
|||||||
let renderedParticipant: RenderedChannelParticipant
|
let renderedParticipant: RenderedChannelParticipant
|
||||||
switch participant {
|
switch participant {
|
||||||
case .creator:
|
case .creator:
|
||||||
renderedParticipant = RenderedChannelParticipant(participant: .creator(id: peer.id, rank: nil), peer: peer)
|
renderedParticipant = RenderedChannelParticipant(participant: .creator(id: peer.id, adminInfo: nil, rank: nil), peer: peer)
|
||||||
case .admin:
|
case .admin:
|
||||||
var peers: [PeerId: Peer] = [:]
|
var peers: [PeerId: Peer] = [:]
|
||||||
peers[creator.id] = creator
|
peers[creator.id] = creator
|
||||||
|
@ -1069,7 +1069,7 @@ private func groupInfoEntries(account: Account, presentationData: PresentationDa
|
|||||||
let participant: ChannelParticipant
|
let participant: ChannelParticipant
|
||||||
switch sortedParticipants[i] {
|
switch sortedParticipants[i] {
|
||||||
case .creator:
|
case .creator:
|
||||||
participant = .creator(id: sortedParticipants[i].peerId, rank: nil)
|
participant = .creator(id: sortedParticipants[i].peerId, adminInfo: nil, rank: nil)
|
||||||
memberStatus = .owner(rank: nil)
|
memberStatus = .owner(rank: nil)
|
||||||
case .admin:
|
case .admin:
|
||||||
participant = .member(id: sortedParticipants[i].peerId, invitedAt: 0, adminInfo: ChannelParticipantAdminInfo(rights: TelegramChatAdminRights(flags: .groupSpecific), promotedBy: account.peerId, canBeEditedByAccountPeer: true), banInfo: nil, rank: nil)
|
participant = .member(id: sortedParticipants[i].peerId, invitedAt: 0, adminInfo: ChannelParticipantAdminInfo(rights: TelegramChatAdminRights(flags: .groupSpecific), promotedBy: account.peerId, canBeEditedByAccountPeer: true), banInfo: nil, rank: nil)
|
||||||
@ -1201,7 +1201,7 @@ private func groupInfoEntries(account: Account, presentationData: PresentationDa
|
|||||||
let participant = participants[i]
|
let participant = participants[i]
|
||||||
let memberStatus: GroupInfoMemberStatus
|
let memberStatus: GroupInfoMemberStatus
|
||||||
switch participant.participant {
|
switch participant.participant {
|
||||||
case let .creator(_, rank):
|
case let .creator(_, _, rank):
|
||||||
memberStatus = .owner(rank: rank)
|
memberStatus = .owner(rank: rank)
|
||||||
case let .member(_, _, adminInfo, _, rank):
|
case let .member(_, _, adminInfo, _, rank):
|
||||||
if adminInfo != nil {
|
if adminInfo != nil {
|
||||||
|
@ -2417,8 +2417,12 @@ public final class Postbox {
|
|||||||
anchor = .index(scrollIndex)
|
anchor = .index(scrollIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case .external:
|
case let .external(input):
|
||||||
anchor = .upperBound
|
if let maxReadMessageId = input.maxReadMessageId {
|
||||||
|
anchor = .message(maxReadMessageId)
|
||||||
|
} else {
|
||||||
|
anchor = .upperBound
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return self.syncAroundMessageHistoryViewForPeerId(subscriber: subscriber, peerIds: peerIds, count: count, clipHoles: clipHoles, anchor: anchor, fixedCombinedReadStates: nil, topTaggedMessageIdNamespaces: topTaggedMessageIdNamespaces, tagMask: tagMask, namespaces: namespaces, orderStatistics: orderStatistics, additionalData: additionalData)
|
return self.syncAroundMessageHistoryViewForPeerId(subscriber: subscriber, peerIds: peerIds, count: count, clipHoles: clipHoles, anchor: anchor, fixedCombinedReadStates: nil, topTaggedMessageIdNamespaces: topTaggedMessageIdNamespaces, tagMask: tagMask, namespaces: namespaces, orderStatistics: orderStatistics, additionalData: additionalData)
|
||||||
})
|
})
|
||||||
|
@ -264,7 +264,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[-1557620115] = { return Api.ChannelParticipant.parse_channelParticipantSelf($0) }
|
dict[-1557620115] = { return Api.ChannelParticipant.parse_channelParticipantSelf($0) }
|
||||||
dict[470789295] = { return Api.ChannelParticipant.parse_channelParticipantBanned($0) }
|
dict[470789295] = { return Api.ChannelParticipant.parse_channelParticipantBanned($0) }
|
||||||
dict[-859915345] = { return Api.ChannelParticipant.parse_channelParticipantAdmin($0) }
|
dict[-859915345] = { return Api.ChannelParticipant.parse_channelParticipantAdmin($0) }
|
||||||
dict[-2138237532] = { return Api.ChannelParticipant.parse_channelParticipantCreator($0) }
|
dict[1149094475] = { return Api.ChannelParticipant.parse_channelParticipantCreator($0) }
|
||||||
dict[-1567730343] = { return Api.MessageUserVote.parse_messageUserVote($0) }
|
dict[-1567730343] = { return Api.MessageUserVote.parse_messageUserVote($0) }
|
||||||
dict[909603888] = { return Api.MessageUserVote.parse_messageUserVoteInputOption($0) }
|
dict[909603888] = { return Api.MessageUserVote.parse_messageUserVoteInputOption($0) }
|
||||||
dict[244310238] = { return Api.MessageUserVote.parse_messageUserVoteMultiple($0) }
|
dict[244310238] = { return Api.MessageUserVote.parse_messageUserVoteMultiple($0) }
|
||||||
@ -605,8 +605,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[537022650] = { return Api.User.parse_userEmpty($0) }
|
dict[537022650] = { return Api.User.parse_userEmpty($0) }
|
||||||
dict[-1820043071] = { return Api.User.parse_user($0) }
|
dict[-1820043071] = { return Api.User.parse_user($0) }
|
||||||
dict[-2082087340] = { return Api.Message.parse_messageEmpty($0) }
|
dict[-2082087340] = { return Api.Message.parse_messageEmpty($0) }
|
||||||
dict[-1642487306] = { return Api.Message.parse_messageService($0) }
|
dict[-146464169] = { return Api.Message.parse_message($0) }
|
||||||
dict[-1971453315] = { return Api.Message.parse_message($0) }
|
dict[-116603007] = { return Api.Message.parse_messageService($0) }
|
||||||
dict[831924812] = { return Api.StatsGroupTopInviter.parse_statsGroupTopInviter($0) }
|
dict[831924812] = { return Api.StatsGroupTopInviter.parse_statsGroupTopInviter($0) }
|
||||||
dict[186120336] = { return Api.messages.RecentStickers.parse_recentStickersNotModified($0) }
|
dict[186120336] = { return Api.messages.RecentStickers.parse_recentStickersNotModified($0) }
|
||||||
dict[586395571] = { return Api.messages.RecentStickers.parse_recentStickers($0) }
|
dict[586395571] = { return Api.messages.RecentStickers.parse_recentStickers($0) }
|
||||||
@ -663,7 +663,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[-1036396922] = { return Api.InputWebFileLocation.parse_inputWebFileLocation($0) }
|
dict[-1036396922] = { return Api.InputWebFileLocation.parse_inputWebFileLocation($0) }
|
||||||
dict[1430205163] = { return Api.InputWebFileLocation.parse_inputWebFileGeoMessageLocation($0) }
|
dict[1430205163] = { return Api.InputWebFileLocation.parse_inputWebFileGeoMessageLocation($0) }
|
||||||
dict[-1625153079] = { return Api.InputWebFileLocation.parse_inputWebFileGeoPointLocation($0) }
|
dict[-1625153079] = { return Api.InputWebFileLocation.parse_inputWebFileGeoPointLocation($0) }
|
||||||
dict[893020267] = { return Api.MessageFwdHeader.parse_messageFwdHeader($0) }
|
dict[1601666510] = { return Api.MessageFwdHeader.parse_messageFwdHeader($0) }
|
||||||
dict[-1012849566] = { return Api.BaseTheme.parse_baseThemeClassic($0) }
|
dict[-1012849566] = { return Api.BaseTheme.parse_baseThemeClassic($0) }
|
||||||
dict[-69724536] = { return Api.BaseTheme.parse_baseThemeDay($0) }
|
dict[-69724536] = { return Api.BaseTheme.parse_baseThemeDay($0) }
|
||||||
dict[-1212997976] = { return Api.BaseTheme.parse_baseThemeNight($0) }
|
dict[-1212997976] = { return Api.BaseTheme.parse_baseThemeNight($0) }
|
||||||
@ -863,7 +863,7 @@ public struct Api {
|
|||||||
return parser(reader)
|
return parser(reader)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
telegramApiLog("Type constructor \(String(signature, radix: 16, uppercase: false)) not found")
|
telegramApiLog("Type constructor \(String(UInt32(bitPattern: signature), radix: 16, uppercase: false)) not found")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8530,7 +8530,7 @@ public extension Api {
|
|||||||
case channelParticipantSelf(userId: Int32, inviterId: Int32, date: Int32)
|
case channelParticipantSelf(userId: Int32, inviterId: Int32, date: Int32)
|
||||||
case channelParticipantBanned(flags: Int32, userId: Int32, kickedBy: Int32, date: Int32, bannedRights: Api.ChatBannedRights)
|
case channelParticipantBanned(flags: Int32, userId: Int32, kickedBy: Int32, date: Int32, bannedRights: Api.ChatBannedRights)
|
||||||
case channelParticipantAdmin(flags: Int32, userId: Int32, inviterId: Int32?, promotedBy: Int32, date: Int32, adminRights: Api.ChatAdminRights, rank: String?)
|
case channelParticipantAdmin(flags: Int32, userId: Int32, inviterId: Int32?, promotedBy: Int32, date: Int32, adminRights: Api.ChatAdminRights, rank: String?)
|
||||||
case channelParticipantCreator(flags: Int32, userId: Int32, rank: String?)
|
case channelParticipantCreator(flags: Int32, userId: Int32, adminRights: Api.ChatAdminRights, rank: String?)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
@ -8571,12 +8571,13 @@ public extension Api {
|
|||||||
adminRights.serialize(buffer, true)
|
adminRights.serialize(buffer, true)
|
||||||
if Int(flags) & Int(1 << 2) != 0 {serializeString(rank!, buffer: buffer, boxed: false)}
|
if Int(flags) & Int(1 << 2) != 0 {serializeString(rank!, buffer: buffer, boxed: false)}
|
||||||
break
|
break
|
||||||
case .channelParticipantCreator(let flags, let userId, let rank):
|
case .channelParticipantCreator(let flags, let userId, let adminRights, let rank):
|
||||||
if boxed {
|
if boxed {
|
||||||
buffer.appendInt32(-2138237532)
|
buffer.appendInt32(1149094475)
|
||||||
}
|
}
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
serializeInt32(userId, buffer: buffer, boxed: false)
|
serializeInt32(userId, buffer: buffer, boxed: false)
|
||||||
|
adminRights.serialize(buffer, true)
|
||||||
if Int(flags) & Int(1 << 0) != 0 {serializeString(rank!, buffer: buffer, boxed: false)}
|
if Int(flags) & Int(1 << 0) != 0 {serializeString(rank!, buffer: buffer, boxed: false)}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -8592,8 +8593,8 @@ public extension Api {
|
|||||||
return ("channelParticipantBanned", [("flags", flags), ("userId", userId), ("kickedBy", kickedBy), ("date", date), ("bannedRights", bannedRights)])
|
return ("channelParticipantBanned", [("flags", flags), ("userId", userId), ("kickedBy", kickedBy), ("date", date), ("bannedRights", bannedRights)])
|
||||||
case .channelParticipantAdmin(let flags, let userId, let inviterId, let promotedBy, let date, let adminRights, let rank):
|
case .channelParticipantAdmin(let flags, let userId, let inviterId, let promotedBy, let date, let adminRights, let rank):
|
||||||
return ("channelParticipantAdmin", [("flags", flags), ("userId", userId), ("inviterId", inviterId), ("promotedBy", promotedBy), ("date", date), ("adminRights", adminRights), ("rank", rank)])
|
return ("channelParticipantAdmin", [("flags", flags), ("userId", userId), ("inviterId", inviterId), ("promotedBy", promotedBy), ("date", date), ("adminRights", adminRights), ("rank", rank)])
|
||||||
case .channelParticipantCreator(let flags, let userId, let rank):
|
case .channelParticipantCreator(let flags, let userId, let adminRights, let rank):
|
||||||
return ("channelParticipantCreator", [("flags", flags), ("userId", userId), ("rank", rank)])
|
return ("channelParticipantCreator", [("flags", flags), ("userId", userId), ("adminRights", adminRights), ("rank", rank)])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8689,13 +8690,18 @@ public extension Api {
|
|||||||
_1 = reader.readInt32()
|
_1 = reader.readInt32()
|
||||||
var _2: Int32?
|
var _2: Int32?
|
||||||
_2 = reader.readInt32()
|
_2 = reader.readInt32()
|
||||||
var _3: String?
|
var _3: Api.ChatAdminRights?
|
||||||
if Int(_1!) & Int(1 << 0) != 0 {_3 = parseString(reader) }
|
if let signature = reader.readInt32() {
|
||||||
|
_3 = Api.parse(reader, signature: signature) as? Api.ChatAdminRights
|
||||||
|
}
|
||||||
|
var _4: String?
|
||||||
|
if Int(_1!) & Int(1 << 0) != 0 {_4 = parseString(reader) }
|
||||||
let _c1 = _1 != nil
|
let _c1 = _1 != nil
|
||||||
let _c2 = _2 != nil
|
let _c2 = _2 != nil
|
||||||
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
|
let _c3 = _3 != nil
|
||||||
if _c1 && _c2 && _c3 {
|
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
|
||||||
return Api.ChannelParticipant.channelParticipantCreator(flags: _1!, userId: _2!, rank: _3)
|
if _c1 && _c2 && _c3 && _c4 {
|
||||||
|
return Api.ChannelParticipant.channelParticipantCreator(flags: _1!, userId: _2!, adminRights: _3!, rank: _4)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return nil
|
return nil
|
||||||
@ -17367,8 +17373,8 @@ public extension Api {
|
|||||||
}
|
}
|
||||||
public enum Message: TypeConstructorDescription {
|
public enum Message: TypeConstructorDescription {
|
||||||
case messageEmpty(id: Int32)
|
case messageEmpty(id: Int32)
|
||||||
case messageService(flags: Int32, id: Int32, fromId: Int32?, toId: Api.Peer, replyToMsgId: Int32?, date: Int32, action: Api.MessageAction)
|
case message(flags: Int32, id: Int32, fromId: Api.Peer, toId: Api.Peer, fwdFrom: Api.MessageFwdHeader?, viaBotId: Int32?, replyToMsgId: Int32?, replyToTopId: Int32?, date: Int32, message: String, media: Api.MessageMedia?, replyMarkup: Api.ReplyMarkup?, entities: [Api.MessageEntity]?, views: Int32?, forwards: Int32?, replies: Api.MessageReplies?, editDate: Int32?, postAuthor: String?, groupedId: Int64?, restrictionReason: [Api.RestrictionReason]?)
|
||||||
case message(flags: Int32, id: Int32, fromId: Int32?, toId: Api.Peer, fwdFrom: Api.MessageFwdHeader?, viaBotId: Int32?, replyToMsgId: Int32?, replyToTopId: Int32?, date: Int32, message: String, media: Api.MessageMedia?, replyMarkup: Api.ReplyMarkup?, entities: [Api.MessageEntity]?, views: Int32?, forwards: Int32?, replies: Api.MessageReplies?, editDate: Int32?, postAuthor: String?, groupedId: Int64?, restrictionReason: [Api.RestrictionReason]?)
|
case messageService(flags: Int32, id: Int32, fromId: Api.Peer, toId: Api.Peer, replyToMsgId: Int32?, date: Int32, action: Api.MessageAction)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
@ -17378,25 +17384,13 @@ public extension Api {
|
|||||||
}
|
}
|
||||||
serializeInt32(id, buffer: buffer, boxed: false)
|
serializeInt32(id, buffer: buffer, boxed: false)
|
||||||
break
|
break
|
||||||
case .messageService(let flags, let id, let fromId, let toId, let replyToMsgId, let date, let action):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(-1642487306)
|
|
||||||
}
|
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
|
||||||
serializeInt32(id, buffer: buffer, boxed: false)
|
|
||||||
if Int(flags) & Int(1 << 8) != 0 {serializeInt32(fromId!, buffer: buffer, boxed: false)}
|
|
||||||
toId.serialize(buffer, true)
|
|
||||||
if Int(flags) & Int(1 << 3) != 0 {serializeInt32(replyToMsgId!, buffer: buffer, boxed: false)}
|
|
||||||
serializeInt32(date, buffer: buffer, boxed: false)
|
|
||||||
action.serialize(buffer, true)
|
|
||||||
break
|
|
||||||
case .message(let flags, let id, let fromId, let toId, let fwdFrom, let viaBotId, let replyToMsgId, let replyToTopId, let date, let message, let media, let replyMarkup, let entities, let views, let forwards, let replies, let editDate, let postAuthor, let groupedId, let restrictionReason):
|
case .message(let flags, let id, let fromId, let toId, let fwdFrom, let viaBotId, let replyToMsgId, let replyToTopId, let date, let message, let media, let replyMarkup, let entities, let views, let forwards, let replies, let editDate, let postAuthor, let groupedId, let restrictionReason):
|
||||||
if boxed {
|
if boxed {
|
||||||
buffer.appendInt32(-1971453315)
|
buffer.appendInt32(-146464169)
|
||||||
}
|
}
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
serializeInt32(id, buffer: buffer, boxed: false)
|
serializeInt32(id, buffer: buffer, boxed: false)
|
||||||
if Int(flags) & Int(1 << 8) != 0 {serializeInt32(fromId!, buffer: buffer, boxed: false)}
|
fromId.serialize(buffer, true)
|
||||||
toId.serialize(buffer, true)
|
toId.serialize(buffer, true)
|
||||||
if Int(flags) & Int(1 << 2) != 0 {fwdFrom!.serialize(buffer, true)}
|
if Int(flags) & Int(1 << 2) != 0 {fwdFrom!.serialize(buffer, true)}
|
||||||
if Int(flags) & Int(1 << 11) != 0 {serializeInt32(viaBotId!, buffer: buffer, boxed: false)}
|
if Int(flags) & Int(1 << 11) != 0 {serializeInt32(viaBotId!, buffer: buffer, boxed: false)}
|
||||||
@ -17423,6 +17417,18 @@ public extension Api {
|
|||||||
item.serialize(buffer, true)
|
item.serialize(buffer, true)
|
||||||
}}
|
}}
|
||||||
break
|
break
|
||||||
|
case .messageService(let flags, let id, let fromId, let toId, let replyToMsgId, let date, let action):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-116603007)
|
||||||
|
}
|
||||||
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
|
serializeInt32(id, buffer: buffer, boxed: false)
|
||||||
|
fromId.serialize(buffer, true)
|
||||||
|
toId.serialize(buffer, true)
|
||||||
|
if Int(flags) & Int(1 << 3) != 0 {serializeInt32(replyToMsgId!, buffer: buffer, boxed: false)}
|
||||||
|
serializeInt32(date, buffer: buffer, boxed: false)
|
||||||
|
action.serialize(buffer, true)
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17430,10 +17436,10 @@ public extension Api {
|
|||||||
switch self {
|
switch self {
|
||||||
case .messageEmpty(let id):
|
case .messageEmpty(let id):
|
||||||
return ("messageEmpty", [("id", id)])
|
return ("messageEmpty", [("id", id)])
|
||||||
case .messageService(let flags, let id, let fromId, let toId, let replyToMsgId, let date, let action):
|
|
||||||
return ("messageService", [("flags", flags), ("id", id), ("fromId", fromId), ("toId", toId), ("replyToMsgId", replyToMsgId), ("date", date), ("action", action)])
|
|
||||||
case .message(let flags, let id, let fromId, let toId, let fwdFrom, let viaBotId, let replyToMsgId, let replyToTopId, let date, let message, let media, let replyMarkup, let entities, let views, let forwards, let replies, let editDate, let postAuthor, let groupedId, let restrictionReason):
|
case .message(let flags, let id, let fromId, let toId, let fwdFrom, let viaBotId, let replyToMsgId, let replyToTopId, let date, let message, let media, let replyMarkup, let entities, let views, let forwards, let replies, let editDate, let postAuthor, let groupedId, let restrictionReason):
|
||||||
return ("message", [("flags", flags), ("id", id), ("fromId", fromId), ("toId", toId), ("fwdFrom", fwdFrom), ("viaBotId", viaBotId), ("replyToMsgId", replyToMsgId), ("replyToTopId", replyToTopId), ("date", date), ("message", message), ("media", media), ("replyMarkup", replyMarkup), ("entities", entities), ("views", views), ("forwards", forwards), ("replies", replies), ("editDate", editDate), ("postAuthor", postAuthor), ("groupedId", groupedId), ("restrictionReason", restrictionReason)])
|
return ("message", [("flags", flags), ("id", id), ("fromId", fromId), ("toId", toId), ("fwdFrom", fwdFrom), ("viaBotId", viaBotId), ("replyToMsgId", replyToMsgId), ("replyToTopId", replyToTopId), ("date", date), ("message", message), ("media", media), ("replyMarkup", replyMarkup), ("entities", entities), ("views", views), ("forwards", forwards), ("replies", replies), ("editDate", editDate), ("postAuthor", postAuthor), ("groupedId", groupedId), ("restrictionReason", restrictionReason)])
|
||||||
|
case .messageService(let flags, let id, let fromId, let toId, let replyToMsgId, let date, let action):
|
||||||
|
return ("messageService", [("flags", flags), ("id", id), ("fromId", fromId), ("toId", toId), ("replyToMsgId", replyToMsgId), ("date", date), ("action", action)])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17448,46 +17454,15 @@ public extension Api {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static func parse_messageService(_ reader: BufferReader) -> Message? {
|
|
||||||
var _1: Int32?
|
|
||||||
_1 = reader.readInt32()
|
|
||||||
var _2: Int32?
|
|
||||||
_2 = reader.readInt32()
|
|
||||||
var _3: Int32?
|
|
||||||
if Int(_1!) & Int(1 << 8) != 0 {_3 = reader.readInt32() }
|
|
||||||
var _4: Api.Peer?
|
|
||||||
if let signature = reader.readInt32() {
|
|
||||||
_4 = Api.parse(reader, signature: signature) as? Api.Peer
|
|
||||||
}
|
|
||||||
var _5: Int32?
|
|
||||||
if Int(_1!) & Int(1 << 3) != 0 {_5 = reader.readInt32() }
|
|
||||||
var _6: Int32?
|
|
||||||
_6 = reader.readInt32()
|
|
||||||
var _7: Api.MessageAction?
|
|
||||||
if let signature = reader.readInt32() {
|
|
||||||
_7 = Api.parse(reader, signature: signature) as? Api.MessageAction
|
|
||||||
}
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
let _c2 = _2 != nil
|
|
||||||
let _c3 = (Int(_1!) & Int(1 << 8) == 0) || _3 != nil
|
|
||||||
let _c4 = _4 != nil
|
|
||||||
let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
|
|
||||||
let _c6 = _6 != nil
|
|
||||||
let _c7 = _7 != nil
|
|
||||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
|
|
||||||
return Api.Message.messageService(flags: _1!, id: _2!, fromId: _3, toId: _4!, replyToMsgId: _5, date: _6!, action: _7!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static func parse_message(_ reader: BufferReader) -> Message? {
|
public static func parse_message(_ reader: BufferReader) -> Message? {
|
||||||
var _1: Int32?
|
var _1: Int32?
|
||||||
_1 = reader.readInt32()
|
_1 = reader.readInt32()
|
||||||
var _2: Int32?
|
var _2: Int32?
|
||||||
_2 = reader.readInt32()
|
_2 = reader.readInt32()
|
||||||
var _3: Int32?
|
var _3: Api.Peer?
|
||||||
if Int(_1!) & Int(1 << 8) != 0 {_3 = reader.readInt32() }
|
if let signature = reader.readInt32() {
|
||||||
|
_3 = Api.parse(reader, signature: signature) as? Api.Peer
|
||||||
|
}
|
||||||
var _4: Api.Peer?
|
var _4: Api.Peer?
|
||||||
if let signature = reader.readInt32() {
|
if let signature = reader.readInt32() {
|
||||||
_4 = Api.parse(reader, signature: signature) as? Api.Peer
|
_4 = Api.parse(reader, signature: signature) as? Api.Peer
|
||||||
@ -17538,7 +17513,7 @@ public extension Api {
|
|||||||
} }
|
} }
|
||||||
let _c1 = _1 != nil
|
let _c1 = _1 != nil
|
||||||
let _c2 = _2 != nil
|
let _c2 = _2 != nil
|
||||||
let _c3 = (Int(_1!) & Int(1 << 8) == 0) || _3 != nil
|
let _c3 = _3 != nil
|
||||||
let _c4 = _4 != nil
|
let _c4 = _4 != nil
|
||||||
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
|
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
|
||||||
let _c6 = (Int(_1!) & Int(1 << 11) == 0) || _6 != nil
|
let _c6 = (Int(_1!) & Int(1 << 11) == 0) || _6 != nil
|
||||||
@ -17557,7 +17532,42 @@ public extension Api {
|
|||||||
let _c19 = (Int(_1!) & Int(1 << 17) == 0) || _19 != nil
|
let _c19 = (Int(_1!) & Int(1 << 17) == 0) || _19 != nil
|
||||||
let _c20 = (Int(_1!) & Int(1 << 22) == 0) || _20 != nil
|
let _c20 = (Int(_1!) & Int(1 << 22) == 0) || _20 != nil
|
||||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 && _c19 && _c20 {
|
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 && _c19 && _c20 {
|
||||||
return Api.Message.message(flags: _1!, id: _2!, fromId: _3, toId: _4!, fwdFrom: _5, viaBotId: _6, replyToMsgId: _7, replyToTopId: _8, date: _9!, message: _10!, media: _11, replyMarkup: _12, entities: _13, views: _14, forwards: _15, replies: _16, editDate: _17, postAuthor: _18, groupedId: _19, restrictionReason: _20)
|
return Api.Message.message(flags: _1!, id: _2!, fromId: _3!, toId: _4!, fwdFrom: _5, viaBotId: _6, replyToMsgId: _7, replyToTopId: _8, date: _9!, message: _10!, media: _11, replyMarkup: _12, entities: _13, views: _14, forwards: _15, replies: _16, editDate: _17, postAuthor: _18, groupedId: _19, restrictionReason: _20)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static func parse_messageService(_ reader: BufferReader) -> Message? {
|
||||||
|
var _1: Int32?
|
||||||
|
_1 = reader.readInt32()
|
||||||
|
var _2: Int32?
|
||||||
|
_2 = reader.readInt32()
|
||||||
|
var _3: Api.Peer?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
_3 = Api.parse(reader, signature: signature) as? Api.Peer
|
||||||
|
}
|
||||||
|
var _4: Api.Peer?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
_4 = Api.parse(reader, signature: signature) as? Api.Peer
|
||||||
|
}
|
||||||
|
var _5: Int32?
|
||||||
|
if Int(_1!) & Int(1 << 3) != 0 {_5 = reader.readInt32() }
|
||||||
|
var _6: Int32?
|
||||||
|
_6 = reader.readInt32()
|
||||||
|
var _7: Api.MessageAction?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
_7 = Api.parse(reader, signature: signature) as? Api.MessageAction
|
||||||
|
}
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
let _c3 = _3 != nil
|
||||||
|
let _c4 = _4 != nil
|
||||||
|
let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
|
||||||
|
let _c6 = _6 != nil
|
||||||
|
let _c7 = _7 != nil
|
||||||
|
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
|
||||||
|
return Api.Message.messageService(flags: _1!, id: _2!, fromId: _3!, toId: _4!, replyToMsgId: _5, date: _6!, action: _7!)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return nil
|
return nil
|
||||||
@ -19224,19 +19234,18 @@ public extension Api {
|
|||||||
|
|
||||||
}
|
}
|
||||||
public enum MessageFwdHeader: TypeConstructorDescription {
|
public enum MessageFwdHeader: TypeConstructorDescription {
|
||||||
case messageFwdHeader(flags: Int32, fromId: Int32?, fromName: String?, date: Int32, channelId: Int32?, channelPost: Int32?, postAuthor: String?, savedFromPeer: Api.Peer?, savedFromMsgId: Int32?, psaType: String?)
|
case messageFwdHeader(flags: Int32, fromId: Api.Peer?, fromName: String?, date: Int32, channelPost: Int32?, postAuthor: String?, savedFromPeer: Api.Peer?, savedFromMsgId: Int32?, psaType: String?)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .messageFwdHeader(let flags, let fromId, let fromName, let date, let channelId, let channelPost, let postAuthor, let savedFromPeer, let savedFromMsgId, let psaType):
|
case .messageFwdHeader(let flags, let fromId, let fromName, let date, let channelPost, let postAuthor, let savedFromPeer, let savedFromMsgId, let psaType):
|
||||||
if boxed {
|
if boxed {
|
||||||
buffer.appendInt32(893020267)
|
buffer.appendInt32(1601666510)
|
||||||
}
|
}
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(fromId!, buffer: buffer, boxed: false)}
|
if Int(flags) & Int(1 << 0) != 0 {fromId!.serialize(buffer, true)}
|
||||||
if Int(flags) & Int(1 << 5) != 0 {serializeString(fromName!, buffer: buffer, boxed: false)}
|
if Int(flags) & Int(1 << 5) != 0 {serializeString(fromName!, buffer: buffer, boxed: false)}
|
||||||
serializeInt32(date, buffer: buffer, boxed: false)
|
serializeInt32(date, buffer: buffer, boxed: false)
|
||||||
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(channelId!, buffer: buffer, boxed: false)}
|
|
||||||
if Int(flags) & Int(1 << 2) != 0 {serializeInt32(channelPost!, buffer: buffer, boxed: false)}
|
if Int(flags) & Int(1 << 2) != 0 {serializeInt32(channelPost!, buffer: buffer, boxed: false)}
|
||||||
if Int(flags) & Int(1 << 3) != 0 {serializeString(postAuthor!, buffer: buffer, boxed: false)}
|
if Int(flags) & Int(1 << 3) != 0 {serializeString(postAuthor!, buffer: buffer, boxed: false)}
|
||||||
if Int(flags) & Int(1 << 4) != 0 {savedFromPeer!.serialize(buffer, true)}
|
if Int(flags) & Int(1 << 4) != 0 {savedFromPeer!.serialize(buffer, true)}
|
||||||
@ -19248,46 +19257,45 @@ public extension Api {
|
|||||||
|
|
||||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
switch self {
|
switch self {
|
||||||
case .messageFwdHeader(let flags, let fromId, let fromName, let date, let channelId, let channelPost, let postAuthor, let savedFromPeer, let savedFromMsgId, let psaType):
|
case .messageFwdHeader(let flags, let fromId, let fromName, let date, let channelPost, let postAuthor, let savedFromPeer, let savedFromMsgId, let psaType):
|
||||||
return ("messageFwdHeader", [("flags", flags), ("fromId", fromId), ("fromName", fromName), ("date", date), ("channelId", channelId), ("channelPost", channelPost), ("postAuthor", postAuthor), ("savedFromPeer", savedFromPeer), ("savedFromMsgId", savedFromMsgId), ("psaType", psaType)])
|
return ("messageFwdHeader", [("flags", flags), ("fromId", fromId), ("fromName", fromName), ("date", date), ("channelPost", channelPost), ("postAuthor", postAuthor), ("savedFromPeer", savedFromPeer), ("savedFromMsgId", savedFromMsgId), ("psaType", psaType)])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func parse_messageFwdHeader(_ reader: BufferReader) -> MessageFwdHeader? {
|
public static func parse_messageFwdHeader(_ reader: BufferReader) -> MessageFwdHeader? {
|
||||||
var _1: Int32?
|
var _1: Int32?
|
||||||
_1 = reader.readInt32()
|
_1 = reader.readInt32()
|
||||||
var _2: Int32?
|
var _2: Api.Peer?
|
||||||
if Int(_1!) & Int(1 << 0) != 0 {_2 = reader.readInt32() }
|
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
|
||||||
|
_2 = Api.parse(reader, signature: signature) as? Api.Peer
|
||||||
|
} }
|
||||||
var _3: String?
|
var _3: String?
|
||||||
if Int(_1!) & Int(1 << 5) != 0 {_3 = parseString(reader) }
|
if Int(_1!) & Int(1 << 5) != 0 {_3 = parseString(reader) }
|
||||||
var _4: Int32?
|
var _4: Int32?
|
||||||
_4 = reader.readInt32()
|
_4 = reader.readInt32()
|
||||||
var _5: Int32?
|
var _5: Int32?
|
||||||
if Int(_1!) & Int(1 << 1) != 0 {_5 = reader.readInt32() }
|
if Int(_1!) & Int(1 << 2) != 0 {_5 = reader.readInt32() }
|
||||||
var _6: Int32?
|
var _6: String?
|
||||||
if Int(_1!) & Int(1 << 2) != 0 {_6 = reader.readInt32() }
|
if Int(_1!) & Int(1 << 3) != 0 {_6 = parseString(reader) }
|
||||||
var _7: String?
|
var _7: Api.Peer?
|
||||||
if Int(_1!) & Int(1 << 3) != 0 {_7 = parseString(reader) }
|
|
||||||
var _8: Api.Peer?
|
|
||||||
if Int(_1!) & Int(1 << 4) != 0 {if let signature = reader.readInt32() {
|
if Int(_1!) & Int(1 << 4) != 0 {if let signature = reader.readInt32() {
|
||||||
_8 = Api.parse(reader, signature: signature) as? Api.Peer
|
_7 = Api.parse(reader, signature: signature) as? Api.Peer
|
||||||
} }
|
} }
|
||||||
var _9: Int32?
|
var _8: Int32?
|
||||||
if Int(_1!) & Int(1 << 4) != 0 {_9 = reader.readInt32() }
|
if Int(_1!) & Int(1 << 4) != 0 {_8 = reader.readInt32() }
|
||||||
var _10: String?
|
var _9: String?
|
||||||
if Int(_1!) & Int(1 << 6) != 0 {_10 = parseString(reader) }
|
if Int(_1!) & Int(1 << 6) != 0 {_9 = parseString(reader) }
|
||||||
let _c1 = _1 != nil
|
let _c1 = _1 != nil
|
||||||
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
|
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
|
||||||
let _c3 = (Int(_1!) & Int(1 << 5) == 0) || _3 != nil
|
let _c3 = (Int(_1!) & Int(1 << 5) == 0) || _3 != nil
|
||||||
let _c4 = _4 != nil
|
let _c4 = _4 != nil
|
||||||
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
|
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
|
||||||
let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil
|
let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil
|
||||||
let _c7 = (Int(_1!) & Int(1 << 3) == 0) || _7 != nil
|
let _c7 = (Int(_1!) & Int(1 << 4) == 0) || _7 != nil
|
||||||
let _c8 = (Int(_1!) & Int(1 << 4) == 0) || _8 != nil
|
let _c8 = (Int(_1!) & Int(1 << 4) == 0) || _8 != nil
|
||||||
let _c9 = (Int(_1!) & Int(1 << 4) == 0) || _9 != nil
|
let _c9 = (Int(_1!) & Int(1 << 6) == 0) || _9 != nil
|
||||||
let _c10 = (Int(_1!) & Int(1 << 6) == 0) || _10 != nil
|
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
|
||||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 {
|
return Api.MessageFwdHeader.messageFwdHeader(flags: _1!, fromId: _2, fromName: _3, date: _4!, channelPost: _5, postAuthor: _6, savedFromPeer: _7, savedFromMsgId: _8, psaType: _9)
|
||||||
return Api.MessageFwdHeader.messageFwdHeader(flags: _1!, fromId: _2, fromName: _3, date: _4!, channelId: _5, channelPost: _6, postAuthor: _7, savedFromPeer: _8, savedFromMsgId: _9, psaType: _10)
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return nil
|
return nil
|
||||||
|
@ -2885,32 +2885,6 @@ public extension Api {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func search(flags: Int32, peer: Api.InputPeer, q: String, fromId: Api.InputUser?, filter: Api.MessagesFilter, minDate: Int32, maxDate: Int32, offsetId: Int32, addOffset: Int32, limit: Int32, maxId: Int32, minId: Int32, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Messages>) {
|
|
||||||
let buffer = Buffer()
|
|
||||||
buffer.appendInt32(-2045448344)
|
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
|
||||||
peer.serialize(buffer, true)
|
|
||||||
serializeString(q, buffer: buffer, boxed: false)
|
|
||||||
if Int(flags) & Int(1 << 0) != 0 {fromId!.serialize(buffer, true)}
|
|
||||||
filter.serialize(buffer, true)
|
|
||||||
serializeInt32(minDate, buffer: buffer, boxed: false)
|
|
||||||
serializeInt32(maxDate, buffer: buffer, boxed: false)
|
|
||||||
serializeInt32(offsetId, buffer: buffer, boxed: false)
|
|
||||||
serializeInt32(addOffset, buffer: buffer, boxed: false)
|
|
||||||
serializeInt32(limit, buffer: buffer, boxed: false)
|
|
||||||
serializeInt32(maxId, buffer: buffer, boxed: false)
|
|
||||||
serializeInt32(minId, buffer: buffer, boxed: false)
|
|
||||||
serializeInt32(hash, buffer: buffer, boxed: false)
|
|
||||||
return (FunctionDescription(name: "messages.search", parameters: [("flags", flags), ("peer", peer), ("q", q), ("fromId", fromId), ("filter", filter), ("minDate", minDate), ("maxDate", maxDate), ("offsetId", offsetId), ("addOffset", addOffset), ("limit", limit), ("maxId", maxId), ("minId", minId), ("hash", hash)]), buffer, DeserializeFunctionResponse { (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 toggleDialogPin(flags: Int32, peer: Api.InputDialogPeer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
|
public static func toggleDialogPin(flags: Int32, peer: Api.InputDialogPeer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
|
||||||
let buffer = Buffer()
|
let buffer = Buffer()
|
||||||
buffer.appendInt32(-1489903017)
|
buffer.appendInt32(-1489903017)
|
||||||
@ -3754,18 +3728,47 @@ public extension Api {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func searchGlobal(flags: Int32, folderId: Int32?, q: String, filter: Api.MessagesFilter, offsetRate: Int32, offsetPeer: Api.InputPeer, offsetId: Int32, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Messages>) {
|
public static func searchGlobal(flags: Int32, folderId: Int32?, q: String, filter: Api.MessagesFilter, minDate: Int32, maxDate: Int32, offsetRate: Int32, offsetPeer: Api.InputPeer, offsetId: Int32, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Messages>) {
|
||||||
let buffer = Buffer()
|
let buffer = Buffer()
|
||||||
buffer.appendInt32(1934479725)
|
buffer.appendInt32(1271290010)
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(folderId!, buffer: buffer, boxed: false)}
|
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(folderId!, buffer: buffer, boxed: false)}
|
||||||
serializeString(q, buffer: buffer, boxed: false)
|
serializeString(q, buffer: buffer, boxed: false)
|
||||||
filter.serialize(buffer, true)
|
filter.serialize(buffer, true)
|
||||||
|
serializeInt32(minDate, buffer: buffer, boxed: false)
|
||||||
|
serializeInt32(maxDate, buffer: buffer, boxed: false)
|
||||||
serializeInt32(offsetRate, buffer: buffer, boxed: false)
|
serializeInt32(offsetRate, buffer: buffer, boxed: false)
|
||||||
offsetPeer.serialize(buffer, true)
|
offsetPeer.serialize(buffer, true)
|
||||||
serializeInt32(offsetId, buffer: buffer, boxed: false)
|
serializeInt32(offsetId, buffer: buffer, boxed: false)
|
||||||
serializeInt32(limit, buffer: buffer, boxed: false)
|
serializeInt32(limit, buffer: buffer, boxed: false)
|
||||||
return (FunctionDescription(name: "messages.searchGlobal", parameters: [("flags", flags), ("folderId", folderId), ("q", q), ("filter", filter), ("offsetRate", offsetRate), ("offsetPeer", offsetPeer), ("offsetId", offsetId), ("limit", limit)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in
|
return (FunctionDescription(name: "messages.searchGlobal", parameters: [("flags", flags), ("folderId", folderId), ("q", q), ("filter", filter), ("minDate", minDate), ("maxDate", maxDate), ("offsetRate", offsetRate), ("offsetPeer", offsetPeer), ("offsetId", offsetId), ("limit", limit)]), buffer, DeserializeFunctionResponse { (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 search(flags: Int32, peer: Api.InputPeer, q: String, fromId: Api.InputUser?, topMsgId: Int32?, filter: Api.MessagesFilter, minDate: Int32, maxDate: Int32, offsetId: Int32, addOffset: Int32, limit: Int32, maxId: Int32, minId: Int32, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Messages>) {
|
||||||
|
let buffer = Buffer()
|
||||||
|
buffer.appendInt32(1310163211)
|
||||||
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
|
peer.serialize(buffer, true)
|
||||||
|
serializeString(q, buffer: buffer, boxed: false)
|
||||||
|
if Int(flags) & Int(1 << 0) != 0 {fromId!.serialize(buffer, true)}
|
||||||
|
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(topMsgId!, buffer: buffer, boxed: false)}
|
||||||
|
filter.serialize(buffer, true)
|
||||||
|
serializeInt32(minDate, buffer: buffer, boxed: false)
|
||||||
|
serializeInt32(maxDate, buffer: buffer, boxed: false)
|
||||||
|
serializeInt32(offsetId, buffer: buffer, boxed: false)
|
||||||
|
serializeInt32(addOffset, buffer: buffer, boxed: false)
|
||||||
|
serializeInt32(limit, buffer: buffer, boxed: false)
|
||||||
|
serializeInt32(maxId, buffer: buffer, boxed: false)
|
||||||
|
serializeInt32(minId, buffer: buffer, boxed: false)
|
||||||
|
serializeInt32(hash, buffer: buffer, boxed: false)
|
||||||
|
return (FunctionDescription(name: "messages.search", parameters: [("flags", flags), ("peer", peer), ("q", q), ("fromId", fromId), ("topMsgId", topMsgId), ("filter", filter), ("minDate", minDate), ("maxDate", maxDate), ("offsetId", offsetId), ("addOffset", addOffset), ("limit", limit), ("maxId", maxId), ("minId", minId), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in
|
||||||
let reader = BufferReader(buffer)
|
let reader = BufferReader(buffer)
|
||||||
var result: Api.messages.Messages?
|
var result: Api.messages.Messages?
|
||||||
if let signature = reader.readInt32() {
|
if let signature = reader.readInt32() {
|
||||||
|
@ -72,12 +72,12 @@ public struct ChannelParticipantBannedInfo: PostboxCoding, Equatable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public enum ChannelParticipant: PostboxCoding, Equatable {
|
public enum ChannelParticipant: PostboxCoding, Equatable {
|
||||||
case creator(id: PeerId, rank: String?)
|
case creator(id: PeerId, adminInfo: ChannelParticipantAdminInfo?, rank: String?)
|
||||||
case member(id: PeerId, invitedAt: Int32, adminInfo: ChannelParticipantAdminInfo?, banInfo: ChannelParticipantBannedInfo?, rank: String?)
|
case member(id: PeerId, invitedAt: Int32, adminInfo: ChannelParticipantAdminInfo?, banInfo: ChannelParticipantBannedInfo?, rank: String?)
|
||||||
|
|
||||||
public var peerId: PeerId {
|
public var peerId: PeerId {
|
||||||
switch self {
|
switch self {
|
||||||
case let .creator(id, _):
|
case let .creator(id, _, _):
|
||||||
return id
|
return id
|
||||||
case let .member(id, _, _, _, _):
|
case let .member(id, _, _, _, _):
|
||||||
return id
|
return id
|
||||||
@ -86,7 +86,7 @@ public enum ChannelParticipant: PostboxCoding, Equatable {
|
|||||||
|
|
||||||
public var rank: String? {
|
public var rank: String? {
|
||||||
switch self {
|
switch self {
|
||||||
case let .creator(_, rank):
|
case let .creator(_, _, rank):
|
||||||
return rank
|
return rank
|
||||||
case let .member(_, _, _, _, rank):
|
case let .member(_, _, _, _, rank):
|
||||||
return rank
|
return rank
|
||||||
@ -116,8 +116,8 @@ public enum ChannelParticipant: PostboxCoding, Equatable {
|
|||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
case let .creator(id, rank):
|
case let .creator(id, adminInfo, rank):
|
||||||
if case .creator(id, rank) = rhs {
|
if case .creator(id, adminInfo, rank) = rhs {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
@ -130,7 +130,7 @@ public enum ChannelParticipant: PostboxCoding, Equatable {
|
|||||||
case ChannelParticipantValue.member.rawValue:
|
case ChannelParticipantValue.member.rawValue:
|
||||||
self = .member(id: PeerId(decoder.decodeInt64ForKey("i", orElse: 0)), invitedAt: decoder.decodeInt32ForKey("t", orElse: 0), adminInfo: decoder.decodeObjectForKey("ai", decoder: { ChannelParticipantAdminInfo(decoder: $0) }) as? ChannelParticipantAdminInfo, banInfo: decoder.decodeObjectForKey("bi", decoder: { ChannelParticipantBannedInfo(decoder: $0) }) as? ChannelParticipantBannedInfo, rank: decoder.decodeOptionalStringForKey("rank"))
|
self = .member(id: PeerId(decoder.decodeInt64ForKey("i", orElse: 0)), invitedAt: decoder.decodeInt32ForKey("t", orElse: 0), adminInfo: decoder.decodeObjectForKey("ai", decoder: { ChannelParticipantAdminInfo(decoder: $0) }) as? ChannelParticipantAdminInfo, banInfo: decoder.decodeObjectForKey("bi", decoder: { ChannelParticipantBannedInfo(decoder: $0) }) as? ChannelParticipantBannedInfo, rank: decoder.decodeOptionalStringForKey("rank"))
|
||||||
case ChannelParticipantValue.creator.rawValue:
|
case ChannelParticipantValue.creator.rawValue:
|
||||||
self = .creator(id: PeerId(decoder.decodeInt64ForKey("i", orElse: 0)), rank: decoder.decodeOptionalStringForKey("rank"))
|
self = .creator(id: PeerId(decoder.decodeInt64ForKey("i", orElse: 0)), adminInfo: decoder.decodeObjectForKey("ai", decoder: { ChannelParticipantAdminInfo(decoder: $0) }) as? ChannelParticipantAdminInfo, rank: decoder.decodeOptionalStringForKey("rank"))
|
||||||
default:
|
default:
|
||||||
self = .member(id: PeerId(decoder.decodeInt64ForKey("i", orElse: 0)), invitedAt: decoder.decodeInt32ForKey("t", orElse: 0), adminInfo: nil, banInfo: nil, rank: nil)
|
self = .member(id: PeerId(decoder.decodeInt64ForKey("i", orElse: 0)), invitedAt: decoder.decodeInt32ForKey("t", orElse: 0), adminInfo: nil, banInfo: nil, rank: nil)
|
||||||
}
|
}
|
||||||
@ -157,9 +157,14 @@ public enum ChannelParticipant: PostboxCoding, Equatable {
|
|||||||
} else {
|
} else {
|
||||||
encoder.encodeNil(forKey: "rank")
|
encoder.encodeNil(forKey: "rank")
|
||||||
}
|
}
|
||||||
case let .creator(id, rank):
|
case let .creator(id, adminInfo, rank):
|
||||||
encoder.encodeInt32(ChannelParticipantValue.creator.rawValue, forKey: "r")
|
encoder.encodeInt32(ChannelParticipantValue.creator.rawValue, forKey: "r")
|
||||||
encoder.encodeInt64(id.toInt64(), forKey: "i")
|
encoder.encodeInt64(id.toInt64(), forKey: "i")
|
||||||
|
if let adminInfo = adminInfo {
|
||||||
|
encoder.encodeObject(adminInfo, forKey: "ai")
|
||||||
|
} else {
|
||||||
|
encoder.encodeNil(forKey: "ai")
|
||||||
|
}
|
||||||
if let rank = rank {
|
if let rank = rank {
|
||||||
encoder.encodeString(rank, forKey: "rank")
|
encoder.encodeString(rank, forKey: "rank")
|
||||||
} else {
|
} else {
|
||||||
@ -195,8 +200,8 @@ extension ChannelParticipant {
|
|||||||
switch apiParticipant {
|
switch apiParticipant {
|
||||||
case let .channelParticipant(userId, date):
|
case let .channelParticipant(userId, date):
|
||||||
self = .member(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: userId), invitedAt: date, adminInfo: nil, banInfo: nil, rank: nil)
|
self = .member(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: userId), invitedAt: date, adminInfo: nil, banInfo: nil, rank: nil)
|
||||||
case let .channelParticipantCreator(_, userId, rank):
|
case let .channelParticipantCreator(_, userId, adminRights, rank):
|
||||||
self = .creator(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: userId), rank: rank)
|
self = .creator(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: userId), adminInfo: ChannelParticipantAdminInfo(rights: TelegramChatAdminRights(apiAdminRights: adminRights), promotedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: userId), canBeEditedByAccountPeer: true), rank: rank)
|
||||||
case let .channelParticipantBanned(flags, userId, restrictedBy, date, bannedRights):
|
case let .channelParticipantBanned(flags, userId, restrictedBy, date, bannedRights):
|
||||||
let hasLeft = (flags & (1 << 0)) != 0
|
let hasLeft = (flags & (1 << 0)) != 0
|
||||||
let banInfo = ChannelParticipantBannedInfo(rights: TelegramChatBannedRights(apiBannedRights: bannedRights), restrictedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: restrictedBy), timestamp: date, isMember: !hasLeft)
|
let banInfo = ChannelParticipantBannedInfo(rights: TelegramChatBannedRights(apiBannedRights: bannedRights), restrictedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: restrictedBy), timestamp: date, isMember: !hasLeft)
|
||||||
|
@ -65,7 +65,7 @@ public func channelAdminIds(postbox: Postbox, network: Network, peerId: PeerId,
|
|||||||
switch participant {
|
switch participant {
|
||||||
case let .channelParticipantAdmin(_, userId, _, _, _, _, _):
|
case let .channelParticipantAdmin(_, userId, _, _, _, _, _):
|
||||||
return user.peerId.id == userId
|
return user.peerId.id == userId
|
||||||
case let .channelParticipantCreator(_, userId, _):
|
case let .channelParticipantCreator(_, userId, _, _):
|
||||||
return user.peerId.id == userId
|
return user.peerId.id == userId
|
||||||
default:
|
default:
|
||||||
return false
|
return false
|
||||||
|
@ -92,7 +92,7 @@ public func updateChannelOwnership(account: Account, accountStateManager: Accoun
|
|||||||
flags = TelegramChatAdminRightsFlags.groupSpecific
|
flags = TelegramChatAdminRightsFlags.groupSpecific
|
||||||
}
|
}
|
||||||
|
|
||||||
let updatedParticipant = ChannelParticipant.creator(id: user.id, rank: currentParticipant?.rank)
|
let updatedParticipant = ChannelParticipant.creator(id: user.id, adminInfo: nil, rank: currentParticipant?.rank)
|
||||||
let updatedPreviousCreator = ChannelParticipant.member(id: accountUser.id, invitedAt: Int32(Date().timeIntervalSince1970), adminInfo: ChannelParticipantAdminInfo(rights: TelegramChatAdminRights(flags: flags), promotedBy: accountUser.id, canBeEditedByAccountPeer: false), banInfo: nil, rank: currentCreator?.rank)
|
let updatedPreviousCreator = ChannelParticipant.member(id: accountUser.id, invitedAt: Int32(Date().timeIntervalSince1970), adminInfo: ChannelParticipantAdminInfo(rights: TelegramChatAdminRights(flags: flags), promotedBy: accountUser.id, canBeEditedByAccountPeer: false), banInfo: nil, rank: currentCreator?.rank)
|
||||||
|
|
||||||
let checkPassword = twoStepAuthData(account.network)
|
let checkPassword = twoStepAuthData(account.network)
|
||||||
|
@ -375,7 +375,7 @@ private func validateChannelMessagesBatch(postbox: Postbox, network: Network, ac
|
|||||||
if tag == MessageTags.unseenPersonalMessage {
|
if tag == MessageTags.unseenPersonalMessage {
|
||||||
requestSignal = network.request(Api.functions.messages.getUnreadMentions(peer: inputPeer, offsetId: messageIds[messageIds.count - 1].id + 1, addOffset: 0, limit: Int32(messageIds.count), maxId: messageIds[messageIds.count - 1].id + 1, minId: messageIds[0].id - 1))
|
requestSignal = network.request(Api.functions.messages.getUnreadMentions(peer: inputPeer, offsetId: messageIds[messageIds.count - 1].id + 1, addOffset: 0, limit: Int32(messageIds.count), maxId: messageIds[messageIds.count - 1].id + 1, minId: messageIds[0].id - 1))
|
||||||
} else if let filter = messageFilterForTagMask(tag) {
|
} else if let filter = messageFilterForTagMask(tag) {
|
||||||
requestSignal = network.request(Api.functions.messages.search(flags: 0, peer: inputPeer, q: "", fromId: nil, filter: filter, minDate: 0, maxDate: 0, offsetId: messageIds[messageIds.count - 1].id + 1, addOffset: 0, limit: Int32(messageIds.count), maxId: messageIds[messageIds.count - 1].id + 1, minId: messageIds[0].id - 1, hash: hash))
|
requestSignal = network.request(Api.functions.messages.search(flags: 0, peer: inputPeer, q: "", fromId: nil, topMsgId: nil, filter: filter, minDate: 0, maxDate: 0, offsetId: messageIds[messageIds.count - 1].id + 1, addOffset: 0, limit: Int32(messageIds.count), maxId: messageIds[messageIds.count - 1].id + 1, minId: messageIds[0].id - 1, hash: hash))
|
||||||
} else {
|
} else {
|
||||||
assertionFailure()
|
assertionFailure()
|
||||||
requestSignal = .complete()
|
requestSignal = .complete()
|
||||||
|
@ -352,7 +352,7 @@ func fetchMessageHistoryHole(accountPeerId: PeerId, source: FetchMessageHistoryH
|
|||||||
minMaxRange = 1 ... (Int32.max - 1)
|
minMaxRange = 1 ... (Int32.max - 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
request = source.request(Api.functions.messages.search(flags: 0, peer: inputPeer, q: "", fromId: nil, filter: filter, minDate: 0, maxDate: 0, offsetId: offsetId, addOffset: addOffset, limit: Int32(selectedLimit), maxId: maxId, minId: minId, hash: 0))
|
request = source.request(Api.functions.messages.search(flags: 0, peer: inputPeer, q: "", fromId: nil, topMsgId: nil, filter: filter, minDate: 0, maxDate: 0, offsetId: offsetId, addOffset: addOffset, limit: Int32(selectedLimit), maxId: maxId, minId: minId, hash: 0))
|
||||||
} else {
|
} else {
|
||||||
assertionFailure()
|
assertionFailure()
|
||||||
minMaxRange = 1 ... 1
|
minMaxRange = 1 ... 1
|
||||||
@ -567,7 +567,7 @@ func fetchCallListHole(network: Network, postbox: Postbox, accountPeerId: PeerId
|
|||||||
offset = single((holeIndex.timestamp, min(holeIndex.id.id, Int32.max - 1) + 1, Api.InputPeer.inputPeerEmpty), NoError.self)
|
offset = single((holeIndex.timestamp, min(holeIndex.id.id, Int32.max - 1) + 1, Api.InputPeer.inputPeerEmpty), NoError.self)
|
||||||
return offset
|
return offset
|
||||||
|> mapToSignal { (timestamp, id, peer) -> Signal<Void, NoError> in
|
|> mapToSignal { (timestamp, id, peer) -> Signal<Void, NoError> in
|
||||||
let searchResult = network.request(Api.functions.messages.search(flags: 0, peer: .inputPeerEmpty, q: "", fromId: nil, filter: .inputMessagesFilterPhoneCalls(flags: 0), minDate: 0, maxDate: holeIndex.timestamp, offsetId: 0, addOffset: 0, limit: limit, maxId: holeIndex.id.id, minId: 0, hash: 0))
|
let searchResult = network.request(Api.functions.messages.search(flags: 0, peer: .inputPeerEmpty, q: "", fromId: nil, topMsgId: nil, filter: .inputMessagesFilterPhoneCalls(flags: 0), minDate: 0, maxDate: holeIndex.timestamp, offsetId: 0, addOffset: 0, limit: limit, maxId: holeIndex.id.id, minId: 0, hash: 0))
|
||||||
|> retryRequest
|
|> retryRequest
|
||||||
|> mapToSignal { result -> Signal<Void, NoError> in
|
|> mapToSignal { result -> Signal<Void, NoError> in
|
||||||
let messages: [Api.Message]
|
let messages: [Api.Message]
|
||||||
|
@ -165,7 +165,13 @@ public func updateChannelAdminRights(account: Account, peerId: PeerId, adminId:
|
|||||||
}
|
}
|
||||||
updatedParticipant = .member(id: adminId, invitedAt: invitedAt, adminInfo: adminInfo, banInfo: nil, rank: rank)
|
updatedParticipant = .member(id: adminId, invitedAt: invitedAt, adminInfo: adminInfo, banInfo: nil, rank: rank)
|
||||||
} else if let currentParticipant = currentParticipant, case .creator = currentParticipant {
|
} else if let currentParticipant = currentParticipant, case .creator = currentParticipant {
|
||||||
updatedParticipant = .creator(id: adminId, rank: rank)
|
let adminInfo: ChannelParticipantAdminInfo?
|
||||||
|
if !rights.flags.isEmpty {
|
||||||
|
adminInfo = ChannelParticipantAdminInfo(rights: rights, promotedBy: account.peerId, canBeEditedByAccountPeer: true)
|
||||||
|
} else {
|
||||||
|
adminInfo = nil
|
||||||
|
}
|
||||||
|
updatedParticipant = .creator(id: adminId, adminInfo: adminInfo, rank: rank)
|
||||||
} else {
|
} else {
|
||||||
let adminInfo: ChannelParticipantAdminInfo?
|
let adminInfo: ChannelParticipantAdminInfo?
|
||||||
if !rights.flags.isEmpty {
|
if !rights.flags.isEmpty {
|
||||||
|
@ -61,7 +61,7 @@ public func requestPeerPhotos(postbox: Postbox, network: Network, peerId: PeerId
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if let peer = peer, let inputPeer = apiInputPeer(peer) {
|
} else if let peer = peer, let inputPeer = apiInputPeer(peer) {
|
||||||
return network.request(Api.functions.messages.search(flags: 0, peer: inputPeer, q: "", fromId: nil, filter: .inputMessagesFilterChatPhotos, minDate: 0, maxDate: 0, offsetId: 0, addOffset: 0, limit: 1000, maxId: 0, minId: 0, hash: 0))
|
return network.request(Api.functions.messages.search(flags: 0, peer: inputPeer, q: "", fromId: nil, topMsgId: nil, filter: .inputMessagesFilterChatPhotos, minDate: 0, maxDate: 0, offsetId: 0, addOffset: 0, limit: 1000, maxId: 0, minId: 0, hash: 0))
|
||||||
|> map(Optional.init)
|
|> map(Optional.init)
|
||||||
|> `catch` { _ -> Signal<Api.messages.Messages?, NoError> in
|
|> `catch` { _ -> Signal<Api.messages.Messages?, NoError> in
|
||||||
return .single(nil)
|
return .single(nil)
|
||||||
|
@ -222,12 +222,15 @@ public func searchMessages(account: Account, location: SearchMessagesLocation, q
|
|||||||
flags |= (1 << 0)
|
flags |= (1 << 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if let topMsgId = topMsgId {
|
||||||
|
flags |= (1 << 1)
|
||||||
|
}
|
||||||
let peerMessages: Signal<Api.messages.Messages?, NoError>
|
let peerMessages: Signal<Api.messages.Messages?, NoError>
|
||||||
if let completed = state?.main.completed, completed {
|
if let completed = state?.main.completed, completed {
|
||||||
peerMessages = .single(nil)
|
peerMessages = .single(nil)
|
||||||
} else {
|
} else {
|
||||||
let lowerBound = state?.main.messages.last.flatMap({ $0.index })
|
let lowerBound = state?.main.messages.last.flatMap({ $0.index })
|
||||||
peerMessages = account.network.request(Api.functions.messages.search(flags: flags, peer: inputPeer, q: query, fromId: fromInputUser, filter: filter, minDate: 0, maxDate: Int32.max - 1, offsetId: lowerBound?.id.id ?? 0, addOffset: 0, limit: limit, maxId: Int32.max - 1, minId: 0, hash: 0))
|
peerMessages = account.network.request(Api.functions.messages.search(flags: flags, peer: inputPeer, q: query, fromId: fromInputUser, topMsgId: topMsgId?.id, filter: filter, minDate: 0, maxDate: Int32.max - 1, offsetId: lowerBound?.id.id ?? 0, addOffset: 0, limit: limit, maxId: Int32.max - 1, minId: 0, hash: 0))
|
||||||
|> map(Optional.init)
|
|> map(Optional.init)
|
||||||
|> `catch` { _ -> Signal<Api.messages.Messages?, NoError> in
|
|> `catch` { _ -> Signal<Api.messages.Messages?, NoError> in
|
||||||
return .single(nil)
|
return .single(nil)
|
||||||
@ -241,7 +244,7 @@ public func searchMessages(account: Account, location: SearchMessagesLocation, q
|
|||||||
additionalPeerMessages = .single(nil)
|
additionalPeerMessages = .single(nil)
|
||||||
} else if mainCompleted || !hasAdditional {
|
} else if mainCompleted || !hasAdditional {
|
||||||
let lowerBound = state?.additional?.messages.last.flatMap({ $0.index })
|
let lowerBound = state?.additional?.messages.last.flatMap({ $0.index })
|
||||||
additionalPeerMessages = account.network.request(Api.functions.messages.search(flags: flags, peer: inputPeer, q: query, fromId: fromInputUser, filter: filter, minDate: 0, maxDate: Int32.max - 1, offsetId: lowerBound?.id.id ?? 0, addOffset: 0, limit: limit, maxId: Int32.max - 1, minId: 0, hash: 0))
|
additionalPeerMessages = account.network.request(Api.functions.messages.search(flags: flags, peer: inputPeer, q: query, fromId: fromInputUser, topMsgId: topMsgId?.id, filter: filter, minDate: 0, maxDate: Int32.max - 1, offsetId: lowerBound?.id.id ?? 0, addOffset: 0, limit: limit, maxId: Int32.max - 1, minId: 0, hash: 0))
|
||||||
|> map(Optional.init)
|
|> map(Optional.init)
|
||||||
|> `catch` { _ -> Signal<Api.messages.Messages?, NoError> in
|
|> `catch` { _ -> Signal<Api.messages.Messages?, NoError> in
|
||||||
return .single(nil)
|
return .single(nil)
|
||||||
@ -270,7 +273,7 @@ public func searchMessages(account: Account, location: SearchMessagesLocation, q
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|> mapToSignal { (nextRate, lowerBound, inputPeer) in
|
|> mapToSignal { (nextRate, lowerBound, inputPeer) in
|
||||||
return account.network.request(Api.functions.messages.searchGlobal(flags: 0, folderId: nil, q: query, filter: .inputMessagesFilterEmpty, offsetRate: nextRate, offsetPeer: inputPeer, offsetId: lowerBound?.id.id ?? 0, limit: limit), automaticFloodWait: false)
|
return account.network.request(Api.functions.messages.searchGlobal(flags: 0, folderId: nil, q: query, filter: .inputMessagesFilterEmpty, minDate: 0, maxDate: 0, offsetRate: nextRate, offsetPeer: inputPeer, offsetId: lowerBound?.id.id ?? 0, limit: limit), automaticFloodWait: false)
|
||||||
|> map { result -> (Api.messages.Messages?, Api.messages.Messages?) in
|
|> map { result -> (Api.messages.Messages?, Api.messages.Messages?) in
|
||||||
return (result, nil)
|
return (result, nil)
|
||||||
}
|
}
|
||||||
|
@ -114,8 +114,12 @@ func apiMessagePeerId(_ messsage: Api.Message) -> PeerId? {
|
|||||||
let fromId = message.fromId
|
let fromId = message.fromId
|
||||||
let toId = message.toId
|
let toId = message.toId
|
||||||
switch toId {
|
switch toId {
|
||||||
case let .peerUser(userId):
|
case .peerUser:
|
||||||
return PeerId(namespace: Namespaces.Peer.CloudUser, id: (flags & Int32(2)) != 0 ? userId : (fromId ?? userId))
|
if (flags & Int32(2)) != 0 {
|
||||||
|
return toId.peerId
|
||||||
|
} else {
|
||||||
|
return fromId.peerId
|
||||||
|
}
|
||||||
case let .peerChat(chatId):
|
case let .peerChat(chatId):
|
||||||
return PeerId(namespace: Namespaces.Peer.CloudGroup, id: chatId)
|
return PeerId(namespace: Namespaces.Peer.CloudGroup, id: chatId)
|
||||||
case let .peerChannel(channelId):
|
case let .peerChannel(channelId):
|
||||||
@ -125,8 +129,12 @@ func apiMessagePeerId(_ messsage: Api.Message) -> PeerId? {
|
|||||||
return nil
|
return nil
|
||||||
case let .messageService(flags, _, fromId, toId, _, _, _):
|
case let .messageService(flags, _, fromId, toId, _, _, _):
|
||||||
switch toId {
|
switch toId {
|
||||||
case let .peerUser(userId):
|
case .peerUser:
|
||||||
return PeerId(namespace: Namespaces.Peer.CloudUser, id: (flags & Int32(2)) != 0 ? userId : (fromId ?? userId))
|
if (flags & Int32(2)) != 0 {
|
||||||
|
return toId.peerId
|
||||||
|
} else {
|
||||||
|
return fromId.peerId
|
||||||
|
}
|
||||||
case let .peerChat(chatId):
|
case let .peerChat(chatId):
|
||||||
return PeerId(namespace: Namespaces.Peer.CloudGroup, id: chatId)
|
return PeerId(namespace: Namespaces.Peer.CloudGroup, id: chatId)
|
||||||
case let .peerChannel(channelId):
|
case let .peerChannel(channelId):
|
||||||
@ -140,8 +148,12 @@ func apiMessagePeerIds(_ message: Api.Message) -> [PeerId] {
|
|||||||
case let .message(flags, _, fromId, toId, fwdHeader, viaBotId, _, _, _, _, media, _, entities, _, _, _, _, _, _, _):
|
case let .message(flags, _, fromId, toId, fwdHeader, viaBotId, _, _, _, _, media, _, entities, _, _, _, _, _, _, _):
|
||||||
let peerId: PeerId
|
let peerId: PeerId
|
||||||
switch toId {
|
switch toId {
|
||||||
case let .peerUser(userId):
|
case .peerUser:
|
||||||
peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: (flags & Int32(2)) != 0 ? userId : (fromId ?? userId))
|
if (flags & Int32(2)) != 0 {
|
||||||
|
peerId = toId.peerId
|
||||||
|
} else {
|
||||||
|
peerId = fromId.peerId
|
||||||
|
}
|
||||||
case let .peerChat(chatId):
|
case let .peerChat(chatId):
|
||||||
peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: chatId)
|
peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: chatId)
|
||||||
case let .peerChannel(channelId):
|
case let .peerChannel(channelId):
|
||||||
@ -150,18 +162,15 @@ func apiMessagePeerIds(_ message: Api.Message) -> [PeerId] {
|
|||||||
|
|
||||||
var result = [peerId]
|
var result = [peerId]
|
||||||
|
|
||||||
if let fromId = fromId, PeerId(namespace: Namespaces.Peer.CloudUser, id: fromId) != peerId {
|
if fromId.peerId != peerId {
|
||||||
result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: fromId))
|
result.append(fromId.peerId)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let fwdHeader = fwdHeader {
|
if let fwdHeader = fwdHeader {
|
||||||
switch fwdHeader {
|
switch fwdHeader {
|
||||||
case let .messageFwdHeader(messageFwdHeader):
|
case let .messageFwdHeader(messageFwdHeader):
|
||||||
if let channelId = messageFwdHeader.channelId {
|
|
||||||
result.append(PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId))
|
|
||||||
}
|
|
||||||
if let fromId = messageFwdHeader.fromId {
|
if let fromId = messageFwdHeader.fromId {
|
||||||
result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: fromId))
|
result.append(fromId.peerId)
|
||||||
}
|
}
|
||||||
if let savedFromPeer = messageFwdHeader.savedFromPeer {
|
if let savedFromPeer = messageFwdHeader.savedFromPeer {
|
||||||
result.append(savedFromPeer.peerId)
|
result.append(savedFromPeer.peerId)
|
||||||
@ -201,8 +210,12 @@ func apiMessagePeerIds(_ message: Api.Message) -> [PeerId] {
|
|||||||
case let .messageService(flags, _, fromId, toId, _, _, action):
|
case let .messageService(flags, _, fromId, toId, _, _, action):
|
||||||
let peerId: PeerId
|
let peerId: PeerId
|
||||||
switch toId {
|
switch toId {
|
||||||
case let .peerUser(userId):
|
case .peerUser:
|
||||||
peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: (flags & Int32(2)) != 0 ? userId : (fromId ?? userId))
|
if (flags & Int32(2)) != 0 {
|
||||||
|
peerId = toId.peerId
|
||||||
|
} else {
|
||||||
|
peerId = fromId.peerId
|
||||||
|
}
|
||||||
case let .peerChat(chatId):
|
case let .peerChat(chatId):
|
||||||
peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: chatId)
|
peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: chatId)
|
||||||
case let .peerChannel(channelId):
|
case let .peerChannel(channelId):
|
||||||
@ -210,8 +223,8 @@ func apiMessagePeerIds(_ message: Api.Message) -> [PeerId] {
|
|||||||
}
|
}
|
||||||
var result = [peerId]
|
var result = [peerId]
|
||||||
|
|
||||||
if let fromId = fromId, PeerId(namespace: Namespaces.Peer.CloudUser, id: fromId) != peerId {
|
if fromId.peerId != peerId {
|
||||||
result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: fromId))
|
result.append(fromId.peerId)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch action {
|
switch action {
|
||||||
@ -245,8 +258,12 @@ func apiMessageAssociatedMessageIds(_ message: Api.Message) -> [MessageId]? {
|
|||||||
if let replyToMsgId = replyToMsgId {
|
if let replyToMsgId = replyToMsgId {
|
||||||
let peerId: PeerId
|
let peerId: PeerId
|
||||||
switch toId {
|
switch toId {
|
||||||
case let .peerUser(userId):
|
case .peerUser:
|
||||||
peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: (flags & Int32(2)) != 0 ? userId : (fromId ?? userId))
|
if (flags & Int32(2)) != 0 {
|
||||||
|
peerId = toId.peerId
|
||||||
|
} else {
|
||||||
|
peerId = fromId.peerId
|
||||||
|
}
|
||||||
case let .peerChat(chatId):
|
case let .peerChat(chatId):
|
||||||
peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: chatId)
|
peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: chatId)
|
||||||
case let .peerChannel(channelId):
|
case let .peerChannel(channelId):
|
||||||
@ -261,8 +278,12 @@ func apiMessageAssociatedMessageIds(_ message: Api.Message) -> [MessageId]? {
|
|||||||
if let replyToMsgId = replyToMsgId {
|
if let replyToMsgId = replyToMsgId {
|
||||||
let peerId: PeerId
|
let peerId: PeerId
|
||||||
switch toId {
|
switch toId {
|
||||||
case let .peerUser(userId):
|
case .peerUser:
|
||||||
peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: (flags & Int32(2)) != 0 ? userId : (fromId ?? userId))
|
if (flags & Int32(2)) != 0 {
|
||||||
|
peerId = toId.peerId
|
||||||
|
} else {
|
||||||
|
peerId = fromId.peerId
|
||||||
|
}
|
||||||
case let .peerChat(chatId):
|
case let .peerChat(chatId):
|
||||||
peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: chatId)
|
peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: chatId)
|
||||||
case let .peerChannel(channelId):
|
case let .peerChannel(channelId):
|
||||||
@ -403,27 +424,19 @@ extension StoreMessage {
|
|||||||
let peerId: PeerId
|
let peerId: PeerId
|
||||||
var authorId: PeerId?
|
var authorId: PeerId?
|
||||||
switch toId {
|
switch toId {
|
||||||
case let .peerUser(userId):
|
case .peerUser:
|
||||||
peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: (flags & Int32(2)) != 0 ? userId : (fromId ?? userId))
|
if (flags & Int32(2)) != 0 {
|
||||||
if let fromId = fromId {
|
peerId = toId.peerId
|
||||||
authorId = PeerId(namespace: Namespaces.Peer.CloudUser, id: fromId)
|
|
||||||
} else {
|
} else {
|
||||||
authorId = peerId
|
peerId = fromId.peerId
|
||||||
}
|
}
|
||||||
|
authorId = fromId.peerId
|
||||||
case let .peerChat(chatId):
|
case let .peerChat(chatId):
|
||||||
peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: chatId)
|
peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: chatId)
|
||||||
if let fromId = fromId {
|
authorId = fromId.peerId
|
||||||
authorId = PeerId(namespace: Namespaces.Peer.CloudUser, id: fromId)
|
|
||||||
} else {
|
|
||||||
authorId = peerId
|
|
||||||
}
|
|
||||||
case let .peerChannel(channelId):
|
case let .peerChannel(channelId):
|
||||||
peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId)
|
peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId)
|
||||||
if let fromId = fromId {
|
authorId = fromId.peerId
|
||||||
authorId = PeerId(namespace: Namespaces.Peer.CloudUser, id: fromId)
|
|
||||||
} else {
|
|
||||||
authorId = peerId
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var attributes: [MessageAttribute] = []
|
var attributes: [MessageAttribute] = []
|
||||||
@ -431,20 +444,22 @@ extension StoreMessage {
|
|||||||
var forwardInfo: StoreMessageForwardInfo?
|
var forwardInfo: StoreMessageForwardInfo?
|
||||||
if let fwdFrom = fwdFrom {
|
if let fwdFrom = fwdFrom {
|
||||||
switch fwdFrom {
|
switch fwdFrom {
|
||||||
case let .messageFwdHeader(_, fromId, fromName, date, channelId, channelPost, postAuthor, savedFromPeer, savedFromMsgId, psaType):
|
case let .messageFwdHeader(_, fromId, fromName, date, channelPost, postAuthor, savedFromPeer, savedFromMsgId, psaType):
|
||||||
var authorId: PeerId?
|
var authorId: PeerId?
|
||||||
var sourceId: PeerId?
|
var sourceId: PeerId?
|
||||||
var sourceMessageId: MessageId?
|
var sourceMessageId: MessageId?
|
||||||
|
|
||||||
if let fromId = fromId {
|
if let fromId = fromId {
|
||||||
authorId = PeerId(namespace: Namespaces.Peer.CloudUser, id: fromId)
|
switch fromId {
|
||||||
}
|
case .peerChannel:
|
||||||
if let channelId = channelId {
|
let peerId = fromId.peerId
|
||||||
let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId)
|
sourceId = peerId
|
||||||
sourceId = peerId
|
|
||||||
|
if let channelPost = channelPost {
|
||||||
if let channelPost = channelPost {
|
sourceMessageId = MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: channelPost)
|
||||||
sourceMessageId = MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: channelPost)
|
}
|
||||||
|
default:
|
||||||
|
authorId = fromId.peerId
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -639,27 +654,19 @@ extension StoreMessage {
|
|||||||
let peerId: PeerId
|
let peerId: PeerId
|
||||||
var authorId: PeerId?
|
var authorId: PeerId?
|
||||||
switch toId {
|
switch toId {
|
||||||
case let .peerUser(userId):
|
case .peerUser:
|
||||||
peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: (flags & Int32(2)) != 0 ? userId : (fromId ?? userId))
|
if (flags & Int32(2)) != 0 {
|
||||||
if let fromId = fromId {
|
peerId = toId.peerId
|
||||||
authorId = PeerId(namespace: Namespaces.Peer.CloudUser, id: fromId)
|
|
||||||
} else {
|
} else {
|
||||||
authorId = peerId
|
peerId = fromId.peerId
|
||||||
}
|
}
|
||||||
|
authorId = fromId.peerId
|
||||||
case let .peerChat(chatId):
|
case let .peerChat(chatId):
|
||||||
peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: chatId)
|
peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: chatId)
|
||||||
if let fromId = fromId {
|
authorId = fromId.peerId
|
||||||
authorId = PeerId(namespace: Namespaces.Peer.CloudUser, id: fromId)
|
|
||||||
} else {
|
|
||||||
authorId = peerId
|
|
||||||
}
|
|
||||||
case let .peerChannel(channelId):
|
case let .peerChannel(channelId):
|
||||||
peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId)
|
peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId)
|
||||||
if let fromId = fromId {
|
authorId = fromId.peerId
|
||||||
authorId = PeerId(namespace: Namespaces.Peer.CloudUser, id: fromId)
|
|
||||||
} else {
|
|
||||||
authorId = peerId
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var attributes: [MessageAttribute] = []
|
var attributes: [MessageAttribute] = []
|
||||||
|
@ -58,7 +58,7 @@ class UpdateMessageService: NSObject, MTMessageService {
|
|||||||
self.putNext(groups)
|
self.putNext(groups)
|
||||||
}
|
}
|
||||||
case let .updateShortChatMessage(flags, id, fromId, chatId, message, pts, ptsCount, date, fwdFrom, viaBotId, replyToMsgId, entities):
|
case let .updateShortChatMessage(flags, id, fromId, chatId, message, pts, ptsCount, date, fwdFrom, viaBotId, replyToMsgId, entities):
|
||||||
let generatedMessage = Api.Message.message(flags: flags, id: id, fromId: fromId, toId: Api.Peer.peerChat(chatId: chatId), fwdFrom: fwdFrom, viaBotId: viaBotId, replyToMsgId: replyToMsgId, replyToTopId: nil, date: date, message: message, media: Api.MessageMedia.messageMediaEmpty, replyMarkup: nil, entities: entities, views: nil, forwards: nil, replies: nil, editDate: nil, postAuthor: nil, groupedId: nil, restrictionReason: nil)
|
let generatedMessage = Api.Message.message(flags: flags, id: id, fromId: .peerChat(chatId: fromId), toId: Api.Peer.peerChat(chatId: chatId), fwdFrom: fwdFrom, viaBotId: viaBotId, replyToMsgId: replyToMsgId, replyToTopId: nil, date: date, message: message, media: Api.MessageMedia.messageMediaEmpty, replyMarkup: nil, entities: entities, views: nil, forwards: nil, replies: nil, editDate: nil, postAuthor: nil, groupedId: nil, restrictionReason: nil)
|
||||||
let update = Api.Update.updateNewMessage(message: generatedMessage, pts: pts, ptsCount: ptsCount)
|
let update = Api.Update.updateNewMessage(message: generatedMessage, pts: pts, ptsCount: ptsCount)
|
||||||
let groups = groupUpdates([update], users: [], chats: [], date: date, seqRange: nil)
|
let groups = groupUpdates([update], users: [], chats: [], date: date, seqRange: nil)
|
||||||
if groups.count != 0 {
|
if groups.count != 0 {
|
||||||
@ -75,7 +75,7 @@ class UpdateMessageService: NSObject, MTMessageService {
|
|||||||
generatedToId = Api.Peer.peerUser(userId: self.peerId.id)
|
generatedToId = Api.Peer.peerUser(userId: self.peerId.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
let generatedMessage = Api.Message.message(flags: flags, id: id, fromId: generatedFromId, toId: generatedToId, fwdFrom: fwdFrom, viaBotId: viaBotId, replyToMsgId: replyToMsgId, replyToTopId: nil, date: date, message: message, media: Api.MessageMedia.messageMediaEmpty, replyMarkup: nil, entities: entities, views: nil, forwards: nil, replies: nil, editDate: nil, postAuthor: nil, groupedId: nil, restrictionReason: nil)
|
let generatedMessage = Api.Message.message(flags: flags, id: id, fromId: .peerUser(userId: userId), toId: generatedToId, fwdFrom: fwdFrom, viaBotId: viaBotId, replyToMsgId: replyToMsgId, replyToTopId: nil, date: date, message: message, media: Api.MessageMedia.messageMediaEmpty, replyMarkup: nil, entities: entities, views: nil, forwards: nil, replies: nil, editDate: nil, postAuthor: nil, groupedId: nil, restrictionReason: nil)
|
||||||
let update = Api.Update.updateNewMessage(message: generatedMessage, pts: pts, ptsCount: ptsCount)
|
let update = Api.Update.updateNewMessage(message: generatedMessage, pts: pts, ptsCount: ptsCount)
|
||||||
let groups = groupUpdates([update], users: [], chats: [], date: date, seqRange: nil)
|
let groups = groupUpdates([update], users: [], chats: [], date: date, seqRange: nil)
|
||||||
if groups.count != 0 {
|
if groups.count != 0 {
|
||||||
|
@ -117,13 +117,17 @@ extension Api.Message {
|
|||||||
let peerId: PeerId
|
let peerId: PeerId
|
||||||
switch toId {
|
switch toId {
|
||||||
case let .peerUser(userId):
|
case let .peerUser(userId):
|
||||||
let id: PeerId.Id
|
let id: PeerId
|
||||||
if namespace == Namespaces.Message.ScheduledCloud {
|
if namespace == Namespaces.Message.ScheduledCloud {
|
||||||
id = userId
|
id = PeerId(namespace: Namespaces.Peer.CloudUser, id: userId)
|
||||||
} else {
|
} else {
|
||||||
id = (flags & Int32(2)) != 0 ? userId : (fromId ?? userId)
|
if (flags & Int32(2)) != 0 {
|
||||||
|
id = PeerId(namespace: Namespaces.Peer.CloudUser, id: userId)
|
||||||
|
} else {
|
||||||
|
id = fromId.peerId
|
||||||
|
}
|
||||||
}
|
}
|
||||||
peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: id)
|
peerId = id
|
||||||
case let .peerChat(chatId):
|
case let .peerChat(chatId):
|
||||||
peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: chatId)
|
peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: chatId)
|
||||||
case let .peerChannel(channelId):
|
case let .peerChannel(channelId):
|
||||||
@ -136,7 +140,17 @@ extension Api.Message {
|
|||||||
let peerId: PeerId
|
let peerId: PeerId
|
||||||
switch toId {
|
switch toId {
|
||||||
case let .peerUser(userId):
|
case let .peerUser(userId):
|
||||||
peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: (flags & Int32(2)) != 0 ? userId : (fromId ?? userId))
|
let id: PeerId
|
||||||
|
if namespace == Namespaces.Message.ScheduledCloud {
|
||||||
|
id = PeerId(namespace: Namespaces.Peer.CloudUser, id: userId)
|
||||||
|
} else {
|
||||||
|
if (flags & Int32(2)) != 0 {
|
||||||
|
id = PeerId(namespace: Namespaces.Peer.CloudUser, id: userId)
|
||||||
|
} else {
|
||||||
|
id = fromId.peerId
|
||||||
|
}
|
||||||
|
}
|
||||||
|
peerId = id
|
||||||
case let .peerChat(chatId):
|
case let .peerChat(chatId):
|
||||||
peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: chatId)
|
peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: chatId)
|
||||||
case let .peerChannel(channelId):
|
case let .peerChannel(channelId):
|
||||||
|
@ -7717,11 +7717,11 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
}
|
}
|
||||||
switch search.domain {
|
switch search.domain {
|
||||||
case .everything:
|
case .everything:
|
||||||
derivedSearchState = ChatSearchState(query: search.query, location: .peer(peerId: self.chatLocation.peerId, fromId: nil, tags: nil), loadMoreState: loadMoreStateFromResultsState(search.resultsState))
|
derivedSearchState = ChatSearchState(query: search.query, location: .peer(peerId: self.chatLocation.peerId, fromId: nil, tags: nil, topMsgId: nil), loadMoreState: loadMoreStateFromResultsState(search.resultsState))
|
||||||
case .members:
|
case .members:
|
||||||
derivedSearchState = nil
|
derivedSearchState = nil
|
||||||
case let .member(peer):
|
case let .member(peer):
|
||||||
derivedSearchState = ChatSearchState(query: search.query, location: .peer(peerId: self.chatLocation.peerId, fromId: peer.id, tags: nil), loadMoreState: loadMoreStateFromResultsState(search.resultsState))
|
derivedSearchState = ChatSearchState(query: search.query, location: .peer(peerId: self.chatLocation.peerId, fromId: peer.id, tags: nil, topMsgId: nil), loadMoreState: loadMoreStateFromResultsState(search.resultsState))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7732,7 +7732,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
if previousSearchState?.query != searchState.query || previousSearchState?.location != searchState.location {
|
if previousSearchState?.query != searchState.query || previousSearchState?.location != searchState.location {
|
||||||
var queryIsEmpty = false
|
var queryIsEmpty = false
|
||||||
if searchState.query.isEmpty {
|
if searchState.query.isEmpty {
|
||||||
if case let .peer(_, fromId, _) = searchState.location {
|
if case let .peer(_, fromId, _, _) = searchState.location {
|
||||||
if fromId == nil {
|
if fromId == nil {
|
||||||
queryIsEmpty = true
|
queryIsEmpty = true
|
||||||
}
|
}
|
||||||
|
@ -2156,7 +2156,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
func loadInputPanels(theme: PresentationTheme, strings: PresentationStrings, fontSize: PresentationFontSize) {
|
func loadInputPanels(theme: PresentationTheme, strings: PresentationStrings, fontSize: PresentationFontSize) {
|
||||||
if self.inputMediaNode == nil {
|
if self.inputMediaNode == nil {
|
||||||
let peerId: PeerId? = self.chatPresentationInterfaceState.chatLocation.peerId
|
let peerId: PeerId? = self.chatPresentationInterfaceState.chatLocation.peerId
|
||||||
let inputNode = ChatMediaInputNode(context: self.context, peerId: peerId, controllerInteraction: self.controllerInteraction, chatWallpaper: self.chatPresentationInterfaceState.chatWallpaper, theme: theme, strings: strings, fontSize: fontSize, gifPaneIsActiveUpdated: { [weak self] value in
|
let inputNode = ChatMediaInputNode(context: self.context, peerId: peerId, chatLocation: self.chatPresentationInterfaceState.chatLocation, controllerInteraction: self.controllerInteraction, chatWallpaper: self.chatPresentationInterfaceState.chatWallpaper, theme: theme, strings: strings, fontSize: fontSize, gifPaneIsActiveUpdated: { [weak self] value in
|
||||||
if let strongSelf = self, let interfaceInteraction = strongSelf.interfaceInteraction {
|
if let strongSelf = self, let interfaceInteraction = strongSelf.interfaceInteraction {
|
||||||
interfaceInteraction.updateInputModeAndDismissedButtonKeyboardMessageId { state in
|
interfaceInteraction.updateInputModeAndDismissedButtonKeyboardMessageId { state in
|
||||||
if case let .media(_, expanded) = state.inputMode {
|
if case let .media(_, expanded) = state.inputMode {
|
||||||
|
@ -185,7 +185,7 @@ final class ChatHistorySearchContainerNode: SearchDisplayControllerContentNode {
|
|||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
let signal: Signal<([ChatHistorySearchEntry], [MessageId: Message])?, NoError>
|
let signal: Signal<([ChatHistorySearchEntry], [MessageId: Message])?, NoError>
|
||||||
if let query = query, !query.isEmpty {
|
if let query = query, !query.isEmpty {
|
||||||
let foundRemoteMessages: Signal<[Message], NoError> = searchMessages(account: context.account, location: .peer(peerId: peerId, fromId: nil, tags: tagMask), query: query, state: nil)
|
let foundRemoteMessages: Signal<[Message], NoError> = searchMessages(account: context.account, location: .peer(peerId: peerId, fromId: nil, tags: tagMask, topMsgId: nil), query: query, state: nil)
|
||||||
|> map { $0.0.messages }
|
|> map { $0.0.messages }
|
||||||
|> delay(0.2, queue: Queue.concurrentDefaultQueue())
|
|> delay(0.2, queue: Queue.concurrentDefaultQueue())
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ func inputNodeForChatPresentationIntefaceState(_ chatPresentationInterfaceState:
|
|||||||
if case let .peer(id) = chatPresentationInterfaceState.chatLocation {
|
if case let .peer(id) = chatPresentationInterfaceState.chatLocation {
|
||||||
peerId = id
|
peerId = id
|
||||||
}
|
}
|
||||||
let inputNode = ChatMediaInputNode(context: context, peerId: peerId, controllerInteraction: controllerInteraction, chatWallpaper: chatPresentationInterfaceState.chatWallpaper, theme: chatPresentationInterfaceState.theme, strings: chatPresentationInterfaceState.strings, fontSize: chatPresentationInterfaceState.fontSize, gifPaneIsActiveUpdated: { [weak interfaceInteraction] value in
|
let inputNode = ChatMediaInputNode(context: context, peerId: peerId, chatLocation: chatPresentationInterfaceState.chatLocation, controllerInteraction: controllerInteraction, chatWallpaper: chatPresentationInterfaceState.chatWallpaper, theme: chatPresentationInterfaceState.theme, strings: chatPresentationInterfaceState.strings, fontSize: chatPresentationInterfaceState.fontSize, gifPaneIsActiveUpdated: { [weak interfaceInteraction] value in
|
||||||
if let interfaceInteraction = interfaceInteraction {
|
if let interfaceInteraction = interfaceInteraction {
|
||||||
interfaceInteraction.updateInputModeAndDismissedButtonKeyboardMessageId { state in
|
interfaceInteraction.updateInputModeAndDismissedButtonKeyboardMessageId { state in
|
||||||
if case let .media(_, expanded) = state.inputMode {
|
if case let .media(_, expanded) = state.inputMode {
|
||||||
|
@ -474,7 +474,7 @@ final class ChatMediaInputNode: ChatInputNode {
|
|||||||
return self._ready.get()
|
return self._ready.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
init(context: AccountContext, peerId: PeerId?, controllerInteraction: ChatControllerInteraction, chatWallpaper: TelegramWallpaper, theme: PresentationTheme, strings: PresentationStrings, fontSize: PresentationFontSize, gifPaneIsActiveUpdated: @escaping (Bool) -> Void) {
|
init(context: AccountContext, peerId: PeerId?, chatLocation: ChatLocation?, controllerInteraction: ChatControllerInteraction, chatWallpaper: TelegramWallpaper, theme: PresentationTheme, strings: PresentationStrings, fontSize: PresentationFontSize, gifPaneIsActiveUpdated: @escaping (Bool) -> Void) {
|
||||||
self.context = context
|
self.context = context
|
||||||
self.peerId = peerId
|
self.peerId = peerId
|
||||||
self.controllerInteraction = controllerInteraction
|
self.controllerInteraction = controllerInteraction
|
||||||
@ -752,7 +752,7 @@ final class ChatMediaInputNode: ChatInputNode {
|
|||||||
|
|
||||||
let inputNodeInteraction = self.inputNodeInteraction!
|
let inputNodeInteraction = self.inputNodeInteraction!
|
||||||
let peerSpecificPack: Signal<(PeerSpecificPackData?, CanInstallPeerSpecificPack), NoError>
|
let peerSpecificPack: Signal<(PeerSpecificPackData?, CanInstallPeerSpecificPack), NoError>
|
||||||
if let peerId = peerId {
|
if let peerId = peerId, case .peer = chatLocation {
|
||||||
self.dismissedPeerSpecificStickerPack.set(context.account.postbox.transaction { transaction -> Bool in
|
self.dismissedPeerSpecificStickerPack.set(context.account.postbox.transaction { transaction -> Bool in
|
||||||
guard let state = transaction.getPeerChatInterfaceState(peerId) as? ChatInterfaceState else {
|
guard let state = transaction.getPeerChatInterfaceState(peerId) as? ChatInterfaceState else {
|
||||||
return false
|
return false
|
||||||
|
@ -649,7 +649,7 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
|||||||
} else {
|
} else {
|
||||||
var appendedRightsHeader = false
|
var appendedRightsHeader = false
|
||||||
|
|
||||||
if case let .creator(_, prevRank) = prev.participant, case let .creator(_, newRank) = new.participant, prevRank != newRank {
|
if case let .creator(_, _, prevRank) = prev.participant, case let .creator(_, _, newRank) = new.participant, prevRank != newRank {
|
||||||
appendAttributedText(text: new.peer.addressName == nil ? self.presentationData.strings.Channel_AdminLog_MessageRankName(new.peer.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder), newRank ?? "") : self.presentationData.strings.Channel_AdminLog_MessageRankUsername(new.peer.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder), "@" + new.peer.addressName!, newRank ?? ""), generateEntities: { index in
|
appendAttributedText(text: new.peer.addressName == nil ? self.presentationData.strings.Channel_AdminLog_MessageRankName(new.peer.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder), newRank ?? "") : self.presentationData.strings.Channel_AdminLog_MessageRankUsername(new.peer.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder), "@" + new.peer.addressName!, newRank ?? ""), generateEntities: { index in
|
||||||
var result: [MessageTextEntityType] = []
|
var result: [MessageTextEntityType] = []
|
||||||
if index == 0 {
|
if index == 0 {
|
||||||
|
@ -93,7 +93,7 @@ private func isParticipantMember(_ participant: ChannelParticipant, infoIsMember
|
|||||||
private extension CachedChannelAdminRank {
|
private extension CachedChannelAdminRank {
|
||||||
init(participant: ChannelParticipant) {
|
init(participant: ChannelParticipant) {
|
||||||
switch participant {
|
switch participant {
|
||||||
case let .creator(_, rank):
|
case let .creator(_, _, rank):
|
||||||
if let rank = rank {
|
if let rank = rank {
|
||||||
self = .custom(rank)
|
self = .custom(rank)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user