mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-07 09:20:08 +00:00
Update API
This commit is contained in:
parent
eef0891e96
commit
48cc049d7b
@ -7090,3 +7090,5 @@ Sorry for the inconvenience.";
|
|||||||
"AuthSessions.HeaderInfo" = "Link [Telegram Desktop](desktop) or [Telegram Web](web) by scanning a QR code.";
|
"AuthSessions.HeaderInfo" = "Link [Telegram Desktop](desktop) or [Telegram Web](web) by scanning a QR code.";
|
||||||
"AuthSessions.LinkDesktopDevice" = "Link Desktop Device";
|
"AuthSessions.LinkDesktopDevice" = "Link Desktop Device";
|
||||||
"AuthSessions.AddDevice.ScanInstallInfo" = "Go to [getdesktop.telegram.org](desktop) or [web.telegram.org](web) to get the QR code";
|
"AuthSessions.AddDevice.ScanInstallInfo" = "Go to [getdesktop.telegram.org](desktop) or [web.telegram.org](web) to get the QR code";
|
||||||
|
|
||||||
|
"Channel.AdminLog.MessageSent" = "%@ sent message:";
|
||||||
|
|||||||
@ -479,6 +479,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[1855199800] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeHistoryTTL($0) }
|
dict[1855199800] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeHistoryTTL($0) }
|
||||||
dict[-1347021750] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionParticipantJoinByRequest($0) }
|
dict[-1347021750] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionParticipantJoinByRequest($0) }
|
||||||
dict[-886388890] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionToggleNoForwards($0) }
|
dict[-886388890] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionToggleNoForwards($0) }
|
||||||
|
dict[663693416] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionSendMessage($0) }
|
||||||
dict[-1271602504] = { return Api.auth.ExportedAuthorization.parse_exportedAuthorization($0) }
|
dict[-1271602504] = { return Api.auth.ExportedAuthorization.parse_exportedAuthorization($0) }
|
||||||
dict[2103482845] = { return Api.SecurePlainData.parse_securePlainPhone($0) }
|
dict[2103482845] = { return Api.SecurePlainData.parse_securePlainPhone($0) }
|
||||||
dict[569137759] = { return Api.SecurePlainData.parse_securePlainEmail($0) }
|
dict[569137759] = { return Api.SecurePlainData.parse_securePlainEmail($0) }
|
||||||
@ -623,7 +624,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[1682413576] = { return Api.messages.Messages.parse_channelMessages($0) }
|
dict[1682413576] = { return Api.messages.Messages.parse_channelMessages($0) }
|
||||||
dict[1951620897] = { return Api.messages.Messages.parse_messagesNotModified($0) }
|
dict[1951620897] = { return Api.messages.Messages.parse_messagesNotModified($0) }
|
||||||
dict[215516896] = { return Api.Invoice.parse_invoice($0) }
|
dict[215516896] = { return Api.Invoice.parse_invoice($0) }
|
||||||
dict[-1474130642] = { return Api.PeerSettings.parse_peerSettings($0) }
|
dict[-1525149427] = { return Api.PeerSettings.parse_peerSettings($0) }
|
||||||
dict[1577067778] = { return Api.auth.SentCode.parse_sentCode($0) }
|
dict[1577067778] = { return Api.auth.SentCode.parse_sentCode($0) }
|
||||||
dict[480546647] = { return Api.InputChatPhoto.parse_inputChatPhotoEmpty($0) }
|
dict[480546647] = { return Api.InputChatPhoto.parse_inputChatPhotoEmpty($0) }
|
||||||
dict[-968723890] = { return Api.InputChatPhoto.parse_inputChatUploadedPhoto($0) }
|
dict[-968723890] = { return Api.InputChatPhoto.parse_inputChatUploadedPhoto($0) }
|
||||||
@ -684,6 +685,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[42402760] = { return Api.InputStickerSet.parse_inputStickerSetAnimatedEmoji($0) }
|
dict[42402760] = { return Api.InputStickerSet.parse_inputStickerSetAnimatedEmoji($0) }
|
||||||
dict[-427863538] = { return Api.InputStickerSet.parse_inputStickerSetDice($0) }
|
dict[-427863538] = { return Api.InputStickerSet.parse_inputStickerSetDice($0) }
|
||||||
dict[215889721] = { return Api.InputStickerSet.parse_inputStickerSetAnimatedEmojiAnimations($0) }
|
dict[215889721] = { return Api.InputStickerSet.parse_inputStickerSetAnimatedEmojiAnimations($0) }
|
||||||
|
dict[1189248700] = { return Api.InputStickerSet.parse_inputStickerSetAnimatedEmojiReactions($0) }
|
||||||
dict[-1231326505] = { return Api.messages.ChatAdminsWithInvites.parse_chatAdminsWithInvites($0) }
|
dict[-1231326505] = { return Api.messages.ChatAdminsWithInvites.parse_chatAdminsWithInvites($0) }
|
||||||
dict[460632885] = { return Api.BotInfo.parse_botInfo($0) }
|
dict[460632885] = { return Api.BotInfo.parse_botInfo($0) }
|
||||||
dict[-2046910401] = { return Api.stickers.SuggestedShortName.parse_suggestedShortName($0) }
|
dict[-2046910401] = { return Api.stickers.SuggestedShortName.parse_suggestedShortName($0) }
|
||||||
|
|||||||
@ -11664,6 +11664,7 @@ public extension Api {
|
|||||||
case channelAdminLogEventActionChangeHistoryTTL(prevValue: Int32, newValue: Int32)
|
case channelAdminLogEventActionChangeHistoryTTL(prevValue: Int32, newValue: Int32)
|
||||||
case channelAdminLogEventActionParticipantJoinByRequest(invite: Api.ExportedChatInvite, approvedBy: Int64)
|
case channelAdminLogEventActionParticipantJoinByRequest(invite: Api.ExportedChatInvite, approvedBy: Int64)
|
||||||
case channelAdminLogEventActionToggleNoForwards(newValue: Api.Bool)
|
case channelAdminLogEventActionToggleNoForwards(newValue: Api.Bool)
|
||||||
|
case channelAdminLogEventActionSendMessage(message: Api.Message)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
@ -11886,6 +11887,12 @@ public extension Api {
|
|||||||
}
|
}
|
||||||
newValue.serialize(buffer, true)
|
newValue.serialize(buffer, true)
|
||||||
break
|
break
|
||||||
|
case .channelAdminLogEventActionSendMessage(let message):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(663693416)
|
||||||
|
}
|
||||||
|
message.serialize(buffer, true)
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11959,6 +11966,8 @@ public extension Api {
|
|||||||
return ("channelAdminLogEventActionParticipantJoinByRequest", [("invite", invite), ("approvedBy", approvedBy)])
|
return ("channelAdminLogEventActionParticipantJoinByRequest", [("invite", invite), ("approvedBy", approvedBy)])
|
||||||
case .channelAdminLogEventActionToggleNoForwards(let newValue):
|
case .channelAdminLogEventActionToggleNoForwards(let newValue):
|
||||||
return ("channelAdminLogEventActionToggleNoForwards", [("newValue", newValue)])
|
return ("channelAdminLogEventActionToggleNoForwards", [("newValue", newValue)])
|
||||||
|
case .channelAdminLogEventActionSendMessage(let message):
|
||||||
|
return ("channelAdminLogEventActionSendMessage", [("message", message)])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12433,6 +12442,19 @@ public extension Api {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static func parse_channelAdminLogEventActionSendMessage(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
|
||||||
|
var _1: Api.Message?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
_1 = Api.parse(reader, signature: signature) as? Api.Message
|
||||||
|
}
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
if _c1 {
|
||||||
|
return Api.ChannelAdminLogEventAction.channelAdminLogEventActionSendMessage(message: _1!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum SecurePlainData: TypeConstructorDescription {
|
public enum SecurePlainData: TypeConstructorDescription {
|
||||||
@ -15880,17 +15902,17 @@ public extension Api {
|
|||||||
|
|
||||||
}
|
}
|
||||||
public enum PeerSettings: TypeConstructorDescription {
|
public enum PeerSettings: TypeConstructorDescription {
|
||||||
case peerSettings(flags: Int32, geoDistance: Int32?, requestChat: Api.Peer?, requestChatDate: Int32?)
|
case peerSettings(flags: Int32, geoDistance: Int32?, requestChatTitle: String?, requestChatDate: Int32?)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .peerSettings(let flags, let geoDistance, let requestChat, let requestChatDate):
|
case .peerSettings(let flags, let geoDistance, let requestChatTitle, let requestChatDate):
|
||||||
if boxed {
|
if boxed {
|
||||||
buffer.appendInt32(-1474130642)
|
buffer.appendInt32(-1525149427)
|
||||||
}
|
}
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
if Int(flags) & Int(1 << 6) != 0 {serializeInt32(geoDistance!, buffer: buffer, boxed: false)}
|
if Int(flags) & Int(1 << 6) != 0 {serializeInt32(geoDistance!, buffer: buffer, boxed: false)}
|
||||||
if Int(flags) & Int(1 << 9) != 0 {requestChat!.serialize(buffer, true)}
|
if Int(flags) & Int(1 << 9) != 0 {serializeString(requestChatTitle!, buffer: buffer, boxed: false)}
|
||||||
if Int(flags) & Int(1 << 9) != 0 {serializeInt32(requestChatDate!, buffer: buffer, boxed: false)}
|
if Int(flags) & Int(1 << 9) != 0 {serializeInt32(requestChatDate!, buffer: buffer, boxed: false)}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -15898,8 +15920,8 @@ public extension Api {
|
|||||||
|
|
||||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
switch self {
|
switch self {
|
||||||
case .peerSettings(let flags, let geoDistance, let requestChat, let requestChatDate):
|
case .peerSettings(let flags, let geoDistance, let requestChatTitle, let requestChatDate):
|
||||||
return ("peerSettings", [("flags", flags), ("geoDistance", geoDistance), ("requestChat", requestChat), ("requestChatDate", requestChatDate)])
|
return ("peerSettings", [("flags", flags), ("geoDistance", geoDistance), ("requestChatTitle", requestChatTitle), ("requestChatDate", requestChatDate)])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -15908,10 +15930,8 @@ public extension Api {
|
|||||||
_1 = reader.readInt32()
|
_1 = reader.readInt32()
|
||||||
var _2: Int32?
|
var _2: Int32?
|
||||||
if Int(_1!) & Int(1 << 6) != 0 {_2 = reader.readInt32() }
|
if Int(_1!) & Int(1 << 6) != 0 {_2 = reader.readInt32() }
|
||||||
var _3: Api.Peer?
|
var _3: String?
|
||||||
if Int(_1!) & Int(1 << 9) != 0 {if let signature = reader.readInt32() {
|
if Int(_1!) & Int(1 << 9) != 0 {_3 = parseString(reader) }
|
||||||
_3 = Api.parse(reader, signature: signature) as? Api.Peer
|
|
||||||
} }
|
|
||||||
var _4: Int32?
|
var _4: Int32?
|
||||||
if Int(_1!) & Int(1 << 9) != 0 {_4 = reader.readInt32() }
|
if Int(_1!) & Int(1 << 9) != 0 {_4 = reader.readInt32() }
|
||||||
let _c1 = _1 != nil
|
let _c1 = _1 != nil
|
||||||
@ -15919,7 +15939,7 @@ public extension Api {
|
|||||||
let _c3 = (Int(_1!) & Int(1 << 9) == 0) || _3 != nil
|
let _c3 = (Int(_1!) & Int(1 << 9) == 0) || _3 != nil
|
||||||
let _c4 = (Int(_1!) & Int(1 << 9) == 0) || _4 != nil
|
let _c4 = (Int(_1!) & Int(1 << 9) == 0) || _4 != nil
|
||||||
if _c1 && _c2 && _c3 && _c4 {
|
if _c1 && _c2 && _c3 && _c4 {
|
||||||
return Api.PeerSettings.peerSettings(flags: _1!, geoDistance: _2, requestChat: _3, requestChatDate: _4)
|
return Api.PeerSettings.peerSettings(flags: _1!, geoDistance: _2, requestChatTitle: _3, requestChatDate: _4)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return nil
|
return nil
|
||||||
@ -17328,6 +17348,7 @@ public extension Api {
|
|||||||
case inputStickerSetAnimatedEmoji
|
case inputStickerSetAnimatedEmoji
|
||||||
case inputStickerSetDice(emoticon: String)
|
case inputStickerSetDice(emoticon: String)
|
||||||
case inputStickerSetAnimatedEmojiAnimations
|
case inputStickerSetAnimatedEmojiAnimations
|
||||||
|
case inputStickerSetAnimatedEmojiReactions
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
@ -17367,6 +17388,12 @@ public extension Api {
|
|||||||
buffer.appendInt32(215889721)
|
buffer.appendInt32(215889721)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break
|
||||||
|
case .inputStickerSetAnimatedEmojiReactions:
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(1189248700)
|
||||||
|
}
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -17385,6 +17412,8 @@ public extension Api {
|
|||||||
return ("inputStickerSetDice", [("emoticon", emoticon)])
|
return ("inputStickerSetDice", [("emoticon", emoticon)])
|
||||||
case .inputStickerSetAnimatedEmojiAnimations:
|
case .inputStickerSetAnimatedEmojiAnimations:
|
||||||
return ("inputStickerSetAnimatedEmojiAnimations", [])
|
return ("inputStickerSetAnimatedEmojiAnimations", [])
|
||||||
|
case .inputStickerSetAnimatedEmojiReactions:
|
||||||
|
return ("inputStickerSetAnimatedEmojiReactions", [])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17433,6 +17462,9 @@ public extension Api {
|
|||||||
public static func parse_inputStickerSetAnimatedEmojiAnimations(_ reader: BufferReader) -> InputStickerSet? {
|
public static func parse_inputStickerSetAnimatedEmojiAnimations(_ reader: BufferReader) -> InputStickerSet? {
|
||||||
return Api.InputStickerSet.inputStickerSetAnimatedEmojiAnimations
|
return Api.InputStickerSet.inputStickerSetAnimatedEmojiAnimations
|
||||||
}
|
}
|
||||||
|
public static func parse_inputStickerSetAnimatedEmojiReactions(_ reader: BufferReader) -> InputStickerSet? {
|
||||||
|
return Api.InputStickerSet.inputStickerSetAnimatedEmojiReactions
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum BotInfo: TypeConstructorDescription {
|
public enum BotInfo: TypeConstructorDescription {
|
||||||
|
|||||||
@ -62,6 +62,8 @@ extension StickerPackReference {
|
|||||||
self = .dice(emoticon)
|
self = .dice(emoticon)
|
||||||
case .inputStickerSetAnimatedEmojiAnimations:
|
case .inputStickerSetAnimatedEmojiAnimations:
|
||||||
self = .animatedEmojiAnimations
|
self = .animatedEmojiAnimations
|
||||||
|
case .inputStickerSetAnimatedEmojiReactions:
|
||||||
|
self = .animatedEmojiReactions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import SwiftSignalKit
|
|||||||
extension PeerStatusSettings {
|
extension PeerStatusSettings {
|
||||||
init(apiSettings: Api.PeerSettings) {
|
init(apiSettings: Api.PeerSettings) {
|
||||||
switch apiSettings {
|
switch apiSettings {
|
||||||
case let .peerSettings(flags, geoDistance, requestChat, requestChatDate):
|
case let .peerSettings(flags, geoDistance, requestChatTitle, requestChatDate):
|
||||||
var result = PeerStatusSettings.Flags()
|
var result = PeerStatusSettings.Flags()
|
||||||
if (flags & (1 << 1)) != 0 {
|
if (flags & (1 << 1)) != 0 {
|
||||||
result.insert(.canAddContact)
|
result.insert(.canAddContact)
|
||||||
@ -32,7 +32,7 @@ extension PeerStatusSettings {
|
|||||||
if (flags & (1 << 8)) != 0 {
|
if (flags & (1 << 8)) != 0 {
|
||||||
result.insert(.suggestAddMembers)
|
result.insert(.suggestAddMembers)
|
||||||
}
|
}
|
||||||
self = PeerStatusSettings(flags: result, geoDistance: geoDistance, requestChatPeerId: requestChat?.peerId, requestChatDate: requestChatDate)
|
self = PeerStatusSettings(flags: result, geoDistance: geoDistance, requestChatTitle: requestChatTitle, requestChatDate: requestChatDate, requestChatIsChannel: (flags & (1 << 9)) != 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,7 +61,7 @@ public func addSavedSticker(postbox: Postbox, network: Network, file: TelegramMe
|
|||||||
if !found {
|
if !found {
|
||||||
fetchReference = packReference
|
fetchReference = packReference
|
||||||
}
|
}
|
||||||
case .animatedEmoji, .animatedEmojiAnimations, .dice:
|
case .animatedEmoji, .animatedEmojiAnimations, .dice, .animatedEmojiReactions:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if let fetchReference = fetchReference {
|
if let fetchReference = fetchReference {
|
||||||
|
|||||||
@ -101,11 +101,7 @@ public final class CachedUserData: CachedPeerData {
|
|||||||
self.autoremoveTimeout = autoremoveTimeout
|
self.autoremoveTimeout = autoremoveTimeout
|
||||||
self.themeEmoticon = themeEmoticon
|
self.themeEmoticon = themeEmoticon
|
||||||
|
|
||||||
var peerIds = Set<PeerId>()
|
self.peerIds = Set<PeerId>()
|
||||||
if let requestChatPeerId = peerStatusSettings?.requestChatPeerId {
|
|
||||||
peerIds.insert(requestChatPeerId)
|
|
||||||
}
|
|
||||||
self.peerIds = peerIds
|
|
||||||
|
|
||||||
var messageIds = Set<MessageId>()
|
var messageIds = Set<MessageId>()
|
||||||
if let pinnedMessageId = self.pinnedMessageId {
|
if let pinnedMessageId = self.pinnedMessageId {
|
||||||
@ -139,11 +135,7 @@ public final class CachedUserData: CachedPeerData {
|
|||||||
self.autoremoveTimeout = decoder.decodeObjectForKey("artv", decoder: CachedPeerAutoremoveTimeout.init(decoder:)) as? CachedPeerAutoremoveTimeout ?? .unknown
|
self.autoremoveTimeout = decoder.decodeObjectForKey("artv", decoder: CachedPeerAutoremoveTimeout.init(decoder:)) as? CachedPeerAutoremoveTimeout ?? .unknown
|
||||||
self.themeEmoticon = decoder.decodeOptionalStringForKey("te")
|
self.themeEmoticon = decoder.decodeOptionalStringForKey("te")
|
||||||
|
|
||||||
var peerIds = Set<PeerId>()
|
self.peerIds = Set<PeerId>()
|
||||||
if let requestChatPeerId = self.peerStatusSettings?.requestChatPeerId {
|
|
||||||
peerIds.insert(requestChatPeerId)
|
|
||||||
}
|
|
||||||
self.peerIds = peerIds
|
|
||||||
|
|
||||||
var messageIds = Set<MessageId>()
|
var messageIds = Set<MessageId>()
|
||||||
if let pinnedMessageId = self.pinnedMessageId {
|
if let pinnedMessageId = self.pinnedMessageId {
|
||||||
|
|||||||
@ -45,6 +45,7 @@ public struct Namespaces {
|
|||||||
public static let CloudAnimatedEmoji: Int32 = 3
|
public static let CloudAnimatedEmoji: Int32 = 3
|
||||||
public static let CloudDice: Int32 = 4
|
public static let CloudDice: Int32 = 4
|
||||||
public static let CloudAnimatedEmojiAnimations: Int32 = 5
|
public static let CloudAnimatedEmojiAnimations: Int32 = 5
|
||||||
|
public static let CloudAnimatedEmojiReactions: Int32 = 6
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct OrderedItemList {
|
public struct OrderedItemList {
|
||||||
|
|||||||
@ -21,28 +21,31 @@ public struct PeerStatusSettings: PostboxCoding, Equatable {
|
|||||||
|
|
||||||
public var flags: PeerStatusSettings.Flags
|
public var flags: PeerStatusSettings.Flags
|
||||||
public var geoDistance: Int32?
|
public var geoDistance: Int32?
|
||||||
public var requestChatPeerId: PeerId?
|
public var requestChatTitle: String?
|
||||||
public var requestChatDate: Int32?
|
public var requestChatDate: Int32?
|
||||||
|
public var requestChatIsChannel: Bool?
|
||||||
|
|
||||||
public init() {
|
public init() {
|
||||||
self.flags = PeerStatusSettings.Flags()
|
self.flags = PeerStatusSettings.Flags()
|
||||||
self.geoDistance = nil
|
self.geoDistance = nil
|
||||||
self.requestChatPeerId = nil
|
self.requestChatTitle = nil
|
||||||
self.requestChatDate = nil
|
self.requestChatDate = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(flags: PeerStatusSettings.Flags, geoDistance: Int32? = nil, requestChatPeerId: PeerId? = nil, requestChatDate: Int32? = nil) {
|
public init(flags: PeerStatusSettings.Flags, geoDistance: Int32? = nil, requestChatTitle: String? = nil, requestChatDate: Int32? = nil, requestChatIsChannel: Bool? = nil) {
|
||||||
self.flags = flags
|
self.flags = flags
|
||||||
self.geoDistance = geoDistance
|
self.geoDistance = geoDistance
|
||||||
self.requestChatPeerId = requestChatPeerId
|
self.requestChatTitle = requestChatTitle
|
||||||
self.requestChatDate = requestChatDate
|
self.requestChatDate = requestChatDate
|
||||||
|
self.requestChatIsChannel = requestChatIsChannel
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(decoder: PostboxDecoder) {
|
public init(decoder: PostboxDecoder) {
|
||||||
self.flags = Flags(rawValue: decoder.decodeInt32ForKey("flags", orElse: 0))
|
self.flags = Flags(rawValue: decoder.decodeInt32ForKey("flags", orElse: 0))
|
||||||
self.geoDistance = decoder.decodeOptionalInt32ForKey("geoDistance")
|
self.geoDistance = decoder.decodeOptionalInt32ForKey("geoDistance")
|
||||||
self.requestChatPeerId = decoder.decodeOptionalInt64ForKey("requestChatPeerId").map { PeerId($0) }
|
self.requestChatTitle = decoder.decodeOptionalStringForKey("requestChatTitle")
|
||||||
self.requestChatDate = decoder.decodeOptionalInt32ForKey("requestChatDate")
|
self.requestChatDate = decoder.decodeOptionalInt32ForKey("requestChatDate")
|
||||||
|
self.requestChatIsChannel = decoder.decodeOptionalBoolForKey("requestChatIsChannel")
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(_ encoder: PostboxEncoder) {
|
public func encode(_ encoder: PostboxEncoder) {
|
||||||
@ -52,16 +55,21 @@ public struct PeerStatusSettings: PostboxCoding, Equatable {
|
|||||||
} else {
|
} else {
|
||||||
encoder.encodeNil(forKey: "geoDistance")
|
encoder.encodeNil(forKey: "geoDistance")
|
||||||
}
|
}
|
||||||
if let requestChatPeerId = self.requestChatPeerId {
|
if let requestChatTitle = self.requestChatTitle {
|
||||||
encoder.encodeInt64(requestChatPeerId.toInt64(), forKey: "requestChatPeerId")
|
encoder.encodeString(requestChatTitle, forKey: "requestChatTitle")
|
||||||
} else {
|
} else {
|
||||||
encoder.encodeNil(forKey: "requestPeerId")
|
encoder.encodeNil(forKey: "requestChatTitle")
|
||||||
}
|
}
|
||||||
if let requestChatDate = self.requestChatDate {
|
if let requestChatDate = self.requestChatDate {
|
||||||
encoder.encodeInt32(requestChatDate, forKey: "requestChatDate")
|
encoder.encodeInt32(requestChatDate, forKey: "requestChatDate")
|
||||||
} else {
|
} else {
|
||||||
encoder.encodeNil(forKey: "requestChatDate")
|
encoder.encodeNil(forKey: "requestChatDate")
|
||||||
}
|
}
|
||||||
|
if let requestChatIsChannel = self.requestChatIsChannel {
|
||||||
|
encoder.encodeBool(requestChatIsChannel, forKey: "requestChatIsChannel")
|
||||||
|
} else {
|
||||||
|
encoder.encodeNil(forKey: "requestChatIsChannel")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func contains(_ member: PeerStatusSettings.Flags) -> Bool {
|
public func contains(_ member: PeerStatusSettings.Flags) -> Bool {
|
||||||
|
|||||||
@ -17,6 +17,7 @@ public enum StickerPackReference: PostboxCoding, Hashable, Equatable {
|
|||||||
case animatedEmoji
|
case animatedEmoji
|
||||||
case dice(String)
|
case dice(String)
|
||||||
case animatedEmojiAnimations
|
case animatedEmojiAnimations
|
||||||
|
case animatedEmojiReactions
|
||||||
|
|
||||||
public init(decoder: PostboxDecoder) {
|
public init(decoder: PostboxDecoder) {
|
||||||
switch decoder.decodeInt32ForKey("r", orElse: 0) {
|
switch decoder.decodeInt32ForKey("r", orElse: 0) {
|
||||||
@ -30,6 +31,8 @@ public enum StickerPackReference: PostboxCoding, Hashable, Equatable {
|
|||||||
self = .dice(decoder.decodeStringForKey("e", orElse: "🎲"))
|
self = .dice(decoder.decodeStringForKey("e", orElse: "🎲"))
|
||||||
case 4:
|
case 4:
|
||||||
self = .animatedEmojiAnimations
|
self = .animatedEmojiAnimations
|
||||||
|
case 5:
|
||||||
|
self = .animatedEmojiReactions
|
||||||
default:
|
default:
|
||||||
self = .name("")
|
self = .name("")
|
||||||
assertionFailure()
|
assertionFailure()
|
||||||
@ -52,6 +55,8 @@ public enum StickerPackReference: PostboxCoding, Hashable, Equatable {
|
|||||||
encoder.encodeString(emoji, forKey: "e")
|
encoder.encodeString(emoji, forKey: "e")
|
||||||
case .animatedEmojiAnimations:
|
case .animatedEmojiAnimations:
|
||||||
encoder.encodeInt32(4, forKey: "r")
|
encoder.encodeInt32(4, forKey: "r")
|
||||||
|
case .animatedEmojiReactions:
|
||||||
|
encoder.encodeInt32(5, forKey: "r")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,6 +92,12 @@ public enum StickerPackReference: PostboxCoding, Hashable, Equatable {
|
|||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
case .animatedEmojiReactions:
|
||||||
|
if case .animatedEmojiReactions = rhs {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,6 +66,7 @@ public enum AdminLogEventAction {
|
|||||||
case changeTheme(previous: String?, updated: String?)
|
case changeTheme(previous: String?, updated: String?)
|
||||||
case participantJoinByRequest(invitation: ExportedInvitation, approvedBy: PeerId)
|
case participantJoinByRequest(invitation: ExportedInvitation, approvedBy: PeerId)
|
||||||
case toggleCopyProtection(Bool)
|
case toggleCopyProtection(Bool)
|
||||||
|
case sendMessage(Message)
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ChannelAdminLogEventError {
|
public enum ChannelAdminLogEventError {
|
||||||
@ -256,6 +257,10 @@ func channelAdminLogEvents(postbox: Postbox, network: Network, peerId: PeerId, m
|
|||||||
action = .participantJoinByRequest(invitation: ExportedInvitation(apiExportedInvite: invite), approvedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(approvedBy)))
|
action = .participantJoinByRequest(invitation: ExportedInvitation(apiExportedInvite: invite), approvedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(approvedBy)))
|
||||||
case let .channelAdminLogEventActionToggleNoForwards(new):
|
case let .channelAdminLogEventActionToggleNoForwards(new):
|
||||||
action = .toggleCopyProtection(boolFromApiValue(new))
|
action = .toggleCopyProtection(boolFromApiValue(new))
|
||||||
|
case let .channelAdminLogEventActionSendMessage(message):
|
||||||
|
if let message = StoreMessage(apiMessage: message), let rendered = locallyRenderedMessage(message: message, peers: peers) {
|
||||||
|
action = .sendMessage(rendered)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))
|
let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))
|
||||||
if let action = action {
|
if let action = action {
|
||||||
|
|||||||
@ -127,6 +127,20 @@ func _internal_cachedStickerPack(postbox: Postbox, network: Network, reference:
|
|||||||
} else {
|
} else {
|
||||||
return (.fetching, true, nil)
|
return (.fetching, true, nil)
|
||||||
}
|
}
|
||||||
|
case .animatedEmojiReactions:
|
||||||
|
let namespace = Namespaces.ItemCollection.CloudAnimatedEmojiReactions
|
||||||
|
let id: ItemCollectionId.Id = 0
|
||||||
|
if let cached = transaction.retrieveItemCacheEntry(id: ItemCacheEntryId(collectionId: Namespaces.CachedItemCollection.cachedStickerPacks, key: CachedStickerPack.cacheKey(ItemCollectionId(namespace: namespace, id: id))))?.get(CachedStickerPack.self), let info = cached.info {
|
||||||
|
previousHash = cached.hash
|
||||||
|
let current: CachedStickerPackResult = .result(info, cached.items, false)
|
||||||
|
if cached.hash != info.hash {
|
||||||
|
return (current, true, previousHash)
|
||||||
|
} else {
|
||||||
|
return (current, false, previousHash)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return (.fetching, true, nil)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|> mapToSignal { result, loadRemote, previousHash in
|
|> mapToSignal { result, loadRemote, previousHash in
|
||||||
@ -223,6 +237,18 @@ func cachedStickerPack(transaction: Transaction, reference: StickerPackReference
|
|||||||
if let cached = transaction.retrieveItemCacheEntry(id: ItemCacheEntryId(collectionId: Namespaces.CachedItemCollection.cachedStickerPacks, key: CachedStickerPack.cacheKey(ItemCollectionId(namespace: namespace, id: id))))?.get(CachedStickerPack.self), let info = cached.info {
|
if let cached = transaction.retrieveItemCacheEntry(id: ItemCacheEntryId(collectionId: Namespaces.CachedItemCollection.cachedStickerPacks, key: CachedStickerPack.cacheKey(ItemCollectionId(namespace: namespace, id: id))))?.get(CachedStickerPack.self), let info = cached.info {
|
||||||
return (info, cached.items, false)
|
return (info, cached.items, false)
|
||||||
}
|
}
|
||||||
|
case .animatedEmojiReactions:
|
||||||
|
let namespace = Namespaces.ItemCollection.CloudAnimatedEmojiReactions
|
||||||
|
let id: ItemCollectionId.Id = 0
|
||||||
|
if let currentInfo = transaction.getItemCollectionInfo(collectionId: ItemCollectionId(namespace: namespace, id: id)) as? StickerPackCollectionInfo {
|
||||||
|
let items = transaction.getItemCollectionItems(collectionId: ItemCollectionId(namespace: namespace, id: id))
|
||||||
|
if !items.isEmpty {
|
||||||
|
return (currentInfo, items.compactMap { $0 as? StickerPackItem }, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let cached = transaction.retrieveItemCacheEntry(id: ItemCacheEntryId(collectionId: Namespaces.CachedItemCollection.cachedStickerPacks, key: CachedStickerPack.cacheKey(ItemCollectionId(namespace: namespace, id: id))))?.get(CachedStickerPack.self), let info = cached.info {
|
||||||
|
return (info, cached.items, false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,8 @@ extension StickerPackReference {
|
|||||||
return .inputStickerSetDice(emoticon: emoji)
|
return .inputStickerSetDice(emoticon: emoji)
|
||||||
case .animatedEmojiAnimations:
|
case .animatedEmojiAnimations:
|
||||||
return .inputStickerSetAnimatedEmojiAnimations
|
return .inputStickerSetAnimatedEmojiAnimations
|
||||||
|
case .animatedEmojiReactions:
|
||||||
|
return .inputStickerSetAnimatedEmojiReactions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,6 +43,9 @@ func _internal_requestStickerSet(postbox: Postbox, network: Network, reference:
|
|||||||
case .animatedEmojiAnimations:
|
case .animatedEmojiAnimations:
|
||||||
collectionId = nil
|
collectionId = nil
|
||||||
input = .inputStickerSetAnimatedEmojiAnimations
|
input = .inputStickerSetAnimatedEmojiAnimations
|
||||||
|
case .animatedEmojiReactions:
|
||||||
|
collectionId = nil
|
||||||
|
input = .inputStickerSetAnimatedEmojiReactions
|
||||||
}
|
}
|
||||||
|
|
||||||
let localSignal: (ItemCollectionId) -> Signal<(ItemCollectionInfo, [ItemCollectionItem])?, NoError> = { collectionId in
|
let localSignal: (ItemCollectionId) -> Signal<(ItemCollectionInfo, [ItemCollectionItem])?, NoError> = { collectionId in
|
||||||
|
|||||||
@ -224,8 +224,6 @@ public extension Message {
|
|||||||
return true
|
return true
|
||||||
} else if let channel = self.peers[self.id.peerId] as? TelegramChannel, case .broadcast = channel.info {
|
} else if let channel = self.peers[self.id.peerId] as? TelegramChannel, case .broadcast = channel.info {
|
||||||
return true
|
return true
|
||||||
} else if self.id.peerId.namespace == Namespaces.Peer.CloudChannel, self.author?.id != accountPeerId {
|
|
||||||
return true
|
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3475,13 +3475,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
var contactStatus: ChatContactStatus?
|
var contactStatus: ChatContactStatus?
|
||||||
if let peer = peerView.peers[peerView.peerId] {
|
if let peer = peerView.peers[peerView.peerId] {
|
||||||
if let cachedData = peerView.cachedData as? CachedUserData {
|
if let cachedData = peerView.cachedData as? CachedUserData {
|
||||||
var requestChatPeer: Peer?
|
contactStatus = ChatContactStatus(canAddContact: !peerView.peerIsContact, canReportIrrelevantLocation: false, peerStatusSettings: cachedData.peerStatusSettings, invitedBy: nil)
|
||||||
if let requestChatPeerId = cachedData.peerStatusSettings?.requestChatPeerId {
|
|
||||||
if let peer = peerView.peers[requestChatPeerId] {
|
|
||||||
requestChatPeer = peer
|
|
||||||
}
|
|
||||||
}
|
|
||||||
contactStatus = ChatContactStatus(canAddContact: !peerView.peerIsContact, canReportIrrelevantLocation: false, peerStatusSettings: cachedData.peerStatusSettings, invitedBy: nil, requestChatPeer: requestChatPeer)
|
|
||||||
} else if let cachedData = peerView.cachedData as? CachedGroupData {
|
} else if let cachedData = peerView.cachedData as? CachedGroupData {
|
||||||
var invitedBy: Peer?
|
var invitedBy: Peer?
|
||||||
if let invitedByPeerId = cachedData.invitedBy {
|
if let invitedByPeerId = cachedData.invitedBy {
|
||||||
@ -3489,7 +3483,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
invitedBy = peer
|
invitedBy = peer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
contactStatus = ChatContactStatus(canAddContact: false, canReportIrrelevantLocation: false, peerStatusSettings: cachedData.peerStatusSettings, invitedBy: invitedBy, requestChatPeer: nil)
|
contactStatus = ChatContactStatus(canAddContact: false, canReportIrrelevantLocation: false, peerStatusSettings: cachedData.peerStatusSettings, invitedBy: invitedBy)
|
||||||
} else if let cachedData = peerView.cachedData as? CachedChannelData {
|
} else if let cachedData = peerView.cachedData as? CachedChannelData {
|
||||||
var canReportIrrelevantLocation = true
|
var canReportIrrelevantLocation = true
|
||||||
if let peer = peerView.peers[peerView.peerId] as? TelegramChannel, peer.participationStatus == .member {
|
if let peer = peerView.peers[peerView.peerId] as? TelegramChannel, peer.participationStatus == .member {
|
||||||
@ -3504,7 +3498,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
invitedBy = peer
|
invitedBy = peer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
contactStatus = ChatContactStatus(canAddContact: false, canReportIrrelevantLocation: canReportIrrelevantLocation, peerStatusSettings: cachedData.peerStatusSettings, invitedBy: invitedBy, requestChatPeer: nil)
|
contactStatus = ChatContactStatus(canAddContact: false, canReportIrrelevantLocation: canReportIrrelevantLocation, peerStatusSettings: cachedData.peerStatusSettings, invitedBy: invitedBy)
|
||||||
}
|
}
|
||||||
|
|
||||||
var peers = SimpleDictionary<PeerId, Peer>()
|
var peers = SimpleDictionary<PeerId, Peer>()
|
||||||
@ -13995,13 +13989,13 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func presentChatRequestAdminInfo() {
|
private func presentChatRequestAdminInfo() {
|
||||||
if let requestChatPeer = self.presentationInterfaceState.contactStatus?.requestChatPeer, let requestDate = self.presentationInterfaceState.contactStatus?.peerStatusSettings?.requestChatDate {
|
if let requestChatTitle = self.presentationInterfaceState.contactStatus?.peerStatusSettings?.requestChatTitle, let requestDate = self.presentationInterfaceState.contactStatus?.peerStatusSettings?.requestChatDate {
|
||||||
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
|
||||||
|
|
||||||
let controller = ActionSheetController(presentationData: presentationData)
|
let controller = ActionSheetController(presentationData: presentationData)
|
||||||
var items: [ActionSheetItem] = []
|
var items: [ActionSheetItem] = []
|
||||||
|
|
||||||
let text = presentationData.strings.Conversation_InviteRequestInfo(EnginePeer(requestChatPeer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), stringForDate(timestamp: requestDate, strings: presentationData.strings))
|
let text = presentationData.strings.Conversation_InviteRequestInfo(requestChatTitle, stringForDate(timestamp: requestDate, strings: presentationData.strings))
|
||||||
|
|
||||||
items.append(ActionSheetTextItem(title: text.string))
|
items.append(ActionSheetTextItem(title: text.string))
|
||||||
items.append(ActionSheetButtonItem(title: self.presentationData.strings.Conversation_InviteRequestInfoConfirm, color: .accent, action: { [weak self, weak controller] in
|
items.append(ActionSheetButtonItem(title: self.presentationData.strings.Conversation_InviteRequestInfoConfirm, color: .accent, action: { [weak self, weak controller] in
|
||||||
|
|||||||
@ -1117,7 +1117,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
|||||||
if allowFullWidth {
|
if allowFullWidth {
|
||||||
tmpWidth = baseWidth
|
tmpWidth = baseWidth
|
||||||
if needsShareButton || isAd {
|
if needsShareButton || isAd {
|
||||||
tmpWidth -= 38.0
|
tmpWidth -= 45.0
|
||||||
} else {
|
} else {
|
||||||
tmpWidth -= 4.0
|
tmpWidth -= 4.0
|
||||||
}
|
}
|
||||||
|
|||||||
@ -198,7 +198,6 @@ struct ChatContactStatus: Equatable {
|
|||||||
var canReportIrrelevantLocation: Bool
|
var canReportIrrelevantLocation: Bool
|
||||||
var peerStatusSettings: PeerStatusSettings?
|
var peerStatusSettings: PeerStatusSettings?
|
||||||
var invitedBy: Peer?
|
var invitedBy: Peer?
|
||||||
var requestChatPeer: Peer?
|
|
||||||
|
|
||||||
var isEmpty: Bool {
|
var isEmpty: Bool {
|
||||||
guard var peerStatusSettings = self.peerStatusSettings else {
|
guard var peerStatusSettings = self.peerStatusSettings else {
|
||||||
@ -226,9 +225,6 @@ struct ChatContactStatus: Equatable {
|
|||||||
if !arePeersEqual(lhs.invitedBy, rhs.invitedBy) {
|
if !arePeersEqual(lhs.invitedBy, rhs.invitedBy) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if !arePeersEqual(lhs.requestChatPeer, rhs.requestChatPeer) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1490,6 +1490,49 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
|||||||
let action = TelegramMediaActionType.customText(text: text, entities: entities)
|
let action = TelegramMediaActionType.customText(text: text, entities: entities)
|
||||||
let message = Message(stableId: self.entry.stableId, stableVersion: 0, id: MessageId(peerId: peer.id, namespace: Namespaces.Message.Cloud, id: Int32(bitPattern: self.entry.stableId)), globallyUniqueId: self.entry.event.id, groupingKey: nil, groupInfo: nil, threadId: nil, timestamp: self.entry.event.date, flags: [.Incoming], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: author, text: "", attributes: [], media: [TelegramMediaAction(action: action)], peers: peers, associatedMessages: SimpleDictionary(), associatedMessageIds: [])
|
let message = Message(stableId: self.entry.stableId, stableVersion: 0, id: MessageId(peerId: peer.id, namespace: Namespaces.Message.Cloud, id: Int32(bitPattern: self.entry.stableId)), globallyUniqueId: self.entry.event.id, groupingKey: nil, groupInfo: nil, threadId: nil, timestamp: self.entry.event.date, flags: [.Incoming], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: author, text: "", attributes: [], media: [TelegramMediaAction(action: action)], peers: peers, associatedMessages: SimpleDictionary(), associatedMessageIds: [])
|
||||||
return ChatMessageItem(presentationData: self.presentationData, context: context, chatLocation: .peer(peer.id), associatedData: ChatMessageItemAssociatedData(automaticDownloadPeerType: .channel, automaticDownloadNetworkType: .cellular, isRecentActions: true), controllerInteraction: controllerInteraction, content: .message(message: message, read: true, selection: .none, attributes: ChatMessageEntryAttributes(), location: nil))
|
return ChatMessageItem(presentationData: self.presentationData, context: context, chatLocation: .peer(peer.id), associatedData: ChatMessageItemAssociatedData(automaticDownloadPeerType: .channel, automaticDownloadNetworkType: .cellular, isRecentActions: true), controllerInteraction: controllerInteraction, content: .message(message: message, read: true, selection: .none, attributes: ChatMessageEntryAttributes(), location: nil))
|
||||||
|
case let .sendMessage(message):
|
||||||
|
switch self.id.contentIndex {
|
||||||
|
case .header:
|
||||||
|
var peers = SimpleDictionary<PeerId, Peer>()
|
||||||
|
var author: Peer?
|
||||||
|
if self.entry.event.peerId == PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(136817688)) {
|
||||||
|
author = message.effectiveAuthor
|
||||||
|
} else if let peer = self.entry.peers[self.entry.event.peerId] {
|
||||||
|
author = peer
|
||||||
|
peers[peer.id] = peer
|
||||||
|
}
|
||||||
|
var text: String = ""
|
||||||
|
var entities: [MessageTextEntity] = []
|
||||||
|
|
||||||
|
let textFormat = self.presentationData.strings.Channel_AdminLog_MessageSent
|
||||||
|
appendAttributedText(text: textFormat(author.flatMap(EnginePeer.init)?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? ""), generateEntities: { index in
|
||||||
|
if index == 0, let author = author {
|
||||||
|
return [.TextMention(peerId: author.id)]
|
||||||
|
}
|
||||||
|
return []
|
||||||
|
}, to: &text, entities: &entities)
|
||||||
|
|
||||||
|
let action = TelegramMediaActionType.customText(text: text, entities: entities)
|
||||||
|
let message = Message(stableId: 0, stableVersion: 0, id: MessageId(peerId: peer.id, namespace: Namespaces.Message.Cloud, id: 1), globallyUniqueId: self.entry.event.id, groupingKey: nil, groupInfo: nil, threadId: nil, timestamp: self.entry.event.date, flags: [.Incoming], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: author, text: "", attributes: [], media: [TelegramMediaAction(action: action)], peers: peers, associatedMessages: SimpleDictionary(), associatedMessageIds: [])
|
||||||
|
return ChatMessageItem(presentationData: self.presentationData, context: context, chatLocation: .peer(peer.id), associatedData: ChatMessageItemAssociatedData(automaticDownloadPeerType: .channel, automaticDownloadNetworkType: .cellular, isRecentActions: true), controllerInteraction: controllerInteraction, content: .message(message: message, read: true, selection: .none, attributes: ChatMessageEntryAttributes(), location: nil))
|
||||||
|
case .content:
|
||||||
|
var peers = SimpleDictionary<PeerId, Peer>()
|
||||||
|
var attributes: [MessageAttribute] = []
|
||||||
|
for attribute in message.attributes {
|
||||||
|
if let attribute = attribute as? TextEntitiesMessageAttribute {
|
||||||
|
attributes.append(attribute)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for attribute in attributes {
|
||||||
|
for peerId in attribute.associatedPeerIds {
|
||||||
|
if let peer = self.entry.peers[peerId] {
|
||||||
|
peers[peer.id] = peer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let message = Message(stableId: self.entry.stableId, stableVersion: 0, id: MessageId(peerId: peer.id, namespace: Namespaces.Message.Cloud, id: Int32(bitPattern: self.entry.stableId)), globallyUniqueId: self.entry.event.id, groupingKey: nil, groupInfo: nil, threadId: nil, timestamp: self.entry.event.date, flags: [.Incoming], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: message.effectiveAuthor, text: message.text, attributes: attributes, media: message.media, peers: peers, associatedMessages: SimpleDictionary(), associatedMessageIds: [])
|
||||||
|
return ChatMessageItem(presentationData: self.presentationData, context: context, chatLocation: .peer(peer.id), associatedData: ChatMessageItemAssociatedData(automaticDownloadPeerType: .channel, automaticDownloadNetworkType: .cellular, isRecentActions: true), controllerInteraction: controllerInteraction, content: .message(message: message, read: true, selection: .none, attributes: ChatMessageEntryAttributes(), location: nil))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -446,14 +446,15 @@ final class ChatReportPeerTitlePanelNode: ChatTitleAccessoryPanelNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let requestChatPeer = interfaceState.contactStatus?.requestChatPeer, let renderedPeer = interfaceState.renderedPeer, let peer = renderedPeer.chatMainPeer {
|
if let requestChatTitle = interfaceState.contactStatus?.peerStatusSettings?.requestChatTitle, let requestChatIsChannel = interfaceState.contactStatus?.peerStatusSettings?.requestChatIsChannel, let renderedPeer = interfaceState.renderedPeer, let peer = renderedPeer.chatMainPeer {
|
||||||
let text: NSAttributedString
|
let text: NSAttributedString
|
||||||
let regular = MarkdownAttributeSet(font: Font.regular(15.0), textColor: interfaceState.theme.rootController.navigationBar.primaryTextColor)
|
let regular = MarkdownAttributeSet(font: Font.regular(15.0), textColor: interfaceState.theme.rootController.navigationBar.primaryTextColor)
|
||||||
let bold = MarkdownAttributeSet(font: Font.bold(15.0), textColor: interfaceState.theme.rootController.navigationBar.primaryTextColor)
|
let bold = MarkdownAttributeSet(font: Font.bold(15.0), textColor: interfaceState.theme.rootController.navigationBar.primaryTextColor)
|
||||||
if let requestChatPeer = requestChatPeer as? TelegramChannel, case .broadcast = requestChatPeer.info {
|
|
||||||
text = addAttributesToStringWithRanges(interfaceState.strings.Conversation_InviteRequestAdminChannel(EnginePeer(peer).compactDisplayTitle, EnginePeer(requestChatPeer).displayTitle(strings: interfaceState.strings, displayOrder: interfaceState.nameDisplayOrder))._tuple, body: regular, argumentAttributes: [0: bold, 1: bold])
|
if requestChatIsChannel {
|
||||||
|
text = addAttributesToStringWithRanges(interfaceState.strings.Conversation_InviteRequestAdminChannel(EnginePeer(peer).compactDisplayTitle, requestChatTitle)._tuple, body: regular, argumentAttributes: [0: bold, 1: bold])
|
||||||
} else {
|
} else {
|
||||||
text = addAttributesToStringWithRanges(interfaceState.strings.Conversation_InviteRequestAdminGroup(EnginePeer(peer).compactDisplayTitle, EnginePeer(requestChatPeer).displayTitle(strings: interfaceState.strings, displayOrder: interfaceState.nameDisplayOrder))._tuple, body: regular, argumentAttributes: [0: bold, 1: bold])
|
text = addAttributesToStringWithRanges(interfaceState.strings.Conversation_InviteRequestAdminGroup(EnginePeer(peer).compactDisplayTitle, requestChatTitle)._tuple, body: regular, argumentAttributes: [0: bold, 1: bold])
|
||||||
}
|
}
|
||||||
self.textNode.attributedText = text
|
self.textNode.attributedText = text
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user