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

@ -79,8 +79,7 @@ private struct ChatListSearchRecentPeersEntry: Comparable, Identifiable {
func item(
accountPeerId: EnginePeer.Id,
postbox: Postbox,
network: Network,
stateManager: AccountStateManager,
energyUsageSettings: EnergyUsageSettings,
contentSettings: ContentSettings,
animationCache: AnimationCache,
@ -96,8 +95,7 @@ private struct ChatListSearchRecentPeersEntry: Comparable, Identifiable {
strings: self.strings,
mode: mode,
accountPeerId: accountPeerId,
postbox: postbox,
network: network,
stateManager: stateManager,
energyUsageSettings: energyUsageSettings,
contentSettings: contentSettings,
animationCache: animationCache,
@ -126,8 +124,7 @@ private struct ChatListSearchRecentNodeTransition {
private func preparedRecentPeersTransition(
accountPeerId: EnginePeer.Id,
postbox: Postbox,
network: Network,
stateManager: AccountStateManager,
energyUsageSettings: EnergyUsageSettings,
contentSettings: ContentSettings,
animationCache: AnimationCache,
@ -148,8 +145,7 @@ private func preparedRecentPeersTransition(
let deletions = deleteIndices.map { ListViewDeleteItem(index: $0, directionHint: nil) }
let insertions = indicesAndItems.map { ListViewInsertItem(index: $0.0, previousIndex: $0.2, item: $0.1.item(
accountPeerId: accountPeerId,
postbox: postbox,
network: network,
stateManager: stateManager,
energyUsageSettings: energyUsageSettings,
contentSettings: contentSettings,
animationCache: animationCache,
@ -162,8 +158,7 @@ private func preparedRecentPeersTransition(
), directionHint: .Down) }
let updates = updateIndices.map { ListViewUpdateItem(index: $0.0, previousIndex: $0.2, item: $0.1.item(
accountPeerId: accountPeerId,
postbox: postbox,
network: network,
stateManager: stateManager,
energyUsageSettings: energyUsageSettings,
contentSettings: contentSettings,
animationCache: animationCache,
@ -204,8 +199,7 @@ public final class ChatListSearchRecentPeersNode: ASDisplayNode {
public init(
accountPeerId: EnginePeer.Id,
postbox: Postbox,
network: Network,
stateManager: AccountStateManager,
energyUsageSettings: EnergyUsageSettings,
contentSettings: ContentSettings,
animationCache: AnimationCache,
@ -238,7 +232,7 @@ public final class ChatListSearchRecentPeersNode: ASDisplayNode {
let peersDisposable = DisposableSet()
let recent: Signal<([EnginePeer], [EnginePeer.Id: (Int32, Bool)], [EnginePeer.Id : EnginePeer.Presence]), NoError> = _internal_recentPeers(accountPeerId: accountPeerId, postbox: postbox)
let recent: Signal<([EnginePeer], [EnginePeer.Id: (Int32, Bool)], [EnginePeer.Id : EnginePeer.Presence]), NoError> = _internal_recentPeers(accountPeerId: accountPeerId, postbox: stateManager.postbox)
|> filter { value -> Bool in
switch value {
case .disabled:
@ -256,11 +250,11 @@ public final class ChatListSearchRecentPeersNode: ASDisplayNode {
peers.filter {
!$0.isDeleted
}.map {
postbox.peerView(id: $0.id)
stateManager.postbox.peerView(id: $0.id)
}
)
|> mapToSignal { peerViews -> Signal<([EnginePeer], [EnginePeer.Id: (Int32, Bool)], [EnginePeer.Id: EnginePeer.Presence]), NoError> in
return postbox.combinedView(keys: peerViews.map { item -> PostboxViewKey in
return stateManager.postbox.combinedView(keys: peerViews.map { item -> PostboxViewKey in
let key = PostboxViewKey.unreadCounts(items: [UnreadMessageCountsItem.peer(id: item.peerId, handleThreads: true)])
return key
})
@ -324,8 +318,7 @@ public final class ChatListSearchRecentPeersNode: ASDisplayNode {
let transition = preparedRecentPeersTransition(
accountPeerId: accountPeerId,
postbox: postbox,
network: network,
stateManager: stateManager,
energyUsageSettings: energyUsageSettings,
contentSettings: contentSettings,
animationCache: animationCache,
@ -345,7 +338,7 @@ public final class ChatListSearchRecentPeersNode: ASDisplayNode {
}
}))
if case .actionSheet = mode {
peersDisposable.add(_internal_managedUpdatedRecentPeers(accountPeerId: accountPeerId, postbox: postbox, network: network).startStrict())
peersDisposable.add(_internal_managedUpdatedRecentPeers(accountPeerId: accountPeerId, postbox: stateManager.postbox, network: stateManager.network).startStrict())
}
self.disposable.set(peersDisposable)
}