Skip to content

feat(firebase): tvOS support for cloud_functions - #19

Open
TheNoumanDev wants to merge 4 commits into
fluttertv:mainfrom
TheNoumanDev:feat/firebase-cloud-functions-tvos
Open

feat(firebase): tvOS support for cloud_functions#19
TheNoumanDev wants to merge 4 commits into
fluttertv:mainfrom
TheNoumanDev:feat/firebase-cloud-functions-tvos

Conversation

@TheNoumanDev

@TheNoumanDev TheNoumanDev commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

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 the cloud_functions Dart API and ships the native tvOS pluginClass; depends on firebase_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.

  • Ran the package's example/ app
  • Verified on tvOS simulator (26.2) — callable round-trip to a live project
  • Verified on a physical Apple TV 4K (tvOS 26.6, AOT) — same round-trip against a live project
  • 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 cloud_functions_tvos files are touched
  • No secrets, absolute local paths, or TODO/debug left
  • README.md documents tvOS behaviour (full API; version-alignment note)
  • Sibling-package constraint noted below

Notes for reviewers

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

related issue: #13

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).

@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

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.

@TheNoumanDev
TheNoumanDev requested a review from DenisovAV August 17, 2026 02:42

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

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.

@MAUstaoglu

Copy link
Copy Markdown
Member

Could someone approve the workflow run on this one? It's sitting in action_required, so nothing has run against 0ced46fe — and the run before it failed, on the phantom firebase_app_check_tvos package those stray registrant files were creating.

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.

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