Skip to content

fix(auth): retry probe when UIApplication.delegate is nil in Flutter apps#15980

Open
videjunior wants to merge 1 commit intofirebase:mainfrom
videjunior:fix/auth-notification-manager-flutter-delegate-nil
Open

fix(auth): retry probe when UIApplication.delegate is nil in Flutter apps#15980
videjunior wants to merge 1 commit intofirebase:mainfrom
videjunior:fix/auth-notification-manager-flutter-delegate-nil

Conversation

@videjunior
Copy link
Copy Markdown

@videjunior videjunior commented Mar 25, 2026

…apps

When using Firebase Phone Auth in Flutter apps, the UIApplication.delegate can be nil at the moment the notification probe fires in DispatchQueue.main.async, because FlutterAppDelegate is assigned asynchronously by the Flutter plugin system after launch.

This causes I-AUT000015 to be logged and phone auth to fail even when the AppDelegate is correctly configured with canHandleNotification.

Fix: replaced DispatchQueue.main.async with Task {} and added up to 10 retries with 300ms delay (3s total) to wait for the delegate to become available. If the delegate is not found after all retries, we signal forwarding as true since the AppDelegate was configured correctly.

Fixes:

#55

Hey there! So you want to contribute to a Firebase SDK?
Before you file this pull request, please read these guidelines:

Discussion

  • Read the contribution guidelines (CONTRIBUTING.md).
  • If this has been discussed in an issue, make sure to link to the issue here.
    If not, go file an issue about this before creating a pull request to discuss.

Testing

  • Make sure all existing tests in the repository pass after your change.
  • If you fixed a bug or added a feature, add a new test to cover your code.

API Changes

  • At this time we cannot accept changes that affect the public API. If you'd like to help
    us make Firebase APIs better, please propose your change in a feature request so that we
    can discuss it together.

…apps

When using Firebase Phone Auth in Flutter apps, the UIApplication.delegate
can be nil at the moment the notification probe fires in DispatchQueue.main.async,
because FlutterAppDelegate is assigned asynchronously by the Flutter plugin
system after launch.

This causes I-AUT000015 to be logged and phone auth to fail even when the
AppDelegate is correctly configured with canHandleNotification.

Fix: replaced DispatchQueue.main.async with Task { @mainactor } and added
up to 10 retries with 300ms delay (3s total) to wait for the delegate to
become available. If the delegate is not found after all retries, we signal
forwarding as true since the AppDelegate was configured correctly.

Fixes:

firebase#55
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

@google-cla
Copy link
Copy Markdown

google-cla bot commented Mar 25, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@ncooke3
Copy link
Copy Markdown
Member

ncooke3 commented Mar 25, 2026

Thanks for the PR, @videjunior! We can take a look when the CLA is signed.

@ncooke3
Copy link
Copy Markdown
Member

ncooke3 commented Mar 25, 2026

Also, is there a issue to reference from the Flutter repo?

@videjunior
Copy link
Copy Markdown
Author

Also, is there a issue to reference from the Flutter repo?

Yes, there is. Issue number 55 was closed due to inactivity.
#55

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

Successfully merging this pull request may close these issues.

2 participants