Postbox -> TelegramEngine waves 11-14: stateManager collapse + BUILD-dep sweep

Wave 11: ActionSheetPeerItem de-Postboxed. Revisits wave-1 abandonment.
`postbox: Postbox, network: Network` init params collapse to
`stateManager: AccountStateManager`; avatar setPeer call routes via
`item.stateManager.postbox` / `.network`. Module never names Postbox.
Sole caller (ShareController.swift:1146) migrated in place.

Wave 12: HorizontalPeerItem de-Postboxed (same pattern). Ripples the
collapse up into ChatListSearchRecentPeersNode's public init
(`postbox:/network:` -> `stateManager:`). That module still imports
Postbox for PostboxViewKey/UnreadMessageCountsView internals but its
public surface simplifies. 3 external caller sites migrated.

Wave 13: AttachmentTextInputPanelNode minor cleanup. Module was already
Postbox-free at source level (wave 6) but carried a dead BUILD dep and
had 2 raw `peerId?.namespace == Namespaces.Peer.SecretChat` checks.
Both now use existing `PeerId.isSecretChat` extension in TelegramCore.

Wave 14: BUILD-dep sweep mirroring wave 6's source sweep. 98 modules
had `//submodules/Postbox:Postbox` (or `//submodules/Postbox`) BUILD
deps despite no source file importing Postbox since wave 6. Single
iteration, zero restores -- Bazel Swift requires source-level `import`
for symbol resolution, so redundant BUILD deps are pure metadata.

Net: 110 files, +116/-149. Build verified green (debug_sim_arm64).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
isaac 2026-04-20 20:26:58 +02:00
parent 3716f59e7d
commit b20cd3502b
110 changed files with 116 additions and 149 deletions

View file

@ -12,7 +12,6 @@ swift_library(
deps = [
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/TelegramCore:TelegramCore",
"//submodules/Postbox:Postbox",
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
"//submodules/Display:Display",
"//submodules/TelegramPresentationData:TelegramPresentationData",

View file

@ -3,7 +3,6 @@ import UIKit
import Display
import AsyncDisplayKit
import TelegramCore
import Postbox
import SwiftSignalKit
import TelegramPresentationData
import TelegramStringFormatting
@ -27,8 +26,7 @@ public final class HorizontalPeerItem: ListViewItem {
let strings: PresentationStrings
let mode: HorizontalPeerItemMode
let accountPeerId: EnginePeer.Id
let postbox: Postbox
let network: Network
let stateManager: AccountStateManager
let energyUsageSettings: EnergyUsageSettings
let contentSettings: ContentSettings
let animationCache: AnimationCache
@ -48,8 +46,7 @@ public final class HorizontalPeerItem: ListViewItem {
strings: PresentationStrings,
mode: HorizontalPeerItemMode,
accountPeerId: EnginePeer.Id,
postbox: Postbox,
network: Network,
stateManager: AccountStateManager,
energyUsageSettings: EnergyUsageSettings,
contentSettings: ContentSettings,
animationCache: AnimationCache,
@ -67,8 +64,7 @@ public final class HorizontalPeerItem: ListViewItem {
self.strings = strings
self.mode = mode
self.accountPeerId = accountPeerId
self.postbox = postbox
self.network = network
self.stateManager = stateManager
self.energyUsageSettings = energyUsageSettings
self.contentSettings = contentSettings
self.animationCache = animationCache
@ -228,7 +224,7 @@ public final class HorizontalPeerItemNode: ListViewItemNode {
} else {
strongSelf.peerNode.compact = false
}
strongSelf.peerNode.setup(accountPeerId: item.accountPeerId, postbox: item.postbox, network: item.network, energyUsageSettings: item.energyUsageSettings, contentSettings: item.contentSettings, animationCache: item.animationCache, animationRenderer: item.animationRenderer, resolveInlineStickers: item.resolveInlineStickers, theme: item.theme, strings: item.strings, peer: EngineRenderedPeer(peer: item.peer), requiresPremiumForMessaging: false, numberOfLines: 1, synchronousLoad: synchronousLoads)
strongSelf.peerNode.setup(accountPeerId: item.accountPeerId, postbox: item.stateManager.postbox, network: item.stateManager.network, energyUsageSettings: item.energyUsageSettings, contentSettings: item.contentSettings, animationCache: item.animationCache, animationRenderer: item.animationRenderer, resolveInlineStickers: item.resolveInlineStickers, theme: item.theme, strings: item.strings, peer: EngineRenderedPeer(peer: item.peer), requiresPremiumForMessaging: false, numberOfLines: 1, synchronousLoad: synchronousLoads)
strongSelf.peerNode.frame = CGRect(origin: CGPoint(), size: itemLayout.size)
strongSelf.peerNode.updateSelection(selected: item.isPeerSelected(item.peer.id), animated: false)