From b02faa87fe80fe763cab49b5bb817af7ece35734 Mon Sep 17 00:00:00 2001 From: overtake <> Date: Fri, 7 Jun 2019 12:13:36 +0200 Subject: [PATCH] PeerContactSettings -> PeerStatusSettings --- .../AccountStateManagementUtils.swift | 8 +- TelegramCore/CachedChannelData.swift | 44 +++++------ TelegramCore/CachedGroupData.swift | 34 ++++----- TelegramCore/CachedUserData.swift | 38 +++++----- .../ManagedSecretChatOutgoingOperations.swift | 6 +- TelegramCore/PeerContactSettings.swift | 12 +-- TelegramCore/ReportPeer.swift | 74 +++++++++---------- TelegramCore/TelegramSecretChat.swift | 20 ++--- TelegramCore/UpdateCachedPeerData.swift | 38 +++++----- 9 files changed, 137 insertions(+), 137 deletions(-) diff --git a/TelegramCore/AccountStateManagementUtils.swift b/TelegramCore/AccountStateManagementUtils.swift index bf706b8b7f..6aad5259a1 100644 --- a/TelegramCore/AccountStateManagementUtils.swift +++ b/TelegramCore/AccountStateManagementUtils.swift @@ -1159,7 +1159,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo } }) case let .updatePeerSettings(peer, settings): - let peerContactSettings = PeerContactSettings(apiSettings: settings) + let peerStatusSettings = PeerStatusSettings(apiSettings: settings) updatedState.updateCachedPeerData(peer.peerId, { current in if peer.peerId.namespace == Namespaces.Peer.CloudUser { let previous: CachedUserData @@ -1168,7 +1168,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo } else { previous = CachedUserData() } - return previous.withUpdatedPeerContactSettings(peerContactSettings) + return previous.withUpdatedPeerStatusSettings(peerStatusSettings) } else if peer.peerId.namespace == Namespaces.Peer.CloudGroup { let previous: CachedGroupData if let current = current as? CachedGroupData { @@ -1176,7 +1176,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo } else { previous = CachedGroupData() } - return previous.withUpdatedPeerContactSettings(peerContactSettings) + return previous.withUpdatedPeerStatusSettings(peerStatusSettings) } else if peer.peerId.namespace == Namespaces.Peer.CloudChannel { let previous: CachedChannelData if let current = current as? CachedChannelData { @@ -1184,7 +1184,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo } else { previous = CachedChannelData() } - return previous.withUpdatedPeerContactSettings(peerContactSettings) + return previous.withUpdatedPeerStatusSettings(peerStatusSettings) } else { return current } diff --git a/TelegramCore/CachedChannelData.swift b/TelegramCore/CachedChannelData.swift index c1f06f7c31..9f6b9a4be2 100644 --- a/TelegramCore/CachedChannelData.swift +++ b/TelegramCore/CachedChannelData.swift @@ -132,7 +132,7 @@ public final class CachedChannelData: CachedPeerData { public let participantsSummary: CachedChannelParticipantsSummary public let exportedInvitation: ExportedInvitation? public let botInfos: [CachedPeerBotInfo] - public let peerContactSettings: PeerContactSettings? + public let peerStatusSettings: PeerStatusSettings? public let pinnedMessageId: MessageId? public let stickerPack: StickerPackCollectionInfo? public let minAvailableMessageId: MessageId? @@ -153,7 +153,7 @@ public final class CachedChannelData: CachedPeerData { self.participantsSummary = CachedChannelParticipantsSummary(memberCount: nil, adminCount: nil, bannedCount: nil, kickedCount: nil) self.exportedInvitation = nil self.botInfos = [] - self.peerContactSettings = nil + self.peerStatusSettings = nil self.pinnedMessageId = nil self.peerIds = Set() self.messageIds = Set() @@ -163,14 +163,14 @@ public final class CachedChannelData: CachedPeerData { self.linkedDiscussionPeerId = nil } - init(isNotAccessible: Bool, flags: CachedChannelFlags, about: String?, participantsSummary: CachedChannelParticipantsSummary, exportedInvitation: ExportedInvitation?, botInfos: [CachedPeerBotInfo], peerContactSettings: PeerContactSettings?, pinnedMessageId: MessageId?, stickerPack: StickerPackCollectionInfo?, minAvailableMessageId: MessageId?, migrationReference: ChannelMigrationReference?, linkedDiscussionPeerId: PeerId?) { + init(isNotAccessible: Bool, flags: CachedChannelFlags, about: String?, participantsSummary: CachedChannelParticipantsSummary, exportedInvitation: ExportedInvitation?, botInfos: [CachedPeerBotInfo], peerStatusSettings: PeerStatusSettings?, pinnedMessageId: MessageId?, stickerPack: StickerPackCollectionInfo?, minAvailableMessageId: MessageId?, migrationReference: ChannelMigrationReference?, linkedDiscussionPeerId: PeerId?) { self.isNotAccessible = isNotAccessible self.flags = flags self.about = about self.participantsSummary = participantsSummary self.exportedInvitation = exportedInvitation self.botInfos = botInfos - self.peerContactSettings = peerContactSettings + self.peerStatusSettings = peerStatusSettings self.pinnedMessageId = pinnedMessageId self.stickerPack = stickerPack self.minAvailableMessageId = minAvailableMessageId @@ -196,51 +196,51 @@ public final class CachedChannelData: CachedPeerData { } func withUpdatedIsNotAccessible(_ isNotAccessible: Bool) -> CachedChannelData { - return CachedChannelData(isNotAccessible: isNotAccessible, flags: self.flags, about: self.about, participantsSummary: self.participantsSummary, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerContactSettings: self.peerContactSettings, pinnedMessageId: self.pinnedMessageId, stickerPack: self.stickerPack, minAvailableMessageId: self.minAvailableMessageId, migrationReference: self.migrationReference, linkedDiscussionPeerId: self.linkedDiscussionPeerId) + return CachedChannelData(isNotAccessible: isNotAccessible, flags: self.flags, about: self.about, participantsSummary: self.participantsSummary, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerStatusSettings: self.peerStatusSettings, pinnedMessageId: self.pinnedMessageId, stickerPack: self.stickerPack, minAvailableMessageId: self.minAvailableMessageId, migrationReference: self.migrationReference, linkedDiscussionPeerId: self.linkedDiscussionPeerId) } func withUpdatedFlags(_ flags: CachedChannelFlags) -> CachedChannelData { - return CachedChannelData(isNotAccessible: self.isNotAccessible, flags: flags, about: self.about, participantsSummary: self.participantsSummary, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerContactSettings: self.peerContactSettings, pinnedMessageId: self.pinnedMessageId, stickerPack: self.stickerPack, minAvailableMessageId: self.minAvailableMessageId, migrationReference: self.migrationReference, linkedDiscussionPeerId: self.linkedDiscussionPeerId) + return CachedChannelData(isNotAccessible: self.isNotAccessible, flags: flags, about: self.about, participantsSummary: self.participantsSummary, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerStatusSettings: self.peerStatusSettings, pinnedMessageId: self.pinnedMessageId, stickerPack: self.stickerPack, minAvailableMessageId: self.minAvailableMessageId, migrationReference: self.migrationReference, linkedDiscussionPeerId: self.linkedDiscussionPeerId) } func withUpdatedAbout(_ about: String?) -> CachedChannelData { - return CachedChannelData(isNotAccessible: self.isNotAccessible, flags: self.flags, about: about, participantsSummary: self.participantsSummary, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerContactSettings: self.peerContactSettings, pinnedMessageId: self.pinnedMessageId, stickerPack: self.stickerPack, minAvailableMessageId: self.minAvailableMessageId, migrationReference: self.migrationReference, linkedDiscussionPeerId: self.linkedDiscussionPeerId) + return CachedChannelData(isNotAccessible: self.isNotAccessible, flags: self.flags, about: about, participantsSummary: self.participantsSummary, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerStatusSettings: self.peerStatusSettings, pinnedMessageId: self.pinnedMessageId, stickerPack: self.stickerPack, minAvailableMessageId: self.minAvailableMessageId, migrationReference: self.migrationReference, linkedDiscussionPeerId: self.linkedDiscussionPeerId) } func withUpdatedParticipantsSummary(_ participantsSummary: CachedChannelParticipantsSummary) -> CachedChannelData { - return CachedChannelData(isNotAccessible: self.isNotAccessible, flags: self.flags, about: self.about, participantsSummary: participantsSummary, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerContactSettings: self.peerContactSettings, pinnedMessageId: self.pinnedMessageId, stickerPack: self.stickerPack, minAvailableMessageId: self.minAvailableMessageId, migrationReference: self.migrationReference, linkedDiscussionPeerId: self.linkedDiscussionPeerId) + return CachedChannelData(isNotAccessible: self.isNotAccessible, flags: self.flags, about: self.about, participantsSummary: participantsSummary, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerStatusSettings: self.peerStatusSettings, pinnedMessageId: self.pinnedMessageId, stickerPack: self.stickerPack, minAvailableMessageId: self.minAvailableMessageId, migrationReference: self.migrationReference, linkedDiscussionPeerId: self.linkedDiscussionPeerId) } func withUpdatedExportedInvitation(_ exportedInvitation: ExportedInvitation?) -> CachedChannelData { - return CachedChannelData(isNotAccessible: self.isNotAccessible, flags: self.flags, about: self.about, participantsSummary: self.participantsSummary, exportedInvitation: exportedInvitation, botInfos: self.botInfos, peerContactSettings: self.peerContactSettings, pinnedMessageId: self.pinnedMessageId, stickerPack: self.stickerPack, minAvailableMessageId: self.minAvailableMessageId, migrationReference: self.migrationReference, linkedDiscussionPeerId: self.linkedDiscussionPeerId) + return CachedChannelData(isNotAccessible: self.isNotAccessible, flags: self.flags, about: self.about, participantsSummary: self.participantsSummary, exportedInvitation: exportedInvitation, botInfos: self.botInfos, peerStatusSettings: self.peerStatusSettings, pinnedMessageId: self.pinnedMessageId, stickerPack: self.stickerPack, minAvailableMessageId: self.minAvailableMessageId, migrationReference: self.migrationReference, linkedDiscussionPeerId: self.linkedDiscussionPeerId) } func withUpdatedBotInfos(_ botInfos: [CachedPeerBotInfo]) -> CachedChannelData { - return CachedChannelData(isNotAccessible: self.isNotAccessible, flags: self.flags, about: self.about, participantsSummary: self.participantsSummary, exportedInvitation: self.exportedInvitation, botInfos: botInfos, peerContactSettings: self.peerContactSettings, pinnedMessageId: self.pinnedMessageId, stickerPack: self.stickerPack, minAvailableMessageId: self.minAvailableMessageId, migrationReference: self.migrationReference, linkedDiscussionPeerId: self.linkedDiscussionPeerId) + return CachedChannelData(isNotAccessible: self.isNotAccessible, flags: self.flags, about: self.about, participantsSummary: self.participantsSummary, exportedInvitation: self.exportedInvitation, botInfos: botInfos, peerStatusSettings: self.peerStatusSettings, pinnedMessageId: self.pinnedMessageId, stickerPack: self.stickerPack, minAvailableMessageId: self.minAvailableMessageId, migrationReference: self.migrationReference, linkedDiscussionPeerId: self.linkedDiscussionPeerId) } - func withUpdatedPeerContactSettings(_ peerContactSettings: PeerContactSettings?) -> CachedChannelData { - return CachedChannelData(isNotAccessible: self.isNotAccessible, flags: self.flags, about: self.about, participantsSummary: self.participantsSummary, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerContactSettings: peerContactSettings, pinnedMessageId: self.pinnedMessageId, stickerPack: self.stickerPack, minAvailableMessageId: self.minAvailableMessageId, migrationReference: self.migrationReference, linkedDiscussionPeerId: self.linkedDiscussionPeerId) + func withUpdatedPeerStatusSettings(_ peerStatusSettings: PeerStatusSettings?) -> CachedChannelData { + return CachedChannelData(isNotAccessible: self.isNotAccessible, flags: self.flags, about: self.about, participantsSummary: self.participantsSummary, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerStatusSettings: peerStatusSettings, pinnedMessageId: self.pinnedMessageId, stickerPack: self.stickerPack, minAvailableMessageId: self.minAvailableMessageId, migrationReference: self.migrationReference, linkedDiscussionPeerId: self.linkedDiscussionPeerId) } func withUpdatedPinnedMessageId(_ pinnedMessageId: MessageId?) -> CachedChannelData { - return CachedChannelData(isNotAccessible: self.isNotAccessible, flags: self.flags, about: self.about, participantsSummary: self.participantsSummary, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerContactSettings: self.peerContactSettings, pinnedMessageId: pinnedMessageId, stickerPack: self.stickerPack, minAvailableMessageId: self.minAvailableMessageId, migrationReference: self.migrationReference, linkedDiscussionPeerId: self.linkedDiscussionPeerId) + return CachedChannelData(isNotAccessible: self.isNotAccessible, flags: self.flags, about: self.about, participantsSummary: self.participantsSummary, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerStatusSettings: self.peerStatusSettings, pinnedMessageId: pinnedMessageId, stickerPack: self.stickerPack, minAvailableMessageId: self.minAvailableMessageId, migrationReference: self.migrationReference, linkedDiscussionPeerId: self.linkedDiscussionPeerId) } func withUpdatedStickerPack(_ stickerPack: StickerPackCollectionInfo?) -> CachedChannelData { - return CachedChannelData(isNotAccessible: self.isNotAccessible, flags: self.flags, about: self.about, participantsSummary: self.participantsSummary, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerContactSettings: self.peerContactSettings, pinnedMessageId: self.pinnedMessageId, stickerPack: stickerPack, minAvailableMessageId: self.minAvailableMessageId, migrationReference: self.migrationReference, linkedDiscussionPeerId: self.linkedDiscussionPeerId) + return CachedChannelData(isNotAccessible: self.isNotAccessible, flags: self.flags, about: self.about, participantsSummary: self.participantsSummary, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerStatusSettings: self.peerStatusSettings, pinnedMessageId: self.pinnedMessageId, stickerPack: stickerPack, minAvailableMessageId: self.minAvailableMessageId, migrationReference: self.migrationReference, linkedDiscussionPeerId: self.linkedDiscussionPeerId) } func withUpdatedMinAvailableMessageId(_ minAvailableMessageId: MessageId?) -> CachedChannelData { - return CachedChannelData(isNotAccessible: self.isNotAccessible, flags: self.flags, about: self.about, participantsSummary: self.participantsSummary, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerContactSettings: self.peerContactSettings, pinnedMessageId: self.pinnedMessageId, stickerPack: self.stickerPack, minAvailableMessageId: minAvailableMessageId, migrationReference: self.migrationReference, linkedDiscussionPeerId: self.linkedDiscussionPeerId) + return CachedChannelData(isNotAccessible: self.isNotAccessible, flags: self.flags, about: self.about, participantsSummary: self.participantsSummary, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerStatusSettings: self.peerStatusSettings, pinnedMessageId: self.pinnedMessageId, stickerPack: self.stickerPack, minAvailableMessageId: minAvailableMessageId, migrationReference: self.migrationReference, linkedDiscussionPeerId: self.linkedDiscussionPeerId) } func withUpdatedMigrationReference(_ migrationReference: ChannelMigrationReference?) -> CachedChannelData { - return CachedChannelData(isNotAccessible: self.isNotAccessible, flags: self.flags, about: self.about, participantsSummary: self.participantsSummary, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerContactSettings: self.peerContactSettings, pinnedMessageId: self.pinnedMessageId, stickerPack: self.stickerPack, minAvailableMessageId: self.minAvailableMessageId, migrationReference: migrationReference, linkedDiscussionPeerId: self.linkedDiscussionPeerId) + return CachedChannelData(isNotAccessible: self.isNotAccessible, flags: self.flags, about: self.about, participantsSummary: self.participantsSummary, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerStatusSettings: self.peerStatusSettings, pinnedMessageId: self.pinnedMessageId, stickerPack: self.stickerPack, minAvailableMessageId: self.minAvailableMessageId, migrationReference: migrationReference, linkedDiscussionPeerId: self.linkedDiscussionPeerId) } func withUpdatedLinkedDiscussionPeerId(_ linkedDiscussionPeerId: PeerId?) -> CachedChannelData { - return CachedChannelData(isNotAccessible: self.isNotAccessible, flags: self.flags, about: self.about, participantsSummary: self.participantsSummary, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerContactSettings: self.peerContactSettings, pinnedMessageId: self.pinnedMessageId, stickerPack: self.stickerPack, minAvailableMessageId: self.minAvailableMessageId, migrationReference: self.migrationReference, linkedDiscussionPeerId: linkedDiscussionPeerId) + return CachedChannelData(isNotAccessible: self.isNotAccessible, flags: self.flags, about: self.about, participantsSummary: self.participantsSummary, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerStatusSettings: self.peerStatusSettings, pinnedMessageId: self.pinnedMessageId, stickerPack: self.stickerPack, minAvailableMessageId: self.minAvailableMessageId, migrationReference: self.migrationReference, linkedDiscussionPeerId: linkedDiscussionPeerId) } public init(decoder: PostboxDecoder) { @@ -252,9 +252,9 @@ public final class CachedChannelData: CachedPeerData { self.botInfos = decoder.decodeObjectArrayWithDecoderForKey("b") as [CachedPeerBotInfo] var peerIds = Set() if let value = decoder.decodeOptionalInt32ForKey("pcs") { - self.peerContactSettings = PeerContactSettings(rawValue: value) + self.peerStatusSettings = PeerStatusSettings(rawValue: value) } else { - self.peerContactSettings = nil + self.peerStatusSettings = nil } if let pinnedMessagePeerId = decoder.decodeOptionalInt64ForKey("pm.p"), let pinnedMessageNamespace = decoder.decodeOptionalInt32ForKey("pm.n"), let pinnedMessageId = decoder.decodeOptionalInt32ForKey("pm.i") { self.pinnedMessageId = MessageId(peerId: PeerId(pinnedMessagePeerId), namespace: pinnedMessageNamespace, id: pinnedMessageId) @@ -314,8 +314,8 @@ public final class CachedChannelData: CachedPeerData { encoder.encodeNil(forKey: "i") } encoder.encodeObjectArray(self.botInfos, forKey: "b") - if let peerContactSettings = self.peerContactSettings { - encoder.encodeInt32(peerContactSettings.rawValue, forKey: "pcs") + if let peerStatusSettings = self.peerStatusSettings { + encoder.encodeInt32(peerStatusSettings.rawValue, forKey: "pcs") } else { encoder.encodeNil(forKey: "pcs") } @@ -387,7 +387,7 @@ public final class CachedChannelData: CachedPeerData { return false } - if other.peerContactSettings != self.peerContactSettings { + if other.peerStatusSettings != self.peerStatusSettings { return false } diff --git a/TelegramCore/CachedGroupData.swift b/TelegramCore/CachedGroupData.swift index a88344e19b..5fb88ed969 100644 --- a/TelegramCore/CachedGroupData.swift +++ b/TelegramCore/CachedGroupData.swift @@ -47,7 +47,7 @@ public final class CachedGroupData: CachedPeerData { public let participants: CachedGroupParticipants? public let exportedInvitation: ExportedInvitation? public let botInfos: [CachedPeerBotInfo] - public let peerContactSettings: PeerContactSettings? + public let peerStatusSettings: PeerStatusSettings? public let pinnedMessageId: MessageId? public let about: String? public let flags: CachedGroupFlags @@ -60,7 +60,7 @@ public final class CachedGroupData: CachedPeerData { self.participants = nil self.exportedInvitation = nil self.botInfos = [] - self.peerContactSettings = nil + self.peerStatusSettings = nil self.pinnedMessageId = nil self.messageIds = Set() self.peerIds = Set() @@ -68,11 +68,11 @@ public final class CachedGroupData: CachedPeerData { self.flags = CachedGroupFlags() } - public init(participants: CachedGroupParticipants?, exportedInvitation: ExportedInvitation?, botInfos: [CachedPeerBotInfo], peerContactSettings: PeerContactSettings?, pinnedMessageId: MessageId?, about: String?, flags: CachedGroupFlags) { + public init(participants: CachedGroupParticipants?, exportedInvitation: ExportedInvitation?, botInfos: [CachedPeerBotInfo], peerStatusSettings: PeerStatusSettings?, pinnedMessageId: MessageId?, about: String?, flags: CachedGroupFlags) { self.participants = participants self.exportedInvitation = exportedInvitation self.botInfos = botInfos - self.peerContactSettings = peerContactSettings + self.peerStatusSettings = peerStatusSettings self.pinnedMessageId = pinnedMessageId self.about = about self.flags = flags @@ -101,9 +101,9 @@ public final class CachedGroupData: CachedPeerData { self.exportedInvitation = decoder.decodeObjectForKey("i", decoder: { ExportedInvitation(decoder: $0) }) as? ExportedInvitation self.botInfos = decoder.decodeObjectArrayWithDecoderForKey("b") as [CachedPeerBotInfo] if let value = decoder.decodeOptionalInt32ForKey("pcs") { - self.peerContactSettings = PeerContactSettings(rawValue: value) + self.peerStatusSettings = PeerStatusSettings(rawValue: value) } else { - self.peerContactSettings = nil + self.peerStatusSettings = nil } if let pinnedMessagePeerId = decoder.decodeOptionalInt64ForKey("pm.p"), let pinnedMessageNamespace = decoder.decodeOptionalInt32ForKey("pm.n"), let pinnedMessageId = decoder.decodeOptionalInt32ForKey("pm.i") { self.pinnedMessageId = MessageId(peerId: PeerId(pinnedMessagePeerId), namespace: pinnedMessageNamespace, id: pinnedMessageId) @@ -144,8 +144,8 @@ public final class CachedGroupData: CachedPeerData { encoder.encodeNil(forKey: "i") } encoder.encodeObjectArray(self.botInfos, forKey: "b") - if let peerContactSettings = self.peerContactSettings { - encoder.encodeInt32(peerContactSettings.rawValue, forKey: "pcs") + if let peerStatusSettings = self.peerStatusSettings { + encoder.encodeInt32(peerStatusSettings.rawValue, forKey: "pcs") } else { encoder.encodeNil(forKey: "pcs") } @@ -171,34 +171,34 @@ public final class CachedGroupData: CachedPeerData { return false } - return self.participants == other.participants && self.exportedInvitation == other.exportedInvitation && self.botInfos == other.botInfos && self.peerContactSettings == other.peerContactSettings && self.pinnedMessageId == other.pinnedMessageId && self.about == other.about && self.flags == other.flags + return self.participants == other.participants && self.exportedInvitation == other.exportedInvitation && self.botInfos == other.botInfos && self.peerStatusSettings == other.peerStatusSettings && self.pinnedMessageId == other.pinnedMessageId && self.about == other.about && self.flags == other.flags } func withUpdatedParticipants(_ participants: CachedGroupParticipants?) -> CachedGroupData { - return CachedGroupData(participants: participants, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerContactSettings: self.peerContactSettings, pinnedMessageId: self.pinnedMessageId, about: self.about, flags: self.flags) + return CachedGroupData(participants: participants, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerStatusSettings: self.peerStatusSettings, pinnedMessageId: self.pinnedMessageId, about: self.about, flags: self.flags) } func withUpdatedExportedInvitation(_ exportedInvitation: ExportedInvitation?) -> CachedGroupData { - return CachedGroupData(participants: self.participants, exportedInvitation: exportedInvitation, botInfos: self.botInfos, peerContactSettings: self.peerContactSettings, pinnedMessageId: self.pinnedMessageId, about: self.about, flags: self.flags) + return CachedGroupData(participants: self.participants, exportedInvitation: exportedInvitation, botInfos: self.botInfos, peerStatusSettings: self.peerStatusSettings, pinnedMessageId: self.pinnedMessageId, about: self.about, flags: self.flags) } func withUpdatedBotInfos(_ botInfos: [CachedPeerBotInfo]) -> CachedGroupData { - return CachedGroupData(participants: self.participants, exportedInvitation: self.exportedInvitation, botInfos: botInfos, peerContactSettings: self.peerContactSettings, pinnedMessageId: self.pinnedMessageId, about: self.about, flags: self.flags) + return CachedGroupData(participants: self.participants, exportedInvitation: self.exportedInvitation, botInfos: botInfos, peerStatusSettings: self.peerStatusSettings, pinnedMessageId: self.pinnedMessageId, about: self.about, flags: self.flags) } - func withUpdatedPeerContactSettings(_ peerContactSettings: PeerContactSettings?) -> CachedGroupData { - return CachedGroupData(participants: self.participants, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerContactSettings: peerContactSettings, pinnedMessageId: self.pinnedMessageId, about: self.about, flags: self.flags) + func withUpdatedPeerStatusSettings(_ peerStatusSettings: PeerStatusSettings?) -> CachedGroupData { + return CachedGroupData(participants: self.participants, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerStatusSettings: peerStatusSettings, pinnedMessageId: self.pinnedMessageId, about: self.about, flags: self.flags) } func withUpdatedPinnedMessageId(_ pinnedMessageId: MessageId?) -> CachedGroupData { - return CachedGroupData(participants: self.participants, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerContactSettings: self.peerContactSettings, pinnedMessageId: pinnedMessageId, about: self.about, flags: self.flags) + return CachedGroupData(participants: self.participants, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerStatusSettings: self.peerStatusSettings, pinnedMessageId: pinnedMessageId, about: self.about, flags: self.flags) } func withUpdatedAbout(_ about: String?) -> CachedGroupData { - return CachedGroupData(participants: self.participants, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerContactSettings: self.peerContactSettings, pinnedMessageId: self.pinnedMessageId, about: about, flags: self.flags) + return CachedGroupData(participants: self.participants, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerStatusSettings: self.peerStatusSettings, pinnedMessageId: self.pinnedMessageId, about: about, flags: self.flags) } func withUpdatedFlags(_ flags: CachedGroupFlags) -> CachedGroupData { - return CachedGroupData(participants: self.participants, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerContactSettings: self.peerContactSettings, pinnedMessageId: self.pinnedMessageId, about: self.about, flags: flags) + return CachedGroupData(participants: self.participants, exportedInvitation: self.exportedInvitation, botInfos: self.botInfos, peerStatusSettings: self.peerStatusSettings, pinnedMessageId: self.pinnedMessageId, about: self.about, flags: flags) } } diff --git a/TelegramCore/CachedUserData.swift b/TelegramCore/CachedUserData.swift index 6ef14742e0..6aa16f0065 100644 --- a/TelegramCore/CachedUserData.swift +++ b/TelegramCore/CachedUserData.swift @@ -8,7 +8,7 @@ import Foundation public final class CachedUserData: CachedPeerData { public let about: String? public let botInfo: BotInfo? - public let peerContactSettings: PeerContactSettings? + public let peerStatusSettings: PeerStatusSettings? public let pinnedMessageId: MessageId? public let isBlocked: Bool public let commonGroupCount: Int32 @@ -23,7 +23,7 @@ public final class CachedUserData: CachedPeerData { init() { self.about = nil self.botInfo = nil - self.peerContactSettings = nil + self.peerStatusSettings = nil self.pinnedMessageId = nil self.isBlocked = false self.commonGroupCount = 0 @@ -33,10 +33,10 @@ public final class CachedUserData: CachedPeerData { self.messageIds = Set() } - init(about: String?, botInfo: BotInfo?, peerContactSettings: PeerContactSettings?, pinnedMessageId: MessageId?, isBlocked: Bool, commonGroupCount: Int32, callsAvailable: Bool, callsPrivate: Bool, canPinMessages: Bool) { + init(about: String?, botInfo: BotInfo?, peerStatusSettings: PeerStatusSettings?, pinnedMessageId: MessageId?, isBlocked: Bool, commonGroupCount: Int32, callsAvailable: Bool, callsPrivate: Bool, canPinMessages: Bool) { self.about = about self.botInfo = botInfo - self.peerContactSettings = peerContactSettings + self.peerStatusSettings = peerStatusSettings self.pinnedMessageId = pinnedMessageId self.isBlocked = isBlocked self.commonGroupCount = commonGroupCount @@ -54,9 +54,9 @@ public final class CachedUserData: CachedPeerData { self.about = decoder.decodeOptionalStringForKey("a") self.botInfo = decoder.decodeObjectForKey("bi") as? BotInfo if let value = decoder.decodeOptionalInt32ForKey("pcs") { - self.peerContactSettings = PeerContactSettings(rawValue: value) + self.peerStatusSettings = PeerStatusSettings(rawValue: value) } else { - self.peerContactSettings = nil + self.peerStatusSettings = nil } if let pinnedMessagePeerId = decoder.decodeOptionalInt64ForKey("pm.p"), let pinnedMessageNamespace = decoder.decodeOptionalInt32ForKey("pm.n"), let pinnedMessageId = decoder.decodeOptionalInt32ForKey("pm.i") { self.pinnedMessageId = MessageId(peerId: PeerId(pinnedMessagePeerId), namespace: pinnedMessageNamespace, id: pinnedMessageId) @@ -87,8 +87,8 @@ public final class CachedUserData: CachedPeerData { } else { encoder.encodeNil(forKey: "bi") } - if let peerContactSettings = self.peerContactSettings { - encoder.encodeInt32(peerContactSettings.rawValue, forKey: "pcs") + if let peerStatusSettings = self.peerStatusSettings { + encoder.encodeInt32(peerStatusSettings.rawValue, forKey: "pcs") } else { encoder.encodeNil(forKey: "pcs") } @@ -120,42 +120,42 @@ public final class CachedUserData: CachedPeerData { return false } - return other.about == self.about && other.botInfo == self.botInfo && self.peerContactSettings == other.peerContactSettings && self.isBlocked == other.isBlocked && self.commonGroupCount == other.commonGroupCount && self.callsAvailable == other.callsAvailable && self.callsPrivate == other.callsPrivate + return other.about == self.about && other.botInfo == self.botInfo && self.peerStatusSettings == other.peerStatusSettings && self.isBlocked == other.isBlocked && self.commonGroupCount == other.commonGroupCount && self.callsAvailable == other.callsAvailable && self.callsPrivate == other.callsPrivate } func withUpdatedAbout(_ about: String?) -> CachedUserData { - return CachedUserData(about: about, botInfo: self.botInfo, peerContactSettings: self.peerContactSettings, pinnedMessageId: self.pinnedMessageId, isBlocked: self.isBlocked, commonGroupCount: self.commonGroupCount, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, canPinMessages: self.canPinMessages) + return CachedUserData(about: about, botInfo: self.botInfo, peerStatusSettings: self.peerStatusSettings, pinnedMessageId: self.pinnedMessageId, isBlocked: self.isBlocked, commonGroupCount: self.commonGroupCount, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, canPinMessages: self.canPinMessages) } func withUpdatedBotInfo(_ botInfo: BotInfo?) -> CachedUserData { - return CachedUserData(about: self.about, botInfo: botInfo, peerContactSettings: self.peerContactSettings, pinnedMessageId: self.pinnedMessageId, isBlocked: self.isBlocked, commonGroupCount: self.commonGroupCount, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, canPinMessages: self.canPinMessages) + return CachedUserData(about: self.about, botInfo: botInfo, peerStatusSettings: self.peerStatusSettings, pinnedMessageId: self.pinnedMessageId, isBlocked: self.isBlocked, commonGroupCount: self.commonGroupCount, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, canPinMessages: self.canPinMessages) } - func withUpdatedPeerContactSettings(_ peerContactSettings: PeerContactSettings) -> CachedUserData { - return CachedUserData(about: self.about, botInfo: self.botInfo, peerContactSettings: peerContactSettings, pinnedMessageId: self.pinnedMessageId, isBlocked: self.isBlocked, commonGroupCount: self.commonGroupCount, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, canPinMessages: self.canPinMessages) + func withUpdatedPeerStatusSettings(_ peerStatusSettings: PeerStatusSettings) -> CachedUserData { + return CachedUserData(about: self.about, botInfo: self.botInfo, peerStatusSettings: peerStatusSettings, pinnedMessageId: self.pinnedMessageId, isBlocked: self.isBlocked, commonGroupCount: self.commonGroupCount, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, canPinMessages: self.canPinMessages) } func withUpdatedPinnedMessageId(_ pinnedMessageId: MessageId?) -> CachedUserData { - return CachedUserData(about: self.about, botInfo: self.botInfo, peerContactSettings: self.peerContactSettings, pinnedMessageId: pinnedMessageId, isBlocked: self.isBlocked, commonGroupCount: self.commonGroupCount, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, canPinMessages: self.canPinMessages) + return CachedUserData(about: self.about, botInfo: self.botInfo, peerStatusSettings: self.peerStatusSettings, pinnedMessageId: pinnedMessageId, isBlocked: self.isBlocked, commonGroupCount: self.commonGroupCount, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, canPinMessages: self.canPinMessages) } func withUpdatedIsBlocked(_ isBlocked: Bool) -> CachedUserData { - return CachedUserData(about: self.about, botInfo: self.botInfo, peerContactSettings: self.peerContactSettings, pinnedMessageId: self.pinnedMessageId, isBlocked: isBlocked, commonGroupCount: self.commonGroupCount, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, canPinMessages: self.canPinMessages) + return CachedUserData(about: self.about, botInfo: self.botInfo, peerStatusSettings: self.peerStatusSettings, pinnedMessageId: self.pinnedMessageId, isBlocked: isBlocked, commonGroupCount: self.commonGroupCount, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, canPinMessages: self.canPinMessages) } func withUpdatedCommonGroupCount(_ commonGroupCount: Int32) -> CachedUserData { - return CachedUserData(about: self.about, botInfo: self.botInfo, peerContactSettings: self.peerContactSettings, pinnedMessageId: self.pinnedMessageId, isBlocked: self.isBlocked, commonGroupCount: commonGroupCount, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, canPinMessages: self.canPinMessages) + return CachedUserData(about: self.about, botInfo: self.botInfo, peerStatusSettings: self.peerStatusSettings, pinnedMessageId: self.pinnedMessageId, isBlocked: self.isBlocked, commonGroupCount: commonGroupCount, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, canPinMessages: self.canPinMessages) } func withUpdatedCallsAvailable(_ callsAvailable: Bool) -> CachedUserData { - return CachedUserData(about: self.about, botInfo: self.botInfo, peerContactSettings: self.peerContactSettings, pinnedMessageId: self.pinnedMessageId, isBlocked: self.isBlocked, commonGroupCount: self.commonGroupCount, callsAvailable: callsAvailable, callsPrivate: self.callsPrivate, canPinMessages: self.canPinMessages) + return CachedUserData(about: self.about, botInfo: self.botInfo, peerStatusSettings: self.peerStatusSettings, pinnedMessageId: self.pinnedMessageId, isBlocked: self.isBlocked, commonGroupCount: self.commonGroupCount, callsAvailable: callsAvailable, callsPrivate: self.callsPrivate, canPinMessages: self.canPinMessages) } func withUpdatedCallsPrivate(_ callsPrivate: Bool) -> CachedUserData { - return CachedUserData(about: self.about, botInfo: self.botInfo, peerContactSettings: self.peerContactSettings, pinnedMessageId: self.pinnedMessageId, isBlocked: self.isBlocked, commonGroupCount: self.commonGroupCount, callsAvailable: self.callsAvailable, callsPrivate: callsPrivate, canPinMessages: self.canPinMessages) + return CachedUserData(about: self.about, botInfo: self.botInfo, peerStatusSettings: self.peerStatusSettings, pinnedMessageId: self.pinnedMessageId, isBlocked: self.isBlocked, commonGroupCount: self.commonGroupCount, callsAvailable: self.callsAvailable, callsPrivate: callsPrivate, canPinMessages: self.canPinMessages) } func withUpdatedCanPinMessages(_ canPinMessages: Bool) -> CachedUserData { - return CachedUserData(about: self.about, botInfo: self.botInfo, peerContactSettings: self.peerContactSettings, pinnedMessageId: self.pinnedMessageId, isBlocked: self.isBlocked, commonGroupCount: self.commonGroupCount, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, canPinMessages: canPinMessages) + return CachedUserData(about: self.about, botInfo: self.botInfo, peerStatusSettings: self.peerStatusSettings, pinnedMessageId: self.pinnedMessageId, isBlocked: self.isBlocked, commonGroupCount: self.commonGroupCount, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, canPinMessages: canPinMessages) } } diff --git a/TelegramCore/ManagedSecretChatOutgoingOperations.swift b/TelegramCore/ManagedSecretChatOutgoingOperations.swift index 6d97ba423a..3ee0947a2c 100644 --- a/TelegramCore/ManagedSecretChatOutgoingOperations.swift +++ b/TelegramCore/ManagedSecretChatOutgoingOperations.swift @@ -1380,9 +1380,9 @@ private func requestTerminateSecretChat(postbox: Postbox, network: Network, peer if result != nil { transaction.updatePeerCachedData(peerIds: Set([peerId]), update: { _, current in if let current = current as? CachedSecretChatData { - var peerContactSettings = current.peerContactSettings ?? PeerContactSettings() - peerContactSettings.insert(.isHidden) - return current.withUpdatedPeerContactSettings(peerContactSettings) + var peerStatusSettings = current.peerStatusSettings ?? PeerStatusSettings() + peerStatusSettings.insert(.isHidden) + return current.withUpdatedPeerStatusSettings(peerStatusSettings) } else { return current } diff --git a/TelegramCore/PeerContactSettings.swift b/TelegramCore/PeerContactSettings.swift index 06351403e0..9a3316cae2 100644 --- a/TelegramCore/PeerContactSettings.swift +++ b/TelegramCore/PeerContactSettings.swift @@ -5,23 +5,23 @@ import Foundation import Postbox #endif -public struct PeerContactSettings: OptionSet { +public struct PeerStatusSettings: OptionSet { public var rawValue: Int32 public init(rawValue: Int32) { self.rawValue = rawValue } - public static let isHidden = PeerContactSettings(rawValue: 1 << 0) - public static let canReport = PeerContactSettings(rawValue: 1 << 1) - public static let canShareContact = PeerContactSettings(rawValue: 1 << 2) + public static let isHidden = PeerStatusSettings(rawValue: 1 << 0) + public static let canReport = PeerStatusSettings(rawValue: 1 << 1) + public static let canShareContact = PeerStatusSettings(rawValue: 1 << 2) } -extension PeerContactSettings { +extension PeerStatusSettings { init(apiSettings: Api.PeerSettings) { switch apiSettings { case let .peerSettings(flags): - var result = PeerContactSettings() + var result = PeerStatusSettings() if (flags & (1 << 1)) != 0 { result.insert(.isHidden) } diff --git a/TelegramCore/ReportPeer.swift b/TelegramCore/ReportPeer.swift index c0699a7516..23f62ad3c0 100644 --- a/TelegramCore/ReportPeer.swift +++ b/TelegramCore/ReportPeer.swift @@ -27,20 +27,20 @@ public func reportPeer(account: Account, peerId: PeerId) -> Signal Signal switchToLatest } -public func dismissPeerContactOptions(account: Account, peerId: PeerId) -> Signal { +public func dismissPeerStatusOptions(account: Account, peerId: PeerId) -> Signal { return account.postbox.transaction { transaction -> Signal in transaction.updatePeerCachedData(peerIds: Set([peerId]), update: { _, current in if let current = current as? CachedUserData { - var peerContactSettings = current.peerContactSettings ?? PeerContactSettings() - peerContactSettings.insert(.isHidden) - return current.withUpdatedPeerContactSettings(peerContactSettings) + var peerStatusSettings = current.peerStatusSettings ?? PeerStatusSettings() + peerStatusSettings.insert(.isHidden) + return current.withUpdatedPeerStatusSettings(peerStatusSettings) } else if let current = current as? CachedGroupData { - var peerContactSettings = current.peerContactSettings ?? PeerContactSettings() - peerContactSettings.insert(.isHidden) - return current.withUpdatedPeerContactSettings(peerContactSettings) + var peerStatusSettings = current.peerStatusSettings ?? PeerStatusSettings() + peerStatusSettings.insert(.isHidden) + return current.withUpdatedPeerStatusSettings(peerStatusSettings) } else if let current = current as? CachedChannelData { - var peerContactSettings = current.peerContactSettings ?? PeerContactSettings() - peerContactSettings.insert(.isHidden) - return current.withUpdatedPeerContactSettings(peerContactSettings) + var peerStatusSettings = current.peerStatusSettings ?? PeerStatusSettings() + peerStatusSettings.insert(.isHidden) + return current.withUpdatedPeerStatusSettings(peerStatusSettings) } else if let current = current as? CachedSecretChatData { - var peerContactSettings = current.peerContactSettings ?? PeerContactSettings() - peerContactSettings.insert(.isHidden) - return current.withUpdatedPeerContactSettings(peerContactSettings) + var peerStatusSettings = current.peerStatusSettings ?? PeerStatusSettings() + peerStatusSettings.insert(.isHidden) + return current.withUpdatedPeerStatusSettings(peerStatusSettings) } else { return current } diff --git a/TelegramCore/TelegramSecretChat.swift b/TelegramCore/TelegramSecretChat.swift index 751ff7c624..7b31ce958c 100644 --- a/TelegramCore/TelegramSecretChat.swift +++ b/TelegramCore/TelegramSecretChat.swift @@ -81,23 +81,23 @@ public final class CachedSecretChatData: CachedPeerData { public let messageIds: Set = Set() public let associatedHistoryMessageId: MessageId? = nil - public let peerContactSettings: PeerContactSettings? + public let peerStatusSettings: PeerStatusSettings? - public init(peerContactSettings: PeerContactSettings?) { - self.peerContactSettings = peerContactSettings + public init(peerStatusSettings: PeerStatusSettings?) { + self.peerStatusSettings = peerStatusSettings } public init(decoder: PostboxDecoder) { if let value = decoder.decodeOptionalInt32ForKey("pcs") { - self.peerContactSettings = PeerContactSettings(rawValue: value) + self.peerStatusSettings = PeerStatusSettings(rawValue: value) } else { - self.peerContactSettings = nil + self.peerStatusSettings = nil } } public func encode(_ encoder: PostboxEncoder) { - if let peerContactSettings = self.peerContactSettings { - encoder.encodeInt32(peerContactSettings.rawValue, forKey: "pcs") + if let peerStatusSettings = self.peerStatusSettings { + encoder.encodeInt32(peerStatusSettings.rawValue, forKey: "pcs") } else { encoder.encodeNil(forKey: "pcs") } @@ -105,13 +105,13 @@ public final class CachedSecretChatData: CachedPeerData { public func isEqual(to: CachedPeerData) -> Bool { if let to = to as? CachedSecretChatData { - return self.peerContactSettings == to.peerContactSettings + return self.peerStatusSettings == to.peerStatusSettings } else { return false } } - func withUpdatedPeerContactSettings(_ peerContactSettings: PeerContactSettings) -> CachedSecretChatData { - return CachedSecretChatData(peerContactSettings: peerContactSettings) + func withUpdatedPeerStatusSettings(_ peerStatusSettings: PeerStatusSettings) -> CachedSecretChatData { + return CachedSecretChatData(peerStatusSettings: peerStatusSettings) } } diff --git a/TelegramCore/UpdateCachedPeerData.swift b/TelegramCore/UpdateCachedPeerData.swift index 693712154b..521fbf4572 100644 --- a/TelegramCore/UpdateCachedPeerData.swift +++ b/TelegramCore/UpdateCachedPeerData.swift @@ -13,44 +13,44 @@ func fetchAndUpdateSupplementalCachedPeerData(peerId: PeerId, network: Network, let cachedData = transaction.getPeerCachedData(peerId: peerId) if let cachedData = cachedData as? CachedUserData { - if cachedData.peerContactSettings != nil { + if cachedData.peerStatusSettings != nil { return .complete() } } else if let cachedData = cachedData as? CachedGroupData { - if cachedData.peerContactSettings != nil { + if cachedData.peerStatusSettings != nil { return .complete() } } else if let cachedData = cachedData as? CachedChannelData { - if cachedData.peerContactSettings != nil { + if cachedData.peerStatusSettings != nil { return .complete() } } else if let cachedData = cachedData as? CachedSecretChatData { - if cachedData.peerContactSettings != nil { + if cachedData.peerStatusSettings != nil { return .complete() } } if peerId.namespace == Namespaces.Peer.SecretChat { return postbox.transaction { transaction -> Void in - var peerContactSettings: PeerContactSettings + var peerStatusSettings: PeerStatusSettings if let peer = transaction.getPeer(peerId), let associatedPeerId = peer.associatedPeerId, !transaction.isPeerContact(peerId: associatedPeerId) { if let peer = peer as? TelegramSecretChat, case .creator = peer.role { - peerContactSettings = PeerContactSettings() - peerContactSettings.insert(.isHidden) + peerStatusSettings = PeerStatusSettings() + peerStatusSettings.insert(.isHidden) } else { - peerContactSettings = PeerContactSettings() - peerContactSettings.insert(.canReport) + peerStatusSettings = PeerStatusSettings() + peerStatusSettings.insert(.canReport) } } else { - peerContactSettings = PeerContactSettings() - peerContactSettings.insert(.isHidden) + peerStatusSettings = PeerStatusSettings() + peerStatusSettings.insert(.isHidden) } transaction.updatePeerCachedData(peerIds: [peerId], update: { peerId, current in if let current = current as? CachedSecretChatData { - return current.withUpdatedPeerContactSettings(peerContactSettings) + return current.withUpdatedPeerStatusSettings(peerStatusSettings) } else { - return CachedSecretChatData(peerContactSettings: peerContactSettings) + return CachedSecretChatData(peerStatusSettings: peerStatusSettings) } }) } @@ -58,7 +58,7 @@ func fetchAndUpdateSupplementalCachedPeerData(peerId: PeerId, network: Network, return network.request(Api.functions.messages.getPeerSettings(peer: inputPeer)) |> retryRequest |> mapToSignal { peerSettings -> Signal in - let peerContactSettings = PeerContactSettings(apiSettings: peerSettings) + let peerStatusSettings = PeerStatusSettings(apiSettings: peerSettings) return postbox.transaction { transaction -> Void in transaction.updatePeerCachedData(peerIds: Set([peerId]), update: { _, current in @@ -70,7 +70,7 @@ func fetchAndUpdateSupplementalCachedPeerData(peerId: PeerId, network: Network, } else { previous = CachedUserData() } - return previous.withUpdatedPeerContactSettings(peerContactSettings) + return previous.withUpdatedPeerStatusSettings(peerStatusSettings) case Namespaces.Peer.CloudGroup: let previous: CachedGroupData if let current = current as? CachedGroupData { @@ -78,7 +78,7 @@ func fetchAndUpdateSupplementalCachedPeerData(peerId: PeerId, network: Network, } else { previous = CachedGroupData() } - return previous.withUpdatedPeerContactSettings(peerContactSettings) + return previous.withUpdatedPeerStatusSettings(peerStatusSettings) case Namespaces.Peer.CloudChannel: let previous: CachedChannelData if let current = current as? CachedChannelData { @@ -86,7 +86,7 @@ func fetchAndUpdateSupplementalCachedPeerData(peerId: PeerId, network: Network, } else { previous = CachedChannelData() } - return previous.withUpdatedPeerContactSettings(peerContactSettings) + return previous.withUpdatedPeerStatusSettings(peerStatusSettings) default: break } @@ -138,9 +138,9 @@ func fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId: PeerId, network let canPinMessages = (userFull.flags & (1 << 7)) != 0 let pinnedMessageId = userFull.pinnedMsgId.flatMap({ MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: $0) }) - let peerContactSettings = PeerContactSettings(apiSettings: userFull.settings) + let peerStatusSettings = PeerStatusSettings(apiSettings: userFull.settings) - return previous.withUpdatedAbout(userFull.about).withUpdatedBotInfo(botInfo).withUpdatedCommonGroupCount(userFull.commonChatsCount).withUpdatedIsBlocked(isBlocked).withUpdatedCallsAvailable(callsAvailable).withUpdatedCallsPrivate(callsPrivate).withUpdatedCanPinMessages(canPinMessages).withUpdatedPeerContactSettings(peerContactSettings).withUpdatedPinnedMessageId(pinnedMessageId) + return previous.withUpdatedAbout(userFull.about).withUpdatedBotInfo(botInfo).withUpdatedCommonGroupCount(userFull.commonChatsCount).withUpdatedIsBlocked(isBlocked).withUpdatedCallsAvailable(callsAvailable).withUpdatedCallsPrivate(callsPrivate).withUpdatedCanPinMessages(canPinMessages).withUpdatedPeerStatusSettings(peerStatusSettings).withUpdatedPinnedMessageId(pinnedMessageId) } }) }