Telegram-iOS/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoInteraction.swift
isaac d1aa0db537 Postbox -> TelegramEngine waves 46-93 (squashed)
Squash of 63 commits spanning waves 46-93 (plus interspersed docs commits)
of the gradual Postbox->TelegramEngine consumer-side migration.

Scope: 139 files changed, 2123 insertions(+), 452 deletions(-).

## Themes by wave-block

**Waves 46-58 — Peer field migrations + facade additions**
Foundational EnginePeer convenience init additions (PeerReference, RenderedPeer,
SelectivePrivacyPeer). Multiple `peer: Peer` field migrations across PeerInfo,
ChatList, and SettingsUI components.

**Waves 59-73 — peer field cascade + EnginePeer wrap drops**
Series of single- to two-file peer-field migrations; consumer-side wrap
removal (`EnginePeer(peer)` -> direct EnginePeer use); `as? TelegramUser`
cast conversion to `case let .user(...)` enum match. Wave 64: RenderedPeer
convenience init. Wave 68: SelectivePrivacyPeer convenience init.

**Waves 74-83 — controller-Node bridge cleanup + small migrations**
Wave-71 shadow-pattern cleanup at controller->Node bridges. Migrations of
ChatRecentActionsController.peer (74), PeerInfoMember (75), MentionChatInputPanelItem
(76), PassportUI SecureIdAuthController (77), AccountWithInfo + ShareController
(78), peerInputActivitiesPromise (79), InactiveChannel (80), BlockedPeers (81),
openHashtag resolveSignal (82), NotificationExceptionsList (83).

**Waves 84-90 — TelegramEngine.Resources facade migrations**
Per-method Shape-A/B sweeps converting `<ctx>.account.postbox.mediaBox.X(...)`
to `<ctx>.engine.resources.X(...)`. Wave 90 was a single-commit big sweep:
40 fetchedMediaResource sites in 25 files migrated to engine.resources.fetch
facade in one atomic pass with first-pass-clean build.

Methods covered: storeResourceData, completedResourcePath, cancelInteractiveResourceFetch,
resourceRangesStatus, resourceStatus, fetch (fetchedMediaResource).

**Waves 91-92 — additional type migrations**
Wave 91: ItemListWebsiteItem.peer + RecentSessionsController enum-case payload
+ openWebSession callback Peer? -> EnginePeer?.
Wave 92: ChatListController StateHolder.EntryContext status type
MediaResourceStatus -> EngineMediaResource.FetchStatus.

**Wave 93 — speculative `import Postbox` drop sweep**
Drop import from 7 wave-touched files where it became unused; restore in 5
files where bare PeerId/Message/MediaId/StoryId references escaped the
pre-flight regex. Includes one MediaId(...) -> EngineMedia.Id(...) swap in
InAppPurchaseManager to unlock its import drop.

## Build state

Final state at squash: clean Telegram/Telegram build at debug_sim_arm64.

## Persistent-state notes

- Pre-existing WIP unchanged across the squashed range:
  - build-system/bazel-rules/sourcekit-bazel-bsp submodule marker
  - Untracked: build-system/tulsi/, submodules/TgVoip/, third-party/libx264/

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 20:48:15 +04:00

244 lines
12 KiB
Swift

import Foundation
import UIKit
import Display
import AsyncDisplayKit
import TelegramCore
import Postbox
import SwiftSignalKit
import AccountContext
import StatisticsUI
final class PeerInfoInteraction {
let openChat: (EnginePeer.Id?) -> Void
let openUsername: (String, Bool, Promise<Bool>?) -> Void
let openPhone: (String, ASDisplayNode, ContextGesture?, Promise<Bool>?) -> Void
let editingOpenNotificationSettings: () -> Void
let editingOpenSoundSettings: () -> Void
let editingToggleShowMessageText: (Bool) -> Void
let requestDeleteContact: () -> Void
let suggestBirthdate: () -> Void
let suggestPhoto: () -> Void
let setCustomPhoto: () -> Void
let resetCustomPhoto: () -> Void
let openAddContact: () -> Void
let updateBlocked: (Bool) -> Void
let openReport: (PeerInfoReportType) -> Void
let openShareBot: () -> Void
let openAddBotToGroup: () -> Void
let performBotCommand: (PeerInfoBotCommand) -> Void
let editingOpenPublicLinkSetup: () -> Void
let editingOpenNameColorSetup: () -> Void
let editingOpenInviteLinksSetup: () -> Void
let editingOpenDiscussionGroupSetup: () -> Void
let editingOpenPostSuggestionsSetup: () -> Void
let editingOpenRevenue: () -> Void
let editingOpenStars: () -> Void
let openParticipantsSection: (PeerInfoParticipantsSection) -> Void
let openRecentActions: () -> Void
let openChannelMessages: () -> Void
let openStats: (ChannelStatsSection) -> Void
let editingOpenPreHistorySetup: () -> Void
let editingOpenAutoremoveMesages: () -> Void
let openPermissions: () -> Void
let openLocation: () -> Void
let editingOpenSetupLocation: () -> Void
let openPeerInfo: (EnginePeer, Bool) -> Void
let performMemberAction: (PeerInfoMember, PeerInfoMemberAction) -> Void
let openPeerInfoContextMenu: (PeerInfoContextSubject, ASDisplayNode, CGRect?) -> Void
let performBioLinkAction: (TextLinkItemActionType, TextLinkItem) -> Void
let requestLayout: (Bool) -> Void
let openEncryptionKey: () -> Void
let openSettings: (PeerInfoSettingsSection) -> Void
let openPaymentMethod: () -> Void
let switchToAccount: (AccountRecordId) -> Void
let logoutAccount: (AccountRecordId) -> Void
let accountContextMenu: (AccountRecordId, ASDisplayNode, ContextGesture?) -> Void
let updateBio: (String) -> Void
let updateNote: (NSAttributedString) -> Void
let openDeletePeer: () -> Void
let openFaq: (String?) -> Void
let openAddMember: () -> Void
let openQrCode: () -> Void
let editingOpenReactionsSetup: () -> Void
let dismissInput: () -> Void
let openForumSettings: () -> Void
let displayTopicsLimited: (TopicsLimitedReason) -> Void
let openPeerMention: (String, ChatControllerInteractionNavigateToPeer) -> Void
let openBotApp: (AttachMenuBot) -> Void
let openEditing: () -> Void
let updateBirthdate: (TelegramBirthday??) -> Void
let updateIsEditingBirthdate: (Bool) -> Void
let openBioPrivacy: () -> Void
let openBirthdatePrivacy: () -> Void
let openPremiumGift: () -> Void
let editingOpenPersonalChannel: () -> Void
let openUsernameContextMenu: (ASDisplayNode, ContextGesture?) -> Void
let openBioContextMenu: (ASDisplayNode, ContextGesture?) -> Void
let openNoteContextMenu: (ASDisplayNode, ContextGesture?) -> Void
let openWorkingHoursContextMenu: (ASDisplayNode, ContextGesture?) -> Void
let openBusinessLocationContextMenu: (ASDisplayNode, ContextGesture?) -> Void
let openBirthdayContextMenu: (ASDisplayNode, ContextGesture?) -> Void
let openMemberContextMenu: (PeerInfoMember, ASDisplayNode, ContextGesture?) -> Void
let editingOpenAffiliateProgram: () -> Void
let editingOpenVerifyAccounts: () -> Void
let editingToggleAutoTranslate: (Bool) -> Void
let displayAutoTranslateLocked: () -> Void
let editingOpenBusinessChatBots: () -> Void
let getController: () -> ViewController?
init(
openUsername: @escaping (String, Bool, Promise<Bool>?) -> Void,
openPhone: @escaping (String, ASDisplayNode, ContextGesture?, Promise<Bool>?) -> Void,
editingOpenNotificationSettings: @escaping () -> Void,
editingOpenSoundSettings: @escaping () -> Void,
editingToggleShowMessageText: @escaping (Bool) -> Void,
requestDeleteContact: @escaping () -> Void,
suggestBirthdate: @escaping () -> Void,
suggestPhoto: @escaping () -> Void,
setCustomPhoto: @escaping () -> Void,
resetCustomPhoto: @escaping () -> Void,
openChat: @escaping (EnginePeer.Id?) -> Void,
openAddContact: @escaping () -> Void,
updateBlocked: @escaping (Bool) -> Void,
openReport: @escaping (PeerInfoReportType) -> Void,
openShareBot: @escaping () -> Void,
openAddBotToGroup: @escaping () -> Void,
performBotCommand: @escaping (PeerInfoBotCommand) -> Void,
editingOpenPublicLinkSetup: @escaping () -> Void,
editingOpenNameColorSetup: @escaping () -> Void,
editingOpenInviteLinksSetup: @escaping () -> Void,
editingOpenDiscussionGroupSetup: @escaping () -> Void,
editingOpenPostSuggestionsSetup: @escaping () -> Void,
editingOpenRevenue: @escaping () -> Void,
editingOpenStars: @escaping () -> Void,
openParticipantsSection: @escaping (PeerInfoParticipantsSection) -> Void,
openRecentActions: @escaping () -> Void,
openChannelMessages: @escaping () -> Void,
openStats: @escaping (ChannelStatsSection) -> Void,
editingOpenPreHistorySetup: @escaping () -> Void,
editingOpenAutoremoveMesages: @escaping () -> Void,
openPermissions: @escaping () -> Void,
openLocation: @escaping () -> Void,
editingOpenSetupLocation: @escaping () -> Void,
openPeerInfo: @escaping (EnginePeer, Bool) -> Void,
performMemberAction: @escaping (PeerInfoMember, PeerInfoMemberAction) -> Void,
openPeerInfoContextMenu: @escaping (PeerInfoContextSubject, ASDisplayNode, CGRect?) -> Void,
performBioLinkAction: @escaping (TextLinkItemActionType, TextLinkItem) -> Void,
requestLayout: @escaping (Bool) -> Void,
openEncryptionKey: @escaping () -> Void,
openSettings: @escaping (PeerInfoSettingsSection) -> Void,
openPaymentMethod: @escaping () -> Void,
switchToAccount: @escaping (AccountRecordId) -> Void,
logoutAccount: @escaping (AccountRecordId) -> Void,
accountContextMenu: @escaping (AccountRecordId, ASDisplayNode, ContextGesture?) -> Void,
updateBio: @escaping (String) -> Void,
updateNote: @escaping (NSAttributedString) -> Void,
openDeletePeer: @escaping () -> Void,
openFaq: @escaping (String?) -> Void,
openAddMember: @escaping () -> Void,
openQrCode: @escaping () -> Void,
editingOpenReactionsSetup: @escaping () -> Void,
dismissInput: @escaping () -> Void,
openForumSettings: @escaping () -> Void,
displayTopicsLimited: @escaping (TopicsLimitedReason) -> Void,
openPeerMention: @escaping (String, ChatControllerInteractionNavigateToPeer) -> Void,
openBotApp: @escaping (AttachMenuBot) -> Void,
openEditing: @escaping () -> Void,
updateBirthdate: @escaping (TelegramBirthday??) -> Void,
updateIsEditingBirthdate: @escaping (Bool) -> Void,
openBioPrivacy: @escaping () -> Void,
openBirthdatePrivacy: @escaping () -> Void,
openPremiumGift: @escaping () -> Void,
editingOpenPersonalChannel: @escaping () -> Void,
openUsernameContextMenu: @escaping (ASDisplayNode, ContextGesture?) -> Void,
openBioContextMenu: @escaping (ASDisplayNode, ContextGesture?) -> Void,
openNoteContextMenu: @escaping (ASDisplayNode, ContextGesture?) -> Void,
openWorkingHoursContextMenu: @escaping (ASDisplayNode, ContextGesture?) -> Void,
openBusinessLocationContextMenu: @escaping (ASDisplayNode, ContextGesture?) -> Void,
openBirthdayContextMenu: @escaping (ASDisplayNode, ContextGesture?) -> Void,
openMemberContextMenu: @escaping (PeerInfoMember, ASDisplayNode, ContextGesture?) -> Void,
editingOpenAffiliateProgram: @escaping () -> Void,
editingOpenVerifyAccounts: @escaping () -> Void,
editingToggleAutoTranslate: @escaping (Bool) -> Void,
displayAutoTranslateLocked: @escaping () -> Void,
editingOpenBusinessChatBots: @escaping () -> Void,
getController: @escaping () -> ViewController?
) {
self.openUsername = openUsername
self.openPhone = openPhone
self.editingOpenNotificationSettings = editingOpenNotificationSettings
self.editingOpenSoundSettings = editingOpenSoundSettings
self.editingToggleShowMessageText = editingToggleShowMessageText
self.requestDeleteContact = requestDeleteContact
self.suggestBirthdate = suggestBirthdate
self.suggestPhoto = suggestPhoto
self.setCustomPhoto = setCustomPhoto
self.resetCustomPhoto = resetCustomPhoto
self.openChat = openChat
self.openAddContact = openAddContact
self.updateBlocked = updateBlocked
self.openReport = openReport
self.openShareBot = openShareBot
self.openAddBotToGroup = openAddBotToGroup
self.performBotCommand = performBotCommand
self.editingOpenPublicLinkSetup = editingOpenPublicLinkSetup
self.editingOpenNameColorSetup = editingOpenNameColorSetup
self.editingOpenInviteLinksSetup = editingOpenInviteLinksSetup
self.editingOpenDiscussionGroupSetup = editingOpenDiscussionGroupSetup
self.editingOpenPostSuggestionsSetup = editingOpenPostSuggestionsSetup
self.editingOpenRevenue = editingOpenRevenue
self.editingOpenStars = editingOpenStars
self.openParticipantsSection = openParticipantsSection
self.openRecentActions = openRecentActions
self.openChannelMessages = openChannelMessages
self.openStats = openStats
self.editingOpenPreHistorySetup = editingOpenPreHistorySetup
self.editingOpenAutoremoveMesages = editingOpenAutoremoveMesages
self.openPermissions = openPermissions
self.openLocation = openLocation
self.editingOpenSetupLocation = editingOpenSetupLocation
self.openPeerInfo = openPeerInfo
self.performMemberAction = performMemberAction
self.openPeerInfoContextMenu = openPeerInfoContextMenu
self.performBioLinkAction = performBioLinkAction
self.requestLayout = requestLayout
self.openEncryptionKey = openEncryptionKey
self.openSettings = openSettings
self.openPaymentMethod = openPaymentMethod
self.switchToAccount = switchToAccount
self.logoutAccount = logoutAccount
self.accountContextMenu = accountContextMenu
self.updateBio = updateBio
self.updateNote = updateNote
self.openDeletePeer = openDeletePeer
self.openFaq = openFaq
self.openAddMember = openAddMember
self.openQrCode = openQrCode
self.editingOpenReactionsSetup = editingOpenReactionsSetup
self.dismissInput = dismissInput
self.openForumSettings = openForumSettings
self.displayTopicsLimited = displayTopicsLimited
self.openPeerMention = openPeerMention
self.openBotApp = openBotApp
self.openEditing = openEditing
self.updateBirthdate = updateBirthdate
self.updateIsEditingBirthdate = updateIsEditingBirthdate
self.openBioPrivacy = openBioPrivacy
self.openBirthdatePrivacy = openBirthdatePrivacy
self.openPremiumGift = openPremiumGift
self.editingOpenPersonalChannel = editingOpenPersonalChannel
self.openUsernameContextMenu = openUsernameContextMenu
self.openBioContextMenu = openBioContextMenu
self.openNoteContextMenu = openNoteContextMenu
self.openWorkingHoursContextMenu = openWorkingHoursContextMenu
self.openBusinessLocationContextMenu = openBusinessLocationContextMenu
self.openBirthdayContextMenu = openBirthdayContextMenu
self.openMemberContextMenu = openMemberContextMenu
self.editingOpenAffiliateProgram = editingOpenAffiliateProgram
self.editingOpenVerifyAccounts = editingOpenVerifyAccounts
self.editingToggleAutoTranslate = editingToggleAutoTranslate
self.displayAutoTranslateLocked = displayAutoTranslateLocked
self.editingOpenBusinessChatBots = editingOpenBusinessChatBots
self.getController = getController
}
}