mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-18 11:30:04 +00:00
Update postbox initialization
This commit is contained in:
parent
2a05628f97
commit
0dd388a014
@ -242,7 +242,12 @@ let telegramPostboxSeedConfiguration: SeedConfiguration = {
|
|||||||
initializeMessageNamespacesWithHoles.append((peerNamespace, Namespaces.Message.Cloud))
|
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<GlobalMessageIdsNamespace>()
|
||||||
|
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 {
|
if let peer = peer as? TelegramChannel {
|
||||||
switch peer.info {
|
switch peer.info {
|
||||||
case .group:
|
case .group:
|
||||||
@ -262,7 +267,7 @@ let telegramPostboxSeedConfiguration: SeedConfiguration = {
|
|||||||
|
|
||||||
public func accountPreferenceEntries(rootPath: String, id: AccountRecordId, keys: Set<ValueBoxKey>) -> Signal<(String, [ValueBoxKey: PreferencesEntry]), NoError> {
|
public func accountPreferenceEntries(rootPath: String, id: AccountRecordId, keys: Set<ValueBoxKey>) -> Signal<(String, [ValueBoxKey: PreferencesEntry]), NoError> {
|
||||||
let path = "\(rootPath)/\(accountRecordIdPathName(id))"
|
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
|
return postbox
|
||||||
|> mapToSignal { value -> Signal<(String, [ValueBoxKey: PreferencesEntry]), NoError> in
|
|> mapToSignal { value -> Signal<(String, [ValueBoxKey: PreferencesEntry]), NoError> in
|
||||||
switch value {
|
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> {
|
public func accountNoticeEntries(rootPath: String, id: AccountRecordId) -> Signal<(String, [ValueBoxKey: NoticeEntry]), NoError> {
|
||||||
let path = "\(rootPath)/\(accountRecordIdPathName(id))"
|
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
|
return postbox
|
||||||
|> mapToSignal { value -> Signal<(String, [ValueBoxKey: NoticeEntry]), NoError> in
|
|> mapToSignal { value -> Signal<(String, [ValueBoxKey: NoticeEntry]), NoError> in
|
||||||
switch value {
|
switch value {
|
||||||
@ -300,7 +305,7 @@ public func accountNoticeEntries(rootPath: String, id: AccountRecordId) -> Signa
|
|||||||
|
|
||||||
public func accountLegacyAccessChallengeData(rootPath: String, id: AccountRecordId) -> Signal<PostboxAccessChallengeData, NoError> {
|
public func accountLegacyAccessChallengeData(rootPath: String, id: AccountRecordId) -> Signal<PostboxAccessChallengeData, NoError> {
|
||||||
let path = "\(rootPath)/\(accountRecordIdPathName(id))"
|
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
|
return postbox
|
||||||
|> mapToSignal { value -> Signal<PostboxAccessChallengeData, NoError> in
|
|> mapToSignal { value -> Signal<PostboxAccessChallengeData, NoError> in
|
||||||
switch value {
|
switch value {
|
||||||
@ -316,7 +321,7 @@ public func accountLegacyAccessChallengeData(rootPath: String, id: AccountRecord
|
|||||||
|
|
||||||
public func accountTransaction<T>(rootPath: String, id: AccountRecordId, transaction: @escaping (Transaction) -> T) -> Signal<T, NoError> {
|
public func accountTransaction<T>(rootPath: String, id: AccountRecordId, transaction: @escaping (Transaction) -> T) -> Signal<T, NoError> {
|
||||||
let path = "\(rootPath)/\(accountRecordIdPathName(id))"
|
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
|
return postbox
|
||||||
|> mapToSignal { value -> Signal<T, NoError> in
|
|> mapToSignal { value -> Signal<T, NoError> in
|
||||||
switch value {
|
switch value {
|
||||||
@ -331,7 +336,7 @@ public func accountTransaction<T>(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<AccountResult, NoError> {
|
public func accountWithId(accountManager: AccountManager, networkArguments: NetworkInitializationArguments, id: AccountRecordId, supplementary: Bool, rootPath: String, beginWithTestingEnvironment: Bool, auxiliaryMethods: AccountAuxiliaryMethods, shouldKeepAutoConnection: Bool = true) -> Signal<AccountResult, NoError> {
|
||||||
let path = "\(rootPath)/\(accountRecordIdPathName(id))"
|
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
|
return postbox
|
||||||
|> mapToSignal { result -> Signal<AccountResult, NoError> in
|
|> mapToSignal { result -> Signal<AccountResult, NoError> in
|
||||||
|
@ -185,7 +185,7 @@ public func temporaryAccount(manager: AccountManager, rootPath: String) -> Signa
|
|||||||
return manager.allocatedTemporaryAccountId()
|
return manager.allocatedTemporaryAccountId()
|
||||||
|> mapToSignal { id -> Signal<TemporaryAccount, NoError> in
|
|> mapToSignal { id -> Signal<TemporaryAccount, NoError> in
|
||||||
let path = "\(rootPath)/\(accountRecordIdPathName(id))"
|
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<TemporaryAccount, NoError> in
|
|> mapToSignal { result -> Signal<TemporaryAccount, NoError> in
|
||||||
switch result {
|
switch result {
|
||||||
case .upgrading:
|
case .upgrading:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user