Skip to content

Commit fac2834

Browse files
authored
Merge pull request #468 from OneSignal/fix/DeviceState-wrong-key-names
Fix OSDeviceState has wrong keys for `pushDisabled` and `subscribed`
2 parents 51d5850 + 33dd4c5 commit fac2834

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

example/pubspec.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ dev_dependencies:
1616
flutter_test:
1717
sdk: flutter
1818

19-
onesignal_flutter: ^3.1.0
19+
onesignal_flutter:
20+
path: ../
2021

2122
# For information on the generic Dart part of this file, see the
2223
# following page: https://www.dartlang.org/tools/pub/pubspec

lib/src/permission.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ class OSPermissionStateChanges extends JSONStringRepresentable {
8686
class OSDeviceState extends JSONStringRepresentable {
8787

8888
bool hasNotificationPermission = false;
89-
bool isPushDisabled = false;
90-
bool isSubscribed = false;
89+
bool pushDisabled = false;
90+
bool subscribed = false;
9191
bool emailSubscribed = false;
9292
bool smsSubscribed = false;
9393
String? userId;
@@ -100,8 +100,8 @@ class OSDeviceState extends JSONStringRepresentable {
100100

101101
OSDeviceState(Map<String, dynamic> json) {
102102
this.hasNotificationPermission = json['hasNotificationPermission'] as bool;
103-
this.isPushDisabled = json['isPushDisabled'] as bool;
104-
this.isSubscribed = json['isSubscribed'] as bool;
103+
this.pushDisabled = json['pushDisabled'] as bool;
104+
this.subscribed = json['subscribed'] as bool;
105105
this.emailSubscribed = json['emailSubscribed'] as bool;
106106
this.smsSubscribed = json['smsSubscribed'] as bool;
107107
this.userId = json['userId'] as String?;
@@ -116,8 +116,8 @@ class OSDeviceState extends JSONStringRepresentable {
116116
String jsonRepresentation() {
117117
return convertToJsonString({
118118
'hasNotificationPermission': this.hasNotificationPermission,
119-
'isPushDisabled': this.isPushDisabled,
120-
'isSubscribed': this.isSubscribed,
119+
'isPushDisabled': this.pushDisabled,
120+
'isSubscribed': this.subscribed,
121121
'userId': this.userId,
122122
'pushToken': this.pushToken,
123123
'isEmailSubscribed': this.emailSubscribed,

0 commit comments

Comments
 (0)