Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,15 @@ public class FLTFirebaseAuthPlugin: NSObject, FlutterPlugin, FLTFirebasePluginPr
open url: URL,
options: [UIApplication.OpenURLOptionsKey: Any] = [:]
) -> Bool {
Auth.auth().canHandle(url)
// Auth.auth() traps when no FirebaseApp has been configured yet (e.g. an
// app that initialises Firebase from Dart-side options after start-up).
guard FirebaseApp.app() != nil else { return false }
return Auth.auth().canHandle(url)
Comment on lines +189 to +192

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth a debug-only log here so it's visible during development that a URL got dropped because Firebase wasn't configured yet.

Suggested change
// Auth.auth() traps when no FirebaseApp has been configured yet (e.g. an
// app that initialises Firebase from Dart-side options after start-up).
guard FirebaseApp.app() != nil else { return false }
return Auth.auth().canHandle(url)
// Auth.auth() traps when no FirebaseApp has been configured yet (e.g. an
// app that initialises Firebase from Dart-side options after start-up).
guard FirebaseApp.app() != nil else {
#if DEBUG
print(
"[firebase_auth] Ignoring URL because no FirebaseApp is configured yet. " +
"Call Firebase.initializeApp() before this URL is delivered if Auth should handle it."
)
#endif
return false
}
return Auth.auth().canHandle(url)

}

public func scene(_ scene: UIScene, openURLContexts urlContexts: Set<UIOpenURLContext>) -> Bool
{
guard FirebaseApp.app() != nil else { return false }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here for consistency with the other handler.

Suggested change
guard FirebaseApp.app() != nil else { return false }
guard FirebaseApp.app() != nil else {
#if DEBUG
print(
"[firebase_auth] Ignoring URL because no FirebaseApp is configured yet. " +
"Call Firebase.initializeApp() before this URL is delivered if Auth should handle it."
)
#endif
return false
}

for urlContext in urlContexts where Auth.auth().canHandle(urlContext.url) {
return true
}
Expand Down