feat(firebase): tvOS support for firebase_analytics - #7
Conversation
|
@MAUstaoglu @DenisovAV — this adds |
…s, fix example Info.plist
DenisovAV
left a comment
There was a problem hiding this comment.
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.swift—import firebase_core_tvosreplacing thecanImportconditional;os(tvOS)added to the messenger gate;tvOS 15.0added to the twologTransactionavailability checks, which matches what the tvOS slice's.swiftinterfacedeclares.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.
…s iOS-only (no-op on tvOS)
MAUstaoglu
left a comment
There was a problem hiding this comment.
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.
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_analyticsDart APIand ships the native tvOS
pluginClass; depends onfirebase_core_tvos. Fullanalytics API, no feature disables.
Package(s) touched:
firebase_analytics_tvos(new)How was it tested?
initializeApp(options:)succeeds, Analytics 12.15.0 starts, collectionenabled, and events reach the backend.
Platform.operatingSystem == "tvos"andPlatform.isIOS == trueunder AOT.example/appdart analyzeis clean for the packageVersioning & changelog
version:set to0.0.1(new package)## 0.0.1entry at the top ofCHANGELOG.md0.x: initial0.0.1Checklist
firebase_analytics_tvosfiles are touchedTODO/debug leftREADME.mddocuments tvOS behaviour (no feature limitations; version-alignment note)Notes for reviewers
_tvosleaf packages): the native Pigeon matchesfirebase_analytics 12.4.3andfirebase_core_platform_interface7.1.0 train (firebase_core 4.11.x). Mixingfirebase_core_tvoswith a differentfirebase_corewhoseFirebaseOptionslist differs can crash inCoreFirebaseOptions.fromListat launch (Dartoptions:init).firebase_core_tvos(publish first).