isaac
0050cc7a08
Rich-message media in gallery/shared-media/preview pipelines via Message.effectiveMedia
...
Add Message/EngineMessage.effectiveMedia (= message.media when non-empty, else
richText.instantPage.allMedia()) and route the media-consuming sites through it
so a rich message's instant-page media participates in the same pipelines as
normal message.media: shared-media grids/file-rows, search media grid, gallery
open + item nodes + footer, the peer audio/voice playlist, secret-media preview,
resource-by-id resolution, recent downloads, downloaded-media store, delete-time
resource cleanup, cache-usage stats, the in-chat download manager, and the
context-menu / share actions (Save to Camera Roll, copy image, save audio/music
to files). For normal messages effectiveMedia == message.media, so each swap is
behavior-preserving; rich messages render their own bubble via
ChatMessageRichDataBubbleContentNode (not the text/file bubbles), so those paths
are deliberately untouched, as are the forward path (the attribute travels with
the forward) and the markdown-based rich-edit path. First-media scope for now.
See docs/instantpage-richtext.md for the full architecture + invariants.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-04 23:46:56 +02:00
Ilya Laktyushin
ec8bd9acdd
Various improvements
2026-06-04 01:44:36 +02:00
Ilya Laktyushin
622f9d970a
Various fixes
2026-05-31 17:35:32 +02:00
Ilya Laktyushin
3e6363abf9
Various improvements
2026-05-28 16:50:05 +02:00
Ilya Laktyushin
91eb779ae2
Merge commit ' c64653ed37'
2026-05-14 12:45:26 +02:00
isaac
69bfc65da7
Postbox refactor waves 138–276: 168-commit squash
...
Consolidates 137 wave commits + 31 supporting commits (CLAUDE.md bump,
typealias additions, AnyObject→EngineMedia restoration) into one squashed
commit. Migrates dozens of consumer-side public APIs, struct fields,
protocol methods, and enum payloads from Postbox protocols/structs to
TelegramEngine engine wrappers and typealiases. Drops `import Postbox`
from many files. Adds new TelegramCore typealiases and one
TelegramEngineUnauthorized facade.
Notable changes by category:
**TelegramCore typealias additions** (rule 2 — narrow utility typealiases):
- EngineChatListIndex, EngineTempBoxFile, EngineItemCollectionItemIndex,
EngineItemCollectionViewEntryIndex, EngineValueBoxEncryptionParameters,
EngineMessageAndThreadId, EnginePeerStoryStats, EngineMessageHistoryAnchorIndex,
EngineChatListTotalUnreadStateCategory, EngineChatListTotalUnreadStateStats,
EnginePeerSummaryCounterTags, EngineChatListTotalUnreadState,
EngineItemCacheEntryId, EngineHashFunctions,
EngineCachedMediaResourceRepresentationResult,
EngineMediaResourceDataFetchResult, EngineMediaResourceDataFetchError,
EngineMediaResourceStatus, EngineCachedPeerData
**TelegramCore engine extensions/forwarders**:
- EngineMessage.engineMedia, EngineMessage.enginePeers,
EngineMessage.adAttribute, EngineMessage.effectivelyIncoming
- engineFileSize forwarder
- TelegramEngine.Resources.clearCachedMediaResources(mediaResourceIds: Set<EngineMediaResource.Id>)
- TelegramEngine.Resources.fetchStatus(id:resourceSize:)
- TelegramEngineUnauthorized.UnauthorizedResources facade with storeResourceData
**Public API/struct migrations to engine types**:
- ChatAvailableMessageActions.banAuthor/banAuthors → EnginePeer?/[EnginePeer]
- WebSessionsContextState.peers → [EnginePeer.Id: EnginePeer]
- CacheUsageStats.peers → [EnginePeer.Id: EnginePeer]
- PeerCommand.peer → EnginePeer
- PeerInfoControllerMode.calls(messages:) → [EngineMessage]
- CallControllerNodeProtocol.updatePeer → EnginePeer params
- ChatHistoryListNode.messageInCurrentHistoryView (and 4 variants) → EngineMessage?
- ChatHistorySearchContainerNode.messageForGallery → EngineMessage?
- PeerInfoPaneNode.findLoadedMessage / ensureMessageIsVisible /
transitionNodeForGallery → engine-typed
- GalleryHiddenMediaTarget.getTransitionInfo /
GalleryHiddenMediaManager.findTarget → engine-typed
- ChatPanelInterfaceInteraction.presentReactionDeletionOptions /
presentBan*MessageOptions → EnginePeer
- DrawingMessageRenderer.messages → [EngineMessage]
- ChatVideoGalleryItemScrubberView.setFetchStatusSignal →
EngineMediaResource.FetchStatus
- ChannelDiscussionGroupActionSheetItem.peer, VoiceChatPeerEntry.peer,
VoiceChatFullscreenParticipantItem.peer, MediaStreamComponent.chatPeer,
MediaStreamVideoComponent.callPeer, ChatMessageContactBubbleContentNode.contactPeer,
ChatMessageForwardInfoNode.peer, ChatMessageCommentFooterContentNode.replyPeers,
ChatReportPeerTitlePanelNode.peer, ChatMessageActionUrlAuthController.bot,
PeerMediaCollectionInterfaceState.peer, ChatMessageCallBubbleContentNode.peopleAvatars,
ChatLoadingNode.renderedPeer (→ EngineRenderedPeer) — all to engine types
**Wave-71-shadow stored-field migrations** (Postbox Peer/Message → Engine wrapper):
- LegacyCallControllerNode.peer
- CallStatusBarNode.currentPeer
**Dead-code / dead-field removals**:
- CallController.peer, CallControllerNodeV2.account,
ContactMultiselectionController PeerNameIndex fields,
preparedChatListNodeViewTransition account: Account param,
FetchResource.swift entirely (unused function)
**Module-level Postbox import drops**: 30+ files including TelegramRootController,
EditStories, GiftViewScreen, AnimatedStickerUtils, FetchPhotoLibraryImageResource,
PeerInfoGiftsPaneNode, PeerInfoPaneContainerNode, PresentAddMembers,
PeerInfoProfileItems, ChatControllerAdminBanUsers, PresentationData typealiases,
DefaultDayPresentationTheme, ChatListViewTransition, GalleryHiddenMediaManager,
RecentSessionsController, GifContext, AuthorizationSequenceController,
PeerInfoHeaderEditingContentNode, PeerInfoHeaderNode,
PeerAllowedReactionListController, CallControllerNodeV2, and 6 PeerInfo pane files.
**AnyObject restoration**: rule 8 added (never substitute Postbox protocols
with Any/AnyObject) — undid previous AnyObject substitutions in waves 141/143
back to EngineMedia.
Doc maintenance: CLAUDE.md updated to reflect new typealiases and forwarders.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 00:44:27 +02:00
isaac
86d1456552
Postbox -> TelegramEngine waves 107-137 (squashed)
...
31 waves of consumer-side migration from `import Postbox` to TelegramEngine
typealiases. Net: 173 import drops + 39 BUILD-dep drops + 1 new typealias
(`EngineStoryId = StoryId`, wave 113).
Wave shapes used:
- Orphan-import sweeps (107, 108, 128): drop `import Postbox` from files
whose only Postbox-symbol reference was the import line itself, then
resolve build failures. Methodology requires token-level (`grep -oE`)
filtering, not line-level, to avoid masking real Postbox usage on lines
that also contain `Namespaces.X` references.
- Identifier-swap mini-waves (109-127, 129-134, 136-137): rename
Postbox-typealiased identifiers to engine equivalents
(PeerId -> EnginePeer.Id, MessageId -> EngineMessage.Id,
MediaId -> EngineMedia.Id, MessageIndex -> EngineMessage.Index,
StoryId -> EngineStoryId, ItemCollectionId -> EngineItemCollectionId,
PreferencesEntry -> EnginePreferencesEntry,
FetchResourceSourceType/Error -> EngineFetchResourceSourceType/Error,
MemoryBuffer -> EngineMemoryBuffer, MessageTags -> EngineMessage.Tags,
MessageAttribute -> EngineMessage.Attribute,
TempBox -> EngineTempBox).
- Asset-string FP-only orphans (124).
- Typealias addition + drain (113): added `EngineStoryId` typealias to
TelegramCore, then drained 3+11 consumer sites.
Hard blockers identified during these waves (must restore `import Postbox`
when present): MediaResource[A-Za-z]* (any suffix -- the literal
`MediaResource` matches don't catch MediaResourceData/MediaResourceId/etc.),
Postbox/MediaBox/MediaResource raw types, PostboxCoding/PostboxEncoder/
PostboxDecoder, TempBoxFile, ValueBoxKey, PostboxView, combinedView,
HashFunctions, postboxLog, openPostbox, declareEncodable, PeerView,
MessageHistoryView, MessageHistoryThreadData, CachedPeerData, RenderedPeer,
SelectivePrivacyPeer, SimpleDictionary, ItemCollectionInfosView,
ItemCollectionItem, ItemCollectionItemIndex, ItemCollectionViewEntryIndex,
ChatListIndex, ChatListEntrySummaryComponents, CodableEntry,
MessageHistoryThread, MessageHistoryAnchorIndex,
MessageHistoryEntryLocation, PeerStoryStats, PeerNameIndex,
PeerSummaryCounterTags, ChatListTotalUnreadStateCategory/Stats,
arePeersEqual. Protocol-shape blockers: bare `Peer`/`Message`/`Media`
in function signatures, generic args, enum-case payloads, or dict value
types (e.g., `[PeerId: Peer]`, `case messages([Message])`,
`Signal<(Peer?, ...), NoError>`).
`replace_all PeerId -> EnginePeer.Id` is dangerous: mangles compound
names like `failedPeerId`, `ContactListPeerId`, `nextRemoteMediaId`,
`replyToMessageId`. Pre-flight grep `\b[a-z][a-zA-Z]*PeerId\b` and only
replace_all if 0 matches.
Also removes unneeded design/plan docs from a separate (link-highlighting)
feature branch:
- docs/superpowers/plans/2026-05-02-link-highlighting-modern-path-fixes.md
- docs/superpowers/specs/2026-05-02-link-highlighting-modern-path-fixes-design.md
Squashed commits: 6d82c2980d..e6de5d53a3 (59 commits, including
per-wave content commits and per-wave CLAUDE.md bumps).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 10:28:50 +02:00
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
isaac
493f3103b3
Postbox -> TelegramEngine waves 37-43 + wave 44 design/plan (squashed)
...
Squashes 20 commits — the implementation and outcome commits of
waves 37 through 43 plus wave 44's spec and implementation-plan
docs — into a single commit. Per-wave lessons remain recorded in
docs/superpowers/postbox-refactor-log.md. The unrelated "Add swift
svg" commit is preserved separately outside this squash.
Wave 37 — peerTokenTitle: peer Peer → EnginePeer (1 file)
Wave 38 — canSendMessagesToPeer: peer Peer → EnginePeer (12 files)
Wave 39 — AccountContext.makePeerInfoController: peer Peer → EnginePeer (52 files)
Wave 40 — makeChatQrCodeScreen + makeChatRecentActionsController bundle (8 files)
Wave 41 — RenderedChannelParticipant.peer: Peer → EnginePeer (28 files)
Wave 42 — PeerInfoScreenData.peer: Peer? → EnginePeer? (17 files)
Wave 43 — PeerInfoScreen 6 helpers: peer Peer? → EnginePeer? (12 files)
Wave 44 — RenderedChannelParticipant.peers design doc + implementation plan
(impl and outcome land in subsequent commits, not part of squash)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 23:19:43 +04:00
isaac
8408e0ae19
Postbox -> TelegramEngine waves 27-36
...
Consumer-sweep, facade-addition, and Peer→EnginePeer migrations:
- Wave 27: preferencesView consumer sweep
- Wave 28: resourceData consumer sweep
- Wave 29: resourceStatus consumer sweep
- Wave 30: _asStatus() bridge cleanup
- Wave 31: unused-import sweep re-run
- Wave 32: resourceStatus residue sweep
- Wave 33: loadedPeerWithId consumer sweep
- Wave 34: FoundPeer.peer Peer -> EnginePeer
- Wave 35: SendAsPeer.peer Peer -> EnginePeer
- Wave 36: ContactListPeer.peer Peer -> EnginePeer
Also includes per-wave specs, implementation plans, outcome logs, and
a CLAUDE.md wave-counter update.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 11:24:13 +04:00
isaac
d78fe8e8b8
Postbox -> TelegramEngine wave 23: cancelInteractiveResourceFetch facade + consumer sweep
...
Adds TelegramEngine.Resources.cancelInteractiveResourceFetch(id:) and migrates 5 of 7 Shape-A
sites. Two sites in ChatMessageInteractiveMediaNode.swift skipped to avoid mixing with
pre-existing uncommitted WIP in that file.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 03:57:46 +04:00
isaac
53f023ea52
Postbox -> TelegramEngine wave 21: completedResourcePath facade + consumer sweep
...
Combined wave-19+wave-20 shape. Adds TelegramEngine.Resources.completedResourcePath(id:, pathExtension:)
facade and sweeps 29 consumer sites across 14 files in one atomic commit.
Shape A/B migrated. Shape C (5 sites with raw account: Account) and Shape D
(3 sites with local postbox: Postbox field) intentionally skipped — need
module-scoped init-signature rework rather than per-site sweep.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 03:19:30 +04:00
Isaac
7b2b74e79b
Postbox -> TelegramEngine wave 6: unused import Postbox batch sweep
...
First build-verified unused-import sweep: speculatively dropped
import Postbox from 782 consumer files (plain ^import Postbox$ lines,
excluding TelegramCore/Postbox/TelegramApi paths), iterated 18 full
project builds with --continueOnError, restored the import on every
file that failed to compile. 183 drops survived; 189 consumer modules
newly Postbox-free.
Bundled: spec + plan + C1 atomic batch drop + C2 CLAUDE.md outcome and
permanent methodology guidance under Wave-selection. The methodology
subsection captures the reusable playbook (--continueOnError is
essential, dependency graphs are deep so expect many iterations,
pattern-based preemptive restores accelerate convergence, and
CLAUDE.md's engine typealias cheat sheet arrows are migration targets
rather than typealiases in TelegramCore).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 23:46:13 +02:00
Isaac
4ae15b42a7
Postbox -> TelegramEngine wave 3: MediaBox fetch/status/data facades + SaveToCameraRoll
...
Adds three thin forwarding methods on TelegramEngine.Resources
(fetch, status, data) over MediaBox, then migrates SaveToCameraRoll's
three public functions to use them, drops import Postbox from the
module (source + Bazel dep), and updates all 23 call sites across 14
caller files atomically.
Bundled: spec + fix + plan + C1 facades + C2 SaveToCameraRoll rewrite
+ BUILD dep drop + CLAUDE.md outcome.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 23:45:34 +02:00
Isaac
d575824ab4
Various improvements
2026-04-10 14:30:23 +02:00
Ilya Laktyushin
5c814c503e
Live photo saving
2026-04-07 19:16:22 +02:00
Isaac
648430e37d
Various improvements
2026-04-03 22:15:42 +08:00
Isaac
16c630b946
Refactoring
2026-04-03 15:50:39 +08:00
Isaac
3e0c38c3ce
Merge commit ' 36440d6566'
2026-03-31 20:24:35 +08:00
Isaac
34477605b1
Various improvements
2026-03-31 20:24:24 +08:00
Ilya Laktyushin
7ea47b8105
Various fixes
2026-03-30 17:23:39 +02:00
Ilya Laktyushin
b3d4c97da4
Various improvements
2026-03-30 05:09:10 +02:00
Ilya Laktyushin
ca3eacda45
Various improvements
2026-03-30 04:37:05 +02:00
Ilya Laktyushin
ceceec2e94
Various fixes
2026-03-28 23:42:30 +01:00
Ilya Laktyushin
6df559ff97
Various fixes
2026-03-28 20:47:35 +01:00
Ilya Laktyushin
77cc01f0d9
Various fixes
2026-03-26 13:58:50 +01:00
Isaac
93bf472472
Text selection
2026-03-24 22:51:44 +08:00
Ilya Laktyushin
5ed2f0ad1e
Various fixes
2026-03-23 00:17:18 +01:00
Ilya Laktyushin
66d08c0e1b
Various improvements
2026-03-22 13:44:04 +01:00
Ilya Laktyushin
433237d1e9
[WIP] Polls
2026-03-20 10:15:00 +01:00
Ilya Laktyushin
b64d4a23fe
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
2026-03-16 13:42:14 +01:00
Ilya Laktyushin
a171e30532
[WIP] Polls
2026-03-14 00:07:57 +01:00
Isaac
72fbe5d7a7
Various improvements
2026-03-13 14:54:44 +01:00
Ilya Laktyushin
dca6b5f145
Various improvements
2026-03-12 13:51:27 +01:00
Ilya Laktyushin
968c577488
Reapply "Fix build"
...
This reverts commit b7312f6933 .
2026-03-11 18:51:50 +01:00
Ilya Laktyushin
94923cc353
Reapply "Update API"
...
This reverts commit 0411cfc18c .
2026-03-11 18:51:44 +01:00
Ilya Laktyushin
0411cfc18c
Revert "Update API"
...
This reverts commit 6c1376169c .
2026-03-11 18:04:50 +01:00
Ilya Laktyushin
b7312f6933
Revert "Fix build"
...
This reverts commit 2d73c0796d .
2026-03-11 18:04:45 +01:00
Ilya Laktyushin
2d73c0796d
Fix build
2026-03-11 14:48:15 +01:00
Ilya Laktyushin
6c1376169c
Update API
2026-03-11 14:37:23 +01:00
Isaac
e4e5142a96
Various improvements
2026-03-10 17:50:37 +01:00
Ilya Laktyushin
b9ba7336bb
Various fixes
2026-02-27 15:24:38 +04:00
Ilya Laktyushin
e3c84fce71
Various fixes
2026-02-27 14:34:18 +04:00
Ilya Laktyushin
8def1683b9
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
2026-02-21 13:45:36 +04:00
Ilya Laktyushin
2c4c9a9d9b
[WIP] Live photos
2026-02-20 13:28:58 +04:00
Ilya Laktyushin
d9d1210c1d
Various improvements
2026-02-19 21:53:26 +04:00
Isaac
fe8d847408
Gallery fixes
2026-02-13 18:09:56 +04:00
Isaac
157a7a978d
Glass
2026-02-13 17:08:48 +04:00
Isaac
0afb17091b
Various improvements
2026-02-09 22:55:28 +04:00
Isaac
45b1306274
Various improvements
2026-02-06 15:18:17 +04:00