diff --git a/TelegramCore/Account.swift b/TelegramCore/Account.swift index 1e7216c4a3..52be2c35c7 100644 --- a/TelegramCore/Account.swift +++ b/TelegramCore/Account.swift @@ -242,7 +242,12 @@ let telegramPostboxSeedConfiguration: SeedConfiguration = { initializeMessageNamespacesWithHoles.append((peerNamespace, Namespaces.Message.Cloud)) } - return SeedConfiguration(initializeChatListWithHole: (topLevel: ChatListHole(index: MessageIndex(id: MessageId(peerId: PeerId(namespace: Namespaces.Peer.Empty, id: 0), namespace: Namespaces.Message.Cloud, id: 1), timestamp: Int32.max - 1)), groups: ChatListHole(index: MessageIndex(id: MessageId(peerId: PeerId(namespace: Namespaces.Peer.Empty, id: 0), namespace: Namespaces.Message.Cloud, id: 1), timestamp: 1))), initializeMessageNamespacesWithHoles: initializeMessageNamespacesWithHoles, existingMessageTags: MessageTags.all, messageTagsWithSummary: MessageTags.unseenPersonalMessage, existingGlobalMessageTags: GlobalMessageTags.all, peerNamespacesRequiringMessageTextIndex: [Namespaces.Peer.SecretChat], peerSummaryCounterTags: { peer in + var globalMessageIdsPeerIdNamespaces = Set() + for peerIdNamespace in [Namespaces.Peer.CloudUser, Namespaces.Peer.CloudGroup] { + globalMessageIdsPeerIdNamespaces.insert(GlobalMessageIdsNamespace(peerIdNamespace: peerIdNamespace, messageIdNamespace: Namespaces.Message.Cloud)) + } + + return SeedConfiguration(globalMessageIdsPeerIdNamespaces: globalMessageIdsPeerIdNamespaces, initializeChatListWithHole: (topLevel: ChatListHole(index: MessageIndex(id: MessageId(peerId: PeerId(namespace: Namespaces.Peer.Empty, id: 0), namespace: Namespaces.Message.Cloud, id: 1), timestamp: Int32.max - 1)), groups: ChatListHole(index: MessageIndex(id: MessageId(peerId: PeerId(namespace: Namespaces.Peer.Empty, id: 0), namespace: Namespaces.Message.Cloud, id: 1), timestamp: 1))), initializeMessageNamespacesWithHoles: initializeMessageNamespacesWithHoles, existingMessageTags: MessageTags.all, messageTagsWithSummary: MessageTags.unseenPersonalMessage, existingGlobalMessageTags: GlobalMessageTags.all, peerNamespacesRequiringMessageTextIndex: [Namespaces.Peer.SecretChat], peerSummaryCounterTags: { peer in if let peer = peer as? TelegramChannel { switch peer.info { case .group: @@ -262,7 +267,7 @@ let telegramPostboxSeedConfiguration: SeedConfiguration = { public func accountPreferenceEntries(rootPath: String, id: AccountRecordId, keys: Set) -> Signal<(String, [ValueBoxKey: PreferencesEntry]), NoError> { let path = "\(rootPath)/\(accountRecordIdPathName(id))" - let postbox = openPostbox(basePath: path + "/postbox", globalMessageIdsNamespace: Namespaces.Message.Cloud, seedConfiguration: telegramPostboxSeedConfiguration) + let postbox = openPostbox(basePath: path + "/postbox", seedConfiguration: telegramPostboxSeedConfiguration) return postbox |> mapToSignal { value -> Signal<(String, [ValueBoxKey: PreferencesEntry]), NoError> in switch value { @@ -284,7 +289,7 @@ public func accountPreferenceEntries(rootPath: String, id: AccountRecordId, keys public func accountNoticeEntries(rootPath: String, id: AccountRecordId) -> Signal<(String, [ValueBoxKey: NoticeEntry]), NoError> { let path = "\(rootPath)/\(accountRecordIdPathName(id))" - let postbox = openPostbox(basePath: path + "/postbox", globalMessageIdsNamespace: Namespaces.Message.Cloud, seedConfiguration: telegramPostboxSeedConfiguration) + let postbox = openPostbox(basePath: path + "/postbox", seedConfiguration: telegramPostboxSeedConfiguration) return postbox |> mapToSignal { value -> Signal<(String, [ValueBoxKey: NoticeEntry]), NoError> in switch value { @@ -300,7 +305,7 @@ public func accountNoticeEntries(rootPath: String, id: AccountRecordId) -> Signa public func accountLegacyAccessChallengeData(rootPath: String, id: AccountRecordId) -> Signal { let path = "\(rootPath)/\(accountRecordIdPathName(id))" - let postbox = openPostbox(basePath: path + "/postbox", globalMessageIdsNamespace: Namespaces.Message.Cloud, seedConfiguration: telegramPostboxSeedConfiguration) + let postbox = openPostbox(basePath: path + "/postbox", seedConfiguration: telegramPostboxSeedConfiguration) return postbox |> mapToSignal { value -> Signal in switch value { @@ -316,7 +321,7 @@ public func accountLegacyAccessChallengeData(rootPath: String, id: AccountRecord public func accountTransaction(rootPath: String, id: AccountRecordId, transaction: @escaping (Transaction) -> T) -> Signal { let path = "\(rootPath)/\(accountRecordIdPathName(id))" - let postbox = openPostbox(basePath: path + "/postbox", globalMessageIdsNamespace: Namespaces.Message.Cloud, seedConfiguration: telegramPostboxSeedConfiguration) + let postbox = openPostbox(basePath: path + "/postbox", seedConfiguration: telegramPostboxSeedConfiguration) return postbox |> mapToSignal { value -> Signal in switch value { @@ -331,7 +336,7 @@ public func accountTransaction(rootPath: String, id: AccountRecordId, transac public func accountWithId(accountManager: AccountManager, networkArguments: NetworkInitializationArguments, id: AccountRecordId, supplementary: Bool, rootPath: String, beginWithTestingEnvironment: Bool, auxiliaryMethods: AccountAuxiliaryMethods, shouldKeepAutoConnection: Bool = true) -> Signal { let path = "\(rootPath)/\(accountRecordIdPathName(id))" - let postbox = openPostbox(basePath: path + "/postbox", globalMessageIdsNamespace: Namespaces.Message.Cloud, seedConfiguration: telegramPostboxSeedConfiguration) + let postbox = openPostbox(basePath: path + "/postbox", seedConfiguration: telegramPostboxSeedConfiguration) return postbox |> mapToSignal { result -> Signal in diff --git a/TelegramCore/AccountManager.swift b/TelegramCore/AccountManager.swift index 57687fb4af..a962bc5a2f 100644 --- a/TelegramCore/AccountManager.swift +++ b/TelegramCore/AccountManager.swift @@ -185,7 +185,7 @@ public func temporaryAccount(manager: AccountManager, rootPath: String) -> Signa return manager.allocatedTemporaryAccountId() |> mapToSignal { id -> Signal in let path = "\(rootPath)/\(accountRecordIdPathName(id))" - return openPostbox(basePath: path + "/postbox", globalMessageIdsNamespace: Namespaces.Message.Cloud, seedConfiguration: telegramPostboxSeedConfiguration) + return openPostbox(basePath: path + "/postbox", seedConfiguration: telegramPostboxSeedConfiguration) |> mapToSignal { result -> Signal in switch result { case .upgrading: