From 0b992df7b2cce9195241d628a5236a8020230b4b Mon Sep 17 00:00:00 2001 From: Adam Gerthel Date: Wed, 6 Sep 2023 15:03:04 +0200 Subject: [PATCH 1/3] feat: add expo config support for NSAdvertisingAttributionReportEndpoint --- expo/withAppsFlyerIos.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/expo/withAppsFlyerIos.js b/expo/withAppsFlyerIos.js index cb2b0343..5b7a684e 100644 --- a/expo/withAppsFlyerIos.js +++ b/expo/withAppsFlyerIos.js @@ -67,8 +67,18 @@ function withPodfile(config, shouldUseStrictMode) { ]); } -module.exports = function withAppsFlyerIos(config, shouldUseStrictMode) { +function withPlistAdvertisingAttribution(config, url) { + return withInfoPlist(config, async config => { + const infoPlist = config.modResults; + infoPlist.NSAdvertisingAttributionReportEndpoint = url; + + return config; + }); +} + +module.exports = function withAppsFlyerIos(config, shouldUseStrictMode, skanEndpoint) { config = withPodfile(config, shouldUseStrictMode); config = withAppsFlyerAppDelegate(config); + config = withPlistAdvertisingAttribution(config, skanEndpoint) return config; }; From cb7995743d46f1eb1a9b9ac31ca589c66038f6ba Mon Sep 17 00:00:00 2001 From: Adam Gerthel Date: Wed, 6 Sep 2023 15:06:16 +0200 Subject: [PATCH 2/3] fix: always add the skan postback url --- expo/withAppsFlyerIos.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/expo/withAppsFlyerIos.js b/expo/withAppsFlyerIos.js index 5b7a684e..0b443846 100644 --- a/expo/withAppsFlyerIos.js +++ b/expo/withAppsFlyerIos.js @@ -8,6 +8,7 @@ const RNAPPSFLYER_CONTINUE_USER_ACTIVITY_IDENTIFIER = `- (BOOL)application:(UIAp const RNAPPSFLYER_OPENURL_IDENTIFIER = `- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary *)options {`; const RNAPPSFLYER_CONTINUE_USER_ACTIVITY_CODE = `[[AppsFlyerAttribution shared] continueUserActivity:userActivity restorationHandler:restorationHandler];\n`; const RNAPPSFLYER_OPENURL_CODE = `[[AppsFlyerAttribution shared] handleOpenUrl:url options:options];\n`; +const RNAPPSFLYER_ATTRIBUTION_ENDPOINT = 'https://appsflyer-skadnetwork.com/'; function modifyAppDelegate(appDelegate) { if (!appDelegate.includes(RNAPPSFLYER_IMPORT)) { @@ -67,10 +68,10 @@ function withPodfile(config, shouldUseStrictMode) { ]); } -function withPlistAdvertisingAttribution(config, url) { +function withPlistAdvertisingAttribution(config) { return withInfoPlist(config, async config => { const infoPlist = config.modResults; - infoPlist.NSAdvertisingAttributionReportEndpoint = url; + infoPlist.NSAdvertisingAttributionReportEndpoint = RNAPPSFLYER_ATTRIBUTION_ENDPOINT; return config; }); @@ -78,7 +79,7 @@ function withPlistAdvertisingAttribution(config, url) { module.exports = function withAppsFlyerIos(config, shouldUseStrictMode, skanEndpoint) { config = withPodfile(config, shouldUseStrictMode); - config = withAppsFlyerAppDelegate(config); - config = withPlistAdvertisingAttribution(config, skanEndpoint) + config = withAppsFlyerAppDelegate(config); + config = withPlistAdvertisingAttribution(config); return config; }; From 79fdbe4d6387b8ef694553de3ab948882a4b7a55 Mon Sep 17 00:00:00 2001 From: Adam Gerthel Date: Wed, 6 Sep 2023 15:12:12 +0200 Subject: [PATCH 3/3] fix: add missing import --- expo/withAppsFlyerIos.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/expo/withAppsFlyerIos.js b/expo/withAppsFlyerIos.js index 0b443846..b5838b37 100644 --- a/expo/withAppsFlyerIos.js +++ b/expo/withAppsFlyerIos.js @@ -1,4 +1,4 @@ -const { withDangerousMod, withAppDelegate, WarningAggregator } = require('@expo/config-plugins'); +const { withDangerousMod, withAppDelegate, WarningAggregator, withInfoPlist } = require('@expo/config-plugins'); const { mergeContents } = require('@expo/config-plugins/build/utils/generateCode'); const fs = require('fs'); const path = require('path');