From 58112d4f87e25490b65b59e6a0b9710c3b6866b0 Mon Sep 17 00:00:00 2001 From: uerceg Date: Mon, 27 Jan 2025 23:48:16 +0100 Subject: [PATCH] feat: add jsonResponse to attribution in web bridge --- Adjust/ADJAttribution.m | 3 +++ .../AdjustWebBridgeTestApp/TestLibraryBridge.h | 4 ++-- .../AdjustWebBridgeTestApp/TestLibraryBridge.js | 16 ++++++++++++++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Adjust/ADJAttribution.m b/Adjust/ADJAttribution.m index 853f2a233..a16fc154c 100644 --- a/Adjust/ADJAttribution.m +++ b/Adjust/ADJAttribution.m @@ -107,6 +107,9 @@ - (NSDictionary *)dictionary { if (self.costCurrency != nil) { [responseDataDic setObject:self.costCurrency forKey:@"costCurrency"]; } + if (self.jsonResponse != nil) { + [responseDataDic setObject:self.jsonResponse forKey:@"jsonResponse"]; + } return responseDataDic; } diff --git a/AdjustTests/AdjustWebBridgeTestApp/AdjustWebBridgeTestApp/TestLibraryBridge.h b/AdjustTests/AdjustWebBridgeTestApp/AdjustWebBridgeTestApp/TestLibraryBridge.h index 66d35a77a..aeaa65891 100644 --- a/AdjustTests/AdjustWebBridgeTestApp/AdjustWebBridgeTestApp/TestLibraryBridge.h +++ b/AdjustTests/AdjustWebBridgeTestApp/AdjustWebBridgeTestApp/TestLibraryBridge.h @@ -15,8 +15,8 @@ //static NSString * controlUrl = @"ws://127.0.0.1:1987"; // device -static NSString * urlOverwrite = @"http://192.168.178.81:8080"; -static NSString * controlUrl = @"ws://192.168.178.81:1987"; +static NSString * urlOverwrite = @"http://192.168.86.82:8080"; +static NSString * controlUrl = @"ws://192.168.86.82:1987"; @interface TestLibraryBridge : NSObject diff --git a/AdjustTests/AdjustWebBridgeTestApp/AdjustWebBridgeTestApp/TestLibraryBridge.js b/AdjustTests/AdjustWebBridgeTestApp/AdjustWebBridgeTestApp/TestLibraryBridge.js index 8397c3f35..a5f4b168c 100644 --- a/AdjustTests/AdjustWebBridgeTestApp/AdjustWebBridgeTestApp/TestLibraryBridge.js +++ b/AdjustTests/AdjustWebBridgeTestApp/AdjustWebBridgeTestApp/TestLibraryBridge.js @@ -2,8 +2,8 @@ //var urlOverwrite = 'http://127.0.0.1:8080'; //var controlUrl = 'ws://127.0.0.1:1987'; // device -var urlOverwrite = 'http://192.168.178.81:8080'; -var controlUrl = 'ws://192.168.178.81:1987'; +var urlOverwrite = 'http://192.168.86.82:8080'; +var controlUrl = 'ws://192.168.86.82:1987'; // local reference of the command executor // originally it was this.adjustCommandExecutor of TestLibraryBridge var @@ -335,6 +335,12 @@ AdjustCommandExecutor.prototype.config = function(params) { addInfoToSend('cost_type', attribution.costType); addInfoToSend('cost_amount', attribution.costAmount); addInfoToSend('cost_currency', attribution.costCurrency); + const jsonResponseWithoutFbInstallReferrer = { ...attribution.jsonResponse }; + if (jsonResponseWithoutFbInstallReferrer.cost_amount !== undefined) { + jsonResponseWithoutFbInstallReferrer.cost_amount = parseFloat(jsonResponseWithoutFbInstallReferrer.cost_amount).toFixed(2); + } + delete jsonResponseWithoutFbInstallReferrer.fb_install_referrer; + addInfoToSend('json_response', JSON.stringify(jsonResponseWithoutFbInstallReferrer)); sendInfoToServer(extraPath); } ); @@ -647,6 +653,12 @@ AdjustCommandExecutor.prototype.attributionGetter = function(params) { addInfoToSend('cost_type', attribution.costType); addInfoToSend('cost_amount', attribution.costAmount); addInfoToSend('cost_currency', attribution.costCurrency); + const jsonResponseWithoutFbInstallReferrer = { ...attribution.jsonResponse }; + if (jsonResponseWithoutFbInstallReferrer.cost_amount !== undefined) { + jsonResponseWithoutFbInstallReferrer.cost_amount = parseFloat(jsonResponseWithoutFbInstallReferrer.cost_amount).toFixed(2); + } + delete jsonResponseWithoutFbInstallReferrer.fb_install_referrer; + addInfoToSend('json_response', JSON.stringify(jsonResponseWithoutFbInstallReferrer)); sendInfoToServer(extraPath); }); }