Commit graph

30443 commits

Author SHA1 Message Date
isaac
50da64adfa InstantPage V2: TextView clipping inset
Design and plan, then the implementation: grow InstantPageV2TextView
frame by 4pt on each side to avoid clipping descenders and italic
overhangs.
2026-05-20 00:33:04 +08:00
isaac
c32ef046b7 InstantPage V2: implementation
Initial design, plan, scaffold, and the full incremental implementation
of InstantPage V2 used by ChatMessageRichDataBubbleContentNode: layout
data types and driver, shared text helpers, text view / divider /
anchor, lists, code blocks, block/pull quotes, media placeholders,
details (with recursion), tables, hit-test / selection / last-line
helpers, V1→V2 swap in the rich-data bubble, and post-swap fix-ups
(cache key, RTL paragraphs, list geometry, lazy pageView construction,
fitToWidth horizontal inset, V2View.update() no longer writes
self.frame).
2026-05-20 00:32:44 +08:00
isaac
cea2846249 Reveal pacing: switch to predicted-arrival algorithm
Adds the V2 reveal-pacing simulator and switches the live pacing
controller from the EWMA inter-arrival approach to a predicted-arrival
algorithm.
2026-05-20 00:32:08 +08:00
isaac
e06e154396 Rich bubble: add statusNode
Spec, plan, and implementation of the date / checks / reactions /
effects status node on ChatMessageRichDataBubbleContentNode. Hoists
layout work out of the inner closure and anchors the status frame top
at text maxY.
2026-05-20 00:30:48 +08:00
isaac
39d33d998c Fix audio route button 2026-05-20 00:30:43 +08:00
isaac
9e3c16cde5 Live typing draft reveal pacing
Smooth-pace reveal of incoming live typing drafts. Adds the design
doc, implementation plan, the EWMA inter-arrival → velocity-smoothed
cursor core, handling for text shrink / item loss, and debug logs.
2026-05-20 00:30:39 +08:00
isaac
b8ee5493d9 Postbox refactor waves 427-437: combinedView → engine.data migrations
Squashed batch of 14 consumer-side migrations from Postbox
combinedView/subscribe patterns to TelegramEngine.data.subscribe /
.get, plus two engine-data-item additions.

- Wave 427: DataAndStorageSettingsController preferences subscribe
- Wave 428: SaveIncomingMediaController inner preferences subscribe
- Wave 429: SaveIncomingMediaController top-level preferences subscribe
- Wave 430 (reverted + retried as 430-retry):
    initial TabBarChatListFilterController globalNotifications attempt
    landed and was reverted; replaced by ChatControllerContentData
    messageAndTopic collapse via additive Messages.MessageCount
    handleThreads/namespace parameter
- Wave 431: ChatControllerContentData savedMessagesPeer collapse via
    new Peer.MainPeer(id:) engine data item
- Wave 432 (+ followup): 6 messageHistoryThreadInfo sites to
    Messages.ThreadInfo
- Wave 433: ChatListController cachedPeerData → engine.data.get
- Wave 434: 8 orderedItemList sites to Collections.Featured*Packs
- Wave 435: StorageUsageExceptionsScreen preferences combinedView
- Wave 436: FeaturedStickersScreen 2 itemCollectionInfos sites
- Wave 437: extends Messages.PeerUnreadCount with handleThreads
    parameter + migrates AccountContext unreadCount site
2026-05-20 00:18:15 +08:00
Ilya Laktyushin
5fbe230308 Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios 2026-05-14 12:49:09 +02:00
Ilya Laktyushin
91eb779ae2 Merge commit 'c64653ed37' 2026-05-14 12:45:26 +02:00
isaac
c64653ed37 Bump version 2026-05-07 07:40:39 +02:00
isaac
4107263747 Postbox refactor waves 358-426
Squashed range bf01b4c..a66739c (70 commits) covering 69 waves of the
Postbox -> TelegramEngine consumer migration plus a few BUILD-dep
followups.

Notable additions to TelegramCore in this range:
- Engine typealiases: EngineRawPeerPresence, EngineRawValueBoxKey,
  EngineSimpleDictionary, EngineRawPeerView, EngineRawPostboxViewKey,
  EngineRawPreferencesView, EngineRawMessageHistoryView (+ entry/attrs/
  read-state), EngineMessageIdNamespaces, EngineHistoryViewInputAnchor,
  EngineRawUnreadMessageCountsItem, EngineRawMessageHistorySavedMessages
  IndexView, EngineRawChatInterfaceStateView, EngineRawOrderedItemList
  View, EngineRawMessageHistoryThreadIndexView, EngineRawCombinedRead
  StateView, EngineRawMessageHistoryThreadInfoView, EngineRawBasicPeer
  View, EngineRawCachedPeerDataView, EngineMessageHistoryThreadData,
  EngineViewUpdateType, EngineInitialMessageHistoryData,
  EnginePeerGroupId, EngineChatLocationInput, EngineHistoryViewInputTag.
- Engine data items: Peer.CachedData, ItemCollections.InstalledPackInfos,
  ItemCollections.InstalledPackIds.
- Engine facade: TelegramEngine.ItemCollections.allItems(namespace:).
- Free function: engineAreMediaArraysEqual forwarder.

Net effect: 65+ consumer modules drop "import Postbox"; 131 files
changed (+1386 / -1493). Build green at HEAD.
2026-05-07 07:36:30 +02:00
isaac
bf01b4c858 Postbox refactor wave 357: drop orphan //submodules/Postbox BUILD deps
Sweep 14 BUILD files whose modules no longer have any source file with
`import Postbox`. All targets are ChatMessage*BubbleContentNode subclasses
plus WallpaperPreviewMedia — modules whose Swift sources stopped importing
Postbox in earlier waves but whose BUILD deps were not cleaned up.

Pre-flight: for each `BUILD` containing `"//submodules/Postbox"`, verified
no source file under `<module>/Sources` matches `^import Postbox$`. 14
modules met the criterion.

Build: 15s warm-cache verify, 0 errors.

Modules:
- ChatMessageActionBubbleContentNode
- ChatMessageEventLogPreviousDescriptionContentNode
- ChatMessageEventLogPreviousLinkContentNode
- ChatMessageEventLogPreviousMessageContentNode
- ChatMessageFileBubbleContentNode
- ChatMessageGameBubbleContentNode
- ChatMessageInvoiceBubbleContentNode
- ChatMessageMapBubbleContentNode
- ChatMessageMediaBubbleContentNode
- ChatMessageProfilePhotoSuggestionContentNode
- ChatMessageStoryMentionContentNode
- ChatMessageWallpaperBubbleContentNode
- ChatMessageWebpageBubbleContentNode
- WallpaperPreviewMedia

Pre-wave attempt failure note: tried 5 source-side `import Postbox` drops
first (StatsMessageItem, StarsAvatarComponent, PeerListItemComponent,
WebAppMessagePreviewScreen, OpenChatMessage). All 5 hit hidden bare
`Media`/`Message`/`PeerStoryStats`/`areMediaArraysEqual` references that
the prior pre-flight regex missed. Reverted source edits; only the
risk-free BUILD-dep sweep survives in this commit.

Lesson: pre-flight regex MUST include bare Postbox protocols
`\bMedia\b`, `\bMessage\b`, `\bPeer\b`, plus the Postbox helper
`areMediaArraysEqual` and the `PeerStoryStats` type. The previous
identifier-typealias-only regex was insufficient.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 21:01:48 +02:00
isaac
71ac72d463 Upate webrtc 2026-05-05 20:32:33 +02:00
isaac
05fe27d0f7 Update tgcalls 2026-05-05 20:28:43 +02:00
isaac
3e9b0742d1 Fix custom emoji 2026-05-05 20:23:06 +02:00
isaac
05f1f19ab0 Context controller portal-view transition 2026-05-05 20:26:25 +02:00
isaac
3051b1f3e4 Add implementation plan: context controller portal-view transition
Eight-task plan covering ContextUI struct field additions,
PortalTransitionStaging helper, CCEPN animateIn/animateOut wiring,
ChatControllerNode contextTransitionContainer, two adopter sources,
and manual visual verification.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 17:26:09 +02:00
isaac
4de5eeccd2 Various improvements 2026-05-05 16:53:47 +02:00
isaac
aafe6d8dab Add implementation plan for ShimmeringMaskView
Three task plan: (1) trim ShimmeringMask BUILD deps, (2) replace stub
with full reveal-mask CAGradientLayer implementation, (3) wrap
streamingStatusTextNode in ChatMessageTextBubbleContentNode. Plus a
manual-verification task since the project has no unit-test harness.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 16:53:13 +02:00
isaac
797326d669 Add design spec for ShimmeringMaskView
Reusable view that applies a moving alpha-mask shimmer (rest=1.0,
dip=peakAlpha) to its contentView. First consumer: the streaming-status
text node in ChatMessageTextBubbleContentNode for ChatGPT-style
"thinking" effect.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 16:41:05 +02:00
isaac
f7dcf20f69 Add design spec: context controller portal-view transition
Replaces CCEPN's manual visible-area clipping with a portal-based
transition mirroring CMTN's primitive. Adds optional
sourceTransitionSurface to TakeViewInfo/PutBackInfo; chat is the
first adopter.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 16:27:20 +02:00
Ilya Laktyushin
7a7333edab Various improvements 2026-05-05 14:57:06 +02:00
isaac
e918b353ec Postbox refactor waves 278-356: squash
Squashes 79 sequential refactor waves into a single commit.

Highlights:
- Drop `import Postbox` (and matching `//submodules/Postbox` BUILD deps) from a wide swath of consumer files: ChatList, ChatMessage*BubbleContentNode subclasses, ListMessageNode/ListMessageItem, GalleryData, ChatHistorySearchContainerNode, ChatPanelInterfaceInteraction, ChatControllerInteraction, ChatMessageStickerItemNode, ChatMessageReplyInfoNode, ChatMessageInstantVideoItemNode, ChatPresentationInterfaceState, BrowserMarkdown/Readability, MediaResources, LocalMediaResources, ICloudResources, FetchManager, ShareController, OpenChatMessage, GalleryController, GroupStickerSearchContainerNode, GroupStickerPackCurrentItem, ChatPinnedMessageTitlePanelNode, OverlayAudioPlayerController, PresentationThemeSettings, StatisticsUI/StoryIconNode, TextFormat/StringWithAppliedEntities, GalleryUI/VideoAdComponent, StickerPackPreviewUI, WallpaperPreviewMedia, WallpaperResources, YoutubeEmbedImplementation, InstantPageExternalMediaResource, PlatformRestrictionMatching, TelegramUIDeclareEncodables, ChatListNode/ChatListSearchContainerNode.
- Add `TelegramEngine` facades: `Themes.wallpapers`, `Themes.themes`, `AccountData.addAppLogEvent`.
- Add `EngineMessageHistoryEntryLocation` wrapper.
- Add `EngineRaw*` escape-hatch typealiases (`EngineRawMessage`, `EngineRawPeer`, `EngineRawMedia`, `EngineRawMediaResource`, `EngineRawMediaResourceData`, `EngineRawItemCollectionItem`, `EngineRawItemCollectionInfo`) and `engineDeclareEncodable` forwarder.
- Drop unused `account:`/`postbox:`/`network:` parameters from several public functions and delete the dead overloads/types/functions left over: `automaticThemeShouldSwitchNow`, `cancelFreeMediaFileInteractiveFetch`, `legacyEnqueueVideoMessage`, `TelegramMediaFileReference`, plus assorted dead public TelegramCore/AccountContext SecureId entry points.
- Delete entire dead modules: `LegacyDataImport`, `TonBinding`, `SpotlightSupport`, `SvgRendering`, third-party `AppCenter`/`VectorPlus`/`SwiftColor`/`SwiftSVG`.
- Drop orphan `//submodules/Postbox` BUILD deps across 3 cleanup rounds.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 14:11:06 +02:00
isaac
ea0f6a685c Postbox refactor wave 277: cachedWallpaper(account:) → cachedWallpaper(engine:network:)
Migrate `cachedWallpaper(account: Account, ...)` in WallpaperCache.swift to
take `(engine: TelegramEngine, network: Network, ...)` instead of the umbrella
Account parameter. Body drops the local `let engine = TelegramEngine(account:)`
since engine is now a parameter; `account.network` is now `network`.

19 context-based callers (`account: context.account` /
`self.context.account` / `component.context.account`) update via perl
sweep to pass `engine: context.engine, network: context.account.network`.

3 internal-Account-typed callers (WallpaperResources.swift × 2,
ThemeUpdateManager.swift × 1) bridge with adhoc
`engine: TelegramEngine(account: account), network: account.network`
since they're inside functions that still take `account: Account` and have
heavier Postbox uses we can't migrate yet.

Drops `import Postbox` from WallpaperCache.swift since the only remaining
Postbox-ish identifier was `ValueBoxKey`, which swaps to `EngineDataBuffer`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 00:54:26 +02:00
isaac
ab7fc69e16 Merge commit '93244da737' 2026-05-05 00:45:32 +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
631df15f40 Refactoring 2026-05-03 10:31:22 +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
Mikhail Filimonov
93244da737 macos 2026-05-02 11:56:45 +01:00
isaac
b1aab0839c LinkHighlightingNode: ceil instead of floor for stair-step radii
drawRectsImageContent's modern path computed nextRadius and
prevRadius as min(outerRadius, floor(|Δx| * 0.5)). When |Δx| < 2
the floor produces 0 and the addArc call becomes a no-op,
leaving an unsmoothed corner at the stair-step. Replace floor
with ceil so any non-zero edge mismatch rounds up to at least
1 px. Exact-equality cases (Δx == 0) are unaffected — they take
the else branch with a straight addLine.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 11:46:38 +02:00
isaac
d1c5d66bd3 LinkHighlightingNode: fix X-edge snap unreachable after midY snap
In drawRectsImageContent's modern path the snap loop runs midY
trimming first, leaving rects[i].maxY == rects[i+1].minY for
adjacent line rects. The X-edge snap guard then evaluated
rects[i].insetBy(dx: 0.0, dy: 1.0).intersects(rects[i+1]) — but
positive dy shrinks the rect, so after the trim the guarded
rectangle no longer intersects its neighbor (CGRect.intersects
requires positive-area overlap). Flip dy to -1.0 so the temp
rect grows and touching neighbors satisfy the guard.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 11:44:05 +02:00
isaac
6e318f314e Add implementation plan: modern path link-highlighting fixes (#3, #7)
Plan covers two single-line edits in LinkHighlightingNode.swift's
modern branch (X-snap dy direction; floor → ceil for stair-step
fillet radii), each landed as its own commit, with a final
full-project build for validation since this repo has no tests.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 11:37:29 +02:00
isaac
42498cd06c Add design spec: modern path link-highlighting fixes (#3, #7)
Document the analysis and intended fixes for two bugs in
LinkHighlightingNode's modern path branch: the X-edge snap is
unreachable after the midY snap (positive dy in insetBy shrinks
rect[i] so it can't intersect the touching neighbor), and the
floor() in nextRadius/prevRadius can produce zero-radius arcs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 11:32:04 +02:00
Mikhail Filimonov
5b56675b06 Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
# Conflicts:
#	submodules/MetalEngine/Sources/MetalEngine.swift
2026-05-02 10:10:18 +01:00
Mikhail Filimonov
5b8e5e0f95 metal transaction 2026-05-02 10:07:13 +01:00
isaac
a1b37776a8 Merge commit '533a179131' 2026-05-02 10:58:57 +02:00
isaac
d5823cd5c7 Merge commit 'ffd82647ee' 2026-05-02 10:58:51 +02:00
isaac
da5a92c1be InstantPage tables: stroke all borders in one path
drawInTile previously stroked each cell's full perimeter, double-drawing
every interior gridline; visible now that the rich-data chat bubble uses
tableBorderColor at 0.25 alpha. Stroking each segment in its own
strokePath call would also have left ~1pt² overdraw at every interior
4-cell junction (where a horizontal divider crosses a vertical one) and
at every T-junction with the outer rounded rect — each strokePath
rasterizes independently and composites against the previous result.

Build a single CGMutablePath containing each cell's interior top/left
segment (skipping cells on the table's top/left boundary) plus the outer
rounded perimeter rect, and call strokePath once. CGContextStrokePath
fills the union of all stroke geometries as a single fill op, so each
pixel is painted exactly once regardless of how many segments overlap.

Empty cells (text == nil) are no longer skipped wholesale: their fill
and text remain gated on text != nil (preserves today's no-fill-for-
empty behavior), but their interior divider segments still get appended
so divider continuity is preserved around them.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 10:58:18 +02:00
isaac
ae37006ee4 Cleanup 2026-05-02 00:52:37 +02:00
isaac
6561adff94 Update tgcalls 2026-05-02 00:40:06 +02:00
isaac
972cdf0658 Rich bubble: text selection in context-preview mode
Adds drag-handle text selection driven by TextSelectionNode. Exposes
attributedString and selection helpers on InstantPage text items, and
introduces a multi-text adapter aggregating items as a TextNodeProtocol.
Gates selection actions on reply-options and fixes highlight z-order.
2026-05-02 00:36:35 +02:00
isaac
fdb2f369ec Rich bubble: scrollToAnchor + getAnchorRect
Adds a base getAnchorRect on ChatMessageBubbleContentNode, the rich-bubble
override (including titleHeight in details recursion), bubble-item
forwarding to content nodes, ChatControllerInteraction.scrollToMessageIdWithAnchor,
and a scrollToAnchor that lands the anchor at the top of the content area /
its line. Threads anchor/scroll params through ChatController and related
call sites.
2026-05-02 00:36:34 +02:00
isaac
f29af03cd7 InstantPage: underline rendering
Render underline runs in layoutTextItemWithString and position them below
the baseline rather than above the text.
2026-05-02 00:36:34 +02:00
isaac
528807a24b Spec: InstantPage table borders, stop drawing shared edges twice
Documents a two-pass refactor for InstantPageTableItem.drawInTile that
draws each interior divider exactly once (top+left of each cell that
isn't on the table boundary) plus a single rounded-rect outer-perimeter
stroke. Needed now that tableBorderColor is being made semi-transparent
(0.25 alpha) by the rich-data chat bubble; current per-cell whole-bounds
strokes overdraw shared edges.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 00:36:33 +02:00
isaac
d02019f985 Rich bubble: instant-page link handling
Adds ChatControllerInteraction dependency, link-progress state, URL tap
detection, press-highlight separation from in-flight URL shimmer, media-tap
routing through openMessage with explicit IV media subject, and gallery↔bubble
transition with hidden-media coordination. Stops re-appending to
currentLayoutItemsWithNodes across re-layouts. Drops a leftover MetalEngine
debug print as well.
2026-05-02 00:36:33 +02:00
isaac
999aac6eb3 ListView: cap pin-to-edge item visible portion at half area
When a pinToEdgeWithInset item is taller than half of the visible
area (visibleSize.height - insets.top - insets.bottom), cap its
visible portion at halfArea. The remaining height extends past
visibleSize - insets.bottom into the bottom-inset region (occluded
by overlay UI like the chat input panel).

A new private helper `pinToEdgeBottomExtension(forPinnedHeight:)`
returns max(0, pinnedHeight - halfArea). Three sites consume it:
- calculatePinToEdgeTopInset caps the pinned item's contribution
  to totalAboveAndPinned via `pinnedHeight - extension`.
- replayOperations isPinToEdgeTarget anchors the pinned item's
  apparent maxY at visibleSize - insets.bottom + extension.
- isStrictlyScrolledToPinToEdgeItem matches the new anchor.

Both isPinToEdgeTarget and isStrictlyScrolledToPinToEdgeItem fire
when either calculatePinToEdgeTopInset() > 0 OR extension > 0, so
the cap also applies when items above the pinned item overflow
the visible area (in which case calculatePinToEdgeTopInset returns
0 but extension is still positive).

When the pinned item fits within halfArea, extension == 0 and
behavior is identical to before this change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 00:36:33 +02:00
isaac
f25d0776c7 Visual improvements 2026-05-02 00:36:33 +02:00
isaac
ce5e3f4911 ReferenceImpl: reactive audio-SSRC discovery via per-receiver frame transformer
Includes spec and plan.
2026-05-02 00:36:33 +02:00
isaac
c256a9eb17 Add plan: ListView pin-to-edge half-area cap
Implementation plan for the spec from
docs/superpowers/specs/2026-05-01-listview-pin-to-edge-half-cap-design.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 00:36:32 +02:00
isaac
4c3437b575 Add spec: instant-page link handling in rich-data bubble
Wire URL tap detection, link-highlight feedback, and item-callback
routing in ChatMessageRichDataBubbleContentNode, with stubbed
intra-page anchor handling.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 00:36:32 +02:00