Refactor constructor use sites for types 100-119 to struct pattern

Migrated 22 constructors: fileHash, folder, folderPeer, forumTopic,
forumTopicDeleted, foundStory, game, geoPoint, geoPointAddress,
globalPrivacySettings, groupCall, groupCallDiscarded, groupCallDonor,
groupCallMessage, groupCallParticipant, groupCallParticipantVideo,
groupCallParticipantVideoSourceGroup, groupCallStreamChannel,
highScore, importedContact, inlineBotSwitchPM, inlineBotWebView

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Isaac 2026-01-16 02:41:47 +08:00
parent ac019b15c5
commit 6b2c0f9c53
20 changed files with 418 additions and 76 deletions

View file

@ -532,7 +532,17 @@ public extension Api {
}
public extension Api {
enum FileHash: TypeConstructorDescription {
case fileHash(offset: Int64, limit: Int32, hash: Buffer)
public class Cons_fileHash {
public var offset: Int64
public var limit: Int32
public var hash: Buffer
public init(offset: Int64, limit: Int32, hash: Buffer) {
self.offset = offset
self.limit = limit
self.hash = hash
}
}
case fileHash(Cons_fileHash)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
#if DEBUG
@ -561,7 +571,19 @@ public extension Api {
}
public extension Api {
enum Folder: TypeConstructorDescription {
case folder(flags: Int32, id: Int32, title: String, photo: Api.ChatPhoto?)
public class Cons_folder {
public var flags: Int32
public var id: Int32
public var title: String
public var photo: Api.ChatPhoto?
public init(flags: Int32, id: Int32, title: String, photo: Api.ChatPhoto?) {
self.flags = flags
self.id = id
self.title = title
self.photo = photo
}
}
case folder(Cons_folder)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
#if DEBUG
@ -590,7 +612,15 @@ public extension Api {
}
public extension Api {
enum FolderPeer: TypeConstructorDescription {
case folderPeer(peer: Api.Peer, folderId: Int32)
public class Cons_folderPeer {
public var peer: Api.Peer
public var folderId: Int32
public init(peer: Api.Peer, folderId: Int32) {
self.peer = peer
self.folderId = folderId
}
}
case folderPeer(Cons_folderPeer)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
#if DEBUG
@ -619,8 +649,50 @@ public extension Api {
}
public extension Api {
indirect enum ForumTopic: TypeConstructorDescription {
case forumTopic(flags: Int32, id: Int32, date: Int32, peer: Api.Peer, title: String, iconColor: Int32, iconEmojiId: Int64?, topMessage: Int32, readInboxMaxId: Int32, readOutboxMaxId: Int32, unreadCount: Int32, unreadMentionsCount: Int32, unreadReactionsCount: Int32, fromId: Api.Peer, notifySettings: Api.PeerNotifySettings, draft: Api.DraftMessage?)
case forumTopicDeleted(id: Int32)
public class Cons_forumTopic {
public var flags: Int32
public var id: Int32
public var date: Int32
public var peer: Api.Peer
public var title: String
public var iconColor: Int32
public var iconEmojiId: Int64?
public var topMessage: Int32
public var readInboxMaxId: Int32
public var readOutboxMaxId: Int32
public var unreadCount: Int32
public var unreadMentionsCount: Int32
public var unreadReactionsCount: Int32
public var fromId: Api.Peer
public var notifySettings: Api.PeerNotifySettings
public var draft: Api.DraftMessage?
public init(flags: Int32, id: Int32, date: Int32, peer: Api.Peer, title: String, iconColor: Int32, iconEmojiId: Int64?, topMessage: Int32, readInboxMaxId: Int32, readOutboxMaxId: Int32, unreadCount: Int32, unreadMentionsCount: Int32, unreadReactionsCount: Int32, fromId: Api.Peer, notifySettings: Api.PeerNotifySettings, draft: Api.DraftMessage?) {
self.flags = flags
self.id = id
self.date = date
self.peer = peer
self.title = title
self.iconColor = iconColor
self.iconEmojiId = iconEmojiId
self.topMessage = topMessage
self.readInboxMaxId = readInboxMaxId
self.readOutboxMaxId = readOutboxMaxId
self.unreadCount = unreadCount
self.unreadMentionsCount = unreadMentionsCount
self.unreadReactionsCount = unreadReactionsCount
self.fromId = fromId
self.notifySettings = notifySettings
self.draft = draft
}
}
public class Cons_forumTopicDeleted {
public var id: Int32
public init(id: Int32) {
self.id = id
}
}
case forumTopic(Cons_forumTopic)
case forumTopicDeleted(Cons_forumTopicDeleted)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
#if DEBUG
@ -656,7 +728,15 @@ public extension Api {
}
public extension Api {
indirect enum FoundStory: TypeConstructorDescription {
case foundStory(peer: Api.Peer, story: Api.StoryItem)
public class Cons_foundStory {
public var peer: Api.Peer
public var story: Api.StoryItem
public init(peer: Api.Peer, story: Api.StoryItem) {
self.peer = peer
self.story = story
}
}
case foundStory(Cons_foundStory)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
#if DEBUG
@ -685,7 +765,27 @@ public extension Api {
}
public extension Api {
enum Game: TypeConstructorDescription {
case game(flags: Int32, id: Int64, accessHash: Int64, shortName: String, title: String, description: String, photo: Api.Photo, document: Api.Document?)
public class Cons_game {
public var flags: Int32
public var id: Int64
public var accessHash: Int64
public var shortName: String
public var title: String
public var description: String
public var photo: Api.Photo
public var document: Api.Document?
public init(flags: Int32, id: Int64, accessHash: Int64, shortName: String, title: String, description: String, photo: Api.Photo, document: Api.Document?) {
self.flags = flags
self.id = id
self.accessHash = accessHash
self.shortName = shortName
self.title = title
self.description = description
self.photo = photo
self.document = document
}
}
case game(Cons_game)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
#if DEBUG
@ -714,7 +814,21 @@ public extension Api {
}
public extension Api {
enum GeoPoint: TypeConstructorDescription {
case geoPoint(flags: Int32, long: Double, lat: Double, accessHash: Int64, accuracyRadius: Int32?)
public class Cons_geoPoint {
public var flags: Int32
public var long: Double
public var lat: Double
public var accessHash: Int64
public var accuracyRadius: Int32?
public init(flags: Int32, long: Double, lat: Double, accessHash: Int64, accuracyRadius: Int32?) {
self.flags = flags
self.long = long
self.lat = lat
self.accessHash = accessHash
self.accuracyRadius = accuracyRadius
}
}
case geoPoint(Cons_geoPoint)
case geoPointEmpty
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
@ -751,7 +865,21 @@ public extension Api {
}
public extension Api {
enum GeoPointAddress: TypeConstructorDescription {
case geoPointAddress(flags: Int32, countryIso2: String, state: String?, city: String?, street: String?)
public class Cons_geoPointAddress {
public var flags: Int32
public var countryIso2: String
public var state: String?
public var city: String?
public var street: String?
public init(flags: Int32, countryIso2: String, state: String?, city: String?, street: String?) {
self.flags = flags
self.countryIso2 = countryIso2
self.state = state
self.city = city
self.street = street
}
}
case geoPointAddress(Cons_geoPointAddress)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
#if DEBUG
@ -780,7 +908,17 @@ public extension Api {
}
public extension Api {
enum GlobalPrivacySettings: TypeConstructorDescription {
case globalPrivacySettings(flags: Int32, noncontactPeersPaidStars: Int64?, disallowedGifts: Api.DisallowedGiftsSettings?)
public class Cons_globalPrivacySettings {
public var flags: Int32
public var noncontactPeersPaidStars: Int64?
public var disallowedGifts: Api.DisallowedGiftsSettings?
public init(flags: Int32, noncontactPeersPaidStars: Int64?, disallowedGifts: Api.DisallowedGiftsSettings?) {
self.flags = flags
self.noncontactPeersPaidStars = noncontactPeersPaidStars
self.disallowedGifts = disallowedGifts
}
}
case globalPrivacySettings(Cons_globalPrivacySettings)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
#if DEBUG
@ -809,8 +947,50 @@ public extension Api {
}
public extension Api {
enum GroupCall: TypeConstructorDescription {
case groupCall(flags: Int32, id: Int64, accessHash: Int64, participantsCount: Int32, title: String?, streamDcId: Int32?, recordStartDate: Int32?, scheduleDate: Int32?, unmutedVideoCount: Int32?, unmutedVideoLimit: Int32, version: Int32, inviteLink: String?, sendPaidMessagesStars: Int64?, defaultSendAs: Api.Peer?)
case groupCallDiscarded(id: Int64, accessHash: Int64, duration: Int32)
public class Cons_groupCall {
public var flags: Int32
public var id: Int64
public var accessHash: Int64
public var participantsCount: Int32
public var title: String?
public var streamDcId: Int32?
public var recordStartDate: Int32?
public var scheduleDate: Int32?
public var unmutedVideoCount: Int32?
public var unmutedVideoLimit: Int32
public var version: Int32
public var inviteLink: String?
public var sendPaidMessagesStars: Int64?
public var defaultSendAs: Api.Peer?
public init(flags: Int32, id: Int64, accessHash: Int64, participantsCount: Int32, title: String?, streamDcId: Int32?, recordStartDate: Int32?, scheduleDate: Int32?, unmutedVideoCount: Int32?, unmutedVideoLimit: Int32, version: Int32, inviteLink: String?, sendPaidMessagesStars: Int64?, defaultSendAs: Api.Peer?) {
self.flags = flags
self.id = id
self.accessHash = accessHash
self.participantsCount = participantsCount
self.title = title
self.streamDcId = streamDcId
self.recordStartDate = recordStartDate
self.scheduleDate = scheduleDate
self.unmutedVideoCount = unmutedVideoCount
self.unmutedVideoLimit = unmutedVideoLimit
self.version = version
self.inviteLink = inviteLink
self.sendPaidMessagesStars = sendPaidMessagesStars
self.defaultSendAs = defaultSendAs
}
}
public class Cons_groupCallDiscarded {
public var id: Int64
public var accessHash: Int64
public var duration: Int32
public init(id: Int64, accessHash: Int64, duration: Int32) {
self.id = id
self.accessHash = accessHash
self.duration = duration
}
}
case groupCall(Cons_groupCall)
case groupCallDiscarded(Cons_groupCallDiscarded)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
#if DEBUG
@ -846,7 +1026,17 @@ public extension Api {
}
public extension Api {
enum GroupCallDonor: TypeConstructorDescription {
case groupCallDonor(flags: Int32, peerId: Api.Peer?, stars: Int64)
public class Cons_groupCallDonor {
public var flags: Int32
public var peerId: Api.Peer?
public var stars: Int64
public init(flags: Int32, peerId: Api.Peer?, stars: Int64) {
self.flags = flags
self.peerId = peerId
self.stars = stars
}
}
case groupCallDonor(Cons_groupCallDonor)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
#if DEBUG
@ -875,7 +1065,23 @@ public extension Api {
}
public extension Api {
enum GroupCallMessage: TypeConstructorDescription {
case groupCallMessage(flags: Int32, id: Int32, fromId: Api.Peer, date: Int32, message: Api.TextWithEntities, paidMessageStars: Int64?)
public class Cons_groupCallMessage {
public var flags: Int32
public var id: Int32
public var fromId: Api.Peer
public var date: Int32
public var message: Api.TextWithEntities
public var paidMessageStars: Int64?
public init(flags: Int32, id: Int32, fromId: Api.Peer, date: Int32, message: Api.TextWithEntities, paidMessageStars: Int64?) {
self.flags = flags
self.id = id
self.fromId = fromId
self.date = date
self.message = message
self.paidMessageStars = paidMessageStars
}
}
case groupCallMessage(Cons_groupCallMessage)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
#if DEBUG

View file

@ -1,6 +1,32 @@
public extension Api {
enum GroupCallParticipant: TypeConstructorDescription {
case groupCallParticipant(flags: Int32, peer: Api.Peer, date: Int32, activeDate: Int32?, source: Int32, volume: Int32?, about: String?, raiseHandRating: Int64?, video: Api.GroupCallParticipantVideo?, presentation: Api.GroupCallParticipantVideo?, paidStarsTotal: Int64?)
public class Cons_groupCallParticipant {
public var flags: Int32
public var peer: Api.Peer
public var date: Int32
public var activeDate: Int32?
public var source: Int32
public var volume: Int32?
public var about: String?
public var raiseHandRating: Int64?
public var video: Api.GroupCallParticipantVideo?
public var presentation: Api.GroupCallParticipantVideo?
public var paidStarsTotal: Int64?
public init(flags: Int32, peer: Api.Peer, date: Int32, activeDate: Int32?, source: Int32, volume: Int32?, about: String?, raiseHandRating: Int64?, video: Api.GroupCallParticipantVideo?, presentation: Api.GroupCallParticipantVideo?, paidStarsTotal: Int64?) {
self.flags = flags
self.peer = peer
self.date = date
self.activeDate = activeDate
self.source = source
self.volume = volume
self.about = about
self.raiseHandRating = raiseHandRating
self.video = video
self.presentation = presentation
self.paidStarsTotal = paidStarsTotal
}
}
case groupCallParticipant(Cons_groupCallParticipant)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
#if DEBUG
@ -29,7 +55,19 @@ public extension Api {
}
public extension Api {
enum GroupCallParticipantVideo: TypeConstructorDescription {
case groupCallParticipantVideo(flags: Int32, endpoint: String, sourceGroups: [Api.GroupCallParticipantVideoSourceGroup], audioSource: Int32?)
public class Cons_groupCallParticipantVideo {
public var flags: Int32
public var endpoint: String
public var sourceGroups: [Api.GroupCallParticipantVideoSourceGroup]
public var audioSource: Int32?
public init(flags: Int32, endpoint: String, sourceGroups: [Api.GroupCallParticipantVideoSourceGroup], audioSource: Int32?) {
self.flags = flags
self.endpoint = endpoint
self.sourceGroups = sourceGroups
self.audioSource = audioSource
}
}
case groupCallParticipantVideo(Cons_groupCallParticipantVideo)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
#if DEBUG
@ -58,7 +96,15 @@ public extension Api {
}
public extension Api {
enum GroupCallParticipantVideoSourceGroup: TypeConstructorDescription {
case groupCallParticipantVideoSourceGroup(semantics: String, sources: [Int32])
public class Cons_groupCallParticipantVideoSourceGroup {
public var semantics: String
public var sources: [Int32]
public init(semantics: String, sources: [Int32]) {
self.semantics = semantics
self.sources = sources
}
}
case groupCallParticipantVideoSourceGroup(Cons_groupCallParticipantVideoSourceGroup)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
#if DEBUG
@ -87,7 +133,17 @@ public extension Api {
}
public extension Api {
enum GroupCallStreamChannel: TypeConstructorDescription {
case groupCallStreamChannel(channel: Int32, scale: Int32, lastTimestampMs: Int64)
public class Cons_groupCallStreamChannel {
public var channel: Int32
public var scale: Int32
public var lastTimestampMs: Int64
public init(channel: Int32, scale: Int32, lastTimestampMs: Int64) {
self.channel = channel
self.scale = scale
self.lastTimestampMs = lastTimestampMs
}
}
case groupCallStreamChannel(Cons_groupCallStreamChannel)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
#if DEBUG
@ -116,7 +172,17 @@ public extension Api {
}
public extension Api {
enum HighScore: TypeConstructorDescription {
case highScore(pos: Int32, userId: Int64, score: Int32)
public class Cons_highScore {
public var pos: Int32
public var userId: Int64
public var score: Int32
public init(pos: Int32, userId: Int64, score: Int32) {
self.pos = pos
self.userId = userId
self.score = score
}
}
case highScore(Cons_highScore)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
#if DEBUG
@ -145,7 +211,15 @@ public extension Api {
}
public extension Api {
enum ImportedContact: TypeConstructorDescription {
case importedContact(userId: Int64, clientId: Int64)
public class Cons_importedContact {
public var userId: Int64
public var clientId: Int64
public init(userId: Int64, clientId: Int64) {
self.userId = userId
self.clientId = clientId
}
}
case importedContact(Cons_importedContact)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
#if DEBUG
@ -174,7 +248,15 @@ public extension Api {
}
public extension Api {
enum InlineBotSwitchPM: TypeConstructorDescription {
case inlineBotSwitchPM(text: String, startParam: String)
public class Cons_inlineBotSwitchPM {
public var text: String
public var startParam: String
public init(text: String, startParam: String) {
self.text = text
self.startParam = startParam
}
}
case inlineBotSwitchPM(Cons_inlineBotSwitchPM)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
#if DEBUG
@ -203,7 +285,15 @@ public extension Api {
}
public extension Api {
enum InlineBotWebView: TypeConstructorDescription {
case inlineBotWebView(text: String, url: String)
public class Cons_inlineBotWebView {
public var text: String
public var url: String
public init(text: String, url: String) {
self.text = text
self.url = url
}
}
case inlineBotWebView(Cons_inlineBotWebView)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
#if DEBUG

View file

@ -618,7 +618,8 @@ extension ChatContextResult {
extension ChatContextResultSwitchPeer {
init(apiSwitchPeer: Api.InlineBotSwitchPM) {
switch apiSwitchPeer {
case let .inlineBotSwitchPM(text, startParam):
case let .inlineBotSwitchPM(inlineBotSwitchPMData):
let (text, startParam) = (inlineBotSwitchPMData.text, inlineBotSwitchPMData.startParam)
self.init(text: text, startParam: startParam)
}
}
@ -627,7 +628,8 @@ extension ChatContextResultSwitchPeer {
extension ChatContextResultWebView {
init(apiSwitchWebView: Api.InlineBotWebView) {
switch apiSwitchWebView {
case let .inlineBotWebView(text, url):
case let .inlineBotWebView(inlineBotWebViewData):
let (text, url) = (inlineBotWebViewData.text, inlineBotWebViewData.url)
self.init(text: text, url: url)
}
}

View file

@ -157,7 +157,8 @@ extension InstantPageBlock {
self = .relatedArticles(title: RichText(apiText: title), articles: articles.map({ InstantPageRelatedArticle(apiRelatedArticle: $0) }))
case let .pageBlockMap(geo, zoom, w, h, caption):
switch geo {
case let .geoPoint(_, long, lat, _, _):
case let .geoPoint(geoPointData):
let (long, lat) = (geoPointData.long, geoPointData.lat)
self = .map(latitude: lat, longitude: long, zoom: zoom, dimensions: PixelDimensions(width: w, height: h), caption: InstantPageCaption(apiCaption: caption))
default:
self = .unsupported

View file

@ -8,7 +8,8 @@ extension PeerGeoLocation {
switch apiLocation {
case let .channelLocation(channelLocationData):
let (geopoint, address) = (channelLocationData.geoPoint, channelLocationData.address)
if case let .geoPoint(_, longitude, latitude, _, _) = geopoint {
if case let .geoPoint(geoPointData) = geopoint {
let (longitude, latitude) = (geoPointData.long, geoPointData.lat)
self.init(latitude: latitude, longitude: longitude, address: address)
} else {
return nil

View file

@ -538,7 +538,8 @@ func mediaAreaFromApiMediaArea(_ mediaArea: Api.MediaArea) -> MediaArea? {
let latitude: Double
let longitude: Double
switch geo {
case let .geoPoint(_, long, lat, _, _):
case let .geoPoint(geoPointData):
let (_, long, lat, _, _) = (geoPointData.flags, geoPointData.long, geoPointData.lat, geoPointData.accessHash, geoPointData.accuracyRadius)
latitude = lat
longitude = long
case .geoPointEmpty:
@ -549,7 +550,8 @@ func mediaAreaFromApiMediaArea(_ mediaArea: Api.MediaArea) -> MediaArea? {
var mappedAddress: MapGeoAddress?
if let address {
switch address {
case let .geoPointAddress(_, countryIso2, state, city, street):
case let .geoPointAddress(geoPointAddressData):
let (_, countryIso2, state, city, street) = (geoPointAddressData.flags, geoPointAddressData.countryIso2, geoPointAddressData.state, geoPointAddressData.city, geoPointAddressData.street)
mappedAddress = MapGeoAddress(
country: countryIso2,
state: state,
@ -571,7 +573,8 @@ func mediaAreaFromApiMediaArea(_ mediaArea: Api.MediaArea) -> MediaArea? {
let latitude: Double
let longitude: Double
switch geo {
case let .geoPoint(_, long, lat, _, _):
case let .geoPoint(geoPointData):
let (_, long, lat, _, _) = (geoPointData.flags, geoPointData.long, geoPointData.lat, geoPointData.accessHash, geoPointData.accuracyRadius)
latitude = lat
longitude = long
case .geoPointEmpty:
@ -617,7 +620,7 @@ func apiMediaAreasFromMediaAreas(_ mediaAreas: [MediaArea], transaction: Transac
if let queryId = venue.queryId, let resultId = venue.resultId {
apiMediaAreas.append(.inputMediaAreaVenue(coordinates: inputCoordinates, queryId: queryId, resultId: resultId))
} else if let venueInfo = venue.venue {
apiMediaAreas.append(.mediaAreaVenue(coordinates: inputCoordinates, geo: .geoPoint(flags: 0, long: venue.longitude, lat: venue.latitude, accessHash: 0, accuracyRadius: nil), title: venueInfo.title, address: venueInfo.address ?? "", provider: venueInfo.provider ?? "", venueId: venueInfo.id ?? "", venueType: venueInfo.type ?? ""))
apiMediaAreas.append(.mediaAreaVenue(coordinates: inputCoordinates, geo: .geoPoint(.init(flags: 0, long: venue.longitude, lat: venue.latitude, accessHash: 0, accuracyRadius: nil)), title: venueInfo.title, address: venueInfo.address ?? "", provider: venueInfo.provider ?? "", venueId: venueInfo.id ?? "", venueType: venueInfo.type ?? ""))
} else {
var flags: Int32 = 0
var inputAddress: Api.GeoPointAddress?
@ -632,10 +635,10 @@ func apiMediaAreasFromMediaAreas(_ mediaAreas: [MediaArea], transaction: Transac
if let _ = address.street {
addressFlags |= (1 << 2)
}
inputAddress = .geoPointAddress(flags: addressFlags, countryIso2: address.country, state: address.state, city: address.city, street: address.street)
inputAddress = .geoPointAddress(.init(flags: addressFlags, countryIso2: address.country, state: address.state, city: address.city, street: address.street))
flags |= (1 << 0)
}
apiMediaAreas.append(.mediaAreaGeoPoint(flags: flags, coordinates: inputCoordinates, geo: .geoPoint(flags: 0, long: venue.longitude, lat: venue.latitude, accessHash: 0, accuracyRadius: nil), address: inputAddress))
apiMediaAreas.append(.mediaAreaGeoPoint(flags: flags, coordinates: inputCoordinates, geo: .geoPoint(.init(flags: 0, long: venue.longitude, lat: venue.latitude, accessHash: 0, accuracyRadius: nil)), address: inputAddress))
}
case let .reaction(_, reaction, flags):
var apiFlags: Int32 = 0

View file

@ -6,7 +6,8 @@ import TelegramApi
extension TelegramMediaGame {
convenience init(apiGame: Api.Game) {
switch apiGame {
case let .game(_, id, accessHash, shortName, title, description, photo, document):
case let .game(gameData):
let (id, accessHash, shortName, title, description, photo, document) = (gameData.id, gameData.accessHash, gameData.shortName, gameData.title, gameData.description, gameData.photo, gameData.document)
var file: TelegramMediaFile?
if let document = document {
file = telegramMediaFileFromApiDocument(document, altDocuments: [])

View file

@ -9,7 +9,8 @@ func telegramMediaMapFromApiGeoPoint(_ geo: Api.GeoPoint, title: String?, addres
venue = MapVenue(title: title, address: address, provider: provider, id: venueId, type: venueType)
}
switch geo {
case let .geoPoint(_, long, lat, _, accuracyRadius):
case let .geoPoint(geoPointData):
let (_, long, lat, _, accuracyRadius) = (geoPointData.flags, geoPointData.long, geoPointData.lat, geoPointData.accessHash, geoPointData.accuracyRadius)
return TelegramMediaMap(latitude: lat, longitude: long, heading: heading, accuracyRadius: accuracyRadius.flatMap { Double($0) }, venue: venue, liveBroadcastingTimeout: liveBroadcastingTimeout, liveProximityNotificationRadius: liveProximityNotificationRadius)
case .geoPointEmpty:
return TelegramMediaMap(latitude: 0.0, longitude: 0.0, heading: nil, accuracyRadius: nil, venue: venue, liveBroadcastingTimeout: liveBroadcastingTimeout, liveProximityNotificationRadius: liveProximityNotificationRadius)
@ -19,7 +20,8 @@ func telegramMediaMapFromApiGeoPoint(_ geo: Api.GeoPoint, title: String?, addres
func mapGeoAddressFromApiGeoPointAddress(_ geo: Api.GeoPointAddress) -> MapGeoAddress {
switch geo {
case let .geoPointAddress(_, countryIso2, state, city, street):
case let .geoPointAddress(geoPointAddressData):
let (countryIso2, state, city, street) = (geoPointAddressData.countryIso2, geoPointAddressData.state, geoPointAddressData.city, geoPointAddressData.street)
return MapGeoAddress(country: countryIso2, state: state, city: city, street: street)
}
}

View file

@ -994,7 +994,8 @@ func _internal_requestMessageHistoryThreads(accountPeerId: PeerId, postbox: Post
for topic in topics {
switch topic {
case let .forumTopic(flags, id, date, peer, title, iconColor, iconEmojiId, topMessage, readInboxMaxId, readOutboxMaxId, unreadCount, unreadMentionsCount, unreadReactionsCount, fromId, notifySettings, draft):
case let .forumTopic(forumTopicData):
let (flags, id, date, peer, title, iconColor, iconEmojiId, topMessage, readInboxMaxId, readOutboxMaxId, unreadCount, unreadMentionsCount, unreadReactionsCount, fromId, notifySettings, draft) = (forumTopicData.flags, forumTopicData.id, forumTopicData.date, forumTopicData.peer, forumTopicData.title, forumTopicData.iconColor, forumTopicData.iconEmojiId, forumTopicData.topMessage, forumTopicData.readInboxMaxId, forumTopicData.readOutboxMaxId, forumTopicData.unreadCount, forumTopicData.unreadMentionsCount, forumTopicData.unreadReactionsCount, forumTopicData.fromId, forumTopicData.notifySettings, forumTopicData.draft)
let _ = draft
let _ = peer
@ -1202,7 +1203,8 @@ func _internal_forumChannelTopicNotificationExceptions(account: Account, id: Eng
case let .forumTopics(_, _, topics, _, _, _, _):
for topic in topics {
switch topic {
case let .forumTopic(_, id, _, _, title, iconColor, iconEmojiId, _, _, _, _, _, _, _, _, _):
case let .forumTopic(forumTopicData):
let (id, title, iconColor, iconEmojiId) = (forumTopicData.id, forumTopicData.title, forumTopicData.iconColor, forumTopicData.iconEmojiId)
infoMapping[Int64(id)] = EngineMessageHistoryThread.Info(title: title, icon: iconEmojiId, iconColor: iconColor)
case .forumTopicDeleted:
break

View file

@ -995,7 +995,8 @@ private final class FetchImpl {
var filledRange = RangeSet<Int64>()
for hashItem in result {
switch hashItem {
case let .fileHash(offset, limit, hash):
case let .fileHash(fileHashData):
let (offset, limit, hash) = (fileHashData.offset, fileHashData.limit, fileHashData.hash)
let rangeValue: Range<Int64> = offset ..< (offset + Int64(limit))
filledRange.formUnion(RangeSet<Int64>(rangeValue))
state.hashRanges[rangeValue.lowerBound] = HashRangeData(

View file

@ -197,7 +197,8 @@ private final class MultipartCdnHashSource {
var parsedPartHashes: [Int64: Data] = [:]
for part in partHashes {
switch part {
case let .fileHash(offset, limit, bytes):
case let .fileHash(fileHashData):
let (offset, limit, bytes) = (fileHashData.offset, fileHashData.limit, fileHashData.hash)
assert(limit == 128 * 1024)
parsedPartHashes[offset] = bytes.makeData()
}
@ -371,7 +372,8 @@ private enum MultipartFetchSource {
var parsedPartHashes: [Int64: Data] = [:]
for part in partHashes {
switch part {
case let .fileHash(offset, limit, bytes):
case let .fileHash(fileHashData):
let (offset, limit, bytes) = (fileHashData.offset, fileHashData.limit, fileHashData.hash)
assert(limit == 128 * 1024)
parsedPartHashes[offset] = bytes.makeData()
}

View file

@ -122,7 +122,8 @@ private func peerIdsRequiringLocalChatStateFromUpdates(_ updates: [Api.Update])
case let .updateFolderPeers(folderPeers, _, _):
for peer in folderPeers {
switch peer {
case let .folderPeer(peer, _):
case let .folderPeer(folderPeerData):
let peer = folderPeerData.peer
peerIds.insert(peer.peerId)
}
}
@ -1694,7 +1695,8 @@ private func finalStateWithUpdatesAndServerTime(accountPeerId: PeerId, postbox:
case let .updateGroupCallMessage(call, message):
if case let .inputGroupCall(id, _) = call {
switch message {
case let .groupCallMessage(flags, messageId, fromId, date, message, paidMessageStars):
case let .groupCallMessage(groupCallMessageData):
let (flags, messageId, fromId, date, message, paidMessageStars) = (groupCallMessageData.flags, groupCallMessageData.id, groupCallMessageData.fromId, groupCallMessageData.date, groupCallMessageData.message, groupCallMessageData.paidMessageStars)
updatedState.updateGroupCallMessage(id: id, authorId: fromId.peerId, isFromAdmin: (flags & (1 << 1)) != 0, messageId: messageId, text: message, date: date, paidMessageStars: paidMessageStars)
}
}
@ -1718,7 +1720,8 @@ private func finalStateWithUpdatesAndServerTime(accountPeerId: PeerId, postbox:
case let .updateFolderPeers(folderPeers, _, _):
for folderPeer in folderPeers {
switch folderPeer {
case let .folderPeer(peer, folderId):
case let .folderPeer(folderPeerData):
let (peer, folderId) = (folderPeerData.peer, folderPeerData.folderId)
updatedState.updatePeerChatInclusion(peerId: peer.peerId, groupId: PeerGroupId(rawValue: folderId), changedGroup: true)
}
}
@ -2141,10 +2144,11 @@ func resolveForumThreads(accountPeerId: PeerId, postbox: Postbox, source: FetchM
switch topic {
case let .forum(topic):
switch topic {
case let .forumTopic(flags, id, date, peer, title, iconColor, iconEmojiId, topMessage, readInboxMaxId, readOutboxMaxId, unreadCount, unreadMentionsCount, unreadReactionsCount, fromId, notifySettings, draft):
case let .forumTopic(forumTopicData):
let (flags, id, date, peer, title, iconColor, iconEmojiId, topMessage, readInboxMaxId, readOutboxMaxId, unreadCount, unreadMentionsCount, unreadReactionsCount, fromId, notifySettings, draft) = (forumTopicData.flags, forumTopicData.id, forumTopicData.date, forumTopicData.peer, forumTopicData.title, forumTopicData.iconColor, forumTopicData.iconEmojiId, forumTopicData.topMessage, forumTopicData.readInboxMaxId, forumTopicData.readOutboxMaxId, forumTopicData.unreadCount, forumTopicData.unreadMentionsCount, forumTopicData.unreadReactionsCount, forumTopicData.fromId, forumTopicData.notifySettings, forumTopicData.draft)
let _ = peer
let _ = draft
state.operations.append(.ResetForumTopic(
topicId: PeerAndBoundThreadId(peerId: peerId, threadId: Int64(id)),
data: StoreMessageHistoryThreadData(
@ -2306,10 +2310,11 @@ func resolveForumThreads(accountPeerId: PeerId, postbox: Postbox, source: FetchM
switch item {
case let .forum(topic):
switch topic {
case let .forumTopic(flags, id, date, peer, title, iconColor, iconEmojiId, topMessage, readInboxMaxId, readOutboxMaxId, unreadCount, unreadMentionsCount, unreadReactionsCount, fromId, notifySettings, draft):
case let .forumTopic(forumTopicData):
let (flags, id, date, peer, title, iconColor, iconEmojiId, topMessage, readInboxMaxId, readOutboxMaxId, unreadCount, unreadMentionsCount, unreadReactionsCount, fromId, notifySettings, draft) = (forumTopicData.flags, forumTopicData.id, forumTopicData.date, forumTopicData.peer, forumTopicData.title, forumTopicData.iconColor, forumTopicData.iconEmojiId, forumTopicData.topMessage, forumTopicData.readInboxMaxId, forumTopicData.readOutboxMaxId, forumTopicData.unreadCount, forumTopicData.unreadMentionsCount, forumTopicData.unreadReactionsCount, forumTopicData.fromId, forumTopicData.notifySettings, forumTopicData.draft)
let _ = peer
let _ = draft
let data = MessageHistoryThreadData(
creationDate: date,
isOwnedByMe: (flags & (1 << 1)) != 0,
@ -2473,10 +2478,11 @@ func resolveForumThreads(accountPeerId: PeerId, postbox: Postbox, source: FetchM
switch item {
case let .forum(topic):
switch topic {
case let .forumTopic(flags, id, date, peer, title, iconColor, iconEmojiId, topMessage, readInboxMaxId, readOutboxMaxId, unreadCount, unreadMentionsCount, unreadReactionsCount, fromId, notifySettings, draft):
case let .forumTopic(forumTopicData):
let (flags, id, date, peer, title, iconColor, iconEmojiId, topMessage, readInboxMaxId, readOutboxMaxId, unreadCount, unreadMentionsCount, unreadReactionsCount, fromId, notifySettings, draft) = (forumTopicData.flags, forumTopicData.id, forumTopicData.date, forumTopicData.peer, forumTopicData.title, forumTopicData.iconColor, forumTopicData.iconEmojiId, forumTopicData.topMessage, forumTopicData.readInboxMaxId, forumTopicData.readOutboxMaxId, forumTopicData.unreadCount, forumTopicData.unreadMentionsCount, forumTopicData.unreadReactionsCount, forumTopicData.fromId, forumTopicData.notifySettings, forumTopicData.draft)
let _ = peer
let _ = draft
fetchedChatList.threadInfos[PeerAndBoundThreadId(peerId: peerId, threadId: Int64(id))] = StoreMessageHistoryThreadData(
data: MessageHistoryThreadData(
creationDate: date,
@ -4934,7 +4940,8 @@ func replayFinalState(
}
switch call {
case let .groupCall(flags, _, _, participantsCount, title, _, recordStartDate, scheduleDate, _, _, _, _, sendPaidMessagesStars, _):
case let .groupCall(groupCallData):
let (flags, participantsCount, title, recordStartDate, scheduleDate, sendPaidMessagesStars) = (groupCallData.flags, groupCallData.participantsCount, groupCallData.title, groupCallData.recordStartDate, groupCallData.scheduleDate, groupCallData.sendPaidMessagesStars)
let isMin = (flags & (1 << 19)) != 0
let isMuted = (flags & (1 << 1)) != 0
let canChange = (flags & (1 << 2)) != 0
@ -4951,7 +4958,8 @@ func replayFinalState(
break
}
}
case let .groupCallDiscarded(callId, _, _):
case let .groupCallDiscarded(groupCallDiscardedData):
let callId = groupCallDiscardedData.id
updatedGroupCallParticipants.append((
callId,
.call(isTerminated: true, defaultParticipantsAreMuted: GroupCallParticipantsContext.State.DefaultParticipantsAreMuted(isMuted: false, canChange: false), messagesAreEnabled: GroupCallParticipantsContext.State.MessagesAreEnabled(isEnabled: false, canChange: false, sendPaidMessagesStars: nil), title: nil, recordingStartTimestamp: nil, scheduleTimestamp: nil, isVideoEnabled: false, participantCount: nil, isMin: false)

View file

@ -346,7 +346,8 @@ private func pushDeviceContactData(accountPeerId: PeerId, postbox: Postbox, netw
for item in imported {
switch item {
case let .importedContact(userId, clientId):
case let .importedContact(importedContactData):
let (userId, clientId) = (importedContactData.userId, importedContactData.clientId)
let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))
addedContactPeerIds.insert(peerId)
peerIdByClientId[clientId] = peerId

View file

@ -137,7 +137,8 @@ private func parseDialogs(accountPeerId: PeerId, apiDialogs: [Api.Dialog], apiMe
case let .dialogFolder(dialogFolderData):
let (folder, unreadMutedPeersCount, unreadMutedMessagesCount) = (dialogFolderData.folder, dialogFolderData.unreadMutedPeersCount, dialogFolderData.unreadMutedMessagesCount)
switch folder {
case let .folder(_, id, _, _):
case let .folder(folderData):
let id = folderData.id
referencedFolders[PeerGroupId(rawValue: id)] = PeerGroupUnreadCountersSummary(all: PeerGroupUnreadCounters(messageCount: unreadMutedMessagesCount, chatCount: unreadMutedPeersCount))
}
}

View file

@ -856,7 +856,8 @@ extension TelegramBusinessHours {
extension TelegramBusinessLocation.Coordinates {
init?(apiGeoPoint: Api.GeoPoint) {
switch apiGeoPoint {
case let .geoPoint(_, long, lat, _, _):
case let .geoPoint(geoPointData):
let (_, long, lat, _, _) = (geoPointData.flags, geoPointData.long, geoPointData.lat, geoPointData.accessHash, geoPointData.accuracyRadius)
self.init(latitude: lat, longitude: long)
case .geoPointEmpty:
return nil

View file

@ -146,7 +146,8 @@ public struct GroupCallSummary: Equatable {
extension GroupCallInfo {
init?(_ call: Api.GroupCall) {
switch call {
case let .groupCall(flags, id, accessHash, participantsCount, title, streamDcId, recordStartDate, scheduleDate, _, unmutedVideoLimit, _, _, sendPaidMessagesStars, defaultSendAs):
case let .groupCall(groupCallData):
let (flags, id, accessHash, participantsCount, title, streamDcId, recordStartDate, scheduleDate, _, unmutedVideoLimit, _, _, sendPaidMessagesStars, defaultSendAs) = (groupCallData.flags, groupCallData.id, groupCallData.accessHash, groupCallData.participantsCount, groupCallData.title, groupCallData.streamDcId, groupCallData.recordStartDate, groupCallData.scheduleDate, groupCallData.unmutedVideoCount, groupCallData.unmutedVideoLimit, groupCallData.version, groupCallData.inviteLink, groupCallData.sendPaidMessagesStars, groupCallData.defaultSendAs)
self.init(
id: id,
accessHash: accessHash,
@ -279,7 +280,8 @@ func _internal_getCurrentGroupCallInfo(account: Account, reference: InternalGrou
switch result {
case let .groupCall(call, participants, _, chats, users):
return account.postbox.transaction { transaction -> (participants: [PeerId], duration: Int32?)? in
if case let .groupCallDiscarded(_, _, duration) = call {
if case let .groupCallDiscarded(groupCallDiscardedData) = call {
let (_, _, duration) = (groupCallDiscardedData.id, groupCallDiscardedData.accessHash, groupCallDiscardedData.duration)
return ([], duration)
}
@ -783,7 +785,8 @@ func _internal_joinGroupCall(account: Account, peerId: PeerId?, joinAs: PeerId?,
maybeParsedCall = GroupCallInfo(call)
switch call {
case let .groupCall(flags, _, _, _, title, _, recordStartDate, scheduleDate, _, unmutedVideoLimit, _, _, sendPaidMessagesStars, defaultSendAs):
case let .groupCall(groupCallData):
let (flags, _, _, _, title, _, recordStartDate, scheduleDate, _, unmutedVideoLimit, _, _, sendPaidMessagesStars, defaultSendAs) = (groupCallData.flags, groupCallData.id, groupCallData.accessHash, groupCallData.participantsCount, groupCallData.title, groupCallData.streamDcId, groupCallData.recordStartDate, groupCallData.scheduleDate, groupCallData.unmutedVideoCount, groupCallData.unmutedVideoLimit, groupCallData.version, groupCallData.inviteLink, groupCallData.sendPaidMessagesStars, groupCallData.defaultSendAs)
let isMin = (flags & (1 << 19)) != 0
let isMuted = (flags & (1 << 1)) != 0
let canChange = (flags & (1 << 2)) != 0
@ -863,7 +866,8 @@ func _internal_joinGroupCall(account: Account, peerId: PeerId?, joinAs: PeerId?,
case let .updateGroupCallParticipants(_, participants, _):
loop: for participant in participants {
switch participant {
case let .groupCallParticipant(flags, apiPeerId, date, activeDate, source, volume, about, raiseHandRating, video, presentation, paidStarsTotal):
case let .groupCallParticipant(groupCallParticipantData):
let (flags, apiPeerId, date, activeDate, source, volume, about, raiseHandRating, video, presentation, paidStarsTotal) = (groupCallParticipantData.flags, groupCallParticipantData.peer, groupCallParticipantData.date, groupCallParticipantData.activeDate, groupCallParticipantData.source, groupCallParticipantData.volume, groupCallParticipantData.about, groupCallParticipantData.raiseHandRating, groupCallParticipantData.video, groupCallParticipantData.presentation, groupCallParticipantData.paidStarsTotal)
let peerId: PeerId = apiPeerId.peerId
let ssrc = UInt32(bitPattern: source)
guard let peer = transaction.getPeer(peerId) else {
@ -2724,7 +2728,8 @@ public final class GroupCallParticipantsContext {
extension GroupCallParticipantsContext.Update.StateUpdate.ParticipantUpdate {
init(_ apiParticipant: Api.GroupCallParticipant) {
switch apiParticipant {
case let .groupCallParticipant(flags, apiPeerId, date, activeDate, source, volume, about, raiseHandRating, video, presentation, paidStarsTotal):
case let .groupCallParticipant(groupCallParticipantData):
let (flags, apiPeerId, date, activeDate, source, volume, about, raiseHandRating, video, presentation, paidStarsTotal) = (groupCallParticipantData.flags, groupCallParticipantData.peer, groupCallParticipantData.date, groupCallParticipantData.activeDate, groupCallParticipantData.source, groupCallParticipantData.volume, groupCallParticipantData.about, groupCallParticipantData.raiseHandRating, groupCallParticipantData.video, groupCallParticipantData.presentation, groupCallParticipantData.paidStarsTotal)
let peerId: PeerId = apiPeerId.peerId
let ssrc = UInt32(bitPattern: source)
let muted = (flags & (1 << 0)) != 0
@ -3200,7 +3205,8 @@ func _internal_getVideoBroadcastPart(dataSource: AudioBroadcastDataSource, callI
extension GroupCallParticipantsContext.Participant {
init?(_ apiParticipant: Api.GroupCallParticipant, transaction: Transaction) {
switch apiParticipant {
case let .groupCallParticipant(flags, apiPeerId, date, activeDate, source, volume, about, raiseHandRating, video, presentation, paidStarsTotal):
case let .groupCallParticipant(groupCallParticipantData):
let (flags, apiPeerId, date, activeDate, source, volume, about, raiseHandRating, video, presentation, paidStarsTotal) = (groupCallParticipantData.flags, groupCallParticipantData.peer, groupCallParticipantData.date, groupCallParticipantData.activeDate, groupCallParticipantData.source, groupCallParticipantData.volume, groupCallParticipantData.about, groupCallParticipantData.raiseHandRating, groupCallParticipantData.video, groupCallParticipantData.presentation, groupCallParticipantData.paidStarsTotal)
let peerId: PeerId = apiPeerId.peerId
let ssrc = UInt32(bitPattern: source)
guard let peer = transaction.getPeer(peerId) else {
@ -3215,7 +3221,7 @@ extension GroupCallParticipantsContext.Participant {
} else if mutedByYou {
muteState = GroupCallParticipantsContext.Participant.MuteState(canUnmute: false, mutedByYou: mutedByYou)
}
var videoDescription = video.flatMap(GroupCallParticipantsContext.Participant.VideoDescription.init)
var presentationDescription = presentation.flatMap(GroupCallParticipantsContext.Participant.VideoDescription.init)
if muteState?.canUnmute == false {
@ -3248,11 +3254,13 @@ extension GroupCallParticipantsContext.Participant {
private extension GroupCallParticipantsContext.Participant.VideoDescription {
init(_ apiVideo: Api.GroupCallParticipantVideo) {
switch apiVideo {
case let .groupCallParticipantVideo(flags, endpoint, sourceGroups, audioSource):
case let .groupCallParticipantVideo(groupCallParticipantVideoData):
let (flags, endpoint, sourceGroups, audioSource) = (groupCallParticipantVideoData.flags, groupCallParticipantVideoData.endpoint, groupCallParticipantVideoData.sourceGroups, groupCallParticipantVideoData.audioSource)
var parsedSsrcGroups: [SsrcGroup] = []
for group in sourceGroups {
switch group {
case let .groupCallParticipantVideoSourceGroup(semantics, sources):
case let .groupCallParticipantVideoSourceGroup(groupCallParticipantVideoSourceGroupData):
let (semantics, sources) = (groupCallParticipantVideoSourceGroupData.semantics, groupCallParticipantVideoSourceGroupData.sources)
parsedSsrcGroups.append(SsrcGroup(semantics: semantics, ssrcs: sources.map(UInt32.init(bitPattern:))))
}
}
@ -4106,7 +4114,8 @@ public final class GroupCallMessagesContext {
updatePeers(transaction: transaction, accountPeerId: accountPeerId, peers: AccumulatedPeers(chats: chats, users: users))
for topDonor in topDonors {
switch topDonor {
case let .groupCallDonor(_, peerId, _):
case let .groupCallDonor(groupCallDonorData):
let (_, peerId, _) = (groupCallDonorData.flags, groupCallDonorData.peerId, groupCallDonorData.stars)
if let peerId {
if peers[peerId.peerId] == nil, let peer = transaction.getPeer(peerId.peerId) {
peers[peer.id] = peer
@ -4128,7 +4137,8 @@ public final class GroupCallMessagesContext {
var state = self.state
state.topStars = topDonors.map { topDonor in
switch topDonor {
case let .groupCallDonor(flags, peerId, stars):
case let .groupCallDonor(groupCallDonorData):
let (flags, peerId, stars) = (groupCallDonorData.flags, groupCallDonorData.peerId, groupCallDonorData.stars)
return TopStarsItem(
peerId: peerId?.peerId,
amount: stars,

View file

@ -164,7 +164,8 @@ public extension TelegramEngine {
case let .groupCallStreamChannels(channels):
let state = EngineCallStreamState(channels: channels.map { channel -> EngineCallStreamState.Channel in
switch channel {
case let .groupCallStreamChannel(channel, scale, lastTimestampMs):
case let .groupCallStreamChannel(groupCallStreamChannelData):
let (channel, scale, lastTimestampMs) = (groupCallStreamChannelData.channel, groupCallStreamChannelData.scale, groupCallStreamChannelData.lastTimestampMs)
return EngineCallStreamState.Channel(id: channel, scale: scale, latestTimestamp: lastTimestampMs)
}
})

View file

@ -2154,7 +2154,8 @@ public final class SearchStoryListContext: StoryListContext {
for story in stories {
switch story {
case let .foundStory(peer, story):
case let .foundStory(foundStoryData):
let (peer, story) = (foundStoryData.peer, foundStoryData.story)
if let storedItem = Stories.StoredItem(apiStoryItem: story, peerId: peer.peerId, transaction: transaction) {
if case let .item(item) = storedItem, let media = item.media {
let mappedItem = EngineStoryItem(

View file

@ -349,7 +349,8 @@ func channelAdminLogEvents(accountPeerId: PeerId, postbox: Postbox, network: Net
action = .changeUsernames(prev: prevValue, new: newValue)
case let .channelAdminLogEventActionCreateTopic(channelAdminLogEventActionCreateTopicData):
switch channelAdminLogEventActionCreateTopicData.topic {
case let .forumTopic(_, _, _, _, title, iconColor, iconEmojiId, _, _, _, _, _, _, _, _, _):
case let .forumTopic(forumTopicData):
let (title, iconColor, iconEmojiId) = (forumTopicData.title, forumTopicData.iconColor, forumTopicData.iconEmojiId)
action = .createTopic(info: EngineMessageHistoryThread.Info(title: title, icon: iconEmojiId, iconColor: iconColor))
case .forumTopicDeleted:
action = .createTopic(info: EngineMessageHistoryThread.Info(title: "", icon: nil, iconColor: 0))
@ -357,7 +358,8 @@ func channelAdminLogEvents(accountPeerId: PeerId, postbox: Postbox, network: Net
case let .channelAdminLogEventActionDeleteTopic(channelAdminLogEventActionDeleteTopicData):
let topic = channelAdminLogEventActionDeleteTopicData.topic
switch topic {
case let .forumTopic(_, _, _, _, title, iconColor, iconEmojiId, _, _, _, _, _, _, _, _, _):
case let .forumTopic(forumTopicData):
let (title, iconColor, iconEmojiId) = (forumTopicData.title, forumTopicData.iconColor, forumTopicData.iconEmojiId)
action = .deleteTopic(info: EngineMessageHistoryThread.Info(title: title, icon: iconEmojiId, iconColor: iconColor))
case .forumTopicDeleted:
action = .deleteTopic(info: EngineMessageHistoryThread.Info(title: "", icon: nil, iconColor: 0))
@ -366,7 +368,8 @@ func channelAdminLogEvents(accountPeerId: PeerId, postbox: Postbox, network: Net
let (prevTopic, newTopic) = (channelAdminLogEventActionEditTopicData.prevTopic, channelAdminLogEventActionEditTopicData.newTopic)
let prevInfo: AdminLogEventAction.ForumTopicInfo
switch prevTopic {
case let .forumTopic(flags, _, _, _, title, iconColor, iconEmojiId, _, _, _, _, _, _, _, _, _):
case let .forumTopic(forumTopicData):
let (flags, title, iconColor, iconEmojiId) = (forumTopicData.flags, forumTopicData.title, forumTopicData.iconColor, forumTopicData.iconEmojiId)
prevInfo = AdminLogEventAction.ForumTopicInfo(info: EngineMessageHistoryThread.Info(title: title, icon: iconEmojiId, iconColor: iconColor), isClosed: (flags & (1 << 2)) != 0, isHidden: (flags & (1 << 6)) != 0)
case .forumTopicDeleted:
prevInfo = AdminLogEventAction.ForumTopicInfo(info: EngineMessageHistoryThread.Info(title: "", icon: nil, iconColor: 0), isClosed: false, isHidden: false)
@ -374,7 +377,8 @@ func channelAdminLogEvents(accountPeerId: PeerId, postbox: Postbox, network: Net
let newInfo: AdminLogEventAction.ForumTopicInfo
switch newTopic {
case let .forumTopic(flags, _, _, _, title, iconColor, iconEmojiId, _, _, _, _, _, _, _, _, _):
case let .forumTopic(forumTopicData):
let (flags, title, iconColor, iconEmojiId) = (forumTopicData.flags, forumTopicData.title, forumTopicData.iconColor, forumTopicData.iconEmojiId)
newInfo = AdminLogEventAction.ForumTopicInfo(info: EngineMessageHistoryThread.Info(title: title, icon: iconEmojiId, iconColor: iconColor), isClosed: (flags & (1 << 2)) != 0, isHidden: (flags & (1 << 6)) != 0)
case .forumTopicDeleted:
newInfo = AdminLogEventAction.ForumTopicInfo(info: EngineMessageHistoryThread.Info(title: "", icon: nil, iconColor: 0), isClosed: false, isHidden: false)
@ -385,7 +389,8 @@ func channelAdminLogEvents(accountPeerId: PeerId, postbox: Postbox, network: Net
let (prevTopic, newTopic) = (channelAdminLogEventActionPinTopicData.prevTopic, channelAdminLogEventActionPinTopicData.newTopic)
let prevInfo: EngineMessageHistoryThread.Info?
switch prevTopic {
case let .forumTopic(_, _, _, _, title, iconColor, iconEmojiId, _, _, _, _, _, _, _, _, _):
case let .forumTopic(forumTopicData):
let (title, iconColor, iconEmojiId) = (forumTopicData.title, forumTopicData.iconColor, forumTopicData.iconEmojiId)
prevInfo = EngineMessageHistoryThread.Info(title: title, icon: iconEmojiId, iconColor: iconColor)
case .forumTopicDeleted:
prevInfo = EngineMessageHistoryThread.Info(title: "", icon: nil, iconColor: 0)
@ -395,7 +400,8 @@ func channelAdminLogEvents(accountPeerId: PeerId, postbox: Postbox, network: Net
let newInfo: EngineMessageHistoryThread.Info?
switch newTopic {
case let .forumTopic(_, _, _, _, title, iconColor, iconEmojiId, _, _, _, _, _, _, _, _, _):
case let .forumTopic(forumTopicData):
let (title, iconColor, iconEmojiId) = (forumTopicData.title, forumTopicData.iconColor, forumTopicData.iconEmojiId)
newInfo = EngineMessageHistoryThread.Info(title: title, icon: iconEmojiId, iconColor: iconColor)
case .forumTopicDeleted:
newInfo = EngineMessageHistoryThread.Info(title: "", icon: nil, iconColor: 0)

View file

@ -16,7 +16,8 @@ func _internal_updateGlobalPrivacySettings(account: Account) -> Signal<Never, No
}
let globalSettings: GlobalPrivacySettings
switch result {
case let .globalPrivacySettings(flags, nonContactPeersPaidStars, disallowedStarGifts):
case let .globalPrivacySettings(globalPrivacySettingsData):
let (flags, nonContactPeersPaidStars, disallowedStarGifts) = (globalPrivacySettingsData.flags, globalPrivacySettingsData.noncontactPeersPaidStars, globalPrivacySettingsData.disallowedGifts)
let automaticallyArchiveAndMuteNonContacts = (flags & (1 << 0)) != 0
let keepArchivedUnmuted = (flags & (1 << 1)) != 0
let keepArchivedFolders = (flags & (1 << 2)) != 0
@ -237,7 +238,8 @@ func _internal_requestAccountPrivacySettings(account: Account) -> Signal<Account
let globalSettings: GlobalPrivacySettings
switch globalPrivacySettings {
case let .globalPrivacySettings(flags, nonContactPeersPaidStars, disallowedStarGifts):
case let .globalPrivacySettings(globalPrivacySettingsData):
let (flags, nonContactPeersPaidStars, disallowedStarGifts) = (globalPrivacySettingsData.flags, globalPrivacySettingsData.noncontactPeersPaidStars, globalPrivacySettingsData.disallowedGifts)
let automaticallyArchiveAndMuteNonContacts = (flags & (1 << 0)) != 0
let keepArchivedUnmuted = (flags & (1 << 1)) != 0
let keepArchivedFolders = (flags & (1 << 2)) != 0
@ -407,7 +409,7 @@ func _internal_updateGlobalPrivacySettings(account: Account, settings: GlobalPri
let disallowedStargifts: Api.DisallowedGiftsSettings = .disallowedGiftsSettings(.init(flags: giftFlags))
return account.network.request(Api.functions.account.setGlobalPrivacySettings(
settings: .globalPrivacySettings(flags: flags, noncontactPeersPaidStars: noncontactPeersPaidStars, disallowedGifts: disallowedStargifts)
settings: .globalPrivacySettings(.init(flags: flags, noncontactPeersPaidStars: noncontactPeersPaidStars, disallowedGifts: disallowedStargifts))
))
|> retryRequest
|> ignoreValues