Skip to content

Commit 355e0d2

Browse files
committed
iOS bridge for Outcomes
1 parent d3043cc commit 355e0d2

File tree

1 file changed

+9
-21
lines changed

1 file changed

+9
-21
lines changed

ios/RCTOneSignal/RCTOneSignalEventEmitter.m

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -413,33 +413,21 @@ + (void)sendEventWithName:(NSString *)name withBody:(NSDictionary *)body {
413413
* Outcomes
414414
*/
415415
RCT_EXPORT_METHOD(sendOutcome:(NSString *)name withCallback:(RCTResponseSenderBlock)callback) {
416-
[OneSignal onesignal_Log:ONE_S_LL_ERROR message:@"Not implemented for iOS"];
417-
418-
// [OneSignal sendUniqueOutcome:name onSuccess:^(NSDictionary *result) {
419-
// callback(@[result]);
420-
// } onFailure:^(NSError *error){
421-
// callback(@[error.userInfo[@"error"] ?: error.localizedDescription]);
422-
// }];
416+
[OneSignal sendOutcome:name onSuccess:^(OSOutcomeEvent *outcome){
417+
callback(@[[outcome jsonRepresentation]]);
418+
}];
423419
}
424420

425421
RCT_EXPORT_METHOD(sendUniqueOutcome:(NSString *)name withCallback:(RCTResponseSenderBlock)callback) {
426-
[OneSignal onesignal_Log:ONE_S_LL_ERROR message:@"Not implemented for iOS"];
427-
428-
// [OneSignal sendUniqueOutcome:name onSuccess:^(NSDictionary *result) {
429-
// callback(@[result]);
430-
// } onFailure:^(NSError *error){
431-
// callback(@[error.userInfo[@"error"] ?: error.localizedDescription]);
432-
// }];
422+
[OneSignal sendUniqueOutcome:name onSuccess:^(OSOutcomeEvent *outcome){
423+
callback(@[[outcome jsonRepresentation]]);
424+
}];
433425
}
434426

435427
RCT_EXPORT_METHOD(sendOutcomeWithValue:(NSString *)name withValue:(float)value withCallback:(RCTResponseSenderBlock)callback) {
436-
[OneSignal onesignal_Log:ONE_S_LL_ERROR message:@"Not implemented for iOS"];
437-
438-
// [OneSignal sendOutcomeWithValue:name onSuccess:^(NSDictionary *result) {
439-
// callback(@[result]);
440-
// } onFailure:^(NSError *error){
441-
// callback(@[error.userInfo[@"error"] ?: error.localizedDescription]);
442-
// }];
428+
[OneSignal sendOutcomeWithValue:name value:value onSuccess:^(OSOutcomeEvent *outcome){
429+
callback(@[[outcome jsonRepresentation]]);
430+
}];
443431
}
444432

445433
@end

0 commit comments

Comments
 (0)