Telegram-iOS/submodules/TelegramCore/Sources
isaac e7662a3de5 Add typing-draft send delay
Delay outgoing messages while the peer in the same (peerId, threadId)
chat is live-typing an incoming message, gated via a new per-account
Postbox `.allTypingDrafts` view feeding a synchronous Set membership
check inside PendingMessageManager.

Postbox:
- Add `AllTypingDraftsView` tracking `Set<PeerAndThreadId>` of active
  typing drafts; expose via `PostboxViewKey.allTypingDrafts`.
- Disambiguate `PostboxViewKey` hash arms for `.typingDrafts` (constant
  prefix 23) and `.contacts` (16 → 24) to avoid runtime collisions
  with peerId-only arms and `.combinedReadState`. Hash values are
  runtime-only, so this is safe.

PendingMessageManager:
- Add `.waitingForSendGate(groupId:content:)` parking state for single
  messages and albums whose upload finished but are gated on a
  typing-draft-clearing event; update `groupId` accessor and
  `dataForPendingMessageGroup` so partially-parked albums drain on
  gate open.
- Add `.waitingForForwardSendGate` parking state for forwards (no
  associated values) so drain section (1) routes single non-grouped
  messages via `commitSendingSingleMessage` and section (3) routes
  forwards via `sendGroupMessagesContent`, avoiding the double-dispatch
  that occurred when forwards reused `.waitingForSendGate`.
- Subscribe to `.allTypingDrafts`; wire the gate at single-message,
  album, and forward send paths and at drain.
- Cleanup parked forwards on pending-message removal; snapshot
  Dictionary keys before iterating to avoid mutation during iteration.

Specs and plan documents are included under `docs/superpowers/`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-30 12:15:55 +04:00
..
Account Update API 2026-04-28 20:35:06 +02:00
AccountManager Postbox -> TelegramEngine waves 94-102 (squashed) 2026-04-26 02:46:44 +04:00
ApiUtils Postbox -> TelegramEngine waves 46-93 (squashed) 2026-04-25 20:48:15 +04:00
MacOS Refactor constructor use sites for types 480-499 to struct pattern 2026-01-18 23:47:18 +08:00
Network Various fixes 2026-04-14 03:33:34 +02:00
PendingMessages Various fixes 2026-04-26 01:07:12 +02:00
SecretChats constTimeIsEqual 2026-02-13 18:13:26 +04:00
Settings Postbox -> TelegramEngine waves 46-93 (squashed) 2026-04-25 20:48:15 +04:00
State Add typing-draft send delay 2026-04-30 12:15:55 +04:00
Statistics Update API 2026-04-16 01:18:22 +02:00
SyncCore Update API 2026-04-28 20:35:06 +02:00
TelegramEngine Various improvements 2026-04-29 18:22:42 +02:00
Utils Various improvements 2026-04-28 14:31:17 +02:00
Authorization.swift Update API 2026-04-28 20:35:06 +02:00
ForumChannels.swift Postbox -> TelegramEngine wave 16a: move EngineMessageHistoryThread to TelegramCore 2026-04-20 21:26:32 +02:00
LoadedPeer.swift Refactor constructor use sites for types 460-479 to struct pattern 2026-01-18 23:36:22 +08:00
LoadedPeerFromMessage.swift Refactor constructor use sites for types 480-499 to struct pattern 2026-01-18 23:47:18 +08:00
SplitTest.swift
Suggestions.swift Temp 2025-12-02 19:30:48 +08:00
Themes.swift Refactor constructor use sites for types 380-399 to struct pattern 2026-01-18 22:58:30 +08:00
UpdatePeers.swift Refactor constructor use sites for types 340-359 to struct pattern 2026-01-18 22:21:57 +08:00
Wallpapers.swift Refactor constructor use sites for types 380-399 to struct pattern 2026-01-18 22:58:30 +08:00
WebpagePreview.swift Refactor constructor use sites for types 500-519 to struct pattern 2026-01-19 00:06:07 +08:00