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

Message opened via SwiftMessagesSegue closes by itself after 2 seconds (regression, appeared in 9.0.7) #545

Open
vitalii-tym opened this issue Mar 20, 2024 · 3 comments

Comments

@vitalii-tym
Copy link

I have SwiftMessageSegue called form the same view controller and configured literally by same code.

In one case the startReleaseMonitor() continues restarting itself each 2 seconds until user dismisses the dialog (expected behavior), but in another case it ends up in self.source.view.window being .none and hides everything (unexpectedly).

Adding segue.duration = .forever doesn't help.

The only meaningful difference in code is that the segue works properly in a scenario when it is called as a result of a button tap:

  @IBAction func updateRequestButtonTapped(_ sender: Any) {
       performSegue(withIdentifier: "openConfirmation", sender: self)
   }

While the malfunctioning scenario is when it is called from a function, which in its turn is triggered from a delegate method.

    private func createFRP() {
        performSegue(withIdentifier: "openConfirmation", sender: self)
    }
    
    extension NewFlightRequestViewController: SetRequestPreferencesDelegate {
    func createFlightRequest(with preferences: RequestPreferences?) {
        self.viewModel.setRequestPreferences(prefs: preferences)
        self.createFRP()
    }
}

I suppose it might be related to view hierarchy, because in the successful scenario it is opened modally above another modal dialog while in unsuccessful one it is opened modally above a simple view controller (having a usual navigation bar).

Important to note that it worked correctly since 2021. After rolling a few versions back I have figured out it was working fine in 9.0.6 and the issue appeared in 9.0.7.

@vitalii-tym vitalii-tym changed the title Message opened via SwiftMessagesSegue closes by itself after 2 seconds Message opened via SwiftMessagesSegue closes by itself after 2 seconds (regression, appeared in 9.0.7) Mar 20, 2024
@wtmoose
Copy link
Member

wtmoose commented Mar 20, 2024

The dismiss monitor should only auto-dismiss if the presenting view controller is removed from the view hierarchy without being properly dismissed, such as if you change the app's root view controller. This is by design. Is your presenting view controller being removed? If so, why should the presented view controller remain presented?

@vitalii-tym
Copy link
Author

Nothing changes in the view hierarchy between the moments when this message is opened and when it closes by itself.

I can see that the monitoring function was added on purpose in 0.9.7. So this could be some kind of hard-to-predict behavior in a specific context or in an edge-case scenario.

I will try to analyze and gather more information about the specifics of the context, in which I'm using this segue. Pls give me some time to analyze further.

@wtmoose
Copy link
Member

wtmoose commented Mar 20, 2024

Sure. My question for you would be, if nothing is changing, how do you explain the source view not being in a window? Any view that is being displayed must have its window property set.

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

2 participants