diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c24b8c2..ba1ca29e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: run: flutter analyze --no-pub --no-fatal-infos - name: Ensure the Dart code is formatted correctly - run: flutter format -o json --set-exit-if-changed . + run: flutter format -o none --set-exit-if-changed . - name: Run Flutter unit tests run: flutter test diff --git a/lib/src/in_app_message.dart b/lib/src/in_app_message.dart index 1348c95e..c235af25 100644 --- a/lib/src/in_app_message.dart +++ b/lib/src/in_app_message.dart @@ -4,7 +4,6 @@ import 'package:onesignal_flutter/src/utils.dart'; /// the handler returns an OSInAppMessageAction object so the Dart code can act accordingly /// This allows for custom action events within Dart class OSInAppMessageAction extends JSONStringRepresentable { - // Name of the action event defined for the IAM element String? clickName; @@ -32,7 +31,6 @@ class OSInAppMessageAction extends JSONStringRepresentable { 'closes_message': this.closesMessage, }); } - } class OSInAppMessage extends JSONStringRepresentable { @@ -40,11 +38,9 @@ class OSInAppMessage extends JSONStringRepresentable { OSInAppMessage(Map json) { this.messageId = json["message_id"]; - } + } String jsonRepresentation() { - return convertToJsonString({ - 'message_id': this.messageId - }); + return convertToJsonString({'message_id': this.messageId}); } } diff --git a/lib/src/permission.dart b/lib/src/permission.dart index 1e48ac39..3aa69ef8 100644 --- a/lib/src/permission.dart +++ b/lib/src/permission.dart @@ -84,7 +84,6 @@ class OSPermissionStateChanges extends JSONStringRepresentable { } class OSDeviceState extends JSONStringRepresentable { - bool hasNotificationPermission = false; bool pushDisabled = false; bool subscribed = false; @@ -110,7 +109,10 @@ class OSDeviceState extends JSONStringRepresentable { this.emailAddress = json['emailAddress'] as String?; this.smsUserId = json['smsUserId'] as String?; this.smsNumber = json['smsNumber'] as String?; - this.notificationPermissionStatus = json['notificationPermissionStatus'] == null ? null : OSNotificationPermission.values[json['notificationPermissionStatus']]; + this.notificationPermissionStatus = json['notificationPermissionStatus'] == + null + ? null + : OSNotificationPermission.values[json['notificationPermissionStatus']]; } String jsonRepresentation() { @@ -129,4 +131,4 @@ class OSDeviceState extends JSONStringRepresentable { 'notificationPermissionStatus': this.notificationPermissionStatus?.index, }); } -} \ No newline at end of file +} diff --git a/lib/src/subscription.dart b/lib/src/subscription.dart index be360817..3bd1652c 100644 --- a/lib/src/subscription.dart +++ b/lib/src/subscription.dart @@ -93,7 +93,8 @@ class OSEmailSubscriptionStateChanges extends JSONStringRepresentable { OSEmailSubscriptionStateChanges(Map json) { if (json.containsKey('from')) - this.from = OSEmailSubscriptionState(json['from'].cast()); + this.from = + OSEmailSubscriptionState(json['from'].cast()); if (json.containsKey('to')) this.to = OSEmailSubscriptionState(json['to'].cast()); } @@ -151,4 +152,4 @@ class OSSMSSubscriptionStateChanges extends JSONStringRepresentable { 'to': this.to.jsonRepresentation() }); } -} \ No newline at end of file +} diff --git a/lib/src/utils.dart b/lib/src/utils.dart index 204dccd0..0f9e1bbd 100644 --- a/lib/src/utils.dart +++ b/lib/src/utils.dart @@ -61,14 +61,14 @@ dynamic convertEnumCaseToValue(dynamic key) { } switch (key) { - case OSSession.DIRECT: - return "DIRECT"; - case OSSession.INDIRECT: - return "INDIRECT"; - case OSSession.UNATTRIBUTED: - return "UNATTRIBUTED"; - case OSSession.DISABLED: - return "DISABLED"; + case OSSession.DIRECT: + return "DIRECT"; + case OSSession.INDIRECT: + return "INDIRECT"; + case OSSession.UNATTRIBUTED: + return "UNATTRIBUTED"; + case OSSession.DISABLED: + return "DISABLED"; } return key; @@ -78,9 +78,9 @@ dynamic convertEnumCaseToValue(dynamic key) { abstract class JSONStringRepresentable { String jsonRepresentation(); - String convertToJsonString(Map? object) => JsonEncoder - .withIndent(' ') - .convert(object) - .replaceAll("\\n", "\n") - .replaceAll("\\", ""); + String convertToJsonString(Map? object) => + JsonEncoder.withIndent(' ') + .convert(object) + .replaceAll("\\n", "\n") + .replaceAll("\\", ""); } diff --git a/test/onesignalflutter_test.dart b/test/onesignalflutter_test.dart index 7ad3d20c..48f9d10c 100644 --- a/test/onesignalflutter_test.dart +++ b/test/onesignalflutter_test.dart @@ -3,7 +3,6 @@ import 'package:onesignal_flutter/onesignal_flutter.dart'; import 'mock_channel.dart'; import 'test_data.dart'; - void main() { TestWidgetsFlutterBinding.ensureInitialized(); @@ -55,7 +54,8 @@ void main() { }).then(expectAsync1((v) { expect(channelController.state.postNotificationJson!['content_available'], true); - expect(channelController.state.postNotificationJson!['include_player_ids'], + expect( + channelController.state.postNotificationJson!['include_player_ids'], [testPlayerId]); })); });