From 1d19d8f09d183eceaf71ae0ff333a67e077e5c38 Mon Sep 17 00:00:00 2001 From: mikechoch Date: Wed, 4 Dec 2019 15:07:09 -0800 Subject: [PATCH 1/2] Updated iOS native SDK to 2.12.2 --- android/build.gradle | 2 +- ios/onesignal_flutter.podspec | 4 ++-- pubspec.yaml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 0343f1e5..b28727c2 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,5 @@ group 'com.onesignal.flutter' -version '2.3.0' +version '2.3.1' buildscript { repositories { diff --git a/ios/onesignal_flutter.podspec b/ios/onesignal_flutter.podspec index 39ae7fa4..2df7807e 100644 --- a/ios/onesignal_flutter.podspec +++ b/ios/onesignal_flutter.podspec @@ -3,7 +3,7 @@ # Pod::Spec.new do |s| s.name = 'onesignal_flutter' - s.version = '2.3.0' + s.version = '2.3.1' s.summary = 'The OneSignal Flutter SDK' s.description = 'Allows you to easily add OneSignal to your flutter projects, to make sending and handling push notifications easy' s.homepage = 'https://www.onesignal.com' @@ -13,7 +13,7 @@ Pod::Spec.new do |s| s.source_files = 'Classes/**/*' s.public_header_files = 'Classes/**/*.h' s.dependency 'Flutter' - s.dependency 'OneSignal', '2.12.1' + s.dependency 'OneSignal', '2.12.2' s.ios.deployment_target = '8.0' s.static_framework = true end diff --git a/pubspec.yaml b/pubspec.yaml index 5ececef5..e15407e0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: onesignal_flutter description: OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your flutter app with OneSignal -version: 2.3.0 +version: 2.3.1 author: Brad Hesse , Josh Kasten homepage: https://github.com/OneSignal/OneSignal-Flutter-SDK From 8cd667999784310e822c100c5ea06202659ae013 Mon Sep 17 00:00:00 2001 From: mikechoch Date: Wed, 4 Dec 2019 16:49:58 -0800 Subject: [PATCH 2/2] Fixed parsing for 'notification_ids' after changes to iOS SDK * Handle the case for if the 'notification_ids' in OSOutcomeEvent is a List as a string or as a List * Removed not needed @implementation inside of 'OSFlutterCategories' --- ios/Classes/OSFlutterCategories.h | 5 ----- ios/Classes/OSFlutterCategories.m | 15 --------------- lib/src/outcome_event.dart | 13 ++++++++++--- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/ios/Classes/OSFlutterCategories.h b/ios/Classes/OSFlutterCategories.h index 0a7e271e..2412840e 100644 --- a/ios/Classes/OSFlutterCategories.h +++ b/ios/Classes/OSFlutterCategories.h @@ -47,11 +47,6 @@ - (NSDictionary *)toJson; @end -// TODO: Will reference the OSOutcomeEvent in OneSignal.h -//@interface OSOutcomeEvent (Flutter) -//- (NSDictionary *)toJson; -//@end - @interface NSError (Flutter) - (FlutterError *)flutterError; @end diff --git a/ios/Classes/OSFlutterCategories.m b/ios/Classes/OSFlutterCategories.m index ba313198..a6897f28 100644 --- a/ios/Classes/OSFlutterCategories.m +++ b/ios/Classes/OSFlutterCategories.m @@ -112,21 +112,6 @@ - (NSDictionary *)toJson { } @end -// TODO: Will reference the OSOutcomeEvent in OneSignal.h -//@implementation OSOutcomeEvent (Flutter) -//- (NSDictionary *)toJson { -// NSMutableDictionary *json = [NSMutableDictionary new]; -// -// json[@"session"] = self.session; -// json[@"notification_ids"] = self.notificationIds; -// json[@"name"] = self.name; -// json[@"timestamp"] = self.timestamp; -// json[@"weight"] = self.weight; -// -// return json; -//} -//@end - @implementation NSError (Flutter) - (FlutterError *)flutterError { return [FlutterError errorWithCode:[NSString stringWithFormat:@"%i", (int)self.code] message:self.localizedDescription details:nil]; diff --git a/lib/src/outcome_event.dart b/lib/src/outcome_event.dart index 3ceb9c11..6a1fb106 100644 --- a/lib/src/outcome_event.dart +++ b/lib/src/outcome_event.dart @@ -46,9 +46,16 @@ class OSOutcomeEvent extends JSONStringRepresentable { OSSession.DISABLED; // Make sure notification_ids exists - this.notificationIds = outcome.containsKey("notification_ids") && outcome["notification_ids"] != null ? - new List.from(json.decode(outcome["notification_ids"])) : - []; + if (outcome.containsKey("notification_ids") && outcome["notification_ids"] != null) { + if (outcome["notification_ids"] is List) { + // Handle if type comes in as a List + this.notificationIds = (outcome["notification_ids"] as List).map((s) => s).toList(); + } + else if (outcome["notification_ids"] is String) { + // Handle if type comes in as a String + this.notificationIds = new List.from(json.decode(outcome["notification_ids"])); + } + } // Make sure name exists this.name = outcome.containsKey("id") && outcome["id"] != null ?