diff --git a/expo/withAppsFlyerIos.js b/expo/withAppsFlyerIos.js index cb2b0343..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'); @@ -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,8 +68,18 @@ function withPodfile(config, shouldUseStrictMode) { ]); } -module.exports = function withAppsFlyerIos(config, shouldUseStrictMode) { +function withPlistAdvertisingAttribution(config) { + return withInfoPlist(config, async config => { + const infoPlist = config.modResults; + infoPlist.NSAdvertisingAttributionReportEndpoint = RNAPPSFLYER_ATTRIBUTION_ENDPOINT; + + return config; + }); +} + +module.exports = function withAppsFlyerIos(config, shouldUseStrictMode, skanEndpoint) { config = withPodfile(config, shouldUseStrictMode); - config = withAppsFlyerAppDelegate(config); + config = withAppsFlyerAppDelegate(config); + config = withPlistAdvertisingAttribution(config); return config; };