TGViewer
Telegram github commits and releases Telegram github commits and releases @tgappsupdates · 4.54K subscribers
Post #20598 36
UnigramDev/Unigram/composer-typing-performance • a8f394e • 5 files, +172/-90
Give SendFilesPopup one input shape

Showing the popup before the files were typed left it with a three step
construction protocol: build it with an empty list, set Validating, then call
Probe from the caller's Loaded handler, all driven by a SendFilesAsync that
took an items/files pair where exactly one was allowed to be null. Miss a step
and you get a silently empty popup or an unguarded send, and nothing enforces
it. The two construction sites differ enough for that to be a real trap -- the
edit path passes a single already-typed item, has no guard at all, and reads
Items[0] back the moment the popup closes.

StorageMediaSource is now the only thing the popup is given. FromMedia exposes
everything through Ready; FromFiles leaves Ready empty and delivers through
LoadAsync. Count is known up front either way.

The constructor seeds Items from Ready rather than loading them, so the edit
path still has its item before the popup opens and Items[0] cannot throw, and
the popup calls LoadAsync from its own Loaded, which is a no-op when the source
is already complete. Callers can no longer forget to start it.

Two things fall out. The expected count comes from the source at construction
instead of being patched in later, so the title states the size of a drop from
the first frame. And the up-front guard loop runs over Ready, which is empty
for files, so the last of the two-flavour branching disappeared rather than
moving somewhere else.

The guard is a constructor argument instead of a settable property. The edit
path passes null, which is honest: that item's permissions were checked when it
was first sent.

SendFileExecute's media overload now takes IReadOnlyList, since IList does not
convert to it and the source needs the read-only form. Its one caller passes an
array.

The constructor's Logger.Info line enumerates ready items, so on the drop path
it would have gone blank. It records the pending count instead -- that line
ships with crash reports.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

#unigram
More from @tgappsupdates
  1. Oct 13, 2026telegramdesktop/tdesktop/dev • 5acda87 • 2 files, +10/-4 [ai] Raised the cross-review roun…
  2. Oct 13, 2026telegramdesktop/tdesktop/dev • 3c9f6ee • 1 files, +8/-8 Bump actions/download-artifact fro…
  3. Oct 13, 2026TGX-Android/Telegram-X/main • e8a46a1 • 3 files, +27/-7 Update `.gitmodules` #tgxandroid
  4. Oct 13, 2026UnigramDev/Unigram/develop • 7842fff • 5 files, +1215/-148 Group the rich editor toolbar's…
  5. Oct 13, 2026UnigramDev/Unigram/develop • c04c03a • 2 files, +53/-9 Map spell checking and collapsible…
  6. Oct 13, 2026UnigramDev/Unigram/develop • 5b57a69 • 1 files, +1/-0 Fix event unsubscribe UnigramDev/Uni…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →