From ff3d3ccbb5e1b3b9031525a9cda5c9ae2a5b7370 Mon Sep 17 00:00:00 2001 From: asadraza-usercentrics Date: Fri, 21 Aug 2026 15:23:23 +0100 Subject: [PATCH] feat(banner): expose windowFullscreen setting on android bridge MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MSDK-4637: windowFullscreen already existed in the core SDK's GeneralStyleSettings but was never plumbed through the Flutter bridge, so publishers relying on the fullscreen backward-compat workaround had no way to set it from Flutter — the same gap already closed on the React Native bridge (MSDK-4636). Adds the field to the Dart model and its Dart/Kotlin serializers, commits the example app's edge-to-edge opt-in, and wires an example scenario to exercise the new field end-to-end. Updates the two bridge test fixtures that assert exact serialized argument maps. --- .../serializer/GeneralStyleSettingsSerializer.kt | 1 + .../sdk/flutter_example/MainActivity.kt | 6 ++++++ example/lib/main.dart | 9 +++++++++ example/lib/window_fullscreen_example.dart | 12 ++++++++++++ .../general_style_settings_serializer.dart | 1 + lib/src/model/general_style_settings.dart | 14 +++++++++++--- .../bridge/show_first_layer_bridge_test.mock.dart | 1 + .../bridge/show_second_layer_bridge_test.mock.dart | 3 ++- 8 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 example/lib/window_fullscreen_example.dart diff --git a/android/src/main/kotlin/com/usercentrics/sdk/flutter/serializer/GeneralStyleSettingsSerializer.kt b/android/src/main/kotlin/com/usercentrics/sdk/flutter/serializer/GeneralStyleSettingsSerializer.kt index 44c8f716..c9c79021 100644 --- a/android/src/main/kotlin/com/usercentrics/sdk/flutter/serializer/GeneralStyleSettingsSerializer.kt +++ b/android/src/main/kotlin/com/usercentrics/sdk/flutter/serializer/GeneralStyleSettingsSerializer.kt @@ -23,5 +23,6 @@ internal fun Any?.deserializeGeneralStyleSettings( font = this["font"].deserializeBannerFont(assetsProvider, activityProvider), links = this["links"].deserializeLegalLinksSettings(), disableSystemBackButton = this["disableSystemBackButton"] as? Boolean, + windowFullscreen = this["windowFullscreen"] as? Boolean, ) } diff --git a/example/android/app/src/main/kotlin/com/usercentrics/sdk/flutter_example/MainActivity.kt b/example/android/app/src/main/kotlin/com/usercentrics/sdk/flutter_example/MainActivity.kt index 4d822786..95937cf1 100644 --- a/example/android/app/src/main/kotlin/com/usercentrics/sdk/flutter_example/MainActivity.kt +++ b/example/android/app/src/main/kotlin/com/usercentrics/sdk/flutter_example/MainActivity.kt @@ -1,6 +1,12 @@ package com.usercentrics.sdk.flutter_example +import android.os.Bundle +import androidx.core.view.WindowCompat import io.flutter.embedding.android.FlutterActivity class MainActivity: FlutterActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + WindowCompat.setDecorFitsSystemWindows(window, false) + } } diff --git a/example/lib/main.dart b/example/lib/main.dart index c2944f10..d4c920d4 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -6,6 +6,7 @@ import 'package:usercentrics_sdk/usercentrics_sdk.dart'; import 'build_your_own_ui.dart'; import 'customization_example_1.dart'; import 'customization_example_2.dart'; +import 'window_fullscreen_example.dart'; // Build-time flag — shows the consent mediation toggle when true. // Usage: flutter run --dart-define=MEDIATION_TEST=true @@ -212,6 +213,14 @@ class HomePageState extends State { : null, child: const Text("Customization Example 2"), ), + ElevatedButton( + onPressed: isSdkReady + ? () => _showFirstLayer( + settings: bannerSettingsWindowFullscreenExample, + ) + : null, + child: const Text("Window Fullscreen (Android)"), + ), ElevatedButton( onPressed: isSdkReady ? () => Navigator.push( diff --git a/example/lib/window_fullscreen_example.dart b/example/lib/window_fullscreen_example.dart new file mode 100644 index 00000000..665369e6 --- /dev/null +++ b/example/lib/window_fullscreen_example.dart @@ -0,0 +1,12 @@ +import 'package:usercentrics_sdk/usercentrics_sdk.dart'; + +// MSDK-4637: exercises the windowFullscreen backward-compat workaround +// (Android only) — see https://usercentrics.atlassian.net/browse/MSDK-4637 +const bannerSettingsWindowFullscreenExample = BannerSettings( + firstLayer: FirstLayerStyleSettings( + layout: UsercentricsLayout.full, + ), + general: GeneralStyleSettings( + windowFullscreen: true, + ), +); diff --git a/lib/src/internal/serializer/general_style_settings_serializer.dart b/lib/src/internal/serializer/general_style_settings_serializer.dart index 5198d8a8..0666e80e 100644 --- a/lib/src/internal/serializer/general_style_settings_serializer.dart +++ b/lib/src/internal/serializer/general_style_settings_serializer.dart @@ -22,6 +22,7 @@ class GeneralStyleSettingsSerializer { 'logo': value.logo?.assetPath, 'links': LegalLinksSettingsSerializer.serialize(value.links), 'disableSystemBackButton': value.disableSystemBackButton, + 'windowFullscreen': value.windowFullscreen, }; static dynamic _serializeFont(BannerFont? customFont) { diff --git a/lib/src/model/general_style_settings.dart b/lib/src/model/general_style_settings.dart index 97a0e869..94b283ec 100644 --- a/lib/src/model/general_style_settings.dart +++ b/lib/src/model/general_style_settings.dart @@ -17,6 +17,7 @@ class GeneralStyleSettings { this.logo, this.links, this.disableSystemBackButton, + this.windowFullscreen, }); /// The text color. @@ -51,6 +52,11 @@ class GeneralStyleSettings { final bool? disableSystemBackButton; + /// Android-only. Backward-compat workaround for publishers who relied on the + /// legacy fullscreen dialog behavior prior to the edge-to-edge fix. Has no + /// effect on iOS. + final bool? windowFullscreen; + @override bool operator ==(Object other) => identical(this, other) || @@ -67,7 +73,8 @@ class GeneralStyleSettings { font == other.font && logo == other.logo && links == other.links && - disableSystemBackButton == other.disableSystemBackButton; + disableSystemBackButton == other.disableSystemBackButton && + windowFullscreen == other.windowFullscreen; @override int get hashCode => @@ -81,11 +88,12 @@ class GeneralStyleSettings { font.hashCode ^ logo.hashCode ^ links.hashCode ^ - disableSystemBackButton.hashCode; + disableSystemBackButton.hashCode ^ + windowFullscreen.hashCode; @override String toString() { - return 'GeneralStyleSettings{textColor: $textColor, layerBackgroundColor: $layerBackgroundColor, layerBackgroundSecondaryColor: $layerBackgroundSecondaryColor, linkColor: $linkColor, tabColor: $tabColor, bordersColor: $bordersColor, toggleStyleSettings: $toggleStyleSettings, font: $font, logo: $logo, links: $links, disableSystemBackButton: $disableSystemBackButton}'; + return 'GeneralStyleSettings{textColor: $textColor, layerBackgroundColor: $layerBackgroundColor, layerBackgroundSecondaryColor: $layerBackgroundSecondaryColor, linkColor: $linkColor, tabColor: $tabColor, bordersColor: $bordersColor, toggleStyleSettings: $toggleStyleSettings, font: $font, logo: $logo, links: $links, disableSystemBackButton: $disableSystemBackButton, windowFullscreen: $windowFullscreen}'; } } diff --git a/test/internal/bridge/show_first_layer_bridge_test.mock.dart b/test/internal/bridge/show_first_layer_bridge_test.mock.dart index dbe7b54a..d1dd3ad0 100644 --- a/test/internal/bridge/show_first_layer_bridge_test.mock.dart +++ b/test/internal/bridge/show_first_layer_bridge_test.mock.dart @@ -116,6 +116,7 @@ const expectedArguments = { 'logo': 'images/flutter-logo.png', 'links': 'BOTH', 'disableSystemBackButton': false, + 'windowFullscreen': null, }, "variantName": "variantA", "initCustomization": null diff --git a/test/internal/bridge/show_second_layer_bridge_test.mock.dart b/test/internal/bridge/show_second_layer_bridge_test.mock.dart index ad5b53d9..49279c3d 100644 --- a/test/internal/bridge/show_second_layer_bridge_test.mock.dart +++ b/test/internal/bridge/show_second_layer_bridge_test.mock.dart @@ -91,7 +91,8 @@ const expectedArguments = { }, 'logo': 'images/flutter-logo.png', 'links': 'HIDDEN', - 'disableSystemBackButton': false + 'disableSystemBackButton': false, + 'windowFullscreen': null }, "variantName": 'variantA', "initCustomization": {