Commit graph

512 commits

Author SHA1 Message Date
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
isaac
4c5c53ec0b Disable auto parsing rich messages 2026-06-02 21:13:59 +02:00
isaac
3ed8c926a8 Custom emoji in markdown rich messages (send + round-trip)
Parse custom emoji into RichText.textCustomEmoji when sending markdown
rich messages, and round-trip them through edit, copy, and paste using a
shared tg://emoji?id=<fileId> markdown-link marker.

- Send: rewrite each customEmoji input attribute into a
  [<alt>](tg://emoji?id=<fileId>) marker before the CommonMark parse, then
  intercept the marker URL afterward to emit .textCustomEmoji. Only rich
  messages are affected; a custom emoji alone stays on the entity path.
- Reverse: InstantPageToMarkdown (whole-message copy + edit reconstruction)
  and InstantPageMultiTextAdapter (selection copy) emit the marker;
  edit-load and chat paste reattach it as a live customEmoji attribute.
- Marker helpers shared in TextFormat/CustomEmojiMarkdownMarker.swift.
- Rich sends now pass inlineStickers so recipients can fetch the files.

Follow-up to verify at runtime: recipient rendering goes out with
Api.InputRichMessage.documents: nil; if recipients see only the fallback
glyph, populate documents: in apiInputRichMessage().

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-31 17:51:37 +02:00
isaac
e1b48665a8 Auto-detect rich vs. entity markdown on send
Classify typed markdown on send: structure the message-entity set can't
represent (headings, lists, tables) is sent as a rich message
(RichTextMessageAttribute carrying an InstantPage); everything else takes
the existing entity path. Adds the parse-then-inspect classifier in
BrowserMarkdown, gates it in ChatControllerNode.sendCurrentMessage
(replacing the debugRichText flag), drops formulas/dividers as triggers,
and cleans up heading blocks for the chat path. Documented in CLAUDE.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 23:10:15 +02:00
isaac
13a153aff2 WIP 2026-05-20 00:33:08 +08:00
isaac
05f1f19ab0 Context controller portal-view transition 2026-05-05 20:26:25 +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
027ac77ad7 Various improvements 2026-04-28 16:58:04 +04:00
isaac
f5cb1391aa Merge commit '96b1432434' 2026-04-24 11:24:47 +04:00
isaac
97f8c53814 Various improvements 2026-04-24 11:24:14 +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
Ilya Laktyushin
dbd40fe7d3 Various improvements 2026-04-22 23:03:51 +02:00
Ilya Laktyushin
d88a29b378 Various improvements 2026-04-18 08:41:08 +02:00
Ilya Laktyushin
532a3ae3e1 Various fixes 2026-04-16 21:45:26 +02:00
Ilya Laktyushin
0df319742a Update API 2026-04-16 01:18:22 +02:00
Isaac
d575824ab4 Various improvements 2026-04-10 14:30:23 +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
1a728382c4 Disable AI button in secret chats 2026-04-03 13:15:06 +08:00
Isaac
337ffb691e Improvements 2026-03-28 21:31:09 +08:00
Isaac
5cc27e5d04 Fix overlay chat layout 2026-03-28 01:22:15 +08:00
Isaac
c9add89043 More ai button fixes 2026-03-27 22:33:54 +08:00
Isaac
2907ddbe46 Unseen polls 2026-03-27 18:30:01 +08:00
Isaac
a0a2f9f6bf Various improvements 2026-03-24 16:47:36 +08:00
Isaac
f437e0bd04 Text editor 2026-03-24 01:39:53 +08:00
Isaac
1a17e97a7c Temp 2026-03-23 23:37:31 +08:00
Isaac
19da3fa55a Merge commit '87409ead6c' 2026-03-23 21:33:37 +08:00
Isaac
0aac8d47ac Temp 2026-03-23 21:33:34 +08:00
Ilya Laktyushin
5ed2f0ad1e Various fixes 2026-03-23 00:17:18 +01:00
Ilya Laktyushin
6fd65e6d26 Various improvements 2026-03-22 16:53:55 +01:00
Ilya Laktyushin
66d08c0e1b Various improvements 2026-03-22 13:44:04 +01:00
Isaac
af6e5f258e Merge commit '90f110a311'
# Conflicts:
#	Telegram/Telegram-iOS/en.lproj/Localizable.strings
#	submodules/ChatPresentationInterfaceState/Sources/ChatPresentationInterfaceState.swift
2026-03-20 18:55:29 +01:00
Isaac
bc7858ad2b AI editing 2026-03-20 18:23:45 +01:00
Ilya Laktyushin
f12fb93a3e [WIP] Polls 2026-03-20 14:52:19 +01:00
Ilya Laktyushin
676f46d44d Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios 2026-03-20 12:48:12 +01:00
Ilya Laktyushin
e7a334364c [WIP] Polls 2026-03-20 12:15:27 +01:00
Ilya Laktyushin
433237d1e9 [WIP] Polls 2026-03-20 10:15:00 +01:00
Isaac
a2d5c530a5 Various improvements 2026-03-18 00:27:13 +01:00
Ilya Laktyushin
c32f645f5e [WIP] Polls 2026-03-17 16:32:49 +01:00
Ilya Laktyushin
6519b5c84d [WIP] Polls 2026-03-17 11:12:58 +01:00
Ilya Laktyushin
b1a190f87a [WIP] Polls 2026-03-16 18:07:12 +01:00
Isaac
f38fa578c6 Fixes 2026-03-13 16:02:19 +01:00
Isaac
72fbe5d7a7 Various improvements 2026-03-13 14:54:44 +01:00
Isaac
e4e5142a96 Various improvements 2026-03-10 17:50:37 +01:00
Isaac
bb23c6f653 Various improvements 2026-03-06 18:13:48 +01:00
Isaac
622ea906ef Merge commit 'e24d411efa' 2026-02-24 17:19:36 +01:00
Isaac
4d4fcdd17f Cleanup 2026-02-23 11:19:09 +01:00
Ilya Laktyushin
2c4c9a9d9b [WIP] Live photos 2026-02-20 13:28:58 +04:00
Isaac
26cc304ca0 Fix bg 2026-02-17 10:19:02 +04:00
Isaac
631d5e1b2f Additional topic fixes 2026-02-13 19:19:48 +04:00