File tree Expand file tree Collapse file tree 3 files changed +10
-23
lines changed Expand file tree Collapse file tree 3 files changed +10
-23
lines changed Original file line number Diff line number Diff line change 4747- (NSDictionary *)toJson ;
4848@end
4949
50- // TODO: Will reference the OSOutcomeEvent in OneSignal.h
51- // @interface OSOutcomeEvent (Flutter)
52- // - (NSDictionary *)toJson;
53- // @end
54-
5550@interface NSError (Flutter)
5651- (FlutterError *)flutterError ;
5752@end
Original file line number Diff line number Diff line change @@ -112,21 +112,6 @@ - (NSDictionary *)toJson {
112112}
113113@end
114114
115- // TODO: Will reference the OSOutcomeEvent in OneSignal.h
116- // @implementation OSOutcomeEvent (Flutter)
117- // - (NSDictionary *)toJson {
118- // NSMutableDictionary *json = [NSMutableDictionary new];
119- //
120- // json[@"session"] = self.session;
121- // json[@"notification_ids"] = self.notificationIds;
122- // json[@"name"] = self.name;
123- // json[@"timestamp"] = self.timestamp;
124- // json[@"weight"] = self.weight;
125- //
126- // return json;
127- // }
128- // @end
129-
130115@implementation NSError (Flutter)
131116- (FlutterError *)flutterError {
132117 return [FlutterError errorWithCode: [NSString stringWithFormat: @" %i " , (int )self .code] message: self .localizedDescription details: nil ];
Original file line number Diff line number Diff line change @@ -46,9 +46,16 @@ class OSOutcomeEvent extends JSONStringRepresentable {
4646 OSSession .DISABLED ;
4747
4848 // Make sure notification_ids exists
49- this .notificationIds = outcome.containsKey ("notification_ids" ) && outcome["notification_ids" ] != null ?
50- new List <String >.from (json.decode (outcome["notification_ids" ])) :
51- [];
49+ if (outcome.containsKey ("notification_ids" ) && outcome["notification_ids" ] != null ) {
50+ if (outcome["notification_ids" ] is List ) {
51+ // Handle if type comes in as a List
52+ this .notificationIds = (outcome["notification_ids" ] as List ).map <String >((s) => s).toList ();
53+ }
54+ else if (outcome["notification_ids" ] is String ) {
55+ // Handle if type comes in as a String
56+ this .notificationIds = new List <String >.from (json.decode (outcome["notification_ids" ]));
57+ }
58+ }
5259
5360 // Make sure name exists
5461 this .name = outcome.containsKey ("id" ) && outcome["id" ] != null ?
You can’t perform that action at this time.
0 commit comments