mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-05 19:28:46 +02:00
Refactor Api types 43-52 to use struct-wrapped constructors
Also adds -warnings-as-errors to TelegramCore Package.swift Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
9f757cbf74
commit
68d60d34dc
24 changed files with 888 additions and 211 deletions
|
|
@ -267,7 +267,15 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum CdnPublicKey: TypeConstructorDescription {
|
||||
case cdnPublicKey(dcId: Int32, publicKey: String)
|
||||
public class Cons_cdnPublicKey {
|
||||
public var dcId: Int32
|
||||
public var publicKey: String
|
||||
public init(dcId: Int32, publicKey: String) {
|
||||
self.dcId = dcId
|
||||
self.publicKey = publicKey
|
||||
}
|
||||
}
|
||||
case cdnPublicKey(Cons_cdnPublicKey)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -296,7 +304,19 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
indirect enum ChannelAdminLogEvent: TypeConstructorDescription {
|
||||
case channelAdminLogEvent(id: Int64, date: Int32, userId: Int64, action: Api.ChannelAdminLogEventAction)
|
||||
public class Cons_channelAdminLogEvent {
|
||||
public var id: Int64
|
||||
public var date: Int32
|
||||
public var userId: Int64
|
||||
public var action: Api.ChannelAdminLogEventAction
|
||||
public init(id: Int64, date: Int32, userId: Int64, action: Api.ChannelAdminLogEventAction) {
|
||||
self.id = id
|
||||
self.date = date
|
||||
self.userId = userId
|
||||
self.action = action
|
||||
}
|
||||
}
|
||||
case channelAdminLogEvent(Cons_channelAdminLogEvent)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -325,57 +345,405 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
indirect enum ChannelAdminLogEventAction: TypeConstructorDescription {
|
||||
case channelAdminLogEventActionChangeAbout(prevValue: String, newValue: String)
|
||||
case channelAdminLogEventActionChangeAvailableReactions(prevValue: Api.ChatReactions, newValue: Api.ChatReactions)
|
||||
case channelAdminLogEventActionChangeEmojiStatus(prevValue: Api.EmojiStatus, newValue: Api.EmojiStatus)
|
||||
case channelAdminLogEventActionChangeEmojiStickerSet(prevStickerset: Api.InputStickerSet, newStickerset: Api.InputStickerSet)
|
||||
case channelAdminLogEventActionChangeHistoryTTL(prevValue: Int32, newValue: Int32)
|
||||
case channelAdminLogEventActionChangeLinkedChat(prevValue: Int64, newValue: Int64)
|
||||
case channelAdminLogEventActionChangeLocation(prevValue: Api.ChannelLocation, newValue: Api.ChannelLocation)
|
||||
case channelAdminLogEventActionChangePeerColor(prevValue: Api.PeerColor, newValue: Api.PeerColor)
|
||||
case channelAdminLogEventActionChangePhoto(prevPhoto: Api.Photo, newPhoto: Api.Photo)
|
||||
case channelAdminLogEventActionChangeProfilePeerColor(prevValue: Api.PeerColor, newValue: Api.PeerColor)
|
||||
case channelAdminLogEventActionChangeStickerSet(prevStickerset: Api.InputStickerSet, newStickerset: Api.InputStickerSet)
|
||||
case channelAdminLogEventActionChangeTitle(prevValue: String, newValue: String)
|
||||
case channelAdminLogEventActionChangeUsername(prevValue: String, newValue: String)
|
||||
case channelAdminLogEventActionChangeUsernames(prevValue: [String], newValue: [String])
|
||||
case channelAdminLogEventActionChangeWallpaper(prevValue: Api.WallPaper, newValue: Api.WallPaper)
|
||||
case channelAdminLogEventActionCreateTopic(topic: Api.ForumTopic)
|
||||
case channelAdminLogEventActionDefaultBannedRights(prevBannedRights: Api.ChatBannedRights, newBannedRights: Api.ChatBannedRights)
|
||||
case channelAdminLogEventActionDeleteMessage(message: Api.Message)
|
||||
case channelAdminLogEventActionDeleteTopic(topic: Api.ForumTopic)
|
||||
case channelAdminLogEventActionDiscardGroupCall(call: Api.InputGroupCall)
|
||||
case channelAdminLogEventActionEditMessage(prevMessage: Api.Message, newMessage: Api.Message)
|
||||
case channelAdminLogEventActionEditTopic(prevTopic: Api.ForumTopic, newTopic: Api.ForumTopic)
|
||||
case channelAdminLogEventActionExportedInviteDelete(invite: Api.ExportedChatInvite)
|
||||
case channelAdminLogEventActionExportedInviteEdit(prevInvite: Api.ExportedChatInvite, newInvite: Api.ExportedChatInvite)
|
||||
case channelAdminLogEventActionExportedInviteRevoke(invite: Api.ExportedChatInvite)
|
||||
case channelAdminLogEventActionParticipantInvite(participant: Api.ChannelParticipant)
|
||||
public class Cons_channelAdminLogEventActionChangeAbout {
|
||||
public var prevValue: String
|
||||
public var newValue: String
|
||||
public init(prevValue: String, newValue: String) {
|
||||
self.prevValue = prevValue
|
||||
self.newValue = newValue
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionChangeAvailableReactions {
|
||||
public var prevValue: Api.ChatReactions
|
||||
public var newValue: Api.ChatReactions
|
||||
public init(prevValue: Api.ChatReactions, newValue: Api.ChatReactions) {
|
||||
self.prevValue = prevValue
|
||||
self.newValue = newValue
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionChangeEmojiStatus {
|
||||
public var prevValue: Api.EmojiStatus
|
||||
public var newValue: Api.EmojiStatus
|
||||
public init(prevValue: Api.EmojiStatus, newValue: Api.EmojiStatus) {
|
||||
self.prevValue = prevValue
|
||||
self.newValue = newValue
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionChangeEmojiStickerSet {
|
||||
public var prevStickerset: Api.InputStickerSet
|
||||
public var newStickerset: Api.InputStickerSet
|
||||
public init(prevStickerset: Api.InputStickerSet, newStickerset: Api.InputStickerSet) {
|
||||
self.prevStickerset = prevStickerset
|
||||
self.newStickerset = newStickerset
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionChangeHistoryTTL {
|
||||
public var prevValue: Int32
|
||||
public var newValue: Int32
|
||||
public init(prevValue: Int32, newValue: Int32) {
|
||||
self.prevValue = prevValue
|
||||
self.newValue = newValue
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionChangeLinkedChat {
|
||||
public var prevValue: Int64
|
||||
public var newValue: Int64
|
||||
public init(prevValue: Int64, newValue: Int64) {
|
||||
self.prevValue = prevValue
|
||||
self.newValue = newValue
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionChangeLocation {
|
||||
public var prevValue: Api.ChannelLocation
|
||||
public var newValue: Api.ChannelLocation
|
||||
public init(prevValue: Api.ChannelLocation, newValue: Api.ChannelLocation) {
|
||||
self.prevValue = prevValue
|
||||
self.newValue = newValue
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionChangePeerColor {
|
||||
public var prevValue: Api.PeerColor
|
||||
public var newValue: Api.PeerColor
|
||||
public init(prevValue: Api.PeerColor, newValue: Api.PeerColor) {
|
||||
self.prevValue = prevValue
|
||||
self.newValue = newValue
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionChangePhoto {
|
||||
public var prevPhoto: Api.Photo
|
||||
public var newPhoto: Api.Photo
|
||||
public init(prevPhoto: Api.Photo, newPhoto: Api.Photo) {
|
||||
self.prevPhoto = prevPhoto
|
||||
self.newPhoto = newPhoto
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionChangeProfilePeerColor {
|
||||
public var prevValue: Api.PeerColor
|
||||
public var newValue: Api.PeerColor
|
||||
public init(prevValue: Api.PeerColor, newValue: Api.PeerColor) {
|
||||
self.prevValue = prevValue
|
||||
self.newValue = newValue
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionChangeStickerSet {
|
||||
public var prevStickerset: Api.InputStickerSet
|
||||
public var newStickerset: Api.InputStickerSet
|
||||
public init(prevStickerset: Api.InputStickerSet, newStickerset: Api.InputStickerSet) {
|
||||
self.prevStickerset = prevStickerset
|
||||
self.newStickerset = newStickerset
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionChangeTitle {
|
||||
public var prevValue: String
|
||||
public var newValue: String
|
||||
public init(prevValue: String, newValue: String) {
|
||||
self.prevValue = prevValue
|
||||
self.newValue = newValue
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionChangeUsername {
|
||||
public var prevValue: String
|
||||
public var newValue: String
|
||||
public init(prevValue: String, newValue: String) {
|
||||
self.prevValue = prevValue
|
||||
self.newValue = newValue
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionChangeUsernames {
|
||||
public var prevValue: [String]
|
||||
public var newValue: [String]
|
||||
public init(prevValue: [String], newValue: [String]) {
|
||||
self.prevValue = prevValue
|
||||
self.newValue = newValue
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionChangeWallpaper {
|
||||
public var prevValue: Api.WallPaper
|
||||
public var newValue: Api.WallPaper
|
||||
public init(prevValue: Api.WallPaper, newValue: Api.WallPaper) {
|
||||
self.prevValue = prevValue
|
||||
self.newValue = newValue
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionCreateTopic {
|
||||
public var topic: Api.ForumTopic
|
||||
public init(topic: Api.ForumTopic) {
|
||||
self.topic = topic
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionDefaultBannedRights {
|
||||
public var prevBannedRights: Api.ChatBannedRights
|
||||
public var newBannedRights: Api.ChatBannedRights
|
||||
public init(prevBannedRights: Api.ChatBannedRights, newBannedRights: Api.ChatBannedRights) {
|
||||
self.prevBannedRights = prevBannedRights
|
||||
self.newBannedRights = newBannedRights
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionDeleteMessage {
|
||||
public var message: Api.Message
|
||||
public init(message: Api.Message) {
|
||||
self.message = message
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionDeleteTopic {
|
||||
public var topic: Api.ForumTopic
|
||||
public init(topic: Api.ForumTopic) {
|
||||
self.topic = topic
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionDiscardGroupCall {
|
||||
public var call: Api.InputGroupCall
|
||||
public init(call: Api.InputGroupCall) {
|
||||
self.call = call
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionEditMessage {
|
||||
public var prevMessage: Api.Message
|
||||
public var newMessage: Api.Message
|
||||
public init(prevMessage: Api.Message, newMessage: Api.Message) {
|
||||
self.prevMessage = prevMessage
|
||||
self.newMessage = newMessage
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionEditTopic {
|
||||
public var prevTopic: Api.ForumTopic
|
||||
public var newTopic: Api.ForumTopic
|
||||
public init(prevTopic: Api.ForumTopic, newTopic: Api.ForumTopic) {
|
||||
self.prevTopic = prevTopic
|
||||
self.newTopic = newTopic
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionExportedInviteDelete {
|
||||
public var invite: Api.ExportedChatInvite
|
||||
public init(invite: Api.ExportedChatInvite) {
|
||||
self.invite = invite
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionExportedInviteEdit {
|
||||
public var prevInvite: Api.ExportedChatInvite
|
||||
public var newInvite: Api.ExportedChatInvite
|
||||
public init(prevInvite: Api.ExportedChatInvite, newInvite: Api.ExportedChatInvite) {
|
||||
self.prevInvite = prevInvite
|
||||
self.newInvite = newInvite
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionExportedInviteRevoke {
|
||||
public var invite: Api.ExportedChatInvite
|
||||
public init(invite: Api.ExportedChatInvite) {
|
||||
self.invite = invite
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionParticipantInvite {
|
||||
public var participant: Api.ChannelParticipant
|
||||
public init(participant: Api.ChannelParticipant) {
|
||||
self.participant = participant
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionParticipantJoinByInvite {
|
||||
public var flags: Int32
|
||||
public var invite: Api.ExportedChatInvite
|
||||
public init(flags: Int32, invite: Api.ExportedChatInvite) {
|
||||
self.flags = flags
|
||||
self.invite = invite
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionParticipantJoinByRequest {
|
||||
public var invite: Api.ExportedChatInvite
|
||||
public var approvedBy: Int64
|
||||
public init(invite: Api.ExportedChatInvite, approvedBy: Int64) {
|
||||
self.invite = invite
|
||||
self.approvedBy = approvedBy
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionParticipantMute {
|
||||
public var participant: Api.GroupCallParticipant
|
||||
public init(participant: Api.GroupCallParticipant) {
|
||||
self.participant = participant
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionParticipantSubExtend {
|
||||
public var prevParticipant: Api.ChannelParticipant
|
||||
public var newParticipant: Api.ChannelParticipant
|
||||
public init(prevParticipant: Api.ChannelParticipant, newParticipant: Api.ChannelParticipant) {
|
||||
self.prevParticipant = prevParticipant
|
||||
self.newParticipant = newParticipant
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionParticipantToggleAdmin {
|
||||
public var prevParticipant: Api.ChannelParticipant
|
||||
public var newParticipant: Api.ChannelParticipant
|
||||
public init(prevParticipant: Api.ChannelParticipant, newParticipant: Api.ChannelParticipant) {
|
||||
self.prevParticipant = prevParticipant
|
||||
self.newParticipant = newParticipant
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionParticipantToggleBan {
|
||||
public var prevParticipant: Api.ChannelParticipant
|
||||
public var newParticipant: Api.ChannelParticipant
|
||||
public init(prevParticipant: Api.ChannelParticipant, newParticipant: Api.ChannelParticipant) {
|
||||
self.prevParticipant = prevParticipant
|
||||
self.newParticipant = newParticipant
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionParticipantUnmute {
|
||||
public var participant: Api.GroupCallParticipant
|
||||
public init(participant: Api.GroupCallParticipant) {
|
||||
self.participant = participant
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionParticipantVolume {
|
||||
public var participant: Api.GroupCallParticipant
|
||||
public init(participant: Api.GroupCallParticipant) {
|
||||
self.participant = participant
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionPinTopic {
|
||||
public var flags: Int32
|
||||
public var prevTopic: Api.ForumTopic?
|
||||
public var newTopic: Api.ForumTopic?
|
||||
public init(flags: Int32, prevTopic: Api.ForumTopic?, newTopic: Api.ForumTopic?) {
|
||||
self.flags = flags
|
||||
self.prevTopic = prevTopic
|
||||
self.newTopic = newTopic
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionSendMessage {
|
||||
public var message: Api.Message
|
||||
public init(message: Api.Message) {
|
||||
self.message = message
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionStartGroupCall {
|
||||
public var call: Api.InputGroupCall
|
||||
public init(call: Api.InputGroupCall) {
|
||||
self.call = call
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionStopPoll {
|
||||
public var message: Api.Message
|
||||
public init(message: Api.Message) {
|
||||
self.message = message
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionToggleAntiSpam {
|
||||
public var newValue: Api.Bool
|
||||
public init(newValue: Api.Bool) {
|
||||
self.newValue = newValue
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionToggleAutotranslation {
|
||||
public var newValue: Api.Bool
|
||||
public init(newValue: Api.Bool) {
|
||||
self.newValue = newValue
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionToggleForum {
|
||||
public var newValue: Api.Bool
|
||||
public init(newValue: Api.Bool) {
|
||||
self.newValue = newValue
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionToggleGroupCallSetting {
|
||||
public var joinMuted: Api.Bool
|
||||
public init(joinMuted: Api.Bool) {
|
||||
self.joinMuted = joinMuted
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionToggleInvites {
|
||||
public var newValue: Api.Bool
|
||||
public init(newValue: Api.Bool) {
|
||||
self.newValue = newValue
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionToggleNoForwards {
|
||||
public var newValue: Api.Bool
|
||||
public init(newValue: Api.Bool) {
|
||||
self.newValue = newValue
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionTogglePreHistoryHidden {
|
||||
public var newValue: Api.Bool
|
||||
public init(newValue: Api.Bool) {
|
||||
self.newValue = newValue
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionToggleSignatureProfiles {
|
||||
public var newValue: Api.Bool
|
||||
public init(newValue: Api.Bool) {
|
||||
self.newValue = newValue
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionToggleSignatures {
|
||||
public var newValue: Api.Bool
|
||||
public init(newValue: Api.Bool) {
|
||||
self.newValue = newValue
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionToggleSlowMode {
|
||||
public var prevValue: Int32
|
||||
public var newValue: Int32
|
||||
public init(prevValue: Int32, newValue: Int32) {
|
||||
self.prevValue = prevValue
|
||||
self.newValue = newValue
|
||||
}
|
||||
}
|
||||
public class Cons_channelAdminLogEventActionUpdatePinned {
|
||||
public var message: Api.Message
|
||||
public init(message: Api.Message) {
|
||||
self.message = message
|
||||
}
|
||||
}
|
||||
case channelAdminLogEventActionChangeAbout(Cons_channelAdminLogEventActionChangeAbout)
|
||||
case channelAdminLogEventActionChangeAvailableReactions(Cons_channelAdminLogEventActionChangeAvailableReactions)
|
||||
case channelAdminLogEventActionChangeEmojiStatus(Cons_channelAdminLogEventActionChangeEmojiStatus)
|
||||
case channelAdminLogEventActionChangeEmojiStickerSet(Cons_channelAdminLogEventActionChangeEmojiStickerSet)
|
||||
case channelAdminLogEventActionChangeHistoryTTL(Cons_channelAdminLogEventActionChangeHistoryTTL)
|
||||
case channelAdminLogEventActionChangeLinkedChat(Cons_channelAdminLogEventActionChangeLinkedChat)
|
||||
case channelAdminLogEventActionChangeLocation(Cons_channelAdminLogEventActionChangeLocation)
|
||||
case channelAdminLogEventActionChangePeerColor(Cons_channelAdminLogEventActionChangePeerColor)
|
||||
case channelAdminLogEventActionChangePhoto(Cons_channelAdminLogEventActionChangePhoto)
|
||||
case channelAdminLogEventActionChangeProfilePeerColor(Cons_channelAdminLogEventActionChangeProfilePeerColor)
|
||||
case channelAdminLogEventActionChangeStickerSet(Cons_channelAdminLogEventActionChangeStickerSet)
|
||||
case channelAdminLogEventActionChangeTitle(Cons_channelAdminLogEventActionChangeTitle)
|
||||
case channelAdminLogEventActionChangeUsername(Cons_channelAdminLogEventActionChangeUsername)
|
||||
case channelAdminLogEventActionChangeUsernames(Cons_channelAdminLogEventActionChangeUsernames)
|
||||
case channelAdminLogEventActionChangeWallpaper(Cons_channelAdminLogEventActionChangeWallpaper)
|
||||
case channelAdminLogEventActionCreateTopic(Cons_channelAdminLogEventActionCreateTopic)
|
||||
case channelAdminLogEventActionDefaultBannedRights(Cons_channelAdminLogEventActionDefaultBannedRights)
|
||||
case channelAdminLogEventActionDeleteMessage(Cons_channelAdminLogEventActionDeleteMessage)
|
||||
case channelAdminLogEventActionDeleteTopic(Cons_channelAdminLogEventActionDeleteTopic)
|
||||
case channelAdminLogEventActionDiscardGroupCall(Cons_channelAdminLogEventActionDiscardGroupCall)
|
||||
case channelAdminLogEventActionEditMessage(Cons_channelAdminLogEventActionEditMessage)
|
||||
case channelAdminLogEventActionEditTopic(Cons_channelAdminLogEventActionEditTopic)
|
||||
case channelAdminLogEventActionExportedInviteDelete(Cons_channelAdminLogEventActionExportedInviteDelete)
|
||||
case channelAdminLogEventActionExportedInviteEdit(Cons_channelAdminLogEventActionExportedInviteEdit)
|
||||
case channelAdminLogEventActionExportedInviteRevoke(Cons_channelAdminLogEventActionExportedInviteRevoke)
|
||||
case channelAdminLogEventActionParticipantInvite(Cons_channelAdminLogEventActionParticipantInvite)
|
||||
case channelAdminLogEventActionParticipantJoin
|
||||
case channelAdminLogEventActionParticipantJoinByInvite(flags: Int32, invite: Api.ExportedChatInvite)
|
||||
case channelAdminLogEventActionParticipantJoinByRequest(invite: Api.ExportedChatInvite, approvedBy: Int64)
|
||||
case channelAdminLogEventActionParticipantJoinByInvite(Cons_channelAdminLogEventActionParticipantJoinByInvite)
|
||||
case channelAdminLogEventActionParticipantJoinByRequest(Cons_channelAdminLogEventActionParticipantJoinByRequest)
|
||||
case channelAdminLogEventActionParticipantLeave
|
||||
case channelAdminLogEventActionParticipantMute(participant: Api.GroupCallParticipant)
|
||||
case channelAdminLogEventActionParticipantSubExtend(prevParticipant: Api.ChannelParticipant, newParticipant: Api.ChannelParticipant)
|
||||
case channelAdminLogEventActionParticipantToggleAdmin(prevParticipant: Api.ChannelParticipant, newParticipant: Api.ChannelParticipant)
|
||||
case channelAdminLogEventActionParticipantToggleBan(prevParticipant: Api.ChannelParticipant, newParticipant: Api.ChannelParticipant)
|
||||
case channelAdminLogEventActionParticipantUnmute(participant: Api.GroupCallParticipant)
|
||||
case channelAdminLogEventActionParticipantVolume(participant: Api.GroupCallParticipant)
|
||||
case channelAdminLogEventActionPinTopic(flags: Int32, prevTopic: Api.ForumTopic?, newTopic: Api.ForumTopic?)
|
||||
case channelAdminLogEventActionSendMessage(message: Api.Message)
|
||||
case channelAdminLogEventActionStartGroupCall(call: Api.InputGroupCall)
|
||||
case channelAdminLogEventActionStopPoll(message: Api.Message)
|
||||
case channelAdminLogEventActionToggleAntiSpam(newValue: Api.Bool)
|
||||
case channelAdminLogEventActionToggleAutotranslation(newValue: Api.Bool)
|
||||
case channelAdminLogEventActionToggleForum(newValue: Api.Bool)
|
||||
case channelAdminLogEventActionToggleGroupCallSetting(joinMuted: Api.Bool)
|
||||
case channelAdminLogEventActionToggleInvites(newValue: Api.Bool)
|
||||
case channelAdminLogEventActionToggleNoForwards(newValue: Api.Bool)
|
||||
case channelAdminLogEventActionTogglePreHistoryHidden(newValue: Api.Bool)
|
||||
case channelAdminLogEventActionToggleSignatureProfiles(newValue: Api.Bool)
|
||||
case channelAdminLogEventActionToggleSignatures(newValue: Api.Bool)
|
||||
case channelAdminLogEventActionToggleSlowMode(prevValue: Int32, newValue: Int32)
|
||||
case channelAdminLogEventActionUpdatePinned(message: Api.Message)
|
||||
case channelAdminLogEventActionParticipantMute(Cons_channelAdminLogEventActionParticipantMute)
|
||||
case channelAdminLogEventActionParticipantSubExtend(Cons_channelAdminLogEventActionParticipantSubExtend)
|
||||
case channelAdminLogEventActionParticipantToggleAdmin(Cons_channelAdminLogEventActionParticipantToggleAdmin)
|
||||
case channelAdminLogEventActionParticipantToggleBan(Cons_channelAdminLogEventActionParticipantToggleBan)
|
||||
case channelAdminLogEventActionParticipantUnmute(Cons_channelAdminLogEventActionParticipantUnmute)
|
||||
case channelAdminLogEventActionParticipantVolume(Cons_channelAdminLogEventActionParticipantVolume)
|
||||
case channelAdminLogEventActionPinTopic(Cons_channelAdminLogEventActionPinTopic)
|
||||
case channelAdminLogEventActionSendMessage(Cons_channelAdminLogEventActionSendMessage)
|
||||
case channelAdminLogEventActionStartGroupCall(Cons_channelAdminLogEventActionStartGroupCall)
|
||||
case channelAdminLogEventActionStopPoll(Cons_channelAdminLogEventActionStopPoll)
|
||||
case channelAdminLogEventActionToggleAntiSpam(Cons_channelAdminLogEventActionToggleAntiSpam)
|
||||
case channelAdminLogEventActionToggleAutotranslation(Cons_channelAdminLogEventActionToggleAutotranslation)
|
||||
case channelAdminLogEventActionToggleForum(Cons_channelAdminLogEventActionToggleForum)
|
||||
case channelAdminLogEventActionToggleGroupCallSetting(Cons_channelAdminLogEventActionToggleGroupCallSetting)
|
||||
case channelAdminLogEventActionToggleInvites(Cons_channelAdminLogEventActionToggleInvites)
|
||||
case channelAdminLogEventActionToggleNoForwards(Cons_channelAdminLogEventActionToggleNoForwards)
|
||||
case channelAdminLogEventActionTogglePreHistoryHidden(Cons_channelAdminLogEventActionTogglePreHistoryHidden)
|
||||
case channelAdminLogEventActionToggleSignatureProfiles(Cons_channelAdminLogEventActionToggleSignatureProfiles)
|
||||
case channelAdminLogEventActionToggleSignatures(Cons_channelAdminLogEventActionToggleSignatures)
|
||||
case channelAdminLogEventActionToggleSlowMode(Cons_channelAdminLogEventActionToggleSlowMode)
|
||||
case channelAdminLogEventActionUpdatePinned(Cons_channelAdminLogEventActionUpdatePinned)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
|
|||
|
|
@ -1,6 +1,12 @@
|
|||
public extension Api {
|
||||
enum ChannelAdminLogEventsFilter: TypeConstructorDescription {
|
||||
case channelAdminLogEventsFilter(flags: Int32)
|
||||
public class Cons_channelAdminLogEventsFilter {
|
||||
public var flags: Int32
|
||||
public init(flags: Int32) {
|
||||
self.flags = flags
|
||||
}
|
||||
}
|
||||
case channelAdminLogEventsFilter(Cons_channelAdminLogEventsFilter)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -29,7 +35,15 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum ChannelLocation: TypeConstructorDescription {
|
||||
case channelLocation(geoPoint: Api.GeoPoint, address: String)
|
||||
public class Cons_channelLocation {
|
||||
public var geoPoint: Api.GeoPoint
|
||||
public var address: String
|
||||
public init(geoPoint: Api.GeoPoint, address: String) {
|
||||
self.geoPoint = geoPoint
|
||||
self.address = address
|
||||
}
|
||||
}
|
||||
case channelLocation(Cons_channelLocation)
|
||||
case channelLocationEmpty
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
|
|
@ -66,7 +80,15 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum ChannelMessagesFilter: TypeConstructorDescription {
|
||||
case channelMessagesFilter(flags: Int32, ranges: [Api.MessageRange])
|
||||
public class Cons_channelMessagesFilter {
|
||||
public var flags: Int32
|
||||
public var ranges: [Api.MessageRange]
|
||||
public init(flags: Int32, ranges: [Api.MessageRange]) {
|
||||
self.flags = flags
|
||||
self.ranges = ranges
|
||||
}
|
||||
}
|
||||
case channelMessagesFilter(Cons_channelMessagesFilter)
|
||||
case channelMessagesFilterEmpty
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
|
|
@ -103,12 +125,88 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum ChannelParticipant: TypeConstructorDescription {
|
||||
case channelParticipant(flags: Int32, userId: Int64, date: Int32, subscriptionUntilDate: Int32?)
|
||||
case channelParticipantAdmin(flags: Int32, userId: Int64, inviterId: Int64?, promotedBy: Int64, date: Int32, adminRights: Api.ChatAdminRights, rank: String?)
|
||||
case channelParticipantBanned(flags: Int32, peer: Api.Peer, kickedBy: Int64, date: Int32, bannedRights: Api.ChatBannedRights)
|
||||
case channelParticipantCreator(flags: Int32, userId: Int64, adminRights: Api.ChatAdminRights, rank: String?)
|
||||
case channelParticipantLeft(peer: Api.Peer)
|
||||
case channelParticipantSelf(flags: Int32, userId: Int64, inviterId: Int64, date: Int32, subscriptionUntilDate: Int32?)
|
||||
public class Cons_channelParticipant {
|
||||
public var flags: Int32
|
||||
public var userId: Int64
|
||||
public var date: Int32
|
||||
public var subscriptionUntilDate: Int32?
|
||||
public init(flags: Int32, userId: Int64, date: Int32, subscriptionUntilDate: Int32?) {
|
||||
self.flags = flags
|
||||
self.userId = userId
|
||||
self.date = date
|
||||
self.subscriptionUntilDate = subscriptionUntilDate
|
||||
}
|
||||
}
|
||||
public class Cons_channelParticipantAdmin {
|
||||
public var flags: Int32
|
||||
public var userId: Int64
|
||||
public var inviterId: Int64?
|
||||
public var promotedBy: Int64
|
||||
public var date: Int32
|
||||
public var adminRights: Api.ChatAdminRights
|
||||
public var rank: String?
|
||||
public init(flags: Int32, userId: Int64, inviterId: Int64?, promotedBy: Int64, date: Int32, adminRights: Api.ChatAdminRights, rank: String?) {
|
||||
self.flags = flags
|
||||
self.userId = userId
|
||||
self.inviterId = inviterId
|
||||
self.promotedBy = promotedBy
|
||||
self.date = date
|
||||
self.adminRights = adminRights
|
||||
self.rank = rank
|
||||
}
|
||||
}
|
||||
public class Cons_channelParticipantBanned {
|
||||
public var flags: Int32
|
||||
public var peer: Api.Peer
|
||||
public var kickedBy: Int64
|
||||
public var date: Int32
|
||||
public var bannedRights: Api.ChatBannedRights
|
||||
public init(flags: Int32, peer: Api.Peer, kickedBy: Int64, date: Int32, bannedRights: Api.ChatBannedRights) {
|
||||
self.flags = flags
|
||||
self.peer = peer
|
||||
self.kickedBy = kickedBy
|
||||
self.date = date
|
||||
self.bannedRights = bannedRights
|
||||
}
|
||||
}
|
||||
public class Cons_channelParticipantCreator {
|
||||
public var flags: Int32
|
||||
public var userId: Int64
|
||||
public var adminRights: Api.ChatAdminRights
|
||||
public var rank: String?
|
||||
public init(flags: Int32, userId: Int64, adminRights: Api.ChatAdminRights, rank: String?) {
|
||||
self.flags = flags
|
||||
self.userId = userId
|
||||
self.adminRights = adminRights
|
||||
self.rank = rank
|
||||
}
|
||||
}
|
||||
public class Cons_channelParticipantLeft {
|
||||
public var peer: Api.Peer
|
||||
public init(peer: Api.Peer) {
|
||||
self.peer = peer
|
||||
}
|
||||
}
|
||||
public class Cons_channelParticipantSelf {
|
||||
public var flags: Int32
|
||||
public var userId: Int64
|
||||
public var inviterId: Int64
|
||||
public var date: Int32
|
||||
public var subscriptionUntilDate: Int32?
|
||||
public init(flags: Int32, userId: Int64, inviterId: Int64, date: Int32, subscriptionUntilDate: Int32?) {
|
||||
self.flags = flags
|
||||
self.userId = userId
|
||||
self.inviterId = inviterId
|
||||
self.date = date
|
||||
self.subscriptionUntilDate = subscriptionUntilDate
|
||||
}
|
||||
}
|
||||
case channelParticipant(Cons_channelParticipant)
|
||||
case channelParticipantAdmin(Cons_channelParticipantAdmin)
|
||||
case channelParticipantBanned(Cons_channelParticipantBanned)
|
||||
case channelParticipantCreator(Cons_channelParticipantCreator)
|
||||
case channelParticipantLeft(Cons_channelParticipantLeft)
|
||||
case channelParticipantSelf(Cons_channelParticipantSelf)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -172,14 +270,48 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum ChannelParticipantsFilter: TypeConstructorDescription {
|
||||
public class Cons_channelParticipantsBanned {
|
||||
public var q: String
|
||||
public init(q: String) {
|
||||
self.q = q
|
||||
}
|
||||
}
|
||||
public class Cons_channelParticipantsContacts {
|
||||
public var q: String
|
||||
public init(q: String) {
|
||||
self.q = q
|
||||
}
|
||||
}
|
||||
public class Cons_channelParticipantsKicked {
|
||||
public var q: String
|
||||
public init(q: String) {
|
||||
self.q = q
|
||||
}
|
||||
}
|
||||
public class Cons_channelParticipantsMentions {
|
||||
public var flags: Int32
|
||||
public var q: String?
|
||||
public var topMsgId: Int32?
|
||||
public init(flags: Int32, q: String?, topMsgId: Int32?) {
|
||||
self.flags = flags
|
||||
self.q = q
|
||||
self.topMsgId = topMsgId
|
||||
}
|
||||
}
|
||||
public class Cons_channelParticipantsSearch {
|
||||
public var q: String
|
||||
public init(q: String) {
|
||||
self.q = q
|
||||
}
|
||||
}
|
||||
case channelParticipantsAdmins
|
||||
case channelParticipantsBanned(q: String)
|
||||
case channelParticipantsBanned(Cons_channelParticipantsBanned)
|
||||
case channelParticipantsBots
|
||||
case channelParticipantsContacts(q: String)
|
||||
case channelParticipantsKicked(q: String)
|
||||
case channelParticipantsMentions(flags: Int32, q: String?, topMsgId: Int32?)
|
||||
case channelParticipantsContacts(Cons_channelParticipantsContacts)
|
||||
case channelParticipantsKicked(Cons_channelParticipantsKicked)
|
||||
case channelParticipantsMentions(Cons_channelParticipantsMentions)
|
||||
case channelParticipantsRecent
|
||||
case channelParticipantsSearch(q: String)
|
||||
case channelParticipantsSearch(Cons_channelParticipantsSearch)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -257,11 +389,113 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
indirect enum Chat: TypeConstructorDescription {
|
||||
case channel(flags: Int32, flags2: Int32, id: Int64, accessHash: Int64?, title: String, username: String?, photo: Api.ChatPhoto, date: Int32, restrictionReason: [Api.RestrictionReason]?, adminRights: Api.ChatAdminRights?, bannedRights: Api.ChatBannedRights?, defaultBannedRights: Api.ChatBannedRights?, participantsCount: Int32?, usernames: [Api.Username]?, storiesMaxId: Api.RecentStory?, color: Api.PeerColor?, profileColor: Api.PeerColor?, emojiStatus: Api.EmojiStatus?, level: Int32?, subscriptionUntilDate: Int32?, botVerificationIcon: Int64?, sendPaidMessagesStars: Int64?, linkedMonoforumId: Int64?)
|
||||
case channelForbidden(flags: Int32, id: Int64, accessHash: Int64, title: String, untilDate: Int32?)
|
||||
case chat(flags: Int32, id: Int64, title: String, photo: Api.ChatPhoto, participantsCount: Int32, date: Int32, version: Int32, migratedTo: Api.InputChannel?, adminRights: Api.ChatAdminRights?, defaultBannedRights: Api.ChatBannedRights?)
|
||||
case chatEmpty(id: Int64)
|
||||
case chatForbidden(id: Int64, title: String)
|
||||
public class Cons_channel {
|
||||
public var flags: Int32
|
||||
public var flags2: Int32
|
||||
public var id: Int64
|
||||
public var accessHash: Int64?
|
||||
public var title: String
|
||||
public var username: String?
|
||||
public var photo: Api.ChatPhoto
|
||||
public var date: Int32
|
||||
public var restrictionReason: [Api.RestrictionReason]?
|
||||
public var adminRights: Api.ChatAdminRights?
|
||||
public var bannedRights: Api.ChatBannedRights?
|
||||
public var defaultBannedRights: Api.ChatBannedRights?
|
||||
public var participantsCount: Int32?
|
||||
public var usernames: [Api.Username]?
|
||||
public var storiesMaxId: Api.RecentStory?
|
||||
public var color: Api.PeerColor?
|
||||
public var profileColor: Api.PeerColor?
|
||||
public var emojiStatus: Api.EmojiStatus?
|
||||
public var level: Int32?
|
||||
public var subscriptionUntilDate: Int32?
|
||||
public var botVerificationIcon: Int64?
|
||||
public var sendPaidMessagesStars: Int64?
|
||||
public var linkedMonoforumId: Int64?
|
||||
public init(flags: Int32, flags2: Int32, id: Int64, accessHash: Int64?, title: String, username: String?, photo: Api.ChatPhoto, date: Int32, restrictionReason: [Api.RestrictionReason]?, adminRights: Api.ChatAdminRights?, bannedRights: Api.ChatBannedRights?, defaultBannedRights: Api.ChatBannedRights?, participantsCount: Int32?, usernames: [Api.Username]?, storiesMaxId: Api.RecentStory?, color: Api.PeerColor?, profileColor: Api.PeerColor?, emojiStatus: Api.EmojiStatus?, level: Int32?, subscriptionUntilDate: Int32?, botVerificationIcon: Int64?, sendPaidMessagesStars: Int64?, linkedMonoforumId: Int64?) {
|
||||
self.flags = flags
|
||||
self.flags2 = flags2
|
||||
self.id = id
|
||||
self.accessHash = accessHash
|
||||
self.title = title
|
||||
self.username = username
|
||||
self.photo = photo
|
||||
self.date = date
|
||||
self.restrictionReason = restrictionReason
|
||||
self.adminRights = adminRights
|
||||
self.bannedRights = bannedRights
|
||||
self.defaultBannedRights = defaultBannedRights
|
||||
self.participantsCount = participantsCount
|
||||
self.usernames = usernames
|
||||
self.storiesMaxId = storiesMaxId
|
||||
self.color = color
|
||||
self.profileColor = profileColor
|
||||
self.emojiStatus = emojiStatus
|
||||
self.level = level
|
||||
self.subscriptionUntilDate = subscriptionUntilDate
|
||||
self.botVerificationIcon = botVerificationIcon
|
||||
self.sendPaidMessagesStars = sendPaidMessagesStars
|
||||
self.linkedMonoforumId = linkedMonoforumId
|
||||
}
|
||||
}
|
||||
public class Cons_channelForbidden {
|
||||
public var flags: Int32
|
||||
public var id: Int64
|
||||
public var accessHash: Int64
|
||||
public var title: String
|
||||
public var untilDate: Int32?
|
||||
public init(flags: Int32, id: Int64, accessHash: Int64, title: String, untilDate: Int32?) {
|
||||
self.flags = flags
|
||||
self.id = id
|
||||
self.accessHash = accessHash
|
||||
self.title = title
|
||||
self.untilDate = untilDate
|
||||
}
|
||||
}
|
||||
public class Cons_chat {
|
||||
public var flags: Int32
|
||||
public var id: Int64
|
||||
public var title: String
|
||||
public var photo: Api.ChatPhoto
|
||||
public var participantsCount: Int32
|
||||
public var date: Int32
|
||||
public var version: Int32
|
||||
public var migratedTo: Api.InputChannel?
|
||||
public var adminRights: Api.ChatAdminRights?
|
||||
public var defaultBannedRights: Api.ChatBannedRights?
|
||||
public init(flags: Int32, id: Int64, title: String, photo: Api.ChatPhoto, participantsCount: Int32, date: Int32, version: Int32, migratedTo: Api.InputChannel?, adminRights: Api.ChatAdminRights?, defaultBannedRights: Api.ChatBannedRights?) {
|
||||
self.flags = flags
|
||||
self.id = id
|
||||
self.title = title
|
||||
self.photo = photo
|
||||
self.participantsCount = participantsCount
|
||||
self.date = date
|
||||
self.version = version
|
||||
self.migratedTo = migratedTo
|
||||
self.adminRights = adminRights
|
||||
self.defaultBannedRights = defaultBannedRights
|
||||
}
|
||||
}
|
||||
public class Cons_chatEmpty {
|
||||
public var id: Int64
|
||||
public init(id: Int64) {
|
||||
self.id = id
|
||||
}
|
||||
}
|
||||
public class Cons_chatForbidden {
|
||||
public var id: Int64
|
||||
public var title: String
|
||||
public init(id: Int64, title: String) {
|
||||
self.id = id
|
||||
self.title = title
|
||||
}
|
||||
}
|
||||
case channel(Cons_channel)
|
||||
case channelForbidden(Cons_channelForbidden)
|
||||
case chat(Cons_chat)
|
||||
case chatEmpty(Cons_chatEmpty)
|
||||
case chatForbidden(Cons_chatForbidden)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -318,7 +552,13 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum ChatAdminRights: TypeConstructorDescription {
|
||||
case chatAdminRights(flags: Int32)
|
||||
public class Cons_chatAdminRights {
|
||||
public var flags: Int32
|
||||
public init(flags: Int32) {
|
||||
self.flags = flags
|
||||
}
|
||||
}
|
||||
case chatAdminRights(Cons_chatAdminRights)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ let package = Package(
|
|||
.product(name: "FlatBuffers", package: "FlatBuffers", condition: nil),
|
||||
.product(name: "FlatSerialization", package: "FlatSerialization", condition: nil),
|
||||
.product(name: "EncryptionProvider", package: "EncryptionProvider", condition: nil)],
|
||||
path: "Sources"),
|
||||
path: "Sources",
|
||||
swiftSettings: [.unsafeFlags(["-warnings-as-errors"])]),
|
||||
]
|
||||
)
|
||||
|
|
|
|||
|
|
@ -508,7 +508,8 @@ struct AccountMutableState {
|
|||
|
||||
for chat in chats {
|
||||
switch chat {
|
||||
case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _, _, _, _, _, _, _):
|
||||
case let .channel(channelData):
|
||||
let participantsCount = channelData.participantsCount
|
||||
if let participantsCount = participantsCount {
|
||||
self.addOperation(.UpdateCachedPeerData(chat.peerId, { current in
|
||||
var previous: CachedChannelData
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@ func imageRepresentationsForApiChatPhoto(_ photo: Api.ChatPhoto) -> [TelegramMed
|
|||
|
||||
func parseTelegramGroupOrChannel(chat: Api.Chat) -> Peer? {
|
||||
switch chat {
|
||||
case let .chat(flags, id, title, photo, participantsCount, date, version, migratedTo, adminRights, defaultBannedRights):
|
||||
case let .chat(chatData):
|
||||
let (flags, id, title, photo, participantsCount, date, version, migratedTo, adminRights, defaultBannedRights) = (chatData.flags, chatData.id, chatData.title, chatData.photo, chatData.participantsCount, chatData.date, chatData.version, chatData.migratedTo, chatData.adminRights, chatData.defaultBannedRights)
|
||||
let left = (flags & ((1 << 1) | (1 << 2))) != 0
|
||||
var migrationReference: TelegramGroupToChannelMigrationReference?
|
||||
if let migratedTo = migratedTo {
|
||||
|
|
@ -57,11 +58,14 @@ func parseTelegramGroupOrChannel(chat: Api.Chat) -> Peer? {
|
|||
groupFlags.insert(.copyProtectionEnabled)
|
||||
}
|
||||
return TelegramGroup(id: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(id)), title: title, photo: imageRepresentationsForApiChatPhoto(photo), participantCount: Int(participantsCount), role: role, membership: left ? .Left : .Member, flags: groupFlags, defaultBannedRights: defaultBannedRights.flatMap(TelegramChatBannedRights.init(apiBannedRights:)), migrationReference: migrationReference, creationDate: date, version: Int(version))
|
||||
case let .chatEmpty(id):
|
||||
case let .chatEmpty(chatEmptyData):
|
||||
let id = chatEmptyData.id
|
||||
return TelegramGroup(id: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(id)), title: "", photo: [], participantCount: 0, role: .member, membership: .Removed, flags: [], defaultBannedRights: nil, migrationReference: nil, creationDate: 0, version: 0)
|
||||
case let .chatForbidden(id, title):
|
||||
case let .chatForbidden(chatForbiddenData):
|
||||
let (id, title) = (chatForbiddenData.id, chatForbiddenData.title)
|
||||
return TelegramGroup(id: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(id)), title: title, photo: [], participantCount: 0, role: .member, membership: .Removed, flags: [], defaultBannedRights: nil, migrationReference: nil, creationDate: 0, version: 0)
|
||||
case let .channel(flags, flags2, id, accessHash, title, username, photo, date, restrictionReason, adminRights, bannedRights, defaultBannedRights, _, usernames, _, color, profileColor, emojiStatus, boostLevel, subscriptionUntilDate, verificationIconFileId, sendPaidMessageStars, linkedMonoforumId):
|
||||
case let .channel(channelData):
|
||||
let (flags, flags2, id, accessHash, title, username, photo, date, restrictionReason, adminRights, bannedRights, defaultBannedRights, usernames, color, profileColor, emojiStatus, boostLevel, subscriptionUntilDate, verificationIconFileId, sendPaidMessageStars, linkedMonoforumId) = (channelData.flags, channelData.flags2, channelData.id, channelData.accessHash, channelData.title, channelData.username, channelData.photo, channelData.date, channelData.restrictionReason, channelData.adminRights, channelData.bannedRights, channelData.defaultBannedRights, channelData.usernames, channelData.color, channelData.profileColor, channelData.emojiStatus, channelData.level, channelData.subscriptionUntilDate, channelData.botVerificationIcon, channelData.sendPaidMessagesStars, channelData.linkedMonoforumId)
|
||||
let isMin = (flags & (1 << 12)) != 0
|
||||
|
||||
let participationStatus: TelegramChannelParticipationStatus
|
||||
|
|
@ -195,7 +199,8 @@ func parseTelegramGroupOrChannel(chat: Api.Chat) -> Peer? {
|
|||
}
|
||||
|
||||
return TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(id)), accessHash: accessHashValue, title: title, username: username, photo: imageRepresentationsForApiChatPhoto(photo), creationDate: date, version: 0, participationStatus: participationStatus, info: info, flags: channelFlags, restrictionInfo: restrictionInfo, adminRights: adminRights.flatMap(TelegramChatAdminRights.init), bannedRights: bannedRights.flatMap(TelegramChatBannedRights.init), defaultBannedRights: defaultBannedRights.flatMap(TelegramChatBannedRights.init), usernames: usernames?.map(TelegramPeerUsername.init(apiUsername:)) ?? [], storiesHidden: storiesHidden, nameColor: nameColorIndex.flatMap { PeerNameColor(rawValue: $0) }, backgroundEmojiId: backgroundEmojiId, profileColor: profileColorIndex.flatMap { PeerNameColor(rawValue: $0) }, profileBackgroundEmojiId: profileBackgroundEmojiId, emojiStatus: emojiStatus.flatMap(PeerEmojiStatus.init(apiStatus:)), approximateBoostLevel: boostLevel, subscriptionUntilDate: subscriptionUntilDate, verificationIconFileId: verificationIconFileId, sendPaidMessageStars: sendPaidMessageStars.flatMap { StarsAmount(value: $0, nanos: 0) }, linkedMonoforumId: linkedMonoforumId.flatMap { PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value($0)) })
|
||||
case let .channelForbidden(flags, id, accessHash, title, untilDate):
|
||||
case let .channelForbidden(channelForbiddenData):
|
||||
let (flags, id, accessHash, title, untilDate) = (channelForbiddenData.flags, channelForbiddenData.id, channelForbiddenData.accessHash, channelForbiddenData.title, channelForbiddenData.untilDate)
|
||||
let info: TelegramChannelInfo
|
||||
if (flags & Int32(1 << 8)) != 0 {
|
||||
info = .group(TelegramChannelGroupInfo(flags: []))
|
||||
|
|
@ -211,7 +216,8 @@ func mergeGroupOrChannel(lhs: Peer?, rhs: Api.Chat) -> Peer? {
|
|||
switch rhs {
|
||||
case .chat, .chatEmpty, .chatForbidden, .channelForbidden:
|
||||
return parseTelegramGroupOrChannel(chat: rhs)
|
||||
case let .channel(flags, flags2, _, accessHash, title, username, photo, _, _, _, _, defaultBannedRights, _, usernames, _, color, profileColor, emojiStatus, boostLevel, subscriptionUntilDate, verificationIconFileId, sendPaidMessageStars, linkedMonoforumIdValue):
|
||||
case let .channel(channelData):
|
||||
let (flags, flags2, accessHash, title, username, photo, defaultBannedRights, usernames, color, profileColor, emojiStatus, boostLevel, subscriptionUntilDate, verificationIconFileId, sendPaidMessageStars, linkedMonoforumIdValue) = (channelData.flags, channelData.flags2, channelData.accessHash, channelData.title, channelData.username, channelData.photo, channelData.defaultBannedRights, channelData.usernames, channelData.color, channelData.profileColor, channelData.emojiStatus, channelData.level, channelData.subscriptionUntilDate, channelData.botVerificationIcon, channelData.sendPaidMessagesStars, channelData.linkedMonoforumId)
|
||||
let isMin = (flags & (1 << 12)) != 0
|
||||
if accessHash != nil && !isMin {
|
||||
return parseTelegramGroupOrChannel(chat: rhs)
|
||||
|
|
|
|||
|
|
@ -205,19 +205,25 @@ public final class CachedChannelParticipants: PostboxCoding, Equatable {
|
|||
extension ChannelParticipant {
|
||||
init(apiParticipant: Api.ChannelParticipant) {
|
||||
switch apiParticipant {
|
||||
case let .channelParticipant(_, userId, date, subscriptionUntilDate):
|
||||
case let .channelParticipant(channelParticipantData):
|
||||
let (_, userId, date, subscriptionUntilDate) = (channelParticipantData.flags, channelParticipantData.userId, channelParticipantData.date, channelParticipantData.subscriptionUntilDate)
|
||||
self = .member(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), invitedAt: date, adminInfo: nil, banInfo: nil, rank: nil, subscriptionUntilDate: subscriptionUntilDate)
|
||||
case let .channelParticipantCreator(_, userId, adminRights, rank):
|
||||
case let .channelParticipantCreator(channelParticipantCreatorData):
|
||||
let (_, userId, adminRights, rank) = (channelParticipantCreatorData.flags, channelParticipantCreatorData.userId, channelParticipantCreatorData.adminRights, channelParticipantCreatorData.rank)
|
||||
self = .creator(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), adminInfo: ChannelParticipantAdminInfo(rights: TelegramChatAdminRights(apiAdminRights: adminRights) ?? TelegramChatAdminRights(rights: []), promotedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), canBeEditedByAccountPeer: true), rank: rank)
|
||||
case let .channelParticipantBanned(flags, userId, restrictedBy, date, bannedRights):
|
||||
case let .channelParticipantBanned(channelParticipantBannedData):
|
||||
let (flags, userId, restrictedBy, date, bannedRights) = (channelParticipantBannedData.flags, channelParticipantBannedData.peer, channelParticipantBannedData.kickedBy, channelParticipantBannedData.date, channelParticipantBannedData.bannedRights)
|
||||
let hasLeft = (flags & (1 << 0)) != 0
|
||||
let banInfo = ChannelParticipantBannedInfo(rights: TelegramChatBannedRights(apiBannedRights: bannedRights), restrictedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(restrictedBy)), timestamp: date, isMember: !hasLeft)
|
||||
self = .member(id: userId.peerId, invitedAt: date, adminInfo: nil, banInfo: banInfo, rank: nil, subscriptionUntilDate: nil)
|
||||
case let .channelParticipantAdmin(flags, userId, _, promotedBy, date, adminRights, rank: rank):
|
||||
case let .channelParticipantAdmin(channelParticipantAdminData):
|
||||
let (flags, userId, _, promotedBy, date, adminRights, rank) = (channelParticipantAdminData.flags, channelParticipantAdminData.userId, channelParticipantAdminData.inviterId, channelParticipantAdminData.promotedBy, channelParticipantAdminData.date, channelParticipantAdminData.adminRights, channelParticipantAdminData.rank)
|
||||
self = .member(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), invitedAt: date, adminInfo: ChannelParticipantAdminInfo(rights: TelegramChatAdminRights(apiAdminRights: adminRights) ?? TelegramChatAdminRights(rights: []), promotedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(promotedBy)), canBeEditedByAccountPeer: (flags & (1 << 0)) != 0), banInfo: nil, rank: rank, subscriptionUntilDate: nil)
|
||||
case let .channelParticipantSelf(_, userId, _, date, subscriptionUntilDate):
|
||||
case let .channelParticipantSelf(channelParticipantSelfData):
|
||||
let (_, userId, _, date, subscriptionUntilDate) = (channelParticipantSelfData.flags, channelParticipantSelfData.userId, channelParticipantSelfData.inviterId, channelParticipantSelfData.date, channelParticipantSelfData.subscriptionUntilDate)
|
||||
self = .member(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), invitedAt: date, adminInfo: nil, banInfo: nil, rank: nil, subscriptionUntilDate: subscriptionUntilDate)
|
||||
case let .channelParticipantLeft(userId):
|
||||
case let .channelParticipantLeft(channelParticipantLeftData):
|
||||
let (userId) = (channelParticipantLeftData.peer)
|
||||
self = .member(id: userId.peerId, invitedAt: 0, adminInfo: nil, banInfo: nil, rank: nil, subscriptionUntilDate: nil)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@ import TelegramApi
|
|||
extension PeerGeoLocation {
|
||||
init?(apiLocation: Api.ChannelLocation) {
|
||||
switch apiLocation {
|
||||
case let .channelLocation(geopoint, address):
|
||||
case let .channelLocation(channelLocationData):
|
||||
let (geopoint, address) = (channelLocationData.geoPoint, channelLocationData.address)
|
||||
if case let .geoPoint(_, longitude, latitude, _, _) = geopoint {
|
||||
self.init(latitude: latitude, longitude: longitude, address: address)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@ import TelegramApi
|
|||
extension TelegramChatAdminRights {
|
||||
init?(apiAdminRights: Api.ChatAdminRights) {
|
||||
switch apiAdminRights {
|
||||
case let .chatAdminRights(flags):
|
||||
case let .chatAdminRights(chatAdminRightsData):
|
||||
let flags = chatAdminRightsData.flags
|
||||
if flags == 0 {
|
||||
return nil
|
||||
}
|
||||
|
|
@ -18,6 +19,6 @@ extension TelegramChatAdminRights {
|
|||
var apiAdminRights: Api.ChatAdminRights {
|
||||
var filteredFlags = self.rights.rawValue
|
||||
filteredFlags |= 1 << 12
|
||||
return .chatAdminRights(flags: filteredFlags)
|
||||
return .chatAdminRights(Api.ChatAdminRights.Cons_chatAdminRights(flags: filteredFlags))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -903,7 +903,8 @@ public final class Network: NSObject, MTRequestMessageServiceDelegate {
|
|||
let publicKeys = cdnConfigData.publicKeys
|
||||
for key in publicKeys {
|
||||
switch key {
|
||||
case let .cdnPublicKey(dcId, publicKey):
|
||||
case let .cdnPublicKey(cdnPublicKeyData):
|
||||
let (dcId, publicKey) = (cdnPublicKeyData.dcId, cdnPublicKeyData.publicKey)
|
||||
if id == Int(dcId) {
|
||||
let dict = NSMutableDictionary()
|
||||
dict["key"] = publicKey
|
||||
|
|
|
|||
|
|
@ -180,15 +180,20 @@ extension Api.Message {
|
|||
extension Api.Chat {
|
||||
var peerId: PeerId {
|
||||
switch self {
|
||||
case let .chat(_, id, _, _, _, _, _, _, _, _):
|
||||
case let .chat(chatData):
|
||||
let id = chatData.id
|
||||
return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(id))
|
||||
case let .chatEmpty(id):
|
||||
case let .chatEmpty(chatEmptyData):
|
||||
let id = chatEmptyData.id
|
||||
return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(id))
|
||||
case let .chatForbidden(id, _):
|
||||
case let .chatForbidden(chatForbiddenData):
|
||||
let id = chatForbiddenData.id
|
||||
return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(id))
|
||||
case let .channel(_, _, id, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _):
|
||||
case let .channel(channelData):
|
||||
let id = channelData.id
|
||||
return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(id))
|
||||
case let .channelForbidden(_, id, _, _, _):
|
||||
case let .channelForbidden(channelForbiddenData):
|
||||
let id = channelForbiddenData.id
|
||||
return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(id))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2909,11 +2909,13 @@ func _internal_groupCallDisplayAsAvailablePeers(accountPeerId: PeerId, network:
|
|||
for chat in chats {
|
||||
if let groupOrChannel = parseTelegramGroupOrChannel(chat: chat) {
|
||||
switch chat {
|
||||
case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _, _, _, _, _, _, _):
|
||||
case let .channel(channelData):
|
||||
let participantsCount = channelData.participantsCount
|
||||
if let participantsCount = participantsCount {
|
||||
subscribers[groupOrChannel.id] = participantsCount
|
||||
}
|
||||
case let .chat(_, _, _, _, participantsCount, _, _, _, _, _):
|
||||
case let .chat(chatData):
|
||||
let participantsCount = chatData.participantsCount
|
||||
subscribers[groupOrChannel.id] = participantsCount
|
||||
default:
|
||||
break
|
||||
|
|
|
|||
|
|
@ -144,11 +144,13 @@ func _internal_peerSendAsAvailablePeers(accountPeerId: PeerId, network: Network,
|
|||
for chat in chats {
|
||||
if let groupOrChannel = parsedPeers.get(chat.peerId) {
|
||||
switch chat {
|
||||
case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _, _, _, _, _, _, _):
|
||||
case let .channel(channelData):
|
||||
let participantsCount = channelData.participantsCount
|
||||
if let participantsCount = participantsCount {
|
||||
subscribers[groupOrChannel.id] = participantsCount
|
||||
}
|
||||
case let .chat(_, _, _, _, participantsCount, _, _, _, _, _):
|
||||
case let .chat(chatData):
|
||||
let participantsCount = chatData.participantsCount
|
||||
subscribers[groupOrChannel.id] = participantsCount
|
||||
default:
|
||||
break
|
||||
|
|
@ -300,11 +302,13 @@ func _internal_liveStorySendAsAvailablePeers(account: Account, peerId: PeerId) -
|
|||
for chat in chats {
|
||||
if let groupOrChannel = parsedPeers.get(chat.peerId) {
|
||||
switch chat {
|
||||
case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _, _, _, _, _, _, _):
|
||||
case let .channel(channelData):
|
||||
let participantsCount = channelData.participantsCount
|
||||
if let participantsCount = participantsCount {
|
||||
subscribers[groupOrChannel.id] = participantsCount
|
||||
}
|
||||
case let .chat(_, _, _, _, participantsCount, _, _, _, _, _):
|
||||
case let .chat(chatData):
|
||||
let participantsCount = chatData.participantsCount
|
||||
subscribers[groupOrChannel.id] = participantsCount
|
||||
default:
|
||||
break
|
||||
|
|
|
|||
|
|
@ -58,7 +58,8 @@ func _internal_searchAdPeers(account: Account, query: String) -> Signal<[AdPeer]
|
|||
for chat in chats {
|
||||
if let groupOrChannel = parseTelegramGroupOrChannel(chat: chat) {
|
||||
switch chat {
|
||||
case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _, _, _, _, _, _, _):
|
||||
case let .channel(channelData):
|
||||
let participantsCount = channelData.participantsCount
|
||||
if let participantsCount = participantsCount {
|
||||
subscribers[groupOrChannel.id] = participantsCount
|
||||
}
|
||||
|
|
|
|||
|
|
@ -561,7 +561,8 @@ func _internal_adminedPublicChannels(account: Account, scope: AdminedPublicChann
|
|||
case let .chats(apiChats):
|
||||
chats = apiChats
|
||||
for chat in apiChats {
|
||||
if case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _, _, _, _, _, _, _) = chat {
|
||||
if case let .channel(channelData) = chat {
|
||||
let participantsCount = channelData.participantsCount
|
||||
subscriberCounts[chat.peerId] = participantsCount.flatMap(Int.init)
|
||||
}
|
||||
}
|
||||
|
|
@ -637,7 +638,7 @@ func _internal_channelsForStories(account: Account) -> Signal<[Peer], NoError> {
|
|||
if let peer = transaction.getPeer(chat.peerId) {
|
||||
peers.append(peer)
|
||||
|
||||
if case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _, _, _, _, _, _, _) = chat, let participantsCount = participantsCount {
|
||||
if case let .channel(channelData) = chat, let participantsCount = channelData.participantsCount {
|
||||
transaction.updatePeerCachedData(peerIds: Set([peer.id]), update: { _, current in
|
||||
var current = current as? CachedChannelData ?? CachedChannelData()
|
||||
var participantsSummary = current.participantsSummary
|
||||
|
|
@ -699,7 +700,7 @@ func _internal_channelsForPublicReaction(account: Account, useLocalCache: Bool)
|
|||
if let peer = transaction.getPeer(chat.peerId) {
|
||||
peers.append(peer)
|
||||
|
||||
if case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _, _, _, _, _, _, _) = chat, let participantsCount = participantsCount {
|
||||
if case let .channel(channelData) = chat, let participantsCount = channelData.participantsCount {
|
||||
transaction.updatePeerCachedData(peerIds: Set([peer.id]), update: { _, current in
|
||||
var current = current as? CachedChannelData ?? CachedChannelData()
|
||||
var participantsSummary = current.participantsSummary
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ func channelAdminLogEvents(accountPeerId: PeerId, postbox: Postbox, network: Net
|
|||
var eventsFilter: Api.ChannelAdminLogEventsFilter? = nil
|
||||
if let filter = filter {
|
||||
flags += Int32(1 << 0)
|
||||
eventsFilter = Api.ChannelAdminLogEventsFilter.channelAdminLogEventsFilter(flags: Int32(filter.rawValue))
|
||||
eventsFilter = Api.ChannelAdminLogEventsFilter.channelAdminLogEventsFilter(Api.ChannelAdminLogEventsFilter.Cons_channelAdminLogEventsFilter(flags: Int32(filter.rawValue)))
|
||||
}
|
||||
if let _ = inputAdmins {
|
||||
flags += Int32(1 << 1)
|
||||
|
|
@ -194,9 +194,11 @@ func channelAdminLogEvents(accountPeerId: PeerId, postbox: Postbox, network: Net
|
|||
var foundDeletedReplyMessage = false
|
||||
for event in apiEvents {
|
||||
switch event {
|
||||
case let .channelAdminLogEvent(_, _, _, apiAction):
|
||||
case let .channelAdminLogEvent(channelAdminLogEventData):
|
||||
let apiAction = channelAdminLogEventData.action
|
||||
switch apiAction {
|
||||
case let .channelAdminLogEventActionDeleteMessage(apiMessage):
|
||||
case let .channelAdminLogEventActionDeleteMessage(channelAdminLogEventActionDeleteMessageData):
|
||||
let apiMessage = channelAdminLogEventActionDeleteMessageData.message
|
||||
if let messageId = apiMessage.id(namespace: Namespaces.Message.Cloud), messageId == replyAttribute.messageId, let message = StoreMessage(apiMessage: apiMessage, accountPeerId: accountPeerId, peerIsForum: peer.isForum), let replyMessage = locallyRenderedMessage(message: message, peers: peers, associatedThreadInfo: associatedThreadInfo) {
|
||||
associatedMessages[replyMessage.id] = replyMessage
|
||||
foundDeletedReplyMessage = true
|
||||
|
|
@ -215,132 +217,153 @@ func channelAdminLogEvents(accountPeerId: PeerId, postbox: Postbox, network: Net
|
|||
|
||||
for event in apiEvents {
|
||||
switch event {
|
||||
case let .channelAdminLogEvent(id, date, userId, apiAction):
|
||||
case let .channelAdminLogEvent(channelAdminLogEventData):
|
||||
let (id, date, userId, apiAction) = (channelAdminLogEventData.id, channelAdminLogEventData.date, channelAdminLogEventData.userId, channelAdminLogEventData.action)
|
||||
var action: AdminLogEventAction?
|
||||
switch apiAction {
|
||||
case let .channelAdminLogEventActionChangeTitle(prev, new):
|
||||
case let .channelAdminLogEventActionChangeTitle(channelAdminLogEventActionChangeTitleData):
|
||||
let (prev, new) = (channelAdminLogEventActionChangeTitleData.prevValue, channelAdminLogEventActionChangeTitleData.newValue)
|
||||
action = .changeTitle(prev: prev, new: new)
|
||||
case let .channelAdminLogEventActionChangeAbout(prev, new):
|
||||
case let .channelAdminLogEventActionChangeAbout(channelAdminLogEventActionChangeAboutData):
|
||||
let (prev, new) = (channelAdminLogEventActionChangeAboutData.prevValue, channelAdminLogEventActionChangeAboutData.newValue)
|
||||
action = .changeAbout(prev: prev, new: new)
|
||||
case let .channelAdminLogEventActionChangeUsername(prev, new):
|
||||
case let .channelAdminLogEventActionChangeUsername(channelAdminLogEventActionChangeUsernameData):
|
||||
let (prev, new) = (channelAdminLogEventActionChangeUsernameData.prevValue, channelAdminLogEventActionChangeUsernameData.newValue)
|
||||
action = .changeUsername(prev: prev, new: new)
|
||||
case let .channelAdminLogEventActionChangePhoto(prev, new):
|
||||
case let .channelAdminLogEventActionChangePhoto(channelAdminLogEventActionChangePhotoData):
|
||||
let (prev, new) = (channelAdminLogEventActionChangePhotoData.prevPhoto, channelAdminLogEventActionChangePhotoData.newPhoto)
|
||||
let previousImage = telegramMediaImageFromApiPhoto(prev)
|
||||
let newImage = telegramMediaImageFromApiPhoto(new)
|
||||
action = .changePhoto(prev: (previousImage?.representations ?? [], previousImage?.videoRepresentations ?? []) , new: (newImage?.representations ?? [], newImage?.videoRepresentations ?? []))
|
||||
case let .channelAdminLogEventActionToggleInvites(new):
|
||||
action = .toggleInvites(boolFromApiValue(new))
|
||||
case let .channelAdminLogEventActionToggleSignatures(new):
|
||||
action = .toggleSignatures(boolFromApiValue(new))
|
||||
case let .channelAdminLogEventActionUpdatePinned(new):
|
||||
switch new {
|
||||
case let .channelAdminLogEventActionToggleInvites(channelAdminLogEventActionToggleInvitesData):
|
||||
action = .toggleInvites(boolFromApiValue(channelAdminLogEventActionToggleInvitesData.newValue))
|
||||
case let .channelAdminLogEventActionToggleSignatures(channelAdminLogEventActionToggleSignaturesData):
|
||||
action = .toggleSignatures(boolFromApiValue(channelAdminLogEventActionToggleSignaturesData.newValue))
|
||||
case let .channelAdminLogEventActionUpdatePinned(channelAdminLogEventActionUpdatePinnedData):
|
||||
switch channelAdminLogEventActionUpdatePinnedData.message {
|
||||
case .messageEmpty:
|
||||
action = .updatePinned(nil)
|
||||
default:
|
||||
if let message = StoreMessage(apiMessage: new, accountPeerId: accountPeerId, peerIsForum: peer.isForum), let rendered = renderedMessage(message: message) {
|
||||
if let message = StoreMessage(apiMessage: channelAdminLogEventActionUpdatePinnedData.message, accountPeerId: accountPeerId, peerIsForum: peer.isForum), let rendered = renderedMessage(message: message) {
|
||||
action = .updatePinned(rendered)
|
||||
}
|
||||
}
|
||||
case let .channelAdminLogEventActionEditMessage(prev, new):
|
||||
case let .channelAdminLogEventActionEditMessage(channelAdminLogEventActionEditMessageData):
|
||||
let (prev, new) = (channelAdminLogEventActionEditMessageData.prevMessage, channelAdminLogEventActionEditMessageData.newMessage)
|
||||
if let prev = StoreMessage(apiMessage: prev, accountPeerId: accountPeerId, peerIsForum: peer.isForum), let prevRendered = renderedMessage(message: prev), let new = StoreMessage(apiMessage: new, accountPeerId: accountPeerId, peerIsForum: peer.isForum), let newRendered = renderedMessage(message: new) {
|
||||
action = .editMessage(prev: prevRendered, new: newRendered)
|
||||
}
|
||||
case let .channelAdminLogEventActionDeleteMessage(message):
|
||||
if let message = StoreMessage(apiMessage: message, accountPeerId: accountPeerId, peerIsForum: peer.isForum), let rendered = renderedMessage(message: message) {
|
||||
case let .channelAdminLogEventActionDeleteMessage(channelAdminLogEventActionDeleteMessageData):
|
||||
if let message = StoreMessage(apiMessage: channelAdminLogEventActionDeleteMessageData.message, accountPeerId: accountPeerId, peerIsForum: peer.isForum), let rendered = renderedMessage(message: message) {
|
||||
action = .deleteMessage(rendered)
|
||||
}
|
||||
case .channelAdminLogEventActionParticipantJoin:
|
||||
action = .participantJoin
|
||||
case .channelAdminLogEventActionParticipantLeave:
|
||||
action = .participantLeave
|
||||
case let .channelAdminLogEventActionParticipantInvite(participant):
|
||||
let participant = ChannelParticipant(apiParticipant: participant)
|
||||
case let .channelAdminLogEventActionParticipantInvite(channelAdminLogEventActionParticipantInviteData):
|
||||
let participant = ChannelParticipant(apiParticipant: channelAdminLogEventActionParticipantInviteData.participant)
|
||||
|
||||
if let peer = peers[participant.peerId] {
|
||||
action = .participantInvite(RenderedChannelParticipant(participant: participant, peer: peer))
|
||||
}
|
||||
case let .channelAdminLogEventActionParticipantToggleBan(prev, new):
|
||||
case let .channelAdminLogEventActionParticipantToggleBan(channelAdminLogEventActionParticipantToggleBanData):
|
||||
let (prev, new) = (channelAdminLogEventActionParticipantToggleBanData.prevParticipant, channelAdminLogEventActionParticipantToggleBanData.newParticipant)
|
||||
let prevParticipant = ChannelParticipant(apiParticipant: prev)
|
||||
let newParticipant = ChannelParticipant(apiParticipant: new)
|
||||
|
||||
if let prevPeer = peers[prevParticipant.peerId], let newPeer = peers[newParticipant.peerId] {
|
||||
action = .participantToggleBan(prev: RenderedChannelParticipant(participant: prevParticipant, peer: prevPeer), new: RenderedChannelParticipant(participant: newParticipant, peer: newPeer))
|
||||
}
|
||||
case let .channelAdminLogEventActionParticipantToggleAdmin(prev, new):
|
||||
case let .channelAdminLogEventActionParticipantToggleAdmin(channelAdminLogEventActionParticipantToggleAdminData):
|
||||
let (prev, new) = (channelAdminLogEventActionParticipantToggleAdminData.prevParticipant, channelAdminLogEventActionParticipantToggleAdminData.newParticipant)
|
||||
let prevParticipant = ChannelParticipant(apiParticipant: prev)
|
||||
let newParticipant = ChannelParticipant(apiParticipant: new)
|
||||
|
||||
if let prevPeer = peers[prevParticipant.peerId], let newPeer = peers[newParticipant.peerId] {
|
||||
action = .participantToggleAdmin(prev: RenderedChannelParticipant(participant: prevParticipant, peer: prevPeer), new: RenderedChannelParticipant(participant: newParticipant, peer: newPeer))
|
||||
}
|
||||
case let .channelAdminLogEventActionChangeStickerSet(prevStickerset, newStickerset):
|
||||
case let .channelAdminLogEventActionChangeStickerSet(channelAdminLogEventActionChangeStickerSetData):
|
||||
let (prevStickerset, newStickerset) = (channelAdminLogEventActionChangeStickerSetData.prevStickerset, channelAdminLogEventActionChangeStickerSetData.newStickerset)
|
||||
action = .changeStickerPack(prev: StickerPackReference(apiInputSet: prevStickerset), new: StickerPackReference(apiInputSet: newStickerset))
|
||||
case let .channelAdminLogEventActionTogglePreHistoryHidden(value):
|
||||
action = .togglePreHistoryHidden(value == .boolTrue)
|
||||
case let .channelAdminLogEventActionDefaultBannedRights(prevBannedRights, newBannedRights):
|
||||
case let .channelAdminLogEventActionTogglePreHistoryHidden(channelAdminLogEventActionTogglePreHistoryHiddenData):
|
||||
action = .togglePreHistoryHidden(channelAdminLogEventActionTogglePreHistoryHiddenData.newValue == .boolTrue)
|
||||
case let .channelAdminLogEventActionDefaultBannedRights(channelAdminLogEventActionDefaultBannedRightsData):
|
||||
let (prevBannedRights, newBannedRights) = (channelAdminLogEventActionDefaultBannedRightsData.prevBannedRights, channelAdminLogEventActionDefaultBannedRightsData.newBannedRights)
|
||||
action = .updateDefaultBannedRights(prev: TelegramChatBannedRights(apiBannedRights: prevBannedRights), new: TelegramChatBannedRights(apiBannedRights: newBannedRights))
|
||||
case let .channelAdminLogEventActionStopPoll(message):
|
||||
if let message = StoreMessage(apiMessage: message, accountPeerId: accountPeerId, peerIsForum: peer.isForum), let rendered = renderedMessage(message: message) {
|
||||
case let .channelAdminLogEventActionStopPoll(channelAdminLogEventActionStopPollData):
|
||||
if let message = StoreMessage(apiMessage: channelAdminLogEventActionStopPollData.message, accountPeerId: accountPeerId, peerIsForum: peer.isForum), let rendered = renderedMessage(message: message) {
|
||||
action = .pollStopped(rendered)
|
||||
}
|
||||
case let .channelAdminLogEventActionChangeLinkedChat(prevValue, newValue):
|
||||
case let .channelAdminLogEventActionChangeLinkedChat(channelAdminLogEventActionChangeLinkedChatData):
|
||||
let (prevValue, newValue) = (channelAdminLogEventActionChangeLinkedChatData.prevValue, channelAdminLogEventActionChangeLinkedChatData.newValue)
|
||||
action = .linkedPeerUpdated(previous: prevValue == 0 ? nil : peers[PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(prevValue))], updated: newValue == 0 ? nil : peers[PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(newValue))])
|
||||
case let .channelAdminLogEventActionChangeLocation(prevValue, newValue):
|
||||
case let .channelAdminLogEventActionChangeLocation(channelAdminLogEventActionChangeLocationData):
|
||||
let (prevValue, newValue) = (channelAdminLogEventActionChangeLocationData.prevValue, channelAdminLogEventActionChangeLocationData.newValue)
|
||||
action = .changeGeoLocation(previous: PeerGeoLocation(apiLocation: prevValue), updated: PeerGeoLocation(apiLocation: newValue))
|
||||
case let .channelAdminLogEventActionToggleSlowMode(prevValue, newValue):
|
||||
case let .channelAdminLogEventActionToggleSlowMode(channelAdminLogEventActionToggleSlowModeData):
|
||||
let (prevValue, newValue) = (channelAdminLogEventActionToggleSlowModeData.prevValue, channelAdminLogEventActionToggleSlowModeData.newValue)
|
||||
action = .updateSlowmode(previous: prevValue == 0 ? nil : prevValue, updated: newValue == 0 ? nil : newValue)
|
||||
case .channelAdminLogEventActionStartGroupCall:
|
||||
action = .startGroupCall
|
||||
case .channelAdminLogEventActionDiscardGroupCall:
|
||||
action = .endGroupCall
|
||||
case let .channelAdminLogEventActionParticipantMute(participant):
|
||||
let parsedParticipant = GroupCallParticipantsContext.Update.StateUpdate.ParticipantUpdate(participant)
|
||||
case let .channelAdminLogEventActionParticipantMute(channelAdminLogEventActionParticipantMuteData):
|
||||
let parsedParticipant = GroupCallParticipantsContext.Update.StateUpdate.ParticipantUpdate(channelAdminLogEventActionParticipantMuteData.participant)
|
||||
action = .groupCallUpdateParticipantMuteStatus(peerId: parsedParticipant.peerId, isMuted: true)
|
||||
case let .channelAdminLogEventActionParticipantUnmute(participant):
|
||||
let parsedParticipant = GroupCallParticipantsContext.Update.StateUpdate.ParticipantUpdate(participant)
|
||||
case let .channelAdminLogEventActionParticipantUnmute(channelAdminLogEventActionParticipantUnmuteData):
|
||||
let parsedParticipant = GroupCallParticipantsContext.Update.StateUpdate.ParticipantUpdate(channelAdminLogEventActionParticipantUnmuteData.participant)
|
||||
action = .groupCallUpdateParticipantMuteStatus(peerId: parsedParticipant.peerId, isMuted: false)
|
||||
case let .channelAdminLogEventActionToggleGroupCallSetting(joinMuted):
|
||||
action = .updateGroupCallSettings(joinMuted: joinMuted == .boolTrue)
|
||||
case let .channelAdminLogEventActionExportedInviteDelete(invite):
|
||||
action = .deleteExportedInvitation(ExportedInvitation(apiExportedInvite: invite))
|
||||
case let .channelAdminLogEventActionExportedInviteRevoke(invite):
|
||||
action = .revokeExportedInvitation(ExportedInvitation(apiExportedInvite: invite))
|
||||
case let .channelAdminLogEventActionExportedInviteEdit(prevInvite, newInvite):
|
||||
case let .channelAdminLogEventActionToggleGroupCallSetting(channelAdminLogEventActionToggleGroupCallSettingData):
|
||||
action = .updateGroupCallSettings(joinMuted: channelAdminLogEventActionToggleGroupCallSettingData.joinMuted == .boolTrue)
|
||||
case let .channelAdminLogEventActionExportedInviteDelete(channelAdminLogEventActionExportedInviteDeleteData):
|
||||
action = .deleteExportedInvitation(ExportedInvitation(apiExportedInvite: channelAdminLogEventActionExportedInviteDeleteData.invite))
|
||||
case let .channelAdminLogEventActionExportedInviteRevoke(channelAdminLogEventActionExportedInviteRevokeData):
|
||||
action = .revokeExportedInvitation(ExportedInvitation(apiExportedInvite: channelAdminLogEventActionExportedInviteRevokeData.invite))
|
||||
case let .channelAdminLogEventActionExportedInviteEdit(channelAdminLogEventActionExportedInviteEditData):
|
||||
let (prevInvite, newInvite) = (channelAdminLogEventActionExportedInviteEditData.prevInvite, channelAdminLogEventActionExportedInviteEditData.newInvite)
|
||||
action = .editExportedInvitation(previous: ExportedInvitation(apiExportedInvite: prevInvite), updated: ExportedInvitation(apiExportedInvite: newInvite))
|
||||
case let .channelAdminLogEventActionParticipantJoinByInvite(flags, invite):
|
||||
case let .channelAdminLogEventActionParticipantJoinByInvite(channelAdminLogEventActionParticipantJoinByInviteData):
|
||||
let (flags, invite) = (channelAdminLogEventActionParticipantJoinByInviteData.flags, channelAdminLogEventActionParticipantJoinByInviteData.invite)
|
||||
action = .participantJoinedViaInvite(invitation: ExportedInvitation(apiExportedInvite: invite), joinedViaFolderLink: (flags & (1 << 0)) != 0)
|
||||
case let .channelAdminLogEventActionParticipantVolume(participant):
|
||||
let parsedParticipant = GroupCallParticipantsContext.Update.StateUpdate.ParticipantUpdate(participant)
|
||||
case let .channelAdminLogEventActionParticipantVolume(channelAdminLogEventActionParticipantVolumeData):
|
||||
let parsedParticipant = GroupCallParticipantsContext.Update.StateUpdate.ParticipantUpdate(channelAdminLogEventActionParticipantVolumeData.participant)
|
||||
action = .groupCallUpdateParticipantVolume(peerId: parsedParticipant.peerId, volume: parsedParticipant.volume ?? 10000)
|
||||
case let .channelAdminLogEventActionChangeHistoryTTL(prevValue, newValue):
|
||||
case let .channelAdminLogEventActionChangeHistoryTTL(channelAdminLogEventActionChangeHistoryTTLData):
|
||||
let (prevValue, newValue) = (channelAdminLogEventActionChangeHistoryTTLData.prevValue, channelAdminLogEventActionChangeHistoryTTLData.newValue)
|
||||
action = .changeHistoryTTL(previousValue: prevValue, updatedValue: newValue)
|
||||
case let .channelAdminLogEventActionParticipantJoinByRequest(invite, approvedBy):
|
||||
case let .channelAdminLogEventActionParticipantJoinByRequest(channelAdminLogEventActionParticipantJoinByRequestData):
|
||||
let (invite, approvedBy) = (channelAdminLogEventActionParticipantJoinByRequestData.invite, channelAdminLogEventActionParticipantJoinByRequestData.approvedBy)
|
||||
action = .participantJoinByRequest(invitation: ExportedInvitation(apiExportedInvite: invite), approvedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(approvedBy)))
|
||||
case let .channelAdminLogEventActionToggleNoForwards(new):
|
||||
action = .toggleCopyProtection(boolFromApiValue(new))
|
||||
case let .channelAdminLogEventActionSendMessage(message):
|
||||
if let message = StoreMessage(apiMessage: message, accountPeerId: accountPeerId, peerIsForum: peer.isForum), let rendered = renderedMessage(message: message) {
|
||||
case let .channelAdminLogEventActionToggleNoForwards(channelAdminLogEventActionToggleNoForwardsData):
|
||||
action = .toggleCopyProtection(boolFromApiValue(channelAdminLogEventActionToggleNoForwardsData.newValue))
|
||||
case let .channelAdminLogEventActionSendMessage(channelAdminLogEventActionSendMessageData):
|
||||
if let message = StoreMessage(apiMessage: channelAdminLogEventActionSendMessageData.message, accountPeerId: accountPeerId, peerIsForum: peer.isForum), let rendered = renderedMessage(message: message) {
|
||||
action = .sendMessage(rendered)
|
||||
}
|
||||
case let .channelAdminLogEventActionChangeAvailableReactions(prevValue, newValue):
|
||||
case let .channelAdminLogEventActionChangeAvailableReactions(channelAdminLogEventActionChangeAvailableReactionsData):
|
||||
let (prevValue, newValue) = (channelAdminLogEventActionChangeAvailableReactionsData.prevValue, channelAdminLogEventActionChangeAvailableReactionsData.newValue)
|
||||
action = .changeAvailableReactions(previousValue: PeerAllowedReactions(apiReactions: prevValue), updatedValue: PeerAllowedReactions(apiReactions: newValue))
|
||||
case let .channelAdminLogEventActionChangeUsernames(prevValue, newValue):
|
||||
case let .channelAdminLogEventActionChangeUsernames(channelAdminLogEventActionChangeUsernamesData):
|
||||
let (prevValue, newValue) = (channelAdminLogEventActionChangeUsernamesData.prevValue, channelAdminLogEventActionChangeUsernamesData.newValue)
|
||||
action = .changeUsernames(prev: prevValue, new: newValue)
|
||||
case let .channelAdminLogEventActionCreateTopic(topic):
|
||||
switch topic {
|
||||
case let .channelAdminLogEventActionCreateTopic(channelAdminLogEventActionCreateTopicData):
|
||||
switch channelAdminLogEventActionCreateTopicData.topic {
|
||||
case let .forumTopic(_, _, _, _, title, iconColor, iconEmojiId, _, _, _, _, _, _, _, _, _):
|
||||
action = .createTopic(info: EngineMessageHistoryThread.Info(title: title, icon: iconEmojiId, iconColor: iconColor))
|
||||
case .forumTopicDeleted:
|
||||
action = .createTopic(info: EngineMessageHistoryThread.Info(title: "", icon: nil, iconColor: 0))
|
||||
}
|
||||
case let .channelAdminLogEventActionDeleteTopic(topic):
|
||||
case let .channelAdminLogEventActionDeleteTopic(channelAdminLogEventActionDeleteTopicData):
|
||||
let topic = channelAdminLogEventActionDeleteTopicData.topic
|
||||
switch topic {
|
||||
case let .forumTopic(_, _, _, _, title, iconColor, iconEmojiId, _, _, _, _, _, _, _, _, _):
|
||||
action = .deleteTopic(info: EngineMessageHistoryThread.Info(title: title, icon: iconEmojiId, iconColor: iconColor))
|
||||
case .forumTopicDeleted:
|
||||
action = .deleteTopic(info: EngineMessageHistoryThread.Info(title: "", icon: nil, iconColor: 0))
|
||||
}
|
||||
case let .channelAdminLogEventActionEditTopic(prevTopic, newTopic):
|
||||
case let .channelAdminLogEventActionEditTopic(channelAdminLogEventActionEditTopicData):
|
||||
let (prevTopic, newTopic) = (channelAdminLogEventActionEditTopicData.prevTopic, channelAdminLogEventActionEditTopicData.newTopic)
|
||||
let prevInfo: AdminLogEventAction.ForumTopicInfo
|
||||
switch prevTopic {
|
||||
case let .forumTopic(flags, _, _, _, title, iconColor, iconEmojiId, _, _, _, _, _, _, _, _, _):
|
||||
|
|
@ -348,7 +371,7 @@ func channelAdminLogEvents(accountPeerId: PeerId, postbox: Postbox, network: Net
|
|||
case .forumTopicDeleted:
|
||||
prevInfo = AdminLogEventAction.ForumTopicInfo(info: EngineMessageHistoryThread.Info(title: "", icon: nil, iconColor: 0), isClosed: false, isHidden: false)
|
||||
}
|
||||
|
||||
|
||||
let newInfo: AdminLogEventAction.ForumTopicInfo
|
||||
switch newTopic {
|
||||
case let .forumTopic(flags, _, _, _, title, iconColor, iconEmojiId, _, _, _, _, _, _, _, _, _):
|
||||
|
|
@ -358,7 +381,8 @@ func channelAdminLogEvents(accountPeerId: PeerId, postbox: Postbox, network: Net
|
|||
}
|
||||
|
||||
action = .editTopic(prevInfo: prevInfo, newInfo: newInfo)
|
||||
case let .channelAdminLogEventActionPinTopic(_, prevTopic, newTopic):
|
||||
case let .channelAdminLogEventActionPinTopic(channelAdminLogEventActionPinTopicData):
|
||||
let (prevTopic, newTopic) = (channelAdminLogEventActionPinTopicData.prevTopic, channelAdminLogEventActionPinTopicData.newTopic)
|
||||
let prevInfo: EngineMessageHistoryThread.Info?
|
||||
switch prevTopic {
|
||||
case let .forumTopic(_, _, _, _, title, iconColor, iconEmojiId, _, _, _, _, _, _, _, _, _):
|
||||
|
|
@ -368,7 +392,7 @@ func channelAdminLogEvents(accountPeerId: PeerId, postbox: Postbox, network: Net
|
|||
case .none:
|
||||
prevInfo = nil
|
||||
}
|
||||
|
||||
|
||||
let newInfo: EngineMessageHistoryThread.Info?
|
||||
switch newTopic {
|
||||
case let .forumTopic(_, _, _, _, title, iconColor, iconEmojiId, _, _, _, _, _, _, _, _, _):
|
||||
|
|
@ -379,27 +403,29 @@ func channelAdminLogEvents(accountPeerId: PeerId, postbox: Postbox, network: Net
|
|||
newInfo = nil
|
||||
}
|
||||
action = .pinTopic(prevInfo: prevInfo, newInfo: newInfo)
|
||||
case let .channelAdminLogEventActionToggleForum(newValue):
|
||||
action = .toggleForum(isForum: newValue == .boolTrue)
|
||||
case let .channelAdminLogEventActionToggleAntiSpam(newValue):
|
||||
action = .toggleAntiSpam(isEnabled: newValue == .boolTrue)
|
||||
case let .channelAdminLogEventActionChangePeerColor(prevValue, newValue):
|
||||
guard case let .peerColor(_, prevColor, prevBackgroundEmojiIdValue) = prevValue, case let .peerColor(_, newColor, newBackgroundEmojiIdValue) = newValue else {
|
||||
case let .channelAdminLogEventActionToggleForum(channelAdminLogEventActionToggleForumData):
|
||||
action = .toggleForum(isForum: channelAdminLogEventActionToggleForumData.newValue == .boolTrue)
|
||||
case let .channelAdminLogEventActionToggleAntiSpam(channelAdminLogEventActionToggleAntiSpamData):
|
||||
action = .toggleAntiSpam(isEnabled: channelAdminLogEventActionToggleAntiSpamData.newValue == .boolTrue)
|
||||
case let .channelAdminLogEventActionChangePeerColor(channelAdminLogEventActionChangePeerColorData):
|
||||
let (prevValue, newValue) = (channelAdminLogEventActionChangePeerColorData.prevValue, channelAdminLogEventActionChangePeerColorData.newValue)
|
||||
guard case let .peerColor(_, prevColor, prevBackgroundEmojiId) = prevValue, case let .peerColor(_, newColor, newBackgroundEmojiId) = newValue else {
|
||||
continue
|
||||
}
|
||||
let prevColorIndex = prevColor ?? 0
|
||||
let prevEmojiId = prevBackgroundEmojiIdValue
|
||||
|
||||
let prevEmojiId = prevBackgroundEmojiId
|
||||
|
||||
let newColorIndex = newColor ?? 0
|
||||
let newEmojiId = newBackgroundEmojiIdValue
|
||||
|
||||
let newEmojiId = newBackgroundEmojiId
|
||||
|
||||
action = .changeNameColor(prevColor: PeerNameColor(rawValue: prevColorIndex), prevIcon: prevEmojiId, newColor: PeerNameColor(rawValue: newColorIndex), newIcon: newEmojiId)
|
||||
case let .channelAdminLogEventActionChangeProfilePeerColor(prevValue, newValue):
|
||||
guard case let .peerColor(_, prevColorIndex, prevEmojiId) = prevValue, case let .peerColor(_, newColorIndex, newEmojiId) = newValue else {
|
||||
case let .channelAdminLogEventActionChangeProfilePeerColor(channelAdminLogEventActionChangeProfilePeerColorData):
|
||||
guard case let .peerColor(_, prevColor, prevBackgroundEmojiId) = channelAdminLogEventActionChangeProfilePeerColorData.prevValue, case let .peerColor(_, newColor, newBackgroundEmojiId) = channelAdminLogEventActionChangeProfilePeerColorData.newValue else {
|
||||
continue
|
||||
}
|
||||
action = .changeProfileColor(prevColor: prevColorIndex.flatMap(PeerNameColor.init(rawValue:)), prevIcon: prevEmojiId, newColor: newColorIndex.flatMap(PeerNameColor.init(rawValue:)), newIcon: newEmojiId)
|
||||
case let .channelAdminLogEventActionChangeWallpaper(prevValue, newValue):
|
||||
action = .changeProfileColor(prevColor: prevColor.flatMap(PeerNameColor.init(rawValue:)), prevIcon: prevBackgroundEmojiId, newColor: newColor.flatMap(PeerNameColor.init(rawValue:)), newIcon: newBackgroundEmojiId)
|
||||
case let .channelAdminLogEventActionChangeWallpaper(channelAdminLogEventActionChangeWallpaperData):
|
||||
let (prevValue, newValue) = (channelAdminLogEventActionChangeWallpaperData.prevValue, channelAdminLogEventActionChangeWallpaperData.newValue)
|
||||
let prev: TelegramWallpaper?
|
||||
if case let .wallPaperNoFile(_, _, settings) = prevValue {
|
||||
if settings == nil {
|
||||
|
|
@ -425,20 +451,24 @@ func channelAdminLogEvents(accountPeerId: PeerId, postbox: Postbox, network: Net
|
|||
new = TelegramWallpaper(apiWallpaper: newValue)
|
||||
}
|
||||
action = .changeWallpaper(prev: prev, new: new)
|
||||
case let .channelAdminLogEventActionChangeEmojiStatus(prevValue, newValue):
|
||||
case let .channelAdminLogEventActionChangeEmojiStatus(channelAdminLogEventActionChangeEmojiStatusData):
|
||||
let (prevValue, newValue) = (channelAdminLogEventActionChangeEmojiStatusData.prevValue, channelAdminLogEventActionChangeEmojiStatusData.newValue)
|
||||
action = .changeStatus(prev: PeerEmojiStatus(apiStatus: prevValue), new: PeerEmojiStatus(apiStatus: newValue))
|
||||
case let .channelAdminLogEventActionChangeEmojiStickerSet(prevStickerset, newStickerset):
|
||||
case let .channelAdminLogEventActionChangeEmojiStickerSet(channelAdminLogEventActionChangeEmojiStickerSetData):
|
||||
let (prevStickerset, newStickerset) = (channelAdminLogEventActionChangeEmojiStickerSetData.prevStickerset, channelAdminLogEventActionChangeEmojiStickerSetData.newStickerset)
|
||||
action = .changeEmojiPack(prev: StickerPackReference(apiInputSet: prevStickerset), new: StickerPackReference(apiInputSet: newStickerset))
|
||||
case let .channelAdminLogEventActionToggleSignatureProfiles(newValue):
|
||||
action = .toggleSignatureProfiles(boolFromApiValue(newValue))
|
||||
case let .channelAdminLogEventActionParticipantSubExtend(prev, new):
|
||||
case let .channelAdminLogEventActionToggleSignatureProfiles(channelAdminLogEventActionToggleSignatureProfilesData):
|
||||
action = .toggleSignatureProfiles(boolFromApiValue(channelAdminLogEventActionToggleSignatureProfilesData.newValue))
|
||||
case let .channelAdminLogEventActionParticipantSubExtend(channelAdminLogEventActionParticipantSubExtendData):
|
||||
let (prev, new) = (channelAdminLogEventActionParticipantSubExtendData.prevParticipant, channelAdminLogEventActionParticipantSubExtendData.newParticipant)
|
||||
let prevParticipant = ChannelParticipant(apiParticipant: prev)
|
||||
let newParticipant = ChannelParticipant(apiParticipant: new)
|
||||
|
||||
if let prevPeer = peers[prevParticipant.peerId], let newPeer = peers[newParticipant.peerId] {
|
||||
action = .participantSubscriptionExtended(prev: RenderedChannelParticipant(participant: prevParticipant, peer: prevPeer), new: RenderedChannelParticipant(participant: newParticipant, peer: newPeer))
|
||||
}
|
||||
case let .channelAdminLogEventActionToggleAutotranslation(newValue):
|
||||
case let .channelAdminLogEventActionToggleAutotranslation(channelAdminLogEventActionToggleAutotranslationData):
|
||||
let newValue = channelAdminLogEventActionToggleAutotranslationData.newValue
|
||||
action = .toggleAutoTranslation(boolFromApiValue(newValue))
|
||||
}
|
||||
let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ func _internal_channelMembers(postbox: Postbox, network: Network, accountPeerId:
|
|||
case .all:
|
||||
apiFilter = .channelParticipantsRecent
|
||||
case let .search(query):
|
||||
apiFilter = .channelParticipantsSearch(q: query)
|
||||
apiFilter = .channelParticipantsSearch(Api.ChannelParticipantsFilter.Cons_channelParticipantsSearch(q: query))
|
||||
}
|
||||
case let .mentions(threadId, filter):
|
||||
switch filter {
|
||||
|
|
@ -49,7 +49,7 @@ func _internal_channelMembers(postbox: Postbox, network: Network, accountPeerId:
|
|||
if threadId != nil {
|
||||
flags |= 1 << 1
|
||||
}
|
||||
apiFilter = .channelParticipantsMentions(flags: flags, q: nil, topMsgId: threadId?.id)
|
||||
apiFilter = .channelParticipantsMentions(Api.ChannelParticipantsFilter.Cons_channelParticipantsMentions(flags: flags, q: nil, topMsgId: threadId?.id))
|
||||
case let .search(query):
|
||||
var flags: Int32 = 0
|
||||
if threadId != nil {
|
||||
|
|
@ -58,32 +58,32 @@ func _internal_channelMembers(postbox: Postbox, network: Network, accountPeerId:
|
|||
if !query.isEmpty {
|
||||
flags |= 1 << 0
|
||||
}
|
||||
apiFilter = .channelParticipantsMentions(flags: flags, q: query.isEmpty ? nil : query, topMsgId: threadId?.id)
|
||||
apiFilter = .channelParticipantsMentions(Api.ChannelParticipantsFilter.Cons_channelParticipantsMentions(flags: flags, q: query.isEmpty ? nil : query, topMsgId: threadId?.id))
|
||||
}
|
||||
case .admins:
|
||||
apiFilter = .channelParticipantsAdmins
|
||||
case let .contacts(filter):
|
||||
switch filter {
|
||||
case .all:
|
||||
apiFilter = .channelParticipantsContacts(q: "")
|
||||
apiFilter = .channelParticipantsContacts(Api.ChannelParticipantsFilter.Cons_channelParticipantsContacts(q: ""))
|
||||
case let .search(query):
|
||||
apiFilter = .channelParticipantsContacts(q: query)
|
||||
apiFilter = .channelParticipantsContacts(Api.ChannelParticipantsFilter.Cons_channelParticipantsContacts(q: query))
|
||||
}
|
||||
case .bots:
|
||||
apiFilter = .channelParticipantsBots
|
||||
case let .restricted(filter):
|
||||
switch filter {
|
||||
case .all:
|
||||
apiFilter = .channelParticipantsBanned(q: "")
|
||||
apiFilter = .channelParticipantsBanned(Api.ChannelParticipantsFilter.Cons_channelParticipantsBanned(q: ""))
|
||||
case let .search(query):
|
||||
apiFilter = .channelParticipantsBanned(q: query)
|
||||
apiFilter = .channelParticipantsBanned(Api.ChannelParticipantsFilter.Cons_channelParticipantsBanned(q: query))
|
||||
}
|
||||
case let .banned(filter):
|
||||
switch filter {
|
||||
case .all:
|
||||
apiFilter = .channelParticipantsKicked(q: "")
|
||||
apiFilter = .channelParticipantsKicked(Api.ChannelParticipantsFilter.Cons_channelParticipantsKicked(q: ""))
|
||||
case let .search(query):
|
||||
apiFilter = .channelParticipantsKicked(q: query)
|
||||
apiFilter = .channelParticipantsKicked(Api.ChannelParticipantsFilter.Cons_channelParticipantsKicked(q: query))
|
||||
}
|
||||
}
|
||||
return network.request(Api.functions.channels.getParticipants(channel: inputChannel, filter: apiFilter, offset: offset, limit: limit, hash: hash))
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ func _internal_requestRecommendedChannels(account: Account, peerId: EnginePeer.I
|
|||
for chat in chats {
|
||||
if let peer = transaction.getPeer(chat.peerId) {
|
||||
peers.append(EnginePeer(peer))
|
||||
if case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _, _, _, _, _, _, _) = chat, let participantsCount = participantsCount {
|
||||
if case let .channel(channelData) = chat, let participantsCount = channelData.participantsCount {
|
||||
transaction.updatePeerCachedData(peerIds: Set([peer.id]), update: { _, current in
|
||||
var current = current as? CachedChannelData ?? CachedChannelData()
|
||||
var participantsSummary = current.participantsSummary
|
||||
|
|
|
|||
|
|
@ -282,15 +282,16 @@ func _internal_checkChatFolderLink(account: Account, slug: String) -> Signal<Cha
|
|||
var memberCounts: [PeerId: Int] = [:]
|
||||
|
||||
for chat in chats {
|
||||
if case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _, _, _, _, _, _, _) = chat {
|
||||
if case let .channel(channelData) = chat {
|
||||
let participantsCount = channelData.participantsCount
|
||||
if let participantsCount = participantsCount {
|
||||
memberCounts[chat.peerId] = Int(participantsCount)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
updatePeers(transaction: transaction, accountPeerId: accountPeerId, peers: parsedPeers)
|
||||
|
||||
|
||||
var resultPeers: [EnginePeer] = []
|
||||
var alreadyMemberPeerIds = Set<EnginePeer.Id>()
|
||||
for peer in peers {
|
||||
|
|
@ -317,15 +318,16 @@ func _internal_checkChatFolderLink(account: Account, slug: String) -> Signal<Cha
|
|||
var memberCounts: [PeerId: Int] = [:]
|
||||
|
||||
for chat in chats {
|
||||
if case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _, _, _, _, _, _, _) = chat {
|
||||
if case let .channel(channelData) = chat {
|
||||
let participantsCount = channelData.participantsCount
|
||||
if let participantsCount = participantsCount {
|
||||
memberCounts[chat.peerId] = Int(participantsCount)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
updatePeers(transaction: transaction, accountPeerId: accountPeerId, peers: parsedPeers)
|
||||
|
||||
|
||||
let currentFilters = _internal_currentChatListFilters(transaction: transaction)
|
||||
var currentFilterTitle: ChatFolderTitle?
|
||||
if let index = currentFilters.firstIndex(where: { $0.id == filterId }) {
|
||||
|
|
@ -612,15 +614,16 @@ func _internal_pollChatFolderUpdatesOnce(account: Account, folderId: Int32) -> S
|
|||
var memberCounts: [ChatListFiltersState.ChatListFilterUpdates.MemberCount] = []
|
||||
|
||||
for chat in chats {
|
||||
if case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _, _, _, _, _, _, _) = chat {
|
||||
if case let .channel(channelData) = chat {
|
||||
let participantsCount = channelData.participantsCount
|
||||
if let participantsCount = participantsCount {
|
||||
memberCounts.append(ChatListFiltersState.ChatListFilterUpdates.MemberCount(id: chat.peerId, count: participantsCount))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
updatePeers(transaction: transaction, accountPeerId: accountPeerId, peers: parsedPeers)
|
||||
|
||||
|
||||
let _ = updateChatListFiltersState(transaction: transaction, { state in
|
||||
var state = state
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,8 @@ func _internal_inactiveChannelList(network: Network) -> Signal<[InactiveChannel]
|
|||
var participantsCounts: [PeerId: Int32] = [:]
|
||||
for chat in chats {
|
||||
switch chat {
|
||||
case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCountValue, _, _, _, _, _, _, _, _, _, _):
|
||||
case let .channel(channelData):
|
||||
let participantsCountValue = channelData.participantsCount
|
||||
if let participantsCountValue = participantsCountValue {
|
||||
participantsCounts[chat.peerId] = participantsCountValue
|
||||
}
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ func _internal_updateChannelAdminRights(account: Account, peerId: PeerId, adminI
|
|||
}
|
||||
updatedParticipant = .member(id: adminId, invitedAt: Int32(Date().timeIntervalSince1970), adminInfo: adminInfo, banInfo: nil, rank: rank, subscriptionUntilDate: nil)
|
||||
}
|
||||
return account.network.request(Api.functions.channels.editAdmin(channel: inputChannel, userId: inputUser, adminRights: rights?.apiAdminRights ?? .chatAdminRights(flags: 0), rank: rank ?? ""))
|
||||
return account.network.request(Api.functions.channels.editAdmin(channel: inputChannel, userId: inputUser, adminRights: rights?.apiAdminRights ?? .chatAdminRights(Api.ChatAdminRights.Cons_chatAdminRights(flags: 0)), rank: rank ?? ""))
|
||||
|> map { [$0] }
|
||||
|> `catch` { error -> Signal<[Api.Updates], UpdateChannelAdminRightsError> in
|
||||
if error.errorDescription == "USER_NOT_PARTICIPANT" {
|
||||
|
|
@ -195,7 +195,7 @@ func _internal_updateChannelAdminRights(account: Account, peerId: PeerId, adminI
|
|||
return .addMemberError(error)
|
||||
}
|
||||
|> then(
|
||||
account.network.request(Api.functions.channels.editAdmin(channel: inputChannel, userId: inputUser, adminRights: rights?.apiAdminRights ?? .chatAdminRights(flags: 0), rank: rank ?? ""))
|
||||
account.network.request(Api.functions.channels.editAdmin(channel: inputChannel, userId: inputUser, adminRights: rights?.apiAdminRights ?? .chatAdminRights(Api.ChatAdminRights.Cons_chatAdminRights(flags: 0)), rank: rank ?? ""))
|
||||
|> mapError { error -> UpdateChannelAdminRightsError in
|
||||
return .generic
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,8 @@ public func _internal_searchPeers(accountPeerId: PeerId, postbox: Postbox, netwo
|
|||
for chat in chats {
|
||||
if let groupOrChannel = parseTelegramGroupOrChannel(chat: chat) {
|
||||
switch chat {
|
||||
case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _, _, _, _, _, _, _):
|
||||
case let .channel(channelData):
|
||||
let participantsCount = channelData.participantsCount
|
||||
if let participantsCount = participantsCount {
|
||||
subscribers[groupOrChannel.id] = participantsCount
|
||||
}
|
||||
|
|
|
|||
|
|
@ -381,7 +381,8 @@ func _internal_fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPee
|
|||
var subscriberCount: Int32?
|
||||
for chat in chats {
|
||||
if chat.peerId == channelPeerId {
|
||||
if case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _, _, _, _, _, _, _) = chat {
|
||||
if case let .channel(channelData) = chat {
|
||||
let participantsCount = channelData.participantsCount
|
||||
subscriberCount = participantsCount
|
||||
}
|
||||
}
|
||||
|
|
@ -775,7 +776,8 @@ func _internal_fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPee
|
|||
switch participantResult {
|
||||
case let .channelParticipant(participant, _, _):
|
||||
switch participant {
|
||||
case let .channelParticipantSelf(flags, _, inviterId, invitedDate, _):
|
||||
case let .channelParticipantSelf(channelParticipantSelfData):
|
||||
let (flags, inviterId, invitedDate) = (channelParticipantSelfData.flags, channelParticipantSelfData.inviterId, channelParticipantSelfData.date)
|
||||
invitedBy = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(inviterId))
|
||||
if (flags & (1 << 0)) != 0 {
|
||||
invitedOn = invitedDate
|
||||
|
|
|
|||
|
|
@ -220,7 +220,8 @@ func _internal_requestAccountPrivacySettings(account: Account) -> Signal<Account
|
|||
if let peer = parseTelegramGroupOrChannel(chat: chat) {
|
||||
var participantCount: Int32? = nil
|
||||
switch chat {
|
||||
case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCountValue, _, _, _, _, _, _, _, _, _, _):
|
||||
case let .channel(channelData):
|
||||
let participantsCountValue = channelData.participantsCount
|
||||
participantCount = participantsCountValue
|
||||
default:
|
||||
break
|
||||
|
|
|
|||
|
|
@ -81,7 +81,8 @@ func updatePeers(transaction: Transaction, accountPeerId: PeerId, peers: Accumul
|
|||
}
|
||||
for (_, chat) in peers.chats {
|
||||
switch chat {
|
||||
case let .channel(flags, flags2, _, _, _, _, _, _, _, _, _, _, _, _, storiesMaxId, _, _, _, _, _, _, _, _):
|
||||
case let .channel(channelData):
|
||||
let (flags, flags2, storiesMaxId) = (channelData.flags, channelData.flags2, channelData.storiesMaxId)
|
||||
let isMin = (flags & (1 << 12)) != 0
|
||||
let storiesUnavailable = (flags2 & (1 << 3)) != 0
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue