-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
If I have the Droar open, but my nav stack is dismissed, then the Droar is stuck open. Droar.isVisible is false because the containerViewController no longer has a parent. (Thus - I assume the “parent” is a VC from the stack I dismissed)
I was able to work around this issue by modifying the dismissalRecognizer.
@objc private static func dismissWindow() {
// if Droar.isVisible {
toggleVisibility(nil)
// }
}
It makes me uncomfortable that I'm toggling without knowing the view state though. Considering I am dismissing 100% of the time for this function, I should call something along the lines of dismiss - not toggle.
While I would love to called dismissWindow from the Droar class, I noticed that those functions are just toggles that check isVisible state (thus they wouldn't work either.
@objc public static func showWindow(completion: (()->Void)? = nil) {
guard !isVisible else { return }
toggleVisibility(completion)
}
@objc public static func dismissWindow(completion: (()->Void)? = nil) {
guard isVisible else { return }
toggleVisibility(completion)
}
So there are a couple issues at play.
- We should change how
isVisibleis determined. It shouldn't have anything to do with a parent. It should probably be based on whether or not the Droar VC is included within the frame of the UIWindow. - Create more explicit
showanddismissfunctions. They should not be dependent on any UI state. Just set the VC offset to a reasonable value. Maybe even renamed them toopenandclose. Toggle should execute these functions based on UI state.
Metadata
Metadata
Assignees
Labels
No labels