feat(config): configurable Firebase + external config injection for embedding#1440
Closed
SERDUN wants to merge 5 commits into
Closed
feat(config): configurable Firebase + external config injection for embedding#1440SERDUN wants to merge 5 commits into
SERDUN wants to merge 5 commits into
Conversation
…mbedding Let webtrit_phone run inside another Flutter host (the theme configurator's realtime preview) purely through configuration — the app never knows it is "embedded". - Add the WEBTRIT_APP_FIREBASE_ENABLED config (default true). bootstrap gates Firebase app/messaging/local-push, the app-id provider (Installations vs shared-preferences) and Remote Config on it; the analytics navigator observer is attached only when it is true, and the analytics provider is lazy so a Firebase-free run never touches FirebaseAnalytics.instance. A host configures this off via the existing dart-define override mechanism — no embedded flag. - RootApp/App accept optional external ThemeSettings/ThemeMode/FeatureAccess streams (+ initial seeds) so a host can drive the live appearance and feature/login config; theme is applied via AppThemeSettingsChanged/ AppThemeModeChanged (no prefs write), and the FeatureAccess StreamProvider source is swapped to the external stream when provided. Standalone behaviour is unchanged: FIREBASE_ENABLED defaults to true and all external streams default to null.
Replace the four external Theme/ThemeMode/FeatureAccess stream params spread across RootApp and App with a single AppConfigSource value object threaded RootApp -> App. RootApp/App now take one optional `configSource` instead of several scattered stream fields. No behaviour change.
AppConfigSource now carries plain values (ThemeSettings/ThemeMode/FeatureAccess) instead of streams. The app renders them directly through the widget tree the same way it renders everything else - App reads the theme from configSource (or its AppBloc), and RootApp provides the FeatureAccess value (or the normal StreamProvider). A host re-supplies a fresh AppConfigSource on each edit, so reactivity comes from the normal rebuild; no stream subscriptions, no AppThemeSettingsChanged/AppThemeModeChanged plumbing, no initial-seed field.
…tree Remove the AppConfigSource wrapper. RootApp now takes plain optional themeSettings/themeMode/featureAccess values and provides each down the widget tree (Provider.value for the theme + the FeatureAccess override), exactly like the app provides everything else. App reads the theme via context.watch (falling back to its AppBloc theme) and FeatureAccess via the existing provider. No wrapper object, no constructor config on App.
…source Stop overriding the theme in build (`hostThemeSettings ?? state.themeSettings`). The app renders only `state.themeSettings`; when a host (the configurator's realtime preview) supplies a theme through the tree, App pushes it into the AppBloc via AppThemeSettingsChanged/AppThemeModeChanged in didChangeDependencies (same place it reacts to FeatureAccess). No streams, no build-time fallback — AppState stays the single source of truth.
Member
Author
|
Splitting into two independent PRs: (A) configurable Firebase, (B) host theme/feature-config injection. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Let
webtrit_phonerun inside another Flutter host (the theme configurator's realtime preview) purely through configuration — the app never has an "embedded" flag and never branches on "am I embedded".WEBTRIT_APP_FIREBASE_ENABLEDconfig (defaulttrue).bootstrapgates Firebase app/messaging/local-push init, the app-id provider (FirebaseAppIdProvider↔SharedPreferencesAppIdProvider) and Remote Config on it. The analytics navigator observer is attached only when it is true, and the analytics provider is now lazy, so a Firebase-free run never touchesFirebaseAnalytics.instance. A host disables Firebase via the existing dart-define override mechanism — noembeddedPreviewflag anywhere.RootApp/Appaccept optional externalThemeSettings/ThemeMode/FeatureAccessstreams (+ initial seeds) so a host drives the live appearance and feature/login config. Theme is applied viaAppThemeSettingsChanged/AppThemeModeChanged(no prefs write); theFeatureAccessStreamProvidersource is swapped to the external stream when provided.Why
Replaces the closed #1437/#1438/#1439 attempts with a single, cleaner design: the app is configured (Firebase on/off + config sources), never aware of embedding. This is the phone-side support for the configurator realtime-preview epic.
Notes
FIREBASE_ENABLEDdefaults true, external streams default null.flutter analyze libgreen;test/environment_config_test.dart(8 tests incl. FIREBASE_ENABLED default/override) passes.