mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Update API [skip ci]
This commit is contained in:
parent
96c3c8d275
commit
5bfe040aa0
@ -6783,13 +6783,7 @@ Sorry for the inconvenience.";
|
|||||||
|
|
||||||
"SponsoredMessageMenu.Info" = "What are sponsored\nmessages?";
|
"SponsoredMessageMenu.Info" = "What are sponsored\nmessages?";
|
||||||
"SponsoredMessageInfoScreen.Title" = "What are sponsored messages?";
|
"SponsoredMessageInfoScreen.Title" = "What are sponsored messages?";
|
||||||
"SponsoredMessageInfoScreen.Text" = "Unlike other apps, Telegram never uses your private data to target ads. You are seeing this message only because someone chose this public one-to many channel as a space to promote their messages. This means that no user data is mined or analyzed to display ads, and every user viewing a channel on Telegram sees the same sponsored message.
|
"SponsoredMessageInfoScreen.Text" = "Unlike other apps, Telegram never uses your private data to target ads. You are seeing this message only because someone chose this public one-to many channel as a space to promote their messages. This means that no user data is mined or analyzed to display ads, and every user viewing a channel on Telegram sees the same sponsored message.\n\nUnline other apps, Telegram doesn't track whether you tapped on a sponsored message and doesn't profile you based on your activity. We also prevent external links in sponsored messages to ensure that third parties can't spy on our users. We believe that everyone has the right to privacy, and technological platforms should respect that.\n\nTelegram offers free and unlimited service to hundreds of millions of users, which involves significant server and traffic costs. In order to remain independent and stay true to its values, Telegram developed a paid tool to promote messages with user privacy in mind. We welcome responsible adverticers at:\n[url]\nAds should no longer be synonymous with abuse of user privacy. Let us redefine how a tech compony should operate — together.";
|
||||||
|
|
||||||
Unline other apps, Telegram doesn't track whether you tapped on a sponsored message and doesn't profile you based on your activity. We also prevent external links in sponsored messages to ensure that third parties can't spy on our users. We believe that everyone has the right to privacy, and technological platforms should respect that.
|
|
||||||
|
|
||||||
Telegram offers free and unlimited service to hundreds of millions of users, which involves significant server and traffic costs. In order to remain independent and stay true to its values, Telegram developed a paid tool to promote messages with user privacy in mind. We welcome responsible adverticers at:
|
|
||||||
[url]
|
|
||||||
Ads should no longer be synonymous with abuse of user privacy. Let us redefine how a tech compony should operate — together.";
|
|
||||||
"SponsoredMessageInfo.Action" = "Learn More";
|
"SponsoredMessageInfo.Action" = "Learn More";
|
||||||
"SponsoredMessageInfo.Url" = "https://telegram.org/ads";
|
"SponsoredMessageInfo.Url" = "https://telegram.org/ads";
|
||||||
|
|
||||||
|
@ -756,7 +756,7 @@ public func inviteLinkListController(context: AccountContext, updatedPresentatio
|
|||||||
|> distinctUntilChanged
|
|> distinctUntilChanged
|
||||||
|> deliverOnMainQueue
|
|> deliverOnMainQueue
|
||||||
|> map { invite -> PeerInvitationImportersContext? in
|
|> map { invite -> PeerInvitationImportersContext? in
|
||||||
return invite.flatMap { context.engine.peers.peerInvitationImporters(peerId: peerId, invite: $0) }
|
return invite.flatMap { context.engine.peers.peerInvitationImporters(peerId: peerId, subject: .invite(invite: $0, requested: false)) }
|
||||||
} |> afterNext { context in
|
} |> afterNext { context in
|
||||||
if let context = context {
|
if let context = context {
|
||||||
importersState.set(context.state |> map(Optional.init))
|
importersState.set(context.state |> map(Optional.init))
|
||||||
|
@ -376,7 +376,7 @@ public final class InviteLinkViewController: ViewController {
|
|||||||
self.presentationDataPromise = Promise(self.presentationData)
|
self.presentationDataPromise = Promise(self.presentationData)
|
||||||
self.controller = controller
|
self.controller = controller
|
||||||
|
|
||||||
self.importersContext = importersContext ?? context.engine.peers.peerInvitationImporters(peerId: peerId, invite: invite)
|
self.importersContext = importersContext ?? context.engine.peers.peerInvitationImporters(peerId: peerId, subject: .invite(invite: invite, requested: false))
|
||||||
|
|
||||||
self.dimNode = ASDisplayNode()
|
self.dimNode = ASDisplayNode()
|
||||||
self.dimNode.backgroundColor = UIColor(white: 0.0, alpha: 0.5)
|
self.dimNode.backgroundColor = UIColor(white: 0.0, alpha: 0.5)
|
||||||
|
@ -166,7 +166,7 @@ public func inviteRequestsController(context: AccountContext, updatedPresentatio
|
|||||||
|
|
||||||
var getControllerImpl: (() -> ViewController?)?
|
var getControllerImpl: (() -> ViewController?)?
|
||||||
|
|
||||||
let importersContext = existingContext ?? context.engine.peers.peerInvitationImporters(peerId: peerId, invite: nil)
|
let importersContext = existingContext ?? context.engine.peers.peerInvitationImporters(peerId: peerId, subject: .requests)
|
||||||
|
|
||||||
let arguments = InviteRequestsControllerArguments(context: context, openLinks: {
|
let arguments = InviteRequestsControllerArguments(context: context, openLinks: {
|
||||||
let controller = inviteLinkListController(context: context, updatedPresentationData: updatedPresentationData, peerId: peerId, admin: nil)
|
let controller = inviteLinkListController(context: context, updatedPresentationData: updatedPresentationData, peerId: peerId, admin: nil)
|
||||||
|
@ -338,25 +338,34 @@ public class ItemListInviteLinkItemNode: ListViewItemNode, ItemListItemNode {
|
|||||||
|
|
||||||
let inviteLink = item.invite?.link.replacingOccurrences(of: "https://", with: "") ?? ""
|
let inviteLink = item.invite?.link.replacingOccurrences(of: "https://", with: "") ?? ""
|
||||||
var titleText = inviteLink
|
var titleText = inviteLink
|
||||||
|
|
||||||
var subtitleText: String = ""
|
var subtitleText: String = ""
|
||||||
var timerValue: TimerNode.Value?
|
var timerValue: TimerNode.Value?
|
||||||
if let invite = item.invite {
|
if let invite = item.invite {
|
||||||
let count = invite.count ?? 0
|
let count = invite.count ?? 0
|
||||||
|
let requestedCount = invite.requestedCount ?? 0
|
||||||
|
|
||||||
if count > 0 {
|
if count > 0 {
|
||||||
if invite.requestApproval {
|
subtitleText = item.presentationData.strings.InviteLink_PeopleJoinedShort(count)
|
||||||
subtitleText = item.presentationData.strings.MemberRequests_PeopleRequestedShort(count)
|
|
||||||
} else {
|
|
||||||
subtitleText = item.presentationData.strings.InviteLink_PeopleJoinedShort(count)
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if let usageLimit = invite.usageLimit, count == 0 && !availability.isZero {
|
if let usageLimit = invite.usageLimit, count == 0 && !availability.isZero {
|
||||||
subtitleText = item.presentationData.strings.InviteLink_PeopleCanJoin(usageLimit)
|
subtitleText = item.presentationData.strings.InviteLink_PeopleCanJoin(usageLimit)
|
||||||
} else {
|
} else {
|
||||||
subtitleText = availability.isZero ? item.presentationData.strings.InviteLink_PeopleJoinedShortNoneExpired : item.presentationData.strings.InviteLink_PeopleJoinedShortNone
|
if availability.isZero {
|
||||||
|
subtitleText = item.presentationData.strings.InviteLink_PeopleJoinedShortNoneExpired
|
||||||
|
} else if requestedCount == 0 {
|
||||||
|
subtitleText = item.presentationData.strings.InviteLink_PeopleJoinedShortNone
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if requestedCount > 0 {
|
||||||
|
if !subtitleText.isEmpty {
|
||||||
|
subtitleText += ", "
|
||||||
|
}
|
||||||
|
subtitleText += item.presentationData.strings.MemberRequests_PeopleRequestedShort(requestedCount)
|
||||||
|
}
|
||||||
|
|
||||||
if invite.isRevoked {
|
if invite.isRevoked {
|
||||||
if !subtitleText.isEmpty {
|
if !subtitleText.isEmpty {
|
||||||
subtitleText += " • "
|
subtitleText += " • "
|
||||||
|
@ -745,7 +745,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[-1625153079] = { return Api.InputWebFileLocation.parse_inputWebFileGeoPointLocation($0) }
|
dict[-1625153079] = { return Api.InputWebFileLocation.parse_inputWebFileGeoPointLocation($0) }
|
||||||
dict[-1275374751] = { return Api.EmojiLanguage.parse_emojiLanguage($0) }
|
dict[-1275374751] = { return Api.EmojiLanguage.parse_emojiLanguage($0) }
|
||||||
dict[1601666510] = { return Api.MessageFwdHeader.parse_messageFwdHeader($0) }
|
dict[1601666510] = { return Api.MessageFwdHeader.parse_messageFwdHeader($0) }
|
||||||
dict[708589599] = { return Api.SponsoredMessage.parse_sponsoredMessage($0) }
|
dict[-783162982] = { return Api.SponsoredMessage.parse_sponsoredMessage($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) }
|
||||||
@ -838,6 +838,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[-1781355374] = { return Api.MessageAction.parse_messageActionChannelCreate($0) }
|
dict[-1781355374] = { return Api.MessageAction.parse_messageActionChannelCreate($0) }
|
||||||
dict[-519864430] = { return Api.MessageAction.parse_messageActionChatMigrateTo($0) }
|
dict[-519864430] = { return Api.MessageAction.parse_messageActionChatMigrateTo($0) }
|
||||||
dict[-365344535] = { return Api.MessageAction.parse_messageActionChannelMigrateFrom($0) }
|
dict[-365344535] = { return Api.MessageAction.parse_messageActionChannelMigrateFrom($0) }
|
||||||
|
dict[-339958837] = { return Api.MessageAction.parse_messageActionChatJoinedByRequest($0) }
|
||||||
dict[-1799538451] = { return Api.MessageAction.parse_messageActionPinMessage($0) }
|
dict[-1799538451] = { return Api.MessageAction.parse_messageActionPinMessage($0) }
|
||||||
dict[-1615153660] = { return Api.MessageAction.parse_messageActionHistoryClear($0) }
|
dict[-1615153660] = { return Api.MessageAction.parse_messageActionHistoryClear($0) }
|
||||||
dict[-1834538890] = { return Api.MessageAction.parse_messageActionGameScore($0) }
|
dict[-1834538890] = { return Api.MessageAction.parse_messageActionGameScore($0) }
|
||||||
@ -856,7 +857,6 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[-1441072131] = { return Api.MessageAction.parse_messageActionSetMessagesTTL($0) }
|
dict[-1441072131] = { return Api.MessageAction.parse_messageActionSetMessagesTTL($0) }
|
||||||
dict[-1281329567] = { return Api.MessageAction.parse_messageActionGroupCallScheduled($0) }
|
dict[-1281329567] = { return Api.MessageAction.parse_messageActionGroupCallScheduled($0) }
|
||||||
dict[-1434950843] = { return Api.MessageAction.parse_messageActionSetChatTheme($0) }
|
dict[-1434950843] = { return Api.MessageAction.parse_messageActionSetChatTheme($0) }
|
||||||
dict[-339958837] = { return Api.MessageAction.parse_messageActionChatJoinedByRequest($0) }
|
|
||||||
dict[1399245077] = { return Api.PhoneCall.parse_phoneCallEmpty($0) }
|
dict[1399245077] = { return Api.PhoneCall.parse_phoneCallEmpty($0) }
|
||||||
dict[-987599081] = { return Api.PhoneCall.parse_phoneCallWaiting($0) }
|
dict[-987599081] = { return Api.PhoneCall.parse_phoneCallWaiting($0) }
|
||||||
dict[347139340] = { return Api.PhoneCall.parse_phoneCallRequested($0) }
|
dict[347139340] = { return Api.PhoneCall.parse_phoneCallRequested($0) }
|
||||||
|
@ -19396,17 +19396,18 @@ public extension Api {
|
|||||||
|
|
||||||
}
|
}
|
||||||
public enum SponsoredMessage: TypeConstructorDescription {
|
public enum SponsoredMessage: TypeConstructorDescription {
|
||||||
case sponsoredMessage(flags: Int32, randomId: Buffer, fromId: Api.Peer, startParam: String?, message: String, entities: [Api.MessageEntity]?)
|
case sponsoredMessage(flags: Int32, randomId: Buffer, fromId: Api.Peer, channelPost: Int32?, startParam: String?, message: String, entities: [Api.MessageEntity]?)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .sponsoredMessage(let flags, let randomId, let fromId, let startParam, let message, let entities):
|
case .sponsoredMessage(let flags, let randomId, let fromId, let channelPost, let startParam, let message, let entities):
|
||||||
if boxed {
|
if boxed {
|
||||||
buffer.appendInt32(708589599)
|
buffer.appendInt32(-783162982)
|
||||||
}
|
}
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
serializeBytes(randomId, buffer: buffer, boxed: false)
|
serializeBytes(randomId, buffer: buffer, boxed: false)
|
||||||
fromId.serialize(buffer, true)
|
fromId.serialize(buffer, true)
|
||||||
|
if Int(flags) & Int(1 << 2) != 0 {serializeInt32(channelPost!, buffer: buffer, boxed: false)}
|
||||||
if Int(flags) & Int(1 << 0) != 0 {serializeString(startParam!, buffer: buffer, boxed: false)}
|
if Int(flags) & Int(1 << 0) != 0 {serializeString(startParam!, buffer: buffer, boxed: false)}
|
||||||
serializeString(message, buffer: buffer, boxed: false)
|
serializeString(message, buffer: buffer, boxed: false)
|
||||||
if Int(flags) & Int(1 << 1) != 0 {buffer.appendInt32(481674261)
|
if Int(flags) & Int(1 << 1) != 0 {buffer.appendInt32(481674261)
|
||||||
@ -19420,8 +19421,8 @@ public extension Api {
|
|||||||
|
|
||||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
switch self {
|
switch self {
|
||||||
case .sponsoredMessage(let flags, let randomId, let fromId, let startParam, let message, let entities):
|
case .sponsoredMessage(let flags, let randomId, let fromId, let channelPost, let startParam, let message, let entities):
|
||||||
return ("sponsoredMessage", [("flags", flags), ("randomId", randomId), ("fromId", fromId), ("startParam", startParam), ("message", message), ("entities", entities)])
|
return ("sponsoredMessage", [("flags", flags), ("randomId", randomId), ("fromId", fromId), ("channelPost", channelPost), ("startParam", startParam), ("message", message), ("entities", entities)])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19434,22 +19435,25 @@ public extension Api {
|
|||||||
if let signature = reader.readInt32() {
|
if let signature = reader.readInt32() {
|
||||||
_3 = Api.parse(reader, signature: signature) as? Api.Peer
|
_3 = Api.parse(reader, signature: signature) as? Api.Peer
|
||||||
}
|
}
|
||||||
var _4: String?
|
var _4: Int32?
|
||||||
if Int(_1!) & Int(1 << 0) != 0 {_4 = parseString(reader) }
|
if Int(_1!) & Int(1 << 2) != 0 {_4 = reader.readInt32() }
|
||||||
var _5: String?
|
var _5: String?
|
||||||
_5 = parseString(reader)
|
if Int(_1!) & Int(1 << 0) != 0 {_5 = parseString(reader) }
|
||||||
var _6: [Api.MessageEntity]?
|
var _6: String?
|
||||||
|
_6 = parseString(reader)
|
||||||
|
var _7: [Api.MessageEntity]?
|
||||||
if Int(_1!) & Int(1 << 1) != 0 {if let _ = reader.readInt32() {
|
if Int(_1!) & Int(1 << 1) != 0 {if let _ = reader.readInt32() {
|
||||||
_6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self)
|
_7 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self)
|
||||||
} }
|
} }
|
||||||
let _c1 = _1 != nil
|
let _c1 = _1 != nil
|
||||||
let _c2 = _2 != nil
|
let _c2 = _2 != nil
|
||||||
let _c3 = _3 != nil
|
let _c3 = _3 != nil
|
||||||
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
|
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
|
||||||
let _c5 = _5 != nil
|
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
|
||||||
let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil
|
let _c6 = _6 != nil
|
||||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
|
let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil
|
||||||
return Api.SponsoredMessage.sponsoredMessage(flags: _1!, randomId: _2!, fromId: _3!, startParam: _4, message: _5!, entities: _6)
|
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
|
||||||
|
return Api.SponsoredMessage.sponsoredMessage(flags: _1!, randomId: _2!, fromId: _3!, channelPost: _4, startParam: _5, message: _6!, entities: _7)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return nil
|
return nil
|
||||||
@ -21079,6 +21083,7 @@ public extension Api {
|
|||||||
case messageActionChannelCreate(title: String)
|
case messageActionChannelCreate(title: String)
|
||||||
case messageActionChatMigrateTo(channelId: Int64)
|
case messageActionChatMigrateTo(channelId: Int64)
|
||||||
case messageActionChannelMigrateFrom(title: String, chatId: Int64)
|
case messageActionChannelMigrateFrom(title: String, chatId: Int64)
|
||||||
|
case messageActionChatJoinedByRequest
|
||||||
case messageActionPinMessage
|
case messageActionPinMessage
|
||||||
case messageActionHistoryClear
|
case messageActionHistoryClear
|
||||||
case messageActionGameScore(gameId: Int64, score: Int32)
|
case messageActionGameScore(gameId: Int64, score: Int32)
|
||||||
@ -21097,7 +21102,6 @@ public extension Api {
|
|||||||
case messageActionSetMessagesTTL(period: Int32)
|
case messageActionSetMessagesTTL(period: Int32)
|
||||||
case messageActionGroupCallScheduled(call: Api.InputGroupCall, scheduleDate: Int32)
|
case messageActionGroupCallScheduled(call: Api.InputGroupCall, scheduleDate: Int32)
|
||||||
case messageActionSetChatTheme(emoticon: String)
|
case messageActionSetChatTheme(emoticon: String)
|
||||||
case messageActionChatJoinedByRequest
|
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
@ -21176,6 +21180,12 @@ public extension Api {
|
|||||||
}
|
}
|
||||||
serializeString(title, buffer: buffer, boxed: false)
|
serializeString(title, buffer: buffer, boxed: false)
|
||||||
serializeInt64(chatId, buffer: buffer, boxed: false)
|
serializeInt64(chatId, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
case .messageActionChatJoinedByRequest:
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-339958837)
|
||||||
|
}
|
||||||
|
|
||||||
break
|
break
|
||||||
case .messageActionPinMessage:
|
case .messageActionPinMessage:
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -21314,12 +21324,6 @@ public extension Api {
|
|||||||
buffer.appendInt32(-1434950843)
|
buffer.appendInt32(-1434950843)
|
||||||
}
|
}
|
||||||
serializeString(emoticon, buffer: buffer, boxed: false)
|
serializeString(emoticon, buffer: buffer, boxed: false)
|
||||||
break
|
|
||||||
case .messageActionChatJoinedByRequest:
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(-339958837)
|
|
||||||
}
|
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -21348,6 +21352,8 @@ public extension Api {
|
|||||||
return ("messageActionChatMigrateTo", [("channelId", channelId)])
|
return ("messageActionChatMigrateTo", [("channelId", channelId)])
|
||||||
case .messageActionChannelMigrateFrom(let title, let chatId):
|
case .messageActionChannelMigrateFrom(let title, let chatId):
|
||||||
return ("messageActionChannelMigrateFrom", [("title", title), ("chatId", chatId)])
|
return ("messageActionChannelMigrateFrom", [("title", title), ("chatId", chatId)])
|
||||||
|
case .messageActionChatJoinedByRequest:
|
||||||
|
return ("messageActionChatJoinedByRequest", [])
|
||||||
case .messageActionPinMessage:
|
case .messageActionPinMessage:
|
||||||
return ("messageActionPinMessage", [])
|
return ("messageActionPinMessage", [])
|
||||||
case .messageActionHistoryClear:
|
case .messageActionHistoryClear:
|
||||||
@ -21384,8 +21390,6 @@ public extension Api {
|
|||||||
return ("messageActionGroupCallScheduled", [("call", call), ("scheduleDate", scheduleDate)])
|
return ("messageActionGroupCallScheduled", [("call", call), ("scheduleDate", scheduleDate)])
|
||||||
case .messageActionSetChatTheme(let emoticon):
|
case .messageActionSetChatTheme(let emoticon):
|
||||||
return ("messageActionSetChatTheme", [("emoticon", emoticon)])
|
return ("messageActionSetChatTheme", [("emoticon", emoticon)])
|
||||||
case .messageActionChatJoinedByRequest:
|
|
||||||
return ("messageActionChatJoinedByRequest", [])
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21506,6 +21510,9 @@ public extension Api {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static func parse_messageActionChatJoinedByRequest(_ reader: BufferReader) -> MessageAction? {
|
||||||
|
return Api.MessageAction.messageActionChatJoinedByRequest
|
||||||
|
}
|
||||||
public static func parse_messageActionPinMessage(_ reader: BufferReader) -> MessageAction? {
|
public static func parse_messageActionPinMessage(_ reader: BufferReader) -> MessageAction? {
|
||||||
return Api.MessageAction.messageActionPinMessage
|
return Api.MessageAction.messageActionPinMessage
|
||||||
}
|
}
|
||||||
@ -21750,9 +21757,6 @@ public extension Api {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static func parse_messageActionChatJoinedByRequest(_ reader: BufferReader) -> MessageAction? {
|
|
||||||
return Api.MessageAction.messageActionChatJoinedByRequest
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum PhoneCall: TypeConstructorDescription {
|
public enum PhoneCall: TypeConstructorDescription {
|
||||||
|
@ -4484,6 +4484,22 @@ public extension Api {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static func hideChatJoinRequest(flags: Int32, peer: Api.InputPeer, userId: Api.InputUser) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
|
||||||
|
let buffer = Buffer()
|
||||||
|
buffer.appendInt32(2145904661)
|
||||||
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
|
peer.serialize(buffer, true)
|
||||||
|
userId.serialize(buffer, true)
|
||||||
|
return (FunctionDescription(name: "messages.hideChatJoinRequest", parameters: [("flags", flags), ("peer", peer), ("userId", userId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
|
||||||
|
let reader = BufferReader(buffer)
|
||||||
|
var result: Api.Updates?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
result = Api.parse(reader, signature: signature) as? Api.Updates
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
public static func getSearchResultsPositions(peer: Api.InputPeer, filter: Api.MessagesFilter, offsetId: Int32, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.SearchResultsPositions>) {
|
public static func getSearchResultsPositions(peer: Api.InputPeer, filter: Api.MessagesFilter, offsetId: Int32, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.SearchResultsPositions>) {
|
||||||
let buffer = Buffer()
|
let buffer = Buffer()
|
||||||
buffer.appendInt32(1855292323)
|
buffer.appendInt32(1855292323)
|
||||||
@ -4500,22 +4516,6 @@ public extension Api {
|
|||||||
return result
|
return result
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func hideChatJoinRequest(flags: Int32, peer: Api.InputPeer, userId: Api.InputUser) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
|
|
||||||
let buffer = Buffer()
|
|
||||||
buffer.appendInt32(2145904661)
|
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
|
||||||
peer.serialize(buffer, true)
|
|
||||||
userId.serialize(buffer, true)
|
|
||||||
return (FunctionDescription(name: "messages.hideChatJoinRequest", parameters: [("flags", flags), ("peer", peer), ("userId", userId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
|
|
||||||
let reader = BufferReader(buffer)
|
|
||||||
var result: Api.Updates?
|
|
||||||
if let signature = reader.readInt32() {
|
|
||||||
result = Api.parse(reader, signature: signature) as? Api.Updates
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public struct channels {
|
public struct channels {
|
||||||
public static func readHistory(channel: Api.InputChannel, maxId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
|
public static func readHistory(channel: Api.InputChannel, maxId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
|
||||||
|
@ -11,6 +11,7 @@ private class AdMessagesHistoryContextImpl {
|
|||||||
case textEntities
|
case textEntities
|
||||||
case media
|
case media
|
||||||
case authorId
|
case authorId
|
||||||
|
case messageId
|
||||||
case startParam
|
case startParam
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19,6 +20,7 @@ private class AdMessagesHistoryContextImpl {
|
|||||||
public let textEntities: [MessageTextEntity]
|
public let textEntities: [MessageTextEntity]
|
||||||
public let media: [Media]
|
public let media: [Media]
|
||||||
public let authorId: PeerId
|
public let authorId: PeerId
|
||||||
|
public let messageId: MessageId?
|
||||||
public let startParam: String?
|
public let startParam: String?
|
||||||
|
|
||||||
public init(
|
public init(
|
||||||
@ -27,6 +29,7 @@ private class AdMessagesHistoryContextImpl {
|
|||||||
textEntities: [MessageTextEntity],
|
textEntities: [MessageTextEntity],
|
||||||
media: [Media],
|
media: [Media],
|
||||||
authorId: PeerId,
|
authorId: PeerId,
|
||||||
|
messageId: MessageId?,
|
||||||
startParam: String?
|
startParam: String?
|
||||||
) {
|
) {
|
||||||
self.opaqueId = opaqueId
|
self.opaqueId = opaqueId
|
||||||
@ -34,6 +37,7 @@ private class AdMessagesHistoryContextImpl {
|
|||||||
self.textEntities = textEntities
|
self.textEntities = textEntities
|
||||||
self.media = media
|
self.media = media
|
||||||
self.authorId = authorId
|
self.authorId = authorId
|
||||||
|
self.messageId = messageId
|
||||||
self.startParam = startParam
|
self.startParam = startParam
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +55,7 @@ private class AdMessagesHistoryContextImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.authorId = try container.decode(PeerId.self, forKey: .authorId)
|
self.authorId = try container.decode(PeerId.self, forKey: .authorId)
|
||||||
|
self.messageId = try container.decodeIfPresent(MessageId.self, forKey: .messageId)
|
||||||
self.startParam = try container.decodeIfPresent(String.self, forKey: .startParam)
|
self.startParam = try container.decodeIfPresent(String.self, forKey: .startParam)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,6 +74,7 @@ private class AdMessagesHistoryContextImpl {
|
|||||||
try container.encode(mediaData, forKey: .media)
|
try container.encode(mediaData, forKey: .media)
|
||||||
|
|
||||||
try container.encode(self.authorId, forKey: .authorId)
|
try container.encode(self.authorId, forKey: .authorId)
|
||||||
|
try container.encodeIfPresent(self.messageId, forKey: .messageId)
|
||||||
try container.encodeIfPresent(self.startParam, forKey: .startParam)
|
try container.encodeIfPresent(self.startParam, forKey: .startParam)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,6 +99,9 @@ private class AdMessagesHistoryContextImpl {
|
|||||||
if lhs.authorId != rhs.authorId {
|
if lhs.authorId != rhs.authorId {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if lhs.messageId != rhs.messageId {
|
||||||
|
return false
|
||||||
|
}
|
||||||
if lhs.startParam != rhs.startParam {
|
if lhs.startParam != rhs.startParam {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -317,7 +325,7 @@ private class AdMessagesHistoryContextImpl {
|
|||||||
|
|
||||||
for message in messages {
|
for message in messages {
|
||||||
switch message {
|
switch message {
|
||||||
case let .sponsoredMessage(_, randomId, fromId, startParam, message, entities):
|
case let .sponsoredMessage(_, randomId, fromId, channelPost, startParam, message, entities):
|
||||||
var parsedEntities: [MessageTextEntity] = []
|
var parsedEntities: [MessageTextEntity] = []
|
||||||
if let entities = entities {
|
if let entities = entities {
|
||||||
parsedEntities = messageTextEntitiesFromApiEntities(entities)
|
parsedEntities = messageTextEntitiesFromApiEntities(entities)
|
||||||
@ -337,6 +345,7 @@ private class AdMessagesHistoryContextImpl {
|
|||||||
textEntities: parsedEntities,
|
textEntities: parsedEntities,
|
||||||
media: parsedMedia,
|
media: parsedMedia,
|
||||||
authorId: fromId.peerId,
|
authorId: fromId.peerId,
|
||||||
|
messageId: channelPost.flatMap { MessageId(peerId: fromId.peerId, namespace: Namespaces.Message.Cloud, id: $0) },
|
||||||
startParam: startParam
|
startParam: startParam
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
@ -662,10 +662,10 @@ final class CachedPeerInvitationImporters: Codable {
|
|||||||
let dates: [PeerId: Int32]
|
let dates: [PeerId: Int32]
|
||||||
let count: Int32
|
let count: Int32
|
||||||
|
|
||||||
static func key(peerId: PeerId, link: String) -> ValueBoxKey {
|
static func key(peerId: PeerId, link: String, requested: Bool) -> ValueBoxKey {
|
||||||
let key = ValueBoxKey(length: 8 + 4)
|
let key = ValueBoxKey(length: 8 + 4)
|
||||||
key.setInt64(0, value: peerId.toInt64())
|
key.setInt64(0, value: peerId.toInt64())
|
||||||
key.setInt32(8, value: Int32(HashFunctions.murMurHash32(link)))
|
key.setInt32(8, value: Int32(HashFunctions.murMurHash32(link + (requested ? "_requested" : ""))))
|
||||||
return key
|
return key
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -722,6 +722,7 @@ private final class PeerInvitationImportersContextImpl {
|
|||||||
private let account: Account
|
private let account: Account
|
||||||
private let peerId: PeerId
|
private let peerId: PeerId
|
||||||
private let link: String?
|
private let link: String?
|
||||||
|
private let requested: Bool
|
||||||
private let disposable = MetaDisposable()
|
private let disposable = MetaDisposable()
|
||||||
private let updateDisposable = MetaDisposable()
|
private let updateDisposable = MetaDisposable()
|
||||||
private let actionDisposables = DisposableSet()
|
private let actionDisposables = DisposableSet()
|
||||||
@ -735,18 +736,26 @@ private final class PeerInvitationImportersContextImpl {
|
|||||||
|
|
||||||
let state = Promise<PeerInvitationImportersState>()
|
let state = Promise<PeerInvitationImportersState>()
|
||||||
|
|
||||||
init(queue: Queue, account: Account, peerId: PeerId, invite: ExportedInvitation?) {
|
init(queue: Queue, account: Account, peerId: PeerId, subject: PeerInvitationImportersContext.Subject) {
|
||||||
self.queue = queue
|
self.queue = queue
|
||||||
self.account = account
|
self.account = account
|
||||||
self.peerId = peerId
|
self.peerId = peerId
|
||||||
|
|
||||||
|
var invite: ExportedInvitation?
|
||||||
|
var requested = false
|
||||||
|
if case let .invite(subjectInvite, subjectRequested) = subject {
|
||||||
|
invite = subjectInvite
|
||||||
|
requested = subjectRequested
|
||||||
|
}
|
||||||
self.link = invite?.link
|
self.link = invite?.link
|
||||||
|
self.requested = requested
|
||||||
|
|
||||||
let count = invite?.count ?? 0
|
let count = invite?.count ?? 0
|
||||||
self.count = count
|
self.count = count
|
||||||
|
|
||||||
self.isLoadingMore = true
|
self.isLoadingMore = true
|
||||||
self.disposable.set((account.postbox.transaction { transaction -> (peers: [PeerInvitationImportersState.Importer], count: Int32, canLoadMore: Bool)? in
|
self.disposable.set((account.postbox.transaction { transaction -> (peers: [PeerInvitationImportersState.Importer], count: Int32, canLoadMore: Bool)? in
|
||||||
let cachedResult = transaction.retrieveItemCacheEntry(id: ItemCacheEntryId(collectionId: Namespaces.CachedItemCollection.cachedPeerInvitationImporters, key: CachedPeerInvitationImporters.key(peerId: peerId, link: invite?.link ?? "requests")))?.get(CachedPeerInvitationImporters.self)
|
let cachedResult = transaction.retrieveItemCacheEntry(id: ItemCacheEntryId(collectionId: Namespaces.CachedItemCollection.cachedPeerInvitationImporters, key: CachedPeerInvitationImporters.key(peerId: peerId, link: invite?.link ?? "requests", requested: self.requested)))?.get(CachedPeerInvitationImporters.self)
|
||||||
if let cachedResult = cachedResult, (Int(cachedResult.count) == count || invite == nil) {
|
if let cachedResult = cachedResult, (Int(cachedResult.count) == count || invite == nil) {
|
||||||
var result: [PeerInvitationImportersState.Importer] = []
|
var result: [PeerInvitationImportersState.Importer] = []
|
||||||
for peerId in cachedResult.peerIds {
|
for peerId in cachedResult.peerIds {
|
||||||
@ -811,6 +820,9 @@ private final class PeerInvitationImportersContextImpl {
|
|||||||
|
|
||||||
var flags: Int32 = 0
|
var flags: Int32 = 0
|
||||||
if let _ = link {
|
if let _ = link {
|
||||||
|
if self.requested {
|
||||||
|
flags |= (1 << 0)
|
||||||
|
}
|
||||||
flags |= (1 << 1)
|
flags |= (1 << 1)
|
||||||
} else {
|
} else {
|
||||||
flags |= (1 << 0)
|
flags |= (1 << 0)
|
||||||
@ -854,7 +866,7 @@ private final class PeerInvitationImportersContextImpl {
|
|||||||
}
|
}
|
||||||
if populateCache {
|
if populateCache {
|
||||||
if let entry = CodableEntry(CachedPeerInvitationImporters(importers: resultImporters, count: count)) {
|
if let entry = CodableEntry(CachedPeerInvitationImporters(importers: resultImporters, count: count)) {
|
||||||
transaction.putItemCacheEntry(id: ItemCacheEntryId(collectionId: Namespaces.CachedItemCollection.cachedPeerInvitationImporters, key: CachedPeerInvitationImporters.key(peerId: peerId, link: link ?? "requests")), entry: entry, collectionSpec: cachedPeerInvitationImportersCollectionSpec)
|
transaction.putItemCacheEntry(id: ItemCacheEntryId(collectionId: Namespaces.CachedItemCollection.cachedPeerInvitationImporters, key: CachedPeerInvitationImporters.key(peerId: peerId, link: link ?? "requests", requested: self.requested)), entry: entry, collectionSpec: cachedPeerInvitationImportersCollectionSpec)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (resultImporters, count)
|
return (resultImporters, count)
|
||||||
@ -916,7 +928,7 @@ private final class PeerInvitationImportersContextImpl {
|
|||||||
let link = self.link
|
let link = self.link
|
||||||
self.updateDisposable.set(self.account.postbox.transaction({ transaction in
|
self.updateDisposable.set(self.account.postbox.transaction({ transaction in
|
||||||
if let entry = CodableEntry(CachedPeerInvitationImporters(importers: resultImporters, count: count)) {
|
if let entry = CodableEntry(CachedPeerInvitationImporters(importers: resultImporters, count: count)) {
|
||||||
transaction.putItemCacheEntry(id: ItemCacheEntryId(collectionId: Namespaces.CachedItemCollection.cachedPeerInvitationImporters, key: CachedPeerInvitationImporters.key(peerId: peerId, link: link ?? "requests")), entry: entry, collectionSpec: cachedPeerInvitationImportersCollectionSpec)
|
transaction.putItemCacheEntry(id: ItemCacheEntryId(collectionId: Namespaces.CachedItemCollection.cachedPeerInvitationImporters, key: CachedPeerInvitationImporters.key(peerId: peerId, link: link ?? "requests", requested: self.requested)), entry: entry, collectionSpec: cachedPeerInvitationImportersCollectionSpec)
|
||||||
}
|
}
|
||||||
}).start())
|
}).start())
|
||||||
}
|
}
|
||||||
@ -927,6 +939,11 @@ private final class PeerInvitationImportersContextImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final class PeerInvitationImportersContext {
|
public final class PeerInvitationImportersContext {
|
||||||
|
public enum Subject {
|
||||||
|
case invite(invite: ExportedInvitation, requested: Bool)
|
||||||
|
case requests
|
||||||
|
}
|
||||||
|
|
||||||
public enum UpdateAction {
|
public enum UpdateAction {
|
||||||
case approve
|
case approve
|
||||||
case deny
|
case deny
|
||||||
@ -947,10 +964,10 @@ public final class PeerInvitationImportersContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
init(account: Account, peerId: PeerId, invite: ExportedInvitation?) {
|
init(account: Account, peerId: PeerId, subject: Subject) {
|
||||||
let queue = self.queue
|
let queue = self.queue
|
||||||
self.impl = QueueLocalObject(queue: queue, generate: {
|
self.impl = QueueLocalObject(queue: queue, generate: {
|
||||||
return PeerInvitationImportersContextImpl(queue: queue, account: account, peerId: peerId, invite: invite)
|
return PeerInvitationImportersContextImpl(queue: queue, account: account, peerId: peerId, subject: subject)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,8 +454,8 @@ public extension TelegramEngine {
|
|||||||
return _internal_revokePersistentPeerExportedInvitation(account: self.account, peerId: peerId)
|
return _internal_revokePersistentPeerExportedInvitation(account: self.account, peerId: peerId)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func peerInvitationImporters(peerId: PeerId, invite: ExportedInvitation?) -> PeerInvitationImportersContext {
|
public func peerInvitationImporters(peerId: PeerId, subject: PeerInvitationImportersContext.Subject) -> PeerInvitationImportersContext {
|
||||||
return PeerInvitationImportersContext(account: self.account, peerId: peerId, invite: invite)
|
return PeerInvitationImportersContext(account: self.account, peerId: peerId, subject: subject)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func notificationExceptionsList() -> Signal<NotificationExceptionsList, NoError> {
|
public func notificationExceptionsList() -> Signal<NotificationExceptionsList, NoError> {
|
||||||
|
11
submodules/TelegramUI/Images.xcassets/Chat/Info/GroupRequestsIcon.imageset/Contents.json
vendored
Normal file
11
submodules/TelegramUI/Images.xcassets/Chat/Info/GroupRequestsIcon.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
@ -4802,7 +4802,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
}
|
}
|
||||||
|
|
||||||
if canManageInvitations, let inviteRequestsPending = inviteRequestsPending, inviteRequestsPending >= 0, strongSelf.inviteRequestsContext == nil {
|
if canManageInvitations, let inviteRequestsPending = inviteRequestsPending, inviteRequestsPending >= 0, strongSelf.inviteRequestsContext == nil {
|
||||||
let inviteRequestsContext = strongSelf.context.engine.peers.peerInvitationImporters(peerId: peerId, invite: nil)
|
let inviteRequestsContext = strongSelf.context.engine.peers.peerInvitationImporters(peerId: peerId, subject: .requests)
|
||||||
strongSelf.inviteRequestsContext = inviteRequestsContext
|
strongSelf.inviteRequestsContext = inviteRequestsContext
|
||||||
|
|
||||||
strongSelf.inviteRequestsDisposable.set((inviteRequestsContext.state
|
strongSelf.inviteRequestsDisposable.set((inviteRequestsContext.state
|
||||||
|
@ -666,7 +666,7 @@ func peerInfoScreenData(context: AccountContext, peerId: PeerId, strings: Presen
|
|||||||
|
|
||||||
if currentRequestsContext == nil {
|
if currentRequestsContext == nil {
|
||||||
if canManageInvitations {
|
if canManageInvitations {
|
||||||
let requestsContext = context.engine.peers.peerInvitationImporters(peerId: peerId, invite: nil)
|
let requestsContext = context.engine.peers.peerInvitationImporters(peerId: peerId, subject: .requests)
|
||||||
requestsContextPromise.set(.single(requestsContext))
|
requestsContextPromise.set(.single(requestsContext))
|
||||||
requestsStatePromise.set(requestsContext.state |> map(Optional.init))
|
requestsStatePromise.set(requestsContext.state |> map(Optional.init))
|
||||||
}
|
}
|
||||||
@ -843,7 +843,7 @@ func peerInfoScreenData(context: AccountContext, peerId: PeerId, strings: Presen
|
|||||||
|
|
||||||
if currentRequestsContext == nil {
|
if currentRequestsContext == nil {
|
||||||
if canManageInvitations {
|
if canManageInvitations {
|
||||||
let requestsContext = context.engine.peers.peerInvitationImporters(peerId: peerId, invite: nil)
|
let requestsContext = context.engine.peers.peerInvitationImporters(peerId: peerId, subject: .requests)
|
||||||
requestsContextPromise.set(.single(requestsContext))
|
requestsContextPromise.set(.single(requestsContext))
|
||||||
requestsStatePromise.set(requestsContext.state |> map(Optional.init))
|
requestsStatePromise.set(requestsContext.state |> map(Optional.init))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user