Skip to content

feat(app): support running embedded in a host (embeddedPreview + injection)#1437

Closed
SERDUN wants to merge 1 commit into
developfrom
feat/embedded-host-support
Closed

feat(app): support running embedded in a host (embeddedPreview + injection)#1437
SERDUN wants to merge 1 commit into
developfrom
feat/embedded-host-support

Conversation

@SERDUN

@SERDUN SERDUN commented Jun 23, 2026

Copy link
Copy Markdown
Member

Overview

Let webtrit_phone run embedded inside another Flutter host — the theme configurator's realtime preview mounts the real app in-process. Two parts, both in bootstrap.dart / main.dart (RootApp) / app/view/app.dart (App):

  1. Firebase-free bootstrap. bootstrap({bool embeddedPreview = false}): when embedded, skip Firebase app/messaging/local-push init, use SharedPreferencesAppIdProvider instead of the Installations-backed FirebaseAppIdProvider, and skip Firebase Remote Config. The host owns the default Firebase app (which may be misconfigured or absent — locally the configurator's app has an empty projectId), so any Firebase touch in the embedded app would throw.
  2. External config injection. RootApp/App accept external ThemeSettings / ThemeMode / FeatureAccess streams (+ initial seeds) so the host drives the live appearance and feature/login/tab config. Theme is applied via AppThemeSettingsChanged / AppThemeModeChanged (no prefs write); the FeatureAccess StreamProvider source is swapped to the external stream. The analytics provider is made lazy and the analytics navigator observer is skipped when embedded, so FirebaseAnalytics.instance is never touched.

Why

Part of the configurator realtime-preview epic (depends on the EnvironmentConfig runtime-override PR for the dart-define injection path the host uses). Standalone builds are unaffected.

Notes

  • Standalone behaviour byte-identical: embeddedPreview defaults to false, all external streams default to null.
  • flutter analyze lib green.

…ction)

Let webtrit_phone run embedded inside another Flutter host (the theme
configurator's realtime preview).

- bootstrap({embeddedPreview}) runs Firebase-free: skip Firebase app/messaging/
  local-push init, use SharedPreferencesAppIdProvider instead of the
  Installations-backed one, and skip Firebase Remote Config. Needed because the
  host owns the default Firebase app, which may be misconfigured/absent.
- RootApp/App accept external ThemeSettings/ThemeMode/FeatureAccess streams
  (+ initial seeds) so the host drives the live appearance and feature/login/tab
  config; theme is applied via AppThemeSettingsChanged/AppThemeModeChanged
  (no prefs write).
- The analytics provider is lazy and the analytics navigator observer is skipped
  when embedded, so FirebaseAnalytics.instance is never touched.

Standalone behaviour is unchanged: embeddedPreview defaults to false and all
external streams default to null.
@SERDUN

SERDUN commented Jun 23, 2026

Copy link
Copy Markdown
Member Author

Splitting into two PRs: (1) embeddedPreview Firebase-free bootstrap, (2) external Theme/FeatureAccess injection.

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