AppsFlyerSDK / appsflyer-flutter-plugin

Flutter Plugin for AppsFlyer SDK
MIT License
148 stars 116 forks source link

JSON response returned in onInstallConversionData is not JSON encoded #225

Closed ec-siddhant closed 2 years ago

ec-siddhant commented 2 years ago

Describe the bug JSON returned in onInstallConversionData(resp) is not JSON encoded, The strings are not in double quotes, which makes JSON corrupt.

To Reproduce call this method and see the log:

 _appsflyerSdk.onInstallConversionData((res) {
      print("$res");
});

It will print something like this: {status: success, payload: {install_time: 2022-07-27 15:05:06.878, af_status: Organic, af_message: organic install, is_first_launch: false}}

Notice the strings are not in double quotes.

Expected behavior The JSON returned should have been something like this: {status: "success", payload: {install_time: "2022-07-27 15:05:06.878", af_status: "Organic", af_message: "organic install", is_first_launch: false}}

Additional context My main goal is to get attribution data so that I can save the campaign id in my own database, my best guess is that this data is available in JSON returned by onInstallConversionData callback, but JSON is not encoded so I can't parse it.

ec-siddhant commented 2 years ago

Passing the response through this function seems to be working now:

 String _formatJson(resp) {
    JsonEncoder encoder = const JsonEncoder.withIndent('  ');
    return encoder.convert(jsonObj);
  }