Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
}
Original file line number Diff line number Diff line change
@@ -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)
}
}
9 changes: 9 additions & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -212,6 +213,14 @@ class HomePageState extends State<HomePage> {
: 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(
Expand Down
12 changes: 12 additions & 0 deletions example/lib/window_fullscreen_example.dart
Original file line number Diff line number Diff line change
@@ -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,
),
);
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
14 changes: 11 additions & 3 deletions lib/src/model/general_style_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class GeneralStyleSettings {
this.logo,
this.links,
this.disableSystemBackButton,
this.windowFullscreen,
});

/// The text color.
Expand Down Expand Up @@ -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) ||
Expand All @@ -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 =>
Expand All @@ -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}';
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ const expectedArguments = {
'logo': 'images/flutter-logo.png',
'links': 'BOTH',
'disableSystemBackButton': false,
'windowFullscreen': null,
},
"variantName": "variantA",
"initCustomization": null
Expand Down
3 changes: 2 additions & 1 deletion test/internal/bridge/show_second_layer_bridge_test.mock.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ const expectedArguments = {
},
'logo': 'images/flutter-logo.png',
'links': 'HIDDEN',
'disableSystemBackButton': false
'disableSystemBackButton': false,
'windowFullscreen': null
},
"variantName": 'variantA',
"initCustomization": {
Expand Down
Loading