Skip to content

feat(config): gate Firebase behind WEBTRIT_APP_FIREBASE_ENABLED#1441

Closed
SERDUN wants to merge 1 commit into
developfrom
feat/configurable-firebase
Closed

feat(config): gate Firebase behind WEBTRIT_APP_FIREBASE_ENABLED#1441
SERDUN wants to merge 1 commit into
developfrom
feat/configurable-firebase

Conversation

@SERDUN

@SERDUN SERDUN commented Jun 24, 2026

Copy link
Copy Markdown
Member

Overview

Adds a WEBTRIT_APP_FIREBASE_ENABLED config (default true, runtime-overridable via EnvRegistry) that lets the app run Firebase-free when a host owns the default Firebase app — specifically the theme configurator's realtime preview, which mounts this app in-process.

This is the first of two PRs split out of the embedding work (the second adds host theme / feature-config injection).

Changes

  • environment_config.dart — new FIREBASE_ENABLED getter (override-first, compile-time default true).
  • bootstrap.dart — gate every Firebase touchpoint behind the flag:
    • Firebase app / messaging / local pushes init.
    • App-id provider: FirebaseAppIdProvider when on, SharedPreferencesAppIdProvider when off.
    • Remote Config: falls back to the local shared-preferences cache when off (and on init failure).
  • main.dartAppAnalyticsRepository provided lazily so FirebaseAnalytics.instance is only touched when the observer is attached.
  • app.dart — analytics navigator observer attached only when the flag is on.
  • dart_define.json / docs/environment.md — document the new flag.
  • test/environment_config_test.dart — covers default-true and false-override.

Verification

  • flutter analyze — clean.
  • flutter test test/environment_config_test.dart — 8/8 pass.
  • Standalone builds default to true and behave exactly as before (no overrides applied).

Add a WEBTRIT_APP_FIREBASE_ENABLED config (default true, runtime-overridable
via EnvRegistry) that gates every Firebase touchpoint in bootstrap: Firebase
app, messaging and local pushes init, the app-id provider (FirebaseAppIdProvider
vs SharedPreferencesAppIdProvider), and Remote Config (falls back to the local
shared-preferences cache when off). The analytics repository is now provided
lazily and its navigator observer is only attached when the flag is on, so the
app never touches FirebaseAnalytics.instance when Firebase is disabled.

This lets a host that owns the default Firebase app - the theme configurator's
realtime preview - run the embedded app Firebase-free by configuring the flag
off, while standalone builds default to true and behave exactly as before.
@SERDUN

SERDUN commented Jun 24, 2026

Copy link
Copy Markdown
Member Author

Closing to restart the embedding support under a single, consistent injection model.

@SERDUN SERDUN closed this Jun 24, 2026
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.

1 participant