Commit 5b980ab
feat: add an initial connection mode to the FDv2 data system config (#318)
Adds `DataSystemConfig.initialConnectionMode` so an application can
choose the connection mode the FDv2 data system starts in.
Setting it is equivalent to calling `setConnectionMode` with that mode
immediately after the client is created: it is a sticky override. While
a mode is set this way the SDK stays in it and does not switch
automatically in response to application lifecycle or network changes.
Clearing the override (`setConnectionMode(null)`) resumes automatic
resolution. When the option is null (the default) the SDK resolves the
mode automatically, starting in streaming while in the foreground.
It is typed as `ConnectionModeId` rather than the FDv1 `ConnectionMode`
enum so it can reach the FDv2 built-in modes (including `background`)
and, later, custom modes.
When a data system is configured, the FDv1
`DataSourceConfig.initialConnectionMode` no longer influences the
connection mode. The SDK now starts in streaming and lets the data
system configuration and connection manager resolve the effective mode,
and the FDv1 option is documented as having no effect under FDv2.
The Flutter wiring that consumes this option
(`setConnectionMode(ConnectionModeId)` and applying the initial
override) stacks on top of this PR.
SDK-2187
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> FDv2-enabled clients that previously relied on
DataSourceConfig.initialConnectionMode will now always bootstrap in
streaming until data-system resolution runs, which is a deliberate
behavior shift in connection startup.
>
> **Overview**
> Adds **`DataSystemConfig.initialConnectionMode`**
(`ConnectionModeId?`) so FDv2 apps can pick the connection mode at
startup. Documented behavior matches a post-create
**`setConnectionMode`** sticky override: while set, the SDK does not
auto-switch on lifecycle/network; **`null`** restores automatic
resolution (default: auto, foreground streaming).
>
> When **`dataSystem`** is configured, **`LDCommonClient`** no longer
seeds **`DataSourceManager`** from
**`DataSourceConfig.initialConnectionMode`**; it always starts in
**streaming** and defers effective mode to the FDv2 data system /
connection manager. **`DataSourceConfig.initialConnectionMode`** is
documented as **ignored under FDv2** in favor of the new field.
>
> Applying the config value at runtime is expected in follow-on Flutter
wiring; this change is the config surface and FDv1/FDv2 split at client
construction.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
a546858. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: joker23 <2494686+joker23@users.noreply.github.com>1 parent df64f8e commit 5b980ab
3 files changed
Lines changed: 29 additions & 1 deletion
File tree
- packages/common_client/lib/src
- config
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
76 | 89 | | |
77 | 90 | | |
| 91 | + | |
78 | 92 | | |
79 | 93 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
287 | | - | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
288 | 294 | | |
289 | 295 | | |
290 | 296 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
52 | 56 | | |
53 | 57 | | |
54 | 58 | | |
| |||
69 | 73 | | |
70 | 74 | | |
71 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
72 | 80 | | |
73 | 81 | | |
74 | 82 | | |
| |||
0 commit comments