mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-08-09 10:09:53 +00:00
Third review pass on this flow. Four things, all in code the previous two passes touched. The one-time link picker's close(). selectProfileAsync ended with an unconditional close(), which pops whatever is on top of the start stack. The reassignment before it can wait indefinitely on the retry alert, and back is not blocked while it does - so backing out and then letting the call complete dismissed the New chat screen as well. The picker now has its own ModalViewId and only closes if it is still the top, which is what isLastModalOpenNotClosing was added for; the create-profile flow was using it and this, the older hazard, was not. The entry guard used hasModalOpen, which counts a modal that is still animating out, so re-opening the form straight after backing out of it was a silent no-op for the length of the animation - the exact bug the NotClosing variant exists for. Adds the matching hasModalOpenNotClosing. The old-core fallback switched the active user and returned without closing the form, leaving it on top of a chat list belonging to a different profile, and did it off the main thread. It now closes first and runs on Main like the rest of the flow. chatModel.chatId is no longer written after the switch. changeActiveUser_ passes keepingChatId and updateChats only clears chatId when the chat is missing from the reloaded list, so on success the write was a no-op - and in the one case the guard does fire it re-pointed the chat view at a chat that is not there. It also undid a notification tap that had navigated to another chat of the same profile, which the active-user check cannot catch. Also restores the profileChangeProhibited guard that the previous commit dropped from the new row while collapsing its click handler; keys the one-time link picker's profile list on the active user as well as the count, so the checkmark is not stale after a switch that leaves the count unchanged; dims the compose picker while it is busy, which was the only picker with no indication at all; and logs the silent abort.