Files
Telegram-iOS/submodules/TelegramCore/Sources/TelegramEngine/TelegramEngine.swift
T
isaacandisaac 4107263747 Postbox refactor waves 358-426
Squashed range bf01b4c..a66739c (70 commits) covering 69 waves of the
Postbox -> TelegramEngine consumer migration plus a few BUILD-dep
followups.

Notable additions to TelegramCore in this range:
- Engine typealiases: EngineRawPeerPresence, EngineRawValueBoxKey,
  EngineSimpleDictionary, EngineRawPeerView, EngineRawPostboxViewKey,
  EngineRawPreferencesView, EngineRawMessageHistoryView (+ entry/attrs/
  read-state), EngineMessageIdNamespaces, EngineHistoryViewInputAnchor,
  EngineRawUnreadMessageCountsItem, EngineRawMessageHistorySavedMessages
  IndexView, EngineRawChatInterfaceStateView, EngineRawOrderedItemList
  View, EngineRawMessageHistoryThreadIndexView, EngineRawCombinedRead
  StateView, EngineRawMessageHistoryThreadInfoView, EngineRawBasicPeer
  View, EngineRawCachedPeerDataView, EngineMessageHistoryThreadData,
  EngineViewUpdateType, EngineInitialMessageHistoryData,
  EnginePeerGroupId, EngineChatLocationInput, EngineHistoryViewInputTag.
- Engine data items: Peer.CachedData, ItemCollections.InstalledPackInfos,
  ItemCollections.InstalledPackIds.
- Engine facade: TelegramEngine.ItemCollections.allItems(namespace:).
- Free function: engineAreMediaArraysEqual forwarder.

Net effect: 65+ consumer modules drop "import Postbox"; 131 files
changed (+1386 / -1493). Build green at HEAD.
2026-05-07 07:36:30 +02:00

147 lines
3.7 KiB
Swift

import Foundation
import SwiftSignalKit
import Postbox
public final class TelegramEngine {
public let account: Account
public init(account: Account) {
self.account = account
}
public lazy var secureId: SecureId = {
return SecureId(account: self.account)
}()
public lazy var peersNearby: PeersNearby = {
return PeersNearby(account: self.account)
}()
public lazy var payments: Payments = {
return Payments(account: self.account)
}()
public lazy var peers: Peers = {
return Peers(account: self.account)
}()
public lazy var auth: Auth = {
return Auth(account: self.account)
}()
public lazy var accountData: AccountData = {
return AccountData(account: self.account)
}()
public lazy var stickers: Stickers = {
return Stickers(account: self.account)
}()
public lazy var localization: Localization = {
return Localization(account: self.account)
}()
public lazy var themes: Themes = {
return Themes(account: self.account)
}()
public lazy var messages: Messages = {
return Messages(account: self.account)
}()
public lazy var privacy: Privacy = {
return Privacy(account: self.account)
}()
public lazy var calls: Calls = {
return Calls(account: self.account)
}()
public lazy var historyImport: HistoryImport = {
return HistoryImport(postbox: self.account.postbox, network: self.account.network)
}()
public lazy var contacts: Contacts = {
return Contacts(account: self.account)
}()
public lazy var resources: Resources = {
return Resources(account: self.account)
}()
public lazy var resolve: Resolve = {
return Resolve(account: self.account)
}()
public lazy var data: EngineData = {
return EngineData(accountPeerId: self.account.peerId, postbox: self.account.postbox)
}()
public lazy var orderedLists: OrderedLists = {
return OrderedLists(account: self.account)
}()
public lazy var itemCollections: ItemCollections = {
return ItemCollections(account: self.account)
}()
public lazy var itemCache: ItemCache = {
return ItemCache(account: self.account)
}()
public lazy var notices: Notices = {
return Notices(account: self.account)
}()
public lazy var preferences: Preferences = {
return Preferences(account: self.account)
}()
}
public final class TelegramEngineUnauthorized {
public let account: UnauthorizedAccount
public init(account: UnauthorizedAccount) {
self.account = account
}
public lazy var auth: Auth = {
return Auth(account: self.account)
}()
public lazy var localization: Localization = {
return Localization(account: self.account)
}()
public lazy var payments: Payments = {
return Payments(account: self.account)
}()
public lazy var resources: UnauthorizedResources = {
return UnauthorizedResources(account: self.account)
}()
public lazy var itemCache: ItemCache = {
return ItemCache(account: self.account)
}()
}
public extension TelegramEngineUnauthorized {
final class UnauthorizedResources {
private let account: UnauthorizedAccount
init(account: UnauthorizedAccount) {
self.account = account
}
public func storeResourceData(id: EngineMediaResource.Id, data: Data, synchronous: Bool = false) {
self.account.postbox.mediaBox.storeResourceData(MediaResourceId(id.stringRepresentation), data: data, synchronous: synchronous)
}
}
}
public enum SomeTelegramEngine {
case unauthorized(TelegramEngineUnauthorized)
case authorized(TelegramEngine)
}