Skip to content

feat(firebase): tvOS support for firebase_analytics - #7

Merged
MAUstaoglu merged 3 commits into
fluttertv:mainfrom
TheNoumanDev:feat/firebase-analytics-tvos
Aug 17, 2026
Merged

feat(firebase): tvOS support for firebase_analytics#7
MAUstaoglu merged 3 commits into
fluttertv:mainfrom
TheNoumanDev:feat/firebase-analytics-tvos

Conversation

@TheNoumanDev

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds federated firebase_analytics_tvos — Firebase Analytics for Apple TV,
built on the Firebase Apple SDK. Re-exports the firebase_analytics Dart API
and ships the native tvOS pluginClass; depends on firebase_core_tvos. Full
analytics API, no feature disables.

Package(s) touched: firebase_analytics_tvos (new)

How was it tested?

initializeApp(options:) succeeds, Analytics 12.15.0 starts, collection
enabled, and events reach the backend. Platform.operatingSystem == "tvos" and
Platform.isIOS == true under AOT.

  • Ran the package's example/ app
  • Verified on tvOS simulator (version: 26.2)
  • Verified on a physical Apple TV (Apple TV 4K 3rd gen / tvOS 26.2)
  • dart analyze is clean for the package

Versioning & changelog

  • version: set to 0.0.1 (new package)
  • Matching ## 0.0.1 entry at the top of CHANGELOG.md
  • No behaviour change (new package)
  • Semver 0.x: initial 0.0.1

Checklist

  • Only firebase_analytics_tvos files are touched
  • No secrets, absolute local paths, or TODO/debug left
  • README.md documents tvOS behaviour (no feature limitations; version-alignment note)
  • Sibling-package constraint noted below

Notes for reviewers

  • Version alignment (affects all Firebase _tvos leaf packages): the native Pigeon matches firebase_analytics 12.4.3 and firebase_core_platform_interface 7.1.0 train (firebase_core 4.11.x). Mixing firebase_core_tvos with a different firebase_core whose FirebaseOptions list differs can crash in CoreFirebaseOptions.fromList at launch (Dart options: init).
  • Depends on firebase_core_tvos (publish first).

@TheNoumanDev

Copy link
Copy Markdown
Contributor Author

@MAUstaoglu @DenisovAV — this adds firebase_analytics_tvos following the same pattern as the Firebase batch in #3. Verified on a physical Apple TV 4K (tvOS 26.2): Firebase initializes, and analytics events reach the backend. Depends on firebase_core_tvos. Would appreciate a review whenever you have time — thanks!

@DenisovAV DenisovAV 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.

Review

Approving — the port is clean and the gate is green on the merged tree. One documentation correction below that I would not hold the merge for; it can land here or as a follow-up.

The 17 Aug commit closed everything I would otherwise have asked for: Info.plist now says Firebase_analytics_example rather than naming the storage example, the obsolete pubspec_overrides.yaml pair is gone, and the README row is present.

Checked 17 package(s) under packages/
  OK — README rows, versions, required files, overrides and tvOS plugin classes all consistent.

Port faithfulness

Diffed tvos/Classes/ against firebase_analytics 12.4.3 as published. Three hunks, all necessary:

  • FirebaseAnalyticsPlugin.swiftimport firebase_core_tvos replacing the canImport conditional; os(tvOS) added to the messenger gate; tvOS 15.0 added to the two logTransaction availability checks, which matches what the tvOS slice's .swiftinterface declares.
  • FirebaseAnalyticsMessages.g.swift — the import gate, one line.
  • Constants.swift — identical.

All twelve Pigeon host methods implemented, nothing behavioural, no stubs.

Podspec

Firebase/Analytics '~> 12.15.0' matches every sibling on main and matches exactly what firebase_core 4.11.0 pins in its firebase_sdk_version.rb. s.platform = :tvos, '15.0' equals FirebaseAnalytics 12.15.0's own tvOS floor. No Flutter CocoaPod dependency.


One correction, not a blocker

README.md says "All firebase_analytics APIs are available (no tvOS feature disables)" and PORTING_REPORT.md says "Full API is available on tvOS". That holds for eleven of the twelve methods. It does not hold for initiateOnDeviceConversionMeasurement.

The handler (FirebaseAnalyticsPlugin.swift:139-162) calls Analytics.initiateOnDeviceConversionMeasurement(...) and then unconditionally returns completion(.success(())), with no tvOS branch — I read that off the source. The API itself is marked API_UNAVAILABLE(macCatalyst, macos, tvos, watchos) in the Firebase binary distribution, and the SDK that implements it, GoogleAdsOnDeviceConversion, declares iOS only. Swift does not enforce availability declared on an ObjC category, so this compiles and silently succeeds.

On provenance: the unconditional .success I verified myself; the API_UNAVAILABLE(tvos) attribution comes from reading the shipped headers in the binary distribution, which I did not reproduce independently.

The code is faithful — FlutterFire ships the identical shape on macOS, where the same header excludes macOS — so I am not asking you to change the call. Just narrow the two claims, so nobody builds a conversion-measurement flow on tvOS and waits for data that cannot arrive. Returning a FlutterError from that handler on tvOS would be the honest-at-runtime version if you would rather fix it properly, but that diverges from upstream and is your call.

@MAUstaoglu MAUstaoglu left a comment

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.

Diffed firebase_analytics_platform_interface 6.0.3 → 6.0.6 (everything ^12.4.3 admits) — pigeon protocol is byte-identical, so no drift risk here. Publishes clean, FirebaseAnalyticsPlugin resolves. The initiateOnDeviceConversionMeasurement note is the right call to document rather than stub. LGTM.

@MAUstaoglu
MAUstaoglu merged commit c8e2b6b into fluttertv:main Aug 17, 2026
19 checks passed
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.

3 participants