Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASWebAuthenticationSessionError.canceledLogin does not fire when swiping down to dismiss

I am creating an ASWebAuthenticationSession session and in the completion handler I have cleanup tasks for when the user cancel's the login:

let session = ASWebAuthenticationSession(url: url, callbackURLScheme: redirectURI) { (callbackURL: URL?, error: Error?) in
    if case .ASWebAuthenticationSessionError.canceledLogin? = error {
        // clean up tasks
    }

    // proceed...
}

In iOS 13+, the user is able to swipe down to dismiss, but the entire completion handler is not fired at all in this scenario. I do not want to disable this gesture by enabling isModalInPresentation.

Is there a way to make the ASWebAuthenticationSessionError.canceledLogin fire for this case, or how can I detect the user swiping down to cancel the ASWebAuthenticationSession session?

like image 791
TruMan1 Avatar asked Nov 06 '22 07:11

TruMan1


1 Answers

I had the same problem. I found out, that the ViewController from which the ASWebAuthenticationSession is presented from, gets a call of its dismiss() function if the user swiped down the ASWebAuthenticationSession screen. So if you want to react on this user interaction, this is the only place where this can be done as far as I know. Find out, from which ViewController the ASWebAuthenticationSession is presented from and the override its dismiss() function.

like image 176
tosi Avatar answered Nov 15 '22 07:11

tosi