Skip to content

feat(firebase): tvOS support for firebase_remote_config - #10

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

feat(firebase): tvOS support for firebase_remote_config#10
TheNoumanDev wants to merge 4 commits into
fluttertv:mainfrom
TheNoumanDev:feat/firebase-remote-config-tvos

Conversation

@TheNoumanDev

Copy link
Copy Markdown
Contributor

PR description (continuous lines)

What does this PR do?

Adds federated firebase_remote_config_tvos — Firebase Remote Config for Apple TV, built on the Firebase Apple SDK. Re-exports the firebase_remote_config Dart API and ships the native tvOS pluginClass; depends on firebase_core_tvos. Full Remote Config API (defaults, fetch/activate/fetchAndActivate, typed getters, config settings, real-time updates), no feature disables.

Package(s) touched: firebase_remote_config_tvos (new)

How was it tested?

Verified end-to-end on both the tvOS simulator and a physical Apple TV 4K (tvOS 26.2, release/AOT) against a live Firebase project. FirebaseRemoteConfig 12.15.0 initialized, a real fetch hit firebaseremoteconfig.googleapis.com/.../namespaces/firebase:fetch, and fetchAndActivate returned activated=true with lastFetchStatus == RemoteConfigFetchStatus.success. A parameter published in the Firebase console was fetched and activated on the device — the on-device RemoteConfig.sqlite3 (pulled via devicectl) holds the console value in both the fetched and active tables, overriding the local default. No feature disables (Remote Config is UI-free). Platform.operatingSystem == "tvos" / Platform.isIOS == true.

  • Ran the package's example/ app
  • Verified on tvOS simulator (version: 26.2) — a console-published parameter was fetched and overrode the local default (RemoteConfigFetchStatus.success)
  • Verified on a physical Apple TV 4K (tvOS 26.2, release/AOT) — console-published parameter fetched + activated on-device (confirmed in the device's RemoteConfig.sqlite3)
  • 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_remote_config_tvos files are touched
  • No secrets, absolute local paths, or TODO/debug leftovers
  • 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 code matches firebase_remote_config 6.5.3 on the 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). 6.5.3 is the latest on this train — 6.5.6 requires firebase_core 4.13 / platform interface 8.1.
  • Manual work beyond the auto-port: podspec deps (Firebase/RemoteConfig + firebase_core_tvos, tvOS 15); Swift firebase_core import repointed to firebase_core_tvos; generated tvos/Package.swift removed (route via podspec); Dart re-export.

@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. The repo gate passes on the merged tree, the native delta against upstream is minimal and necessary, and Remote Config genuinely works on tvOS including the part I most expected to be missing. One informational note at the end, no requests.

Port faithfulness

Diffed tvos/Classes/ against firebase_remote_config 6.5.3 as published. The whole delta is three mechanical hunks:

  • FirebaseRemoteConfigPlugin.swift — the canImport(firebase_core) block replaced by import firebase_core_tvos, and #elseif os(iOS)#elseif (os(iOS) || os(tvOS)) for the binary messenger.
  • FirebaseRemoteConfigMessages.g.swift:9 — the import gate, one line changed in 495.
  • FirebaseRemoteConfigUtils.swift and Constants.swift — identical.

No behavioral change anywhere, no stubs, no #if !TARGET_OS_TV. That is what makes the next rebase onto a new firebase_remote_config cheap, and it is the right instinct.

Real-time updates do work on tvOS

Worth stating with evidence, because it is the one Remote Config feature most likely to be quietly platform-gated and the README claims it.

FirebaseRemoteConfig.podspec at 12.15.0 declares tvos_deployment_target = '15.0', and RCNConfigRealtime.m — 754 lines carrying the whole SSE listener — contains zero platform guards. Its foreground reconnect hooks UIApplicationWillEnterForegroundNotification, which tvOS posts. The event-channel wiring in FirebaseRemoteConfigPlugin.swift is upstream's, intact.

One honest gap in the evidence rather than the code: the example exercises fetchAndActivate but not the realtime listener, so the "verified" claim covers fetch. The support claim itself holds per the SDK source.

Podspec

Firebase/RemoteConfig '~> 12.15.0' matches every sibling on main, tvOS 15.0 equals the pod's own floor, no Flutter CocoaPod dependency, static_framework. Upstream ships no privacy-manifest bundle for this package, so dropping resource_bundles loses nothing.


One note, not a request

On tvOS the SDK keeps RemoteConfig.sqlite3 somewhere different (RCNConfigDBManager.m):

#if TARGET_OS_TV
  NSArray *dirPaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, ...);
#else
  ... NSApplicationSupportDirectory ...
#endif

Caches is purgeable — the system may reclaim it under disk pressure, taking the activated config and the fetch-throttle metadata with it. An app that sets in-app defaults is fine; one that assumes "config was activated last launch, so it is still there" is not. Worth a sentence in the README's tvOS notes, since it is a behavioural difference from iOS that nothing else will surface.

LGTM.

@TheNoumanDev

Copy link
Copy Markdown
Contributor Author

Thanks for the review @DenisovAV! Added the tvOS Caches directory note to the README to address your point.

Two things are on your side to finish this: the CI workflow shows "awaiting approval" (a maintainer needs to trigger the run), and I don't have merge permission on the repo, so it's ready to merge whenever you're able to approve the checks and land it. Thanks again for the thorough review!

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

Pigeon identical across 3.0.3 → 3.0.6, range is safe. The Caches-directory persistence note is worth having — that one would be a confusing bug report otherwise. LGTM.

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