Skip to content

Sign-in with a single provider: Cancelling is silent in iOS13+ #809

Description

@Ruberik

The issue

In iOS 13, on the iPhone 8 emulator, in Swift.

It's possible to start the sign-in for a single provider. Code is at the bottom.

The problem is that the caller apparently has no control over how the phone auth window is presented. In iOS13, it's presented on about 90% of the screen, meaning that the presenting UIViewController is still visible. If the user cancels, or dismisses the window by swiping down, neither the delegate nor the presenting UIViewController has a way of finding out that cancellation happened. Prior to iOS13, because the sign-in window occluded the original UIViewController, its viewWillAppear method would be called when the sign-in window got out of the way.

A few ideas about how to fix this:

  • On viewWillDisappear or something like it, call a method of the delegate to say "I'm done and the user didn't sign in."
  • Have the provider login UI presented full-screen instead of default.
  • Instead of the current phoneAuth.signIn(withPresenting:phoneNumber) starting the UIViewController, have an equivalent method return a UIViewController. The user can then configure the modalPresentationStyle, or add a notification such as in this SO answer (note that I don't actually know whether such notifications work or are desirable).
  • Something else I haven't thought of.

Steps to reproduce:

  1. Run the code above.
  2. Hit "cancel" or swipe down.
  3. Try to write code to detect that the sign-in window disappeared without modifying FirebaseUI.

Observed Results:

  • I can't figure out how to write code to detect that the sign-in window disappeared.

Expected Results:

  • I expected to be able to figure out how to write code to detect that the sign-in window disappeared.

Relevant Code:

    let auth = Auth.auth(app: FirebaseApp.app()!)
    let authUI = FUIAuth(uiWith: auth)!
    authUI.delegate = self
    let phoneAuth = FUIPhoneAuth(authUI: authUI)
    authUI.providers = [phoneAuth]
    phoneAuth.signIn(withPresenting: viewController, phoneNumber: nil)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions