Skip to content

feat: register flutter-fire-ai and flutter-fire-dc platform versions and fix web late registration - #18707

Open
kevmoo wants to merge 3 commits into
firebase:mainfrom
kevmoo:fix-web-ai-dc-telemetry
Open

kevmoo wants to merge 3 commits into
firebase:mainfrom
kevmoo:fix-web-ai-dc-telemetry

Conversation

@kevmoo

@kevmoo kevmoo commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Description

Registers flutter-fire-ai (firebase_ai) and flutter-fire-dc (firebase_data_connect) with Firebase Core's platform version logger (x-firebase-client heartbeats) and fixes late library version registration on Web:

  1. firebase_core_web (FirebaseCoreWeb.registerLibraryVersion):

    • Previously, FirebaseCoreWeb.registerLibraryVersion(libraryName, version) only added the library entry to _libraryVersions, which was flushed exclusively inside _initializeCore(). Any plugin or Dart package registering its version after Firebase.initializeApp() completed was never forwarded to firebase.registerVersion(...).
    • Updated FirebaseCoreWeb.registerLibraryVersion to immediately invoke _registerVersionIfNeeded(libraryName, version) when firebase_core is already loaded in globalContext.
  2. firebase_ai (flutter-fire-ai):

    • Android: Added user-agent.gradle (LIBRARY_NAME = "flutter-fire-ai"), FlutterFirebaseAppRegistrar (ComponentRegistrar registering LibraryVersionComponent), and ComponentDiscoveryService <meta-data> in AndroidManifest.xml.
    • iOS & macOS: Added Constants.swift (versionNumber, wired into scripts/generate_versions_spm.dart) and registered "flutter-fire-ai" via FIRApp.registerLibrary(_:withVersion:) in FirebaseAIPlugin.register(with:) (since Swift does not expose C GCC_PREPROCESSOR_DEFINITIONS string macros).
    • Web: Registered 'flutter-fire-ai' with firebase_core.registerVersion on FirebaseAI initialization.
  3. firebase_data_connect (flutter-fire-dc):

    • Web: Registered 'flutter-fire-dc' with firebase_core.registerVersion on FirebaseDataConnect initialization.

Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See [Contributor Guide]).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (melos run analyze) does not report any problems on my PR.
  • I read and followed the [Flutter Style Guide].
  • I signed the [CLA].
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

@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
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the 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 counterproductive. 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.

@kevmoo

kevmoo commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces library version registration for the firebase_ai and firebase_data_connect packages across Android, iOS, and Web platforms to support user-agent tracking. Feedback on these changes includes addressing a Gradle anti-pattern where repositories are configured via rootProject.allprojects, replacing an unsafe perform selector call in Swift with a direct method implementation cast, and refactoring the registerWebLibraryVersion functions in Dart to comply with the repository's 20-line function limit.

Comment thread packages/firebase_ai/firebase_ai/android/build.gradle Outdated
Comment thread packages/firebase_ai/firebase_ai/lib/src/platform_version_web.dart

This branch has not been deployed

No deployments
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.

1 participant