Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions packages/firebase_remote_config_tvos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Dart / Flutter
.dart_tool/
build/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub/

# CocoaPods
tvos/Pods/
tvos/Podfile.lock
tvos/.symlinks/
tvos/Flutter/Flutter.framework
tvos/Flutter/Flutter.podspec

# Xcode / SwiftPM (per-user, generated when tvos/Package.swift is opened)
**/.swiftpm/
**/xcuserdata/

# IDE
.idea/
.vscode/
*.iml

# macOS
.DS_Store
1 change: 1 addition & 0 deletions packages/firebase_remote_config_tvos/.pubignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pubspec_overrides.yaml
9 changes: 9 additions & 0 deletions packages/firebase_remote_config_tvos/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## 0.0.1

* Initial tvOS (Apple TV) implementation of `firebase_remote_config`, ported from
`firebase_remote_config` 6.5.3 with `flutter-tvos plugin port` and finished by
hand. Full Remote Config API (defaults, fetch/activate/fetchAndActivate, typed
getters, config settings, real-time updates); no tvOS feature disables.
* Native code aligned to the `firebase_core 4.11.x` /
`firebase_core_platform_interface 7.1.0` FlutterFire train; depends on
`firebase_core_tvos`.
26 changes: 26 additions & 0 deletions packages/firebase_remote_config_tvos/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Copyright 2018, the Chromium project authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
103 changes: 103 additions & 0 deletions packages/firebase_remote_config_tvos/PORTING_REPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# firebase_remote_config_tvos — porting report

Generated by `flutter-tvos plugin port` on 2026-08-13.

Source: `firebase_remote_config` 6.5.3 (Swift). Base platform: ios.
Output: `./firebase_remote_config_tvos`

> ✅ No tvOS-incompatible APIs detected at type level — the generated package
> compiles on tvOS.

## Summary

| Status | Count |
| ------------------------------- | ----------- |
| Methods ported as-is | full API |
| Methods stubbed (iOS-only) | 0 |
| Native regions disabled on tvOS | 0 |
| tvOS build outlook | ✅ compiles |
| Manual review items | 0 |

## Methods

Dispatch is via Pigeon (`FirebaseRemoteConfigHostApi` in
`FirebaseRemoteConfigMessages.g.swift`), not a raw method channel — so no
`case "<method>":` handlers appear. The full host API is available on tvOS.

## Imports removed

None. Every `import` in the source compiles on tvOS.

## Cross-platform Dart pruned

The porter copied the source's app-facing Dart. Replaced with a one-line
re-export (see the addendum) — the Dart API is platform-agnostic and must not be
duplicated.

## Disabled on tvOS

None. No type-level tvOS-incompatible API was found; nothing had to be compiled
out. `RemoteConfigError`, `RemoteConfig`, and `ConfigUpdateListenerRegistration`
are all available on tvOS.

## Manual review items

None flagged automatically.

## Checklist

- [x] Stubbed methods — **N/A**: none. Full API on tvOS.
- [x] Partial methods — **N/A**: none.
- [x] Removed imports — **N/A**: none removed.
- [x] `flutter-tvos build tvos` compiles the generated registrant — **verified** (simulator, arm64).
- [x] Version set (`0.0.1`) and `CHANGELOG.md` updated.

---

Manual review complete (2026-08-13) — see the addendum below for the applied
fixes and verification.

## Addendum: manual fixes + verification (2026-08-13)

The auto-port compiled clean (no tvOS-incompatible APIs; Remote Config is
UI-free — no UIKit; 0 stubs, 0 disables). Applied by hand:

- **Podspec:** depend on `Firebase/RemoteConfig '~> 12.15.0'` + `firebase_core_tvos`
(not upstream `firebase_core`); tvOS 15.0 floor; `static_framework`; no
Flutter-CocoaPod dependency (Flutter via `FRAMEWORK_SEARCH_PATHS`).
- **`FirebaseRemoteConfigPlugin.swift`:** `#if canImport(firebase_core) … #else
firebase_core_shared` repointed to a plain `import firebase_core_tvos`.
- **Deleted the generated `tvos/Package.swift`** (route via the podspec, like the
other Swift Firebase `_tvos` packages; the SPM manifest lacks the Firebase +
`firebase_core_tvos` deps).
- **`lib/firebase_remote_config_tvos.dart`:** one-line re-export of
`package:firebase_remote_config/firebase_remote_config.dart` (the Dart API is
method-channel-only — duplicating would create incompatible types). Copied
Dart (`lib/src/`) removed.

**Version alignment:** matches `firebase_remote_config 6.5.3` on the
`firebase_core_platform_interface` **7.1.0** train (`firebase_core 4.11.x`) — the
same train as `firebase_core_tvos`. 6.5.4+ drift off-train (6.5.5 → pi 8.0.0,
6.5.6 → core 4.13 / pi 8.1.0), so 6.5.3 is the correct latest on this train.
Keep the whole Firebase stack on one consistent FlutterFire release.

**Verified (runtime, end-to-end):** on the tvOS simulator (26.2, Apple TV 4K)
against a live Firebase project — `[FirebaseRemoteConfig] 12.15.0 - New config
database created`, a real fetch hit
`https://firebaseremoteconfig.googleapis.com/v1/projects/<id>/namespaces/firebase:fetch`,
and `fetchAndActivate` returned `activated=true` with
`lastFetchStatus == RemoteConfigFetchStatus.success`. **A parameter published in
the Firebase console (`welcome_message`) was then pulled down and overrode the
local default** — `getString('welcome_message')` returned the console value, not
the app default. This confirms real server→client delivery through the tvOS
native plugin, not just a successful network round-trip.
`Platform.operatingSystem == "tvos"` / `Platform.isIOS == true`.

**Verified on a physical Apple TV 4K (tvOS 26.2, release/AOT):** the signed
release build was installed with `devicectl` and launched; it fetched and
activated the same console-published parameter on real hardware. Pulling the
app's `Library/Caches/Google/RemoteConfig/RemoteConfig.sqlite3` off the device
(`devicectl device copy from`) shows `welcome_message` = the console value in
both the fetched (`main`) and active (`main_active`) tables, while the local
default (`main_default`) remained the app default — i.e. the server value was
fetched, persisted, and activated on the Apple TV itself.
41 changes: 41 additions & 0 deletions packages/firebase_remote_config_tvos/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# firebase_remote_config_tvos

The tvOS implementation of [`firebase_remote_config`](https://pub.dev/packages/firebase_remote_config).

> Ported with [`flutter-tvos plugin port`](https://github.com/fluttertv/flutter-tvos)
> from `firebase_remote_config` 6.5.3, then finished + verified by hand. See
> `PORTING_REPORT.md`.

## Usage

Federated plugin implementation — no imports needed from app code; it registers
automatically. Apps that already use `firebase_remote_config` and target tvOS add:

```yaml
dependencies:
firebase_remote_config: ^6.5.3
firebase_remote_config_tvos: ^0.0.1
firebase_core: ^4.11.0
firebase_core_tvos: ^0.0.1 # tvOS core (this package depends on it)
```

> **Version alignment matters.** This package's native code matches the
> `firebase_core_platform_interface` **7.1.0** train (`firebase_core 4.11.x`).
> Keep your whole Firebase stack on one consistent FlutterFire release, or Dart
> `initializeApp(options:)` can crash in `CoreFirebaseOptions.fromList` at launch
> (a `FirebaseOptions` field-count mismatch).

## Status

| Platform | Implemented | Verified |
| --------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Apple TV (`appletvos`) | yes | ✅ verified on a **physical Apple TV 4K** (tvOS 26.2, release/AOT) — a parameter published in the **Firebase console** was fetched and activated on the device; the on-device `RemoteConfig.sqlite3` shows the console value in both the fetched and active tables, overriding the local default |
| Apple TV simulator (`appletvsimulator`) | yes | ✅ verified end-to-end — a parameter published in the **Firebase console** was fetched by the Apple TV app (`fetchAndActivate` → `RemoteConfigFetchStatus.success`) and the server value overrode the local default via `getString` |

All `firebase_remote_config` APIs are available (no tvOS feature disables) —
defaults, `fetch`/`activate`/`fetchAndActivate`, typed getters, config settings,
and real-time config updates.

## License

fluttertv under a BSD-3-Clause license. See `LICENSE` for the full text.
7 changes: 7 additions & 0 deletions packages/firebase_remote_config_tvos/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include: package:flutter_lints/flutter.yaml

analyzer:
language:
strict-casts: true
strict-inference: true
strict-raw-types: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// PLACEHOLDER — replace by running `flutterfire configure` in this example dir.
//
// On tvOS, `defaultTargetPlatform == TargetPlatform.iOS`, so the `ios` entry
// below is what the Apple TV build uses — i.e. your existing iOS Firebase app's
// config is reused for tvOS.
//
// ignore_for_file: lines_longer_than_80_chars
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
import 'package:flutter/foundation.dart'
show defaultTargetPlatform, kIsWeb, TargetPlatform;

class DefaultFirebaseOptions {
static FirebaseOptions get currentPlatform {
if (kIsWeb) {
throw UnsupportedError('This example targets Apple TV (tvOS) only.');
}
switch (defaultTargetPlatform) {
case TargetPlatform.iOS: // tvOS reports iOS
return ios;
default:
throw UnsupportedError('This example targets Apple TV (tvOS) only.');
}
}

// Replace with your real values — run `flutterfire configure`, or copy them
// from your iOS app's GoogleService-Info.plist / Firebase console.
static const FirebaseOptions ios = FirebaseOptions(
apiKey: 'REPLACE_ME',
appId: 'REPLACE_ME', // GOOGLE_APP_ID
messagingSenderId: 'REPLACE_ME', // GCM_SENDER_ID
projectId: 'REPLACE_ME',
storageBucket: 'REPLACE_ME',
iosBundleId: 'com.example.firebaseRemoteConfigExample',
);
}
112 changes: 112 additions & 0 deletions packages/firebase_remote_config_tvos/example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_remote_config/firebase_remote_config.dart';
import 'package:flutter/material.dart';

import 'firebase_options.dart';

Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
runApp(const RemoteConfigExampleApp());
}

class RemoteConfigExampleApp extends StatelessWidget {
const RemoteConfigExampleApp({super.key});

@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'firebase_remote_config tvOS example',
theme: ThemeData.dark(useMaterial3: true),
home: const RemoteConfigHomePage(),
);
}
}

class RemoteConfigHomePage extends StatefulWidget {
const RemoteConfigHomePage({super.key});

@override
State<RemoteConfigHomePage> createState() => _RemoteConfigHomePageState();
}

class _RemoteConfigHomePageState extends State<RemoteConfigHomePage> {
final _rc = FirebaseRemoteConfig.instance;
String _status = 'Ready.';
String _welcome = '(not fetched yet)';

@override
void initState() {
super.initState();
_rc.setDefaults(const {
'welcome_message': 'Hello from tvOS defaults',
'feature_enabled': false,
});
}

Future<void> _run(String label, Future<void> Function() action) async {
try {
await action();
setState(() => _status = '✅ $label — ok.');
} catch (e) {
setState(() => _status = '❌ $label — $e');
}
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('firebase_remote_config · tvOS')),
body: Padding(
padding: const EdgeInsets.all(48),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(_status, style: const TextStyle(fontSize: 28)),
const SizedBox(height: 16),
Text(
'welcome_message = $_welcome',
style: const TextStyle(fontSize: 24),
),
const SizedBox(height: 32),
Wrap(
spacing: 24,
runSpacing: 24,
children: [
ElevatedButton(
autofocus: true,
onPressed: () => _run('fetchAndActivate', () async {
await _rc.setConfigSettings(
RemoteConfigSettings(
fetchTimeout: const Duration(seconds: 10),
minimumFetchInterval: Duration.zero,
),
);
final activated = await _rc.fetchAndActivate();
setState(() {
_welcome = _rc.getString('welcome_message');
_status = '✅ fetchAndActivate — activated=$activated';
});
}),
child: const Text('fetch & activate'),
),
ElevatedButton(
onPressed: () => _run('read defaults', () async {
setState(() {
_welcome = _rc.getString('welcome_message');
});
}),
child: const Text('read current value'),
),
],
),
],
),
),
);
}
}
28 changes: 28 additions & 0 deletions packages/firebase_remote_config_tvos/example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: firebase_remote_config_example
description: Demonstrates how to use the firebase_remote_config plugin on tvOS.
publish_to: none

environment:
sdk: '^3.6.0'
flutter: '>=3.27.0'

dependencies:
# Pinned to the train the published _tvos packages ship on (firebase_core
# 4.11.x -> firebase_core_platform_interface 7.1.0). Keeps the native Pigeon
# ABI in sync with firebase_core_tvos.
firebase_core: 4.11.0
firebase_remote_config: 6.5.3
firebase_remote_config_tvos:
path: ../
firebase_core_tvos:
path: ../../firebase_core_tvos
flutter:
sdk: flutter

dev_dependencies:
flutter_lints: ^4.0.0
flutter_test:
sdk: flutter

flutter:
uses-material-design: true
Loading