Skip to content

Dismissing navigation stack while Droar is open results in Droar being stuck open #34

@Alarson93

Description

@Alarson93

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.

  1. We should change how isVisible is 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.
  2. Create more explicit show and dismiss functions. They should not be dependent on any UI state. Just set the VC offset to a reasonable value. Maybe even renamed them to open and close. Toggle should execute these functions based on UI state.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions