feat(MSDK-4525): add controllerId to Flutter bridge options - #202
feat(MSDK-4525): add controllerId to Flutter bridge options#202uc-brunosilva wants to merge 2 commits into
Conversation
Adds an optional controllerId String parameter to Usercentrics.initialize(), mirroring the native SDK's UsercentricsOptions.controllerId (MSDK-4160/4525). Lets Advanced-tier customers inject a previously-issued controllerID at SDK init to preserve identity across login/logout flows that clear local consent storage. Threaded through the full Dart call chain: - lib/src/usercentrics.dart (public API + doc comment) - lib/src/platform/usercentrics_platform.dart (abstract platform interface) - lib/src/internal/platform/method_channel_usercentrics.dart - lib/src/internal/bridge/initialize_bridge.dart - lib/src/internal/serializer/initialize_options_serializer.dart (Map key) And into the native bridges: - android/src/main/kotlin/.../serializer/OptionsSerializer.kt - forwards "controllerId" into UsercentricsOptions.controllerId - ios/usercentrics_sdk/.../Serializer/InitializeOptionsSerializer.swift - forwards "controllerId" into UsercentricsOptions.controllerId Extended existing tests (fakes + assertions) for the Dart layer and the Android bridge unit test to cover the new field. No Dart model class or build_runner codegen exists for options - they are passed as named parameters and serialized to a plain Map, so no .g.dart regeneration was needed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…trics CI Lint job was failing: FakeUsercentrics (example/test/fake_usercentrics.dart) also implements UsercentricsPlatform and was missed when controllerId was added to the interface — flutter analyze flagged it as invalid_override. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Heads up — CI This bridge compiles This isn't fixable by editing this PR further — it needs, in order:
Leaving this PR open as-is per team decision — CI will go green once the native SDK release lands and the version pin is bumped. Please don't merge before that. (The 🤖 Generated with Claude Code |
Summary
Follow-up to MSDK-4525 — adds an optional
controllerIdparameter toUsercentrics.initialize(), mirroring the native mobile-sdk's newUsercentricsOptions.controllerId(landed in mobile-sdk PR #2440).This lets Advanced-tier customers inject a previously-issued controllerID at SDK init to preserve identity across login/logout flows that clear local consent storage (shared-device / GDPR DSR compliance scenario).
Changes
Threaded
controllerId: String?through the full Dart call chain:lib/src/usercentrics.dart(public API + doc comment mirroring native semantics)lib/src/platform/usercentrics_platform.dartlib/src/internal/platform/method_channel_usercentrics.dartlib/src/internal/bridge/initialize_bridge.dartlib/src/internal/serializer/initialize_options_serializer.dart(Map key)And into the native bridges:
android/.../serializer/OptionsSerializer.kt) — forwardscontrollerIdinto nativeUsercentricsOptions.ios/usercentrics_sdk/.../Serializer/InitializeOptionsSerializer.swift) — same, from the dictionary.Extended existing Dart tests (fakes + assertions) and the Android bridge unit test to cover the new field.
Note:
masteris the repo's integration branch — there is nodevelopbranch here. There's also no dedicatedUsercentricsOptionsDart model class or build_runner codegen in this repo — options are passed as named parameters and serialized to a plainMap, so no.g.dartregeneration was needed.Validation
flutter test— 64/64 passing.flutter analyze lib/ test/— no issues.Open items for reviewer
CHANGELOG.mdhas no "Unreleased" section (latest entry2.30.0is already released) — an entry should be added when release notes are prepared.controllerId— this bridge code is correct but inert until the native mobile-sdk release with the field is consumed.🤖 Generated with Claude Code