Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Alarson93 opened this issue Aug 30, 2019 · 0 comments

Comments

@Alarson93
Copy link
Contributor

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.
@Alarson93 Alarson93 mentioned this issue Aug 30, 2019
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant