feat: acknowledge physical modal removal - #20
Draft
robmaceachern wants to merge 2 commits into
Draft
robmaceachern wants to merge 2 commits into
robmaceachern wants to merge 2 commits into
Conversation
Add an optional callback after a presenter's modal container and bookkeeping have been removed. Carry the latest callback through workflow rendering and defer delivery until reconciliation completes so callbacks can safely update the modal list. Retire withdrawn, unloaded presentations without loading their views. Document per-presenter forwarding semantics and the limits around unaccepted requests and presenter destruction. Add focused regression and compatibility tests without changing dismissal-request APIs. --- *This response was drafted with AI assistance.*
Cover loaded callback freshness and physical removal when a controller is requested again during an exit or pending-removal reconciliation. Document that removal is not proof that content is no longer wanted. Clarify the direct UIKit API boundary and preserve the rationale for the existing trailing presentation callback's parameter position. --- *This response was drafted with AI assistance.*
Member
Author
|
🤖 @codex review Please review head This response was drafted with AI assistance. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Add an optional
onDidRemovecallback toPresentableModalandWorkflowModals.Modalfor work that must run after a modal is physically removed. Appearance callbacks are not that boundary: they can run before detachment, or not run again when an already-disappeared presenter removes content.A presenter is the controller that owns a modal's container and decorations. The new callback reports removal of that presenter's instance, not the end of the content's lifetime everywhere.
How it works
onDidPresent, dismissal-request APIs and forwarding policy retain their existing roles.Boundaries and failures
Forwarding can remove a presentation from one host while another still presents the content, so a removal callback is not a global dismissal or cancellation signal. Requesting the same controller again during its exit does not cancel that exit: the latest callback still observes the old instance's removal, and a later update can create a new instance. Consumers should check current state or a request identifier before interpreting removal as completion of application work.
Hiding a window or cancelling an interactive dismissal does not remove the modal. Presenter destruction does not guarantee a callback. A request withdrawn before any presenter receives it has no physical instance to remove and produces no callback.
The UIKit lifetime-token API (
modalPresenter.present/ModalLifetime.dismiss) is intentionally unchanged and does not expose removal completion. UIKit integrations constructingPresentableModaldirectly can opt in; both usage guides explain this boundary.Validation
This remains a draft. CI is green on
476c81e6bc0d40b73bffbf78d1d108791f27947d. The separate automated-review request has not been acknowledged; no completed remote review is claimed.test_removalCallback_loaded_uses_latest_callback_including_nil,test_removalCallback_requested_again_during_exit_still_removes_old_instance, andtest_removalCallback_pending_removal_still_requested_is_retired.ModalPresentationViewControllerTestsfor visible/disappeared presenters, hidden windows, zero-duration transitions, latest/nil callbacks, replacement and reused controllers, interrupted entry, cancelled interaction, destruction, reentrant updates and existing trailing-closure behavior.ModalHostContainerViewControllerTests.test_removal_callback_is_local_when_forwarded_modal_moves_to_inner_hostcovers the forwarding boundary. TwoModalContainerTestscover callback propagation through mapping/type erasure, reused controllers and duplicate keys.Existing-caller compatibility: supported for the tested library scope by current-head regressions, including
test_no_leaks_on_teardown,test_should_log_on_presentation_and_dismissal,test_accessibilityViewIsModal_restored_after_nested_dismissand the trailing-closure compatibility test. The default-nil API still shares the intentional lazy-loading fix, covered bytest_withdraw_before_loading_does_not_load_or_later_attach_modal. The unacknowledged remote-review request remains a separate review-evidence gap; no merge recommendation yet.Visibility-independent removal: visible/disappeared presenter and hidden-window tests passed in public CI. These are UIKit-hosted and controlled transition tests, not OS-driven scene lifecycle qualification.
Checklist
This response was drafted with AI assistance.