Files
Narasimha-sc 7b9b8d9876 ios: save draft when another chat is opened in place
ComposeView saves the draft only in onDisappear, which does not run
when chatModel.chatId changes while ChatView stays presented - opening
a group member's direct chat, a "forwarded from" chat, or a chat from
a notification. The compose text was carried into the opened chat, and
if the user could not send messages there (observer, channel
subscriber, review by admins), the sendMsgEnabled change handler
cleared it, losing the draft.

The draft is now saved or cleared in ChatView's chatId change handler,
mirroring onDisappear, before chat is replaced - ComposeView still
renders the previous chat at that point, so its sendMsgEnabled handler
fires only after the draft is safe, and clearCurrentDraft skips it
because draftChatId no longer matches the opened chat.

Skipped: secondary (member support) chat views, which share the
group's chat id and would clobber the main chat's draft; forwarding
compose state, which is prepared for the destination chat; drafts
already prepared for the opened chat (shareChatLink); live messages
and active voice recordings, which only ComposeView can complete.
2026-07-11 16:24:36 +00:00
..