mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Update API
This commit is contained in:
parent
41ea1fb330
commit
96256c99bb
@ -6059,7 +6059,6 @@ Sorry for the inconvenience.";
|
||||
|
||||
"Channel.AdminLog.CanInviteUsersViaLink" = "Invite Users via Link";
|
||||
|
||||
|
||||
"BroadcastGroups.IntroTitle" = "Broadcast Groups";
|
||||
"BroadcastGroups.IntroText" = "• No limit on the number of members.\n\n• Only admins can post.\n\n• Can't be turned back into a regular group.";
|
||||
"BroadcastGroups.Convert" = "Convert to Broadcast Group";
|
||||
|
@ -653,9 +653,9 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[-1670052855] = { return Api.FoundGif.parse_foundGifCached($0) }
|
||||
dict[537022650] = { return Api.User.parse_userEmpty($0) }
|
||||
dict[-1820043071] = { return Api.User.parse_user($0) }
|
||||
dict[678405636] = { return Api.Message.parse_messageService($0) }
|
||||
dict[-1868117372] = { return Api.Message.parse_messageEmpty($0) }
|
||||
dict[-1125940270] = { return Api.Message.parse_message($0) }
|
||||
dict[721967202] = { return Api.Message.parse_messageService($0) }
|
||||
dict[831924812] = { return Api.StatsGroupTopInviter.parse_statsGroupTopInviter($0) }
|
||||
dict[186120336] = { return Api.messages.RecentStickers.parse_recentStickersNotModified($0) }
|
||||
dict[586395571] = { return Api.messages.RecentStickers.parse_recentStickers($0) }
|
||||
|
@ -16706,24 +16706,12 @@ public extension Api {
|
||||
|
||||
}
|
||||
public enum Message: TypeConstructorDescription {
|
||||
case messageService(flags: Int32, id: Int32, fromId: Api.Peer?, peerId: Api.Peer, replyTo: Api.MessageReplyHeader?, date: Int32, action: Api.MessageAction)
|
||||
case messageEmpty(flags: Int32, id: Int32, peerId: Api.Peer?)
|
||||
case message(flags: Int32, id: Int32, fromId: Api.Peer?, peerId: Api.Peer, fwdFrom: Api.MessageFwdHeader?, viaBotId: Int32?, replyTo: Api.MessageReplyHeader?, 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]?, ttlPeriod: Int32?)
|
||||
case messageService(flags: Int32, id: Int32, fromId: Api.Peer?, peerId: Api.Peer, replyTo: Api.MessageReplyHeader?, date: Int32, action: Api.MessageAction, ttlPeriod: Int32?)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .messageService(let flags, let id, let fromId, let peerId, let replyTo, let date, let action):
|
||||
if boxed {
|
||||
buffer.appendInt32(678405636)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeInt32(id, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 8) != 0 {fromId!.serialize(buffer, true)}
|
||||
peerId.serialize(buffer, true)
|
||||
if Int(flags) & Int(1 << 3) != 0 {replyTo!.serialize(buffer, true)}
|
||||
serializeInt32(date, buffer: buffer, boxed: false)
|
||||
action.serialize(buffer, true)
|
||||
break
|
||||
case .messageEmpty(let flags, let id, let peerId):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1868117372)
|
||||
@ -16765,57 +16753,33 @@ public extension Api {
|
||||
}}
|
||||
if Int(flags) & Int(1 << 25) != 0 {serializeInt32(ttlPeriod!, buffer: buffer, boxed: false)}
|
||||
break
|
||||
case .messageService(let flags, let id, let fromId, let peerId, let replyTo, let date, let action, let ttlPeriod):
|
||||
if boxed {
|
||||
buffer.appendInt32(721967202)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeInt32(id, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 8) != 0 {fromId!.serialize(buffer, true)}
|
||||
peerId.serialize(buffer, true)
|
||||
if Int(flags) & Int(1 << 3) != 0 {replyTo!.serialize(buffer, true)}
|
||||
serializeInt32(date, buffer: buffer, boxed: false)
|
||||
action.serialize(buffer, true)
|
||||
if Int(flags) & Int(1 << 25) != 0 {serializeInt32(ttlPeriod!, buffer: buffer, boxed: false)}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .messageService(let flags, let id, let fromId, let peerId, let replyTo, let date, let action):
|
||||
return ("messageService", [("flags", flags), ("id", id), ("fromId", fromId), ("peerId", peerId), ("replyTo", replyTo), ("date", date), ("action", action)])
|
||||
case .messageEmpty(let flags, let id, let peerId):
|
||||
return ("messageEmpty", [("flags", flags), ("id", id), ("peerId", peerId)])
|
||||
case .message(let flags, let id, let fromId, let peerId, let fwdFrom, let viaBotId, let replyTo, let date, let message, let media, let replyMarkup, let entities, let views, let forwards, let replies, let editDate, let postAuthor, let groupedId, let restrictionReason, let ttlPeriod):
|
||||
return ("message", [("flags", flags), ("id", id), ("fromId", fromId), ("peerId", peerId), ("fwdFrom", fwdFrom), ("viaBotId", viaBotId), ("replyTo", replyTo), ("date", date), ("message", message), ("media", media), ("replyMarkup", replyMarkup), ("entities", entities), ("views", views), ("forwards", forwards), ("replies", replies), ("editDate", editDate), ("postAuthor", postAuthor), ("groupedId", groupedId), ("restrictionReason", restrictionReason), ("ttlPeriod", ttlPeriod)])
|
||||
case .messageService(let flags, let id, let fromId, let peerId, let replyTo, let date, let action, let ttlPeriod):
|
||||
return ("messageService", [("flags", flags), ("id", id), ("fromId", fromId), ("peerId", peerId), ("replyTo", replyTo), ("date", date), ("action", action), ("ttlPeriod", ttlPeriod)])
|
||||
}
|
||||
}
|
||||
|
||||
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 Int(_1!) & Int(1 << 8) != 0 {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: Api.MessageReplyHeader?
|
||||
if Int(_1!) & Int(1 << 3) != 0 {if let signature = reader.readInt32() {
|
||||
_5 = Api.parse(reader, signature: signature) as? Api.MessageReplyHeader
|
||||
} }
|
||||
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, peerId: _4!, replyTo: _5, date: _6!, action: _7!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_messageEmpty(_ reader: BufferReader) -> Message? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
@ -16921,6 +16885,46 @@ public extension Api {
|
||||
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 Int(_1!) & Int(1 << 8) != 0 {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: Api.MessageReplyHeader?
|
||||
if Int(_1!) & Int(1 << 3) != 0 {if let signature = reader.readInt32() {
|
||||
_5 = Api.parse(reader, signature: signature) as? Api.MessageReplyHeader
|
||||
} }
|
||||
var _6: Int32?
|
||||
_6 = reader.readInt32()
|
||||
var _7: Api.MessageAction?
|
||||
if let signature = reader.readInt32() {
|
||||
_7 = Api.parse(reader, signature: signature) as? Api.MessageAction
|
||||
}
|
||||
var _8: Int32?
|
||||
if Int(_1!) & Int(1 << 25) != 0 {_8 = reader.readInt32() }
|
||||
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
|
||||
let _c8 = (Int(_1!) & Int(1 << 25) == 0) || _8 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
|
||||
return Api.Message.messageService(flags: _1!, id: _2!, fromId: _3, peerId: _4!, replyTo: _5, date: _6!, action: _7!, ttlPeriod: _8)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public enum StatsGroupTopInviter: TypeConstructorDescription {
|
||||
|
@ -4456,21 +4456,6 @@ public extension Api {
|
||||
})
|
||||
}
|
||||
|
||||
public static func deleteHistory(channel: Api.InputChannel, maxId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(-1355375294)
|
||||
channel.serialize(buffer, true)
|
||||
serializeInt32(maxId, buffer: buffer, boxed: false)
|
||||
return (FunctionDescription(name: "channels.deleteHistory", parameters: [("channel", channel), ("maxId", maxId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.Bool?
|
||||
if let signature = reader.readInt32() {
|
||||
result = Api.parse(reader, signature: signature) as? Api.Bool
|
||||
}
|
||||
return result
|
||||
})
|
||||
}
|
||||
|
||||
public static func togglePreHistoryHidden(channel: Api.InputChannel, enabled: Api.Bool) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(-356796084)
|
||||
@ -4721,6 +4706,22 @@ public extension Api {
|
||||
return result
|
||||
})
|
||||
}
|
||||
|
||||
public static func deleteHistory(flags: Int32, channel: Api.InputChannel, maxId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(-1113317569)
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
channel.serialize(buffer, true)
|
||||
serializeInt32(maxId, buffer: buffer, boxed: false)
|
||||
return (FunctionDescription(name: "channels.deleteHistory", parameters: [("flags", flags), ("channel", channel), ("maxId", maxId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.Bool?
|
||||
if let signature = reader.readInt32() {
|
||||
result = Api.parse(reader, signature: signature) as? Api.Bool
|
||||
}
|
||||
return result
|
||||
})
|
||||
}
|
||||
}
|
||||
public struct payments {
|
||||
public static func getPaymentForm(msgId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.payments.PaymentForm>) {
|
||||
|
@ -384,7 +384,8 @@ private func clearHistory(transaction: Transaction, postbox: Postbox, network: N
|
||||
return .complete()
|
||||
}
|
||||
} else if peer.id.namespace == Namespaces.Peer.CloudChannel, let inputChannel = apiInputChannel(peer) {
|
||||
return network.request(Api.functions.channels.deleteHistory(channel: inputChannel, maxId: operation.topMessageId.id))
|
||||
var flags: Int32 = 0
|
||||
return network.request(Api.functions.channels.deleteHistory(flags: flags, channel: inputChannel, maxId: operation.topMessageId.id))
|
||||
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
||||
return .single(.boolFalse)
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ func apiMessagePeerId(_ messsage: Api.Message) -> PeerId? {
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
case let .messageService(flags, _, fromId, chatPeerId, _, _, _):
|
||||
case let .messageService(flags, _, fromId, chatPeerId, _, _, _, _):
|
||||
return chatPeerId.peerId
|
||||
}
|
||||
}
|
||||
@ -185,7 +185,7 @@ func apiMessagePeerIds(_ message: Api.Message) -> [PeerId] {
|
||||
return result
|
||||
case .messageEmpty:
|
||||
return []
|
||||
case let .messageService(flags, _, fromId, chatPeerId, _, _, action):
|
||||
case let .messageService(flags, _, fromId, chatPeerId, _, _, action, _):
|
||||
let peerId: PeerId = chatPeerId.peerId
|
||||
var result = [peerId]
|
||||
|
||||
@ -240,7 +240,7 @@ func apiMessageAssociatedMessageIds(_ message: Api.Message) -> [MessageId]? {
|
||||
}
|
||||
case .messageEmpty:
|
||||
break
|
||||
case let .messageService(_, _, _, chatPeerId, replyHeader, _, _):
|
||||
case let .messageService(_, _, _, chatPeerId, replyHeader, _, _, _):
|
||||
if let replyHeader = replyHeader {
|
||||
switch replyHeader {
|
||||
case let .messageReplyHeader(_, replyToMsgId, replyToPeerId, _):
|
||||
@ -620,7 +620,7 @@ extension StoreMessage {
|
||||
self.init(id: MessageId(peerId: peerId, namespace: namespace, id: id), globallyUniqueId: nil, groupingKey: groupingId, threadId: threadId, timestamp: date, flags: storeFlags, tags: tags, globalTags: globalTags, localTags: [], forwardInfo: forwardInfo, authorId: authorId, text: messageText, attributes: attributes, media: medias)
|
||||
case .messageEmpty:
|
||||
return nil
|
||||
case let .messageService(flags, id, fromId, chatPeerId, replyTo, date, action):
|
||||
case let .messageService(flags, id, fromId, chatPeerId, replyTo, date, action, ttlPeriod):
|
||||
let peerId: PeerId = chatPeerId.peerId
|
||||
let authorId: PeerId? = fromId?.peerId ?? chatPeerId.peerId
|
||||
|
||||
@ -673,6 +673,10 @@ extension StoreMessage {
|
||||
media.append(action)
|
||||
}
|
||||
|
||||
if let ttlPeriod = ttlPeriod {
|
||||
attributes.append(AutoremoveTimeoutMessageAttribute(timeout: ttlPeriod, countdownBeginTime: date))
|
||||
}
|
||||
|
||||
let (tags, globalTags) = tagsForStoreMessage(incoming: storeFlags.contains(.Incoming), attributes: attributes, media: media, textEntities: nil, isPinned: false)
|
||||
|
||||
storeFlags.insert(.CanBeGroupedIntoFeed)
|
||||
|
@ -101,7 +101,7 @@ extension Api.Message {
|
||||
return message.id
|
||||
case let .messageEmpty(_, id, _):
|
||||
return id
|
||||
case let .messageService(_, id, _, _, _, _, _):
|
||||
case let .messageService(_, id, _, _, _, _, _, _):
|
||||
return id
|
||||
}
|
||||
}
|
||||
@ -121,7 +121,7 @@ extension Api.Message {
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
case let .messageService(flags, id, fromId, chatPeerId, _, _, _):
|
||||
case let .messageService(flags, id, fromId, chatPeerId, _, _, _, _):
|
||||
let peerId: PeerId = chatPeerId.peerId
|
||||
return MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: id)
|
||||
}
|
||||
|
@ -311,6 +311,10 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
private let checksTooltipDisposable = MetaDisposable()
|
||||
private var shouldDisplayChecksTooltip = false
|
||||
|
||||
private let peerSuggestionsDisposable = MetaDisposable()
|
||||
private let peerSuggestionsDismissDisposable = MetaDisposable()
|
||||
private var displayedConvertToGigagroupSuggestion = false
|
||||
|
||||
private var checkedPeerChatServiceActions = false
|
||||
|
||||
private var willAppear = false
|
||||
@ -3602,6 +3606,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
self.hasActiveGroupCallDisposable?.dispose()
|
||||
self.createVoiceChatDisposable.dispose()
|
||||
self.checksTooltipDisposable.dispose()
|
||||
self.peerSuggestionsDisposable.dispose()
|
||||
self.peerSuggestionsDismissDisposable.dispose()
|
||||
self.selectAddMemberDisposable.dispose()
|
||||
self.addMemberDisposable.dispose()
|
||||
self.importStateDisposable?.dispose()
|
||||
@ -7014,6 +7020,26 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
strongSelf.shouldDisplayChecksTooltip = true
|
||||
}))
|
||||
|
||||
if case let .peer(peerId) = self.chatLocation {
|
||||
self.peerSuggestionsDisposable.set((getPeerSpecificServerProvidedSuggestions(postbox: self.context.account.postbox, peerId: peerId)
|
||||
|> deliverOnMainQueue).start(next: { [weak self] values in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
|
||||
if values.contains(.convertToGigagroup) && !strongSelf.displayedConvertToGigagroupSuggestion {
|
||||
strongSelf.displayedConvertToGigagroupSuggestion = true
|
||||
|
||||
// let attributedTitle = NSAttributedString(string: strongSelf.presentationData.strings.BroadcastGroups_LimitAlert_Title, font: Font.medium(17.0), textColor: theme.primaryColor, paragraphAlignment: .center)
|
||||
// let body = MarkdownAttributeSet(font: Font.regular(13.0), textColor: theme.primaryColor)
|
||||
// let bold = MarkdownAttributeSet(font: Font.semibold(13.0), textColor: theme.primaryColor)
|
||||
// let attributedText = parseMarkdownIntoAttributedString(text, attributes: MarkdownAttributes(body: body, bold: bold, link: body, linkAttribute: { _ in return nil }), textAlignment: .center)
|
||||
//
|
||||
//// let controller = richTextAlertController(context: strongSelf.context, title: <#T##NSAttributedString?#>, text: <#T##NSAttributedString#>, actions: <#T##[TextAlertAction]#>)
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
if self.scheduledActivateInput {
|
||||
self.scheduledActivateInput = false
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user