Skip to content

Commit

Permalink
iOS null callback fix for setExternalUserId
Browse files Browse the repository at this point in the history
Motivation: we want to make sure that the `setExternalUserId` works for iOS even if no callback is passed. Thus, we are re-adding the default callback but for iOS only. 

Note: for Android we want it to be nullable temporarily as a workaround for the current issue of the same callback firing multiple times (crashes) due to the `onSuccess` triggering once per channel.

Note: in the future, we intend to make argument non-nullability or nullability consistent across both platforms.
  • Loading branch information
rgomezp committed Jan 11, 2021
1 parent 6392215 commit aa5b2b8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,10 @@ export default class OneSignal {
return;
}

if (!varArg2 && Platform.OS === 'ios') {
varArg2 = function(){};
}

RNOneSignal.setExternalUserId(externalId, varArg1, varArg2);
}

Expand Down

0 comments on commit aa5b2b8

Please sign in to comment.