Skip to content

Commit c41174e

Browse files
committed
undo closing message change
1 parent e54fec7 commit c41174e

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

lib/src/inappmessage.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ class OSInAppMessageClickResult extends JSONStringRepresentable {
3333
String? url;
3434

3535
// Whether or not the click action should dismiss the IAM
36-
bool? closingMessage;
36+
bool closingMessage = false;
3737

3838
OSInAppMessageClickResult(Map<String, dynamic> json) {
3939
this.actionId = json["action_id"];
4040
this.url = json["url"];
41-
this.closingMessage = json["closing_message"] ?? false;
41+
this.closingMessage = json["closing_message"] as bool;
4242
}
4343

4444
String jsonRepresentation() {

test/inappmessage_test.dart

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ void main() {
7777
expect(result.closingMessage, true);
7878
});
7979

80-
test('creates from empty JSON', () {
81-
final json = <String, dynamic>{};
80+
test('creates from minimal JSON', () {
81+
final json = <String, dynamic>{
82+
'closing_message': false,
83+
};
8284
final result = OSInAppMessageClickResult(json);
8385

8486
expect(result.actionId, isNull);
@@ -96,7 +98,9 @@ void main() {
9698
});
9799

98100
test('jsonRepresentation handles null optional fields', () {
99-
final json = <String, dynamic>{};
101+
final json = <String, dynamic>{
102+
'closing_message': false,
103+
};
100104
final result = OSInAppMessageClickResult(json);
101105
final jsonString = result.jsonRepresentation();
102106

@@ -111,6 +115,7 @@ void main() {
111115
final json = {
112116
'message': validMessageJson,
113117
'result': validClickResultJson,
118+
'closing_message': false,
114119
};
115120
final event = OSInAppMessageClickEvent(json);
116121

@@ -123,7 +128,9 @@ void main() {
123128
test('creates from JSON with minimal fields', () {
124129
final json = {
125130
'message': validMessageJson,
126-
'result': {},
131+
'result': {
132+
'closing_message': false,
133+
},
127134
};
128135
final event = OSInAppMessageClickEvent(json);
129136

0 commit comments

Comments
 (0)