mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-08-14 15:50:09 +00:00
Mirrors the Android/desktop fixes where iOS has the same defects, and fixes the ones that are specific to SwiftUI. Still not compiled - no Swift toolchain here, same status as the rest of the iOS port in this branch. Swallowed alert. The one-time link picker reported "the core ignored keepActiveUser" by setting its own `alert` @State, consumed by .alert(item:) on the very view that is presenting the create-profile sheet. UIKit refuses an alert on a controller that already has a presentation, so it was never shown: the active profile silently switched, the connection stayed where it was, and the user was left looking at an unchanged form. Uses the global showAlert, which targets the top view controller, as the compose picker already does. Stale picker list. The compose picker fills its own `users` in onAppear and never again, so the profile just created was missing from the list whenever the reassignment failed - tapping "Add profile" again then hit "Duplicate display name!" - and the frame height, which is computed from that count, was one row short. The local from listUsers also shadowed the property, which is what hid this. Resync failure reported as a creation failure. changeActiveUserAsync_ throws, and on the "core ignored the flag" path that propagated into the form's catch, which says "Error creating profile!" although the profile had been created. On the compose picker that path also left chatId pointing at a prepared chat that had stayed with the previous profile, i.e. at a chat absent from the list, which renders blank. Sheet owner destroyed mid-dismissal. The compose picker's sheet was attached inside profilePicker(), which is swapped out for currentSelection() the moment listExpanded flips - which changeProfile does while the sheet is still dismissing, and which an incoming event can do at any time via profileChangeProhibited. Moved to the Group in viewBody(), which survives both; stacking sheets is supported from iOS 14.5 and the app targets 15. Dismissal during creation. The submit runs in an unstructured Task that SwiftUI does not cancel, so a swipe-to-dismiss still created the profile and switched to it while every state write, including the one clearing the in-flight flag, landed on a view that was gone. Both sheets now block interactive dismissal while creating. Latched picker. If apiChangeConnectionUser returns nothing rather than throwing, profileSwitchStatus was never reset, leaving the picker dimmed behind a spinner with hit testing off. Pre-existing, but the new row routes through the same handler. Re-tappable row. switchingProfileByTimeout only latches half a second after the switch starts, and creatingProfile is cleared as soon as the switch is handed over, so the row was live in between.