Properly wait for dismissal before presenting a new view controller #5977
+5
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First time contributor checklist
Contributor checklist
Description
Potentially fixes #5976
My theory, given the error in #5976, is that because the original code failed to wait for the dismissal to complete, it would occasionally try to present a new view while an existing view was present. This caused the animation for the navigation buttons in ImageEditorCropViewController and similar image editing views to be left in a state with no bottom navigation buttons. Therefore, the user has to force quit the app in order to exit the view. I think this may stabilize that flow and prevent such situations from occurring.
ImageEditorCropViewController:
I would imagine when encountering the error
2025/02/20 00:54:25:091 ERR❤️ [AttachmentPrepViewController.swift:221 presentFullScreen(viewController:)]: Already has presented view controller. [<SignalUI.ImageEditorCropViewController: 0x127aef700>
that it possibly short circuits or resets the logic responsible for summoning the bottom buttons. I was originally fixated on the logic summoning the buttons until I noticed a seemingly correlated error with the occurrence of the bug in AttachmentPrepViewController.