Skip to content

Commit

Permalink
Merge pull request #444 from kutsan/remove-json-parse
Browse files Browse the repository at this point in the history
Explicitly check for is_first_launch instead of using JSON.parse
  • Loading branch information
amit-kremer93 authored Jan 11, 2023
2 parents b2b6ef3 + 127145e commit 9ec7763
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,8 @@ The code implementation for the conversion listener must be made prior to the in
```javascript
const onInstallConversionDataCanceller = appsFlyer.onInstallConversionData(
(res) => {
if (JSON.parse(res.data.is_first_launch) == true) {
// Note that `is_first_launch` will be "true" (string) on Android and true (boolean) on iOS.
if (res.data.is_first_launch === "true" || res.data.is_first_launch === true) {
if (res.data.af_status === 'Non-organic') {
var media_source = res.data.media_source;
var campaign = res.data.campaign;
Expand Down Expand Up @@ -950,8 +951,6 @@ appsFlyer.initSdk(/*...*/);
}
```

> **Note** is_first_launch will be "true" (string) on Android and true (boolean) on iOS. To solve this issue wrap is_first_launch with JSON.parse(res.data.is_first_launch) as in the example above.
`appsFlyer.onInstallConversionData` returns a function the will allow us to call `NativeAppEventEmitter.remove()`.<br/>

---
Expand Down

0 comments on commit 9ec7763

Please sign in to comment.