fix(auth,ios): allow firebase_auth to compile under APPLICATION_EXTENSION_API_ONLY#18236
Conversation
Using Gemini Code AssistThe 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
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 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. |
|
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. |
…SION_API_ONLY Fixes firebase#18232. Wraps the four call sites in FLTFirebaseAuthPlugin.m that reference APIs unavailable to app extensions: - -[FlutterPluginRegistrar addApplicationDelegate:] in +registerWithRegistrar: (line 156) - +[UIApplication sharedApplication].connectedScenes (lines 904, 914) - +[[UIApplication sharedApplication] keyWindow] fallback (line 926) The first is gated with #if !TARGET_OS_EXTENSION. The presentationAnchorForAuthorizationController: method already had TARGET_OS_OSX branching; this adds an extension branch that returns nil. Sign-in flows that require a presentation anchor cannot run from an extension context, so this method is not expected to be invoked there. Pre-extension behaviour is unchanged on iOS and macOS host targets.
12cca69 to
07b82ea
Compare
|
@googlebot I signed it! |
Fixes #18232.
What's wrong
When
firebase_authis built into an iOS target withAPPLICATION_EXTENSION_API_ONLY=YES(Share Extension, Action Extension, etc.), Xcode rejects four call sites inFLTFirebaseAuthPlugin.m:The current workaround — setting
APPLICATION_EXTENSION_API_ONLY = NOon the firebase_auth pod via a Podfile post-install hook — lets the build pass, but the resulting extension binary contains references to APIs that App Store review can flag.Fix
Wrap the four sites in
#if !TARGET_OS_EXTENSION:[registrar addApplicationDelegate:instance]in+registerWithRegistrar:is gated; in extensions there is no application delegate to register against, so the openURL / scene-delegate paths below it are unreachable anyway.presentationAnchorForAuthorizationController:method already branched onTARGET_OS_OSX; this PR splits the iOS branch into!TARGET_OS_EXTENSION(existing UIScene/keyWindow logic) and a fallback that returnsnil. Sign-in flows that need a presentation anchor cannot run from an extension context — the host app is the only place that can present them — so the method is not expected to be invoked from an extension build.iOS and macOS host-app behaviour is unchanged.
Test plan
FLTFirebaseAuthPlugin.register(with:)withAPPLICATION_EXTENSION_API_ONLY=YES— confirm clean compile, no "not available on iOS (App Extension)" diagnostics.presentationAnchorForAuthorizationController:still returns the macOS key window.I have not yet run all of these locally; opening as a draft so a maintainer or CI can validate the full matrix before this is marked ready.
Notes
.mfile atpackages/firebase_auth/firebase_auth/macos/firebase_auth/Sources/firebase_auth/FLTFirebaseAuthPlugin.mis a symlink to the iOS source, so this single edit covers both platforms.CHANGELOG.mdsince flutterfire generates changelog entries from conventional commit subjects at release time via melos.