@@ -377,8 +377,8 @@ + (void)sendEventWithName:(NSString *)name withBody:(NSDictionary *)body {
377377 [OneSignal removeTriggerForKey: key];
378378}
379379
380- RCT_REMAP_METHOD (getTriggerValueForKey,
381- key:(NSString *)key
380+ RCT_REMAP_METHOD (getTriggerValueForKey,
381+ key:(NSString *)key
382382 getTriggerValueForKeyResolver:(RCTPromiseResolveBlock)resolve
383383 rejecter:(RCTPromiseRejectBlock)reject) {
384384
@@ -404,42 +404,30 @@ + (void)sendEventWithName:(NSString *)name withBody:(NSDictionary *)body {
404404 @" clickUrl" : action.clickUrl .absoluteString ?: [NSNull null ],
405405 @" firstClick" : @(action.firstClick ),
406406 @" closesMessage" : @(action.closesMessage )
407- };
407+ };
408408 [RCTOneSignalEventEmitter sendEventWithName: @" OneSignal-inAppMessageClicked" withBody: result];
409409 }];
410410}
411411
412412/*
413413 * Outcomes
414414 */
415- 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- // }];
415+ RCT_EXPORT_METHOD (sendOutcome:(NSString *)name :(RCTResponseSenderBlock)callback) {
416+ [OneSignal sendOutcome: name onSuccess: ^(OSOutcomeEvent *outcome){
417+ callback (@[[outcome jsonRepresentation ]]);
418+ }];
423419}
424420
425- 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- // }];
421+ RCT_EXPORT_METHOD (sendUniqueOutcome:(NSString *)name :(RCTResponseSenderBlock)callback) {
422+ [OneSignal sendUniqueOutcome: name onSuccess: ^(OSOutcomeEvent *outcome){
423+ callback (@[[outcome jsonRepresentation ]]);
424+ }];
433425}
434426
435- 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- // }];
427+ RCT_EXPORT_METHOD (sendOutcomeWithValue:(NSString *)name :(NSNumber * _Nonnull)value :(RCTResponseSenderBlock)callback) {
428+ [OneSignal sendOutcomeWithValue: name value: value onSuccess: ^(OSOutcomeEvent *outcome){
429+ callback (@[[outcome jsonRepresentation ]]);
430+ }];
443431}
444432
445433@end
0 commit comments