feat(firebase): tvOS support for cloud_functions - #19
Conversation
Federated cloud_functions_tvos — Firebase Cloud Functions for Apple TV, built on the Firebase Apple SDK. Re-exports the cloud_functions Dart API and ships the native tvOS pluginClass; depends on firebase_core_tvos. Full callable + streaming API, no feature disables. Ported from cloud_functions 6.3.3 (the firebase_core 4.11.x train).
…fix example Info.plist
DenisovAV
left a comment
There was a problem hiding this comment.
Review
Clean port. One thing to drop, then I'd merge it; the rest is documentation polish.
Port faithfulness
Delta against cloud_functions 6.3.3 as published is the usual two mechanical hunks in FirebaseFunctionsPlugin.swift (core import, messenger gate), one line in CloudFunctionsMessages.g.swift:9, and — correctly — FunctionsStreamHandler.swift:68 widened to #available(iOS 15.0, tvOS 15.0, macOS 12.0, *). That last one is exactly right rather than merely plausible: the streaming API is annotated @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) in Callable+Codable.swift, so it is available at this pod's 15.0 floor. CodecUtility.swift and Constants.swift identical.
Cloud Functions is fully supported on tvOS: FirebaseFunctions.podspec at 12.15.0 declares tvos_deployment_target = '15.0', and none of Functions.swift, HTTPSCallable.swift, Callable+Codable.swift, FunctionsError.swift, HTTPSCallableOptions.swift, FunctionsContext.swift or FunctionsSerializer.swift carries a platform guard. The App Check path uses FirebaseAppCheckInterop only — with no provider installed the token is nil and no header is sent, same as iOS.
Podspec consistent with the siblings on main: Firebase/Functions '~> 12.15.0', tvOS 15.0, no Flutter pod.
Please drop two files
packages/firebase_app_check_tvos/example/tvos/Runner/GeneratedPluginRegistrant.h
packages/firebase_app_check_tvos/example/tvos/Runner/GeneratedPluginRegistrant.m
Build output from #18's example — they @import firebase_app_check_tvos and register FirebaseAppCheckPlugin. #18 lists GeneratedPluginRegistrant in its own example/tvos/.gitignore and does not commit them, so this would put into main precisely what that package excludes. Your own package gets it right.
Ordering hazard, same as #8's: merged before #18, this creates a packages/firebase_app_check_tvos/ holding nothing but those two files, which the repo gate reports as a package missing everything.
Documentation polish
README.md still carries porter boilerplate — "Read PORTING_REPORT.md before publishing", a cloud_functions: ^<latest> placeholder where ^6.3.3 belongs, no firebase_core / firebase_core_tvos lines, and none of the version-alignment warning #10's README carries. That warning applies here identically: a firebase_core outside the pinned train can crash in CoreFirebaseOptions.fromList at launch. The PORTING_REPORT.md checklist is also unticked, and no verification claim is made anywhere — honest, but an on-device pass like #10's would be worth having before this ships.
Cosmetic and unreachable: the fallback message at FunctionsStreamHandler.swift:120-126 still reads "Streaming requires iOS 15+ or macOS 12+" with no mention of tvOS. Dead code at a 15.0 floor, but it would read oddly if it ever surfaced.
DenisovAV
left a comment
There was a problem hiding this comment.
Re-review — everything closed
The two files belonging to #18 are gone: nothing under packages/firebase_app_check_tvos/ is tracked here. The gate is clean on the merged tree.
The README is sorted — the porter boilerplate is out, the firebase_core and firebase_core_tvos lines are in, and the version-alignment warning from #10 is carried over. It applies here identically: a firebase_core outside the pinned train crashes the app in CoreFirebaseOptions.fromList at launch.
The port stays verbatim. Worth calling out the availability widening in FunctionsStreamHandler.swift to tvOS 15.0 — that is not a guess but an exact match to the SDK: the streaming API is annotated @available(..., tvOS 15.0, *), so it is available at this pod's 15.0 floor.
LGTM.
|
Could someone approve the workflow run on this one? It's sitting in The fix looks right (gate passes locally on the merged tree, files are gone), but this is the one PR in the set that would land with no CI behind it, and it's the one that already tripped the gate once. Rather have the run confirm it than approve on my reading. |
What does this PR do?
Adds federated
cloud_functions_tvos— Firebase Cloud Functions (callable + streaming) for Apple TV, built on the Firebase Apple SDK. Re-exports thecloud_functionsDart API and ships the native tvOSpluginClass; depends onfirebase_core_tvos. Full API, no feature disables.Package(s) touched:
cloud_functions_tvos(new)How was it tested?
FirebaseFunctions.instance.httpsCallable(...).call()reaches the Cloud Functions backend (GTMSessionFetcher → us-central1-<project>.cloudfunctions.net) and returns the server's response.Platform.operatingSystem == "tvos"/Platform.isIOS == true.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
cloud_functions_tvosfiles are touchedTODO/debug leftREADME.mddocuments tvOS behaviour (full API; version-alignment note)Notes for reviewers
_tvosleaf packages): the native Pigeon matches thefirebase_core 4.11.x/firebase_core_platform_interface 7.1.0train. Mixingfirebase_core_tvoswith a differentfirebase_corewhoseFirebaseOptionslist differs can crash inCoreFirebaseOptions.fromListat launch (Dartoptions:init).related issue: #13