diff --git a/submodules/ItemListPeerItem/Sources/ItemListPeerItem.swift b/submodules/ItemListPeerItem/Sources/ItemListPeerItem.swift index 0cdf4f54d0..2d999a8023 100644 --- a/submodules/ItemListPeerItem/Sources/ItemListPeerItem.swift +++ b/submodules/ItemListPeerItem/Sources/ItemListPeerItem.swift @@ -326,25 +326,22 @@ public final class ItemListPeerItem: ListViewItem, ItemListItem { public enum Context { public final class Custom { public let accountPeerId: EnginePeer.Id - public let postbox: Postbox - public let network: Network + public let engine: TelegramEngine public let animationCache: AnimationCache public let animationRenderer: MultiAnimationRenderer public let isPremiumDisabled: Bool public let resolveInlineStickers: ([Int64]) -> Signal<[Int64: TelegramMediaFile], NoError> - + public init( accountPeerId: EnginePeer.Id, - postbox: Postbox, - network: Network, + engine: TelegramEngine, animationCache: AnimationCache, animationRenderer: MultiAnimationRenderer, isPremiumDisabled: Bool, resolveInlineStickers: @escaping ([Int64]) -> Signal<[Int64: TelegramMediaFile], NoError> ) { self.accountPeerId = accountPeerId - self.postbox = postbox - self.network = network + self.engine = engine self.animationCache = animationCache self.animationRenderer = animationRenderer self.isPremiumDisabled = isPremiumDisabled @@ -364,21 +361,12 @@ public final class ItemListPeerItem: ListViewItem, ItemListItem { } } - public var postbox: Postbox { + public var engine: TelegramEngine { switch self { case let .account(context): - return context.account.postbox + return context.engine case let .custom(custom): - return custom.postbox - } - } - - public var network: Network { - switch self { - case let .account(context): - return context.account.network - case let .custom(custom): - return custom.network + return custom.engine } } @@ -1495,7 +1483,7 @@ public class ItemListPeerItemNode: ItemListRevealOptionsItemNode, ItemListItemNo } let verifiedIconComponent = EmojiStatusComponent( - postbox: item.context.postbox, + postbox: item.context.engine.account.postbox, energyUsageSettings: item.context.energyUsageSettings, resolveInlineStickers: item.context.resolveInlineStickers, animationCache: animationCache, @@ -1543,7 +1531,7 @@ public class ItemListPeerItemNode: ItemListRevealOptionsItemNode, ItemListItemNo } let credibilityIconComponent = EmojiStatusComponent( - postbox: item.context.postbox, + postbox: item.context.engine.account.postbox, energyUsageSettings: item.context.energyUsageSettings, resolveInlineStickers: item.context.resolveInlineStickers, animationCache: animationCache, @@ -1702,7 +1690,7 @@ public class ItemListPeerItemNode: ItemListRevealOptionsItemNode, ItemListItemNo } let avatarIconComponent = EmojiStatusComponent( - postbox: item.context.postbox, + postbox: item.context.engine.account.postbox, energyUsageSettings: item.context.energyUsageSettings, resolveInlineStickers: item.context.resolveInlineStickers, animationCache: item.context.animationCache, @@ -1730,8 +1718,8 @@ public class ItemListPeerItemNode: ItemListRevealOptionsItemNode, ItemListItemNo if item.peer.id == item.context.accountPeerId, case .threatSelfAsSaved = item.aliasHandling { strongSelf.avatarNode.setPeer( accountPeerId: item.context.accountPeerId, - postbox: item.context.postbox, - network: item.context.network, + postbox: item.context.engine.account.postbox, + network: item.context.engine.account.network, contentSettings: item.context.contentSettings, theme: item.presentationData.theme, peer: item.peer, @@ -1742,8 +1730,8 @@ public class ItemListPeerItemNode: ItemListRevealOptionsItemNode, ItemListItemNo } else if item.peer.id.isReplies { strongSelf.avatarNode.setPeer( accountPeerId: item.context.accountPeerId, - postbox: item.context.postbox, - network: item.context.network, + postbox: item.context.engine.account.postbox, + network: item.context.engine.account.network, contentSettings: item.context.contentSettings, theme: item.presentationData.theme, peer: item.peer, @@ -1765,8 +1753,8 @@ public class ItemListPeerItemNode: ItemListRevealOptionsItemNode, ItemListItemNo strongSelf.avatarNode.setPeer( accountPeerId: item.context.accountPeerId, - postbox: item.context.postbox, - network: item.context.network, + postbox: item.context.engine.account.postbox, + network: item.context.engine.account.network, contentSettings: item.context.contentSettings, theme: item.presentationData.theme, peer: item.peer, diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoSettingsItems.swift b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoSettingsItems.swift index 18b22f5d2d..732d19be82 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoSettingsItems.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoSettingsItems.swift @@ -120,8 +120,7 @@ func settingsItems(data: PeerInfoScreenData?, context: AccountContext, presentat for (peerAccountContext, peer, badgeCount) in settings.accountsAndPeers { let mappedContext = ItemListPeerItem.Context.custom(ItemListPeerItem.Context.Custom( accountPeerId: peerAccountContext.account.peerId, - postbox: peerAccountContext.account.postbox, - network: peerAccountContext.account.network, + engine: peerAccountContext.engine, animationCache: context.animationCache, animationRenderer: context.animationRenderer, isPremiumDisabled: false,