Skip to content

Commit e343499

Browse files
rgomezpmikechoch
authored andcommitted
Finished iOS bridge for Outcomes
1 parent e77832e commit e343499

File tree

2 files changed

+6
-21
lines changed

2 files changed

+6
-21
lines changed

index.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -475,11 +475,6 @@ export default class OneSignal {
475475
static sendOutcome(name, callback=()=>{}) {
476476
if (!checkIfInitialized()) return;
477477

478-
if (Platform.OS === "ios") {
479-
console.warn("OneSignal.sendOutcome is not yet supported on iOS");
480-
return;
481-
}
482-
483478
invariant(
484479
typeof callback === 'function',
485480
'Must provide a valid callback'
@@ -491,11 +486,6 @@ export default class OneSignal {
491486
static sendUniqueOutcome(name, callback=()=>{}) {
492487
if (!checkIfInitialized()) return;
493488

494-
if (Platform.OS === "ios") {
495-
console.warn("OneSignal.sendUniqueOutcome is not yet supported on iOS");
496-
return;
497-
}
498-
499489
invariant(
500490
typeof callback === 'function',
501491
'Must provide a valid callback'
@@ -507,11 +497,6 @@ export default class OneSignal {
507497
static sendOutcomeWithValue(name, value, callback=()=>{}) {
508498
if (!checkIfInitialized()) return;
509499

510-
if (Platform.OS === "ios") {
511-
console.warn("OneSignal.sendOutcomeWithValue is not yet supported on iOS");
512-
return;
513-
}
514-
515500
invariant(
516501
typeof callback === 'function',
517502
'Must provide a valid callback'

ios/RCTOneSignal/RCTOneSignalEventEmitter.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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,27 +404,27 @@ + (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) {
415+
RCT_EXPORT_METHOD(sendOutcome:(NSString *)name :(RCTResponseSenderBlock)callback) {
416416
[OneSignal sendOutcome:name onSuccess:^(OSOutcomeEvent *outcome){
417417
callback(@[[outcome jsonRepresentation]]);
418418
}];
419419
}
420420

421-
RCT_EXPORT_METHOD(sendUniqueOutcome:(NSString *)name withCallback:(RCTResponseSenderBlock)callback) {
421+
RCT_EXPORT_METHOD(sendUniqueOutcome:(NSString *)name :(RCTResponseSenderBlock)callback) {
422422
[OneSignal sendUniqueOutcome:name onSuccess:^(OSOutcomeEvent *outcome){
423423
callback(@[[outcome jsonRepresentation]]);
424424
}];
425425
}
426426

427-
RCT_EXPORT_METHOD(sendOutcomeWithValue:(NSString *)name withValue:(float)value withCallback:(RCTResponseSenderBlock)callback) {
427+
RCT_EXPORT_METHOD(sendOutcomeWithValue:(NSString *)name :(NSNumber * _Nonnull)value :(RCTResponseSenderBlock)callback) {
428428
[OneSignal sendOutcomeWithValue:name value:value onSuccess:^(OSOutcomeEvent *outcome){
429429
callback(@[[outcome jsonRepresentation]]);
430430
}];

0 commit comments

Comments
 (0)