Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions expo/withAppsFlyerIos.js
Original file line number Diff line number Diff line change
@@ -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');
Expand All @@ -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<UIApplicationOpenURLOptionsKey,id> *)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)) {
Expand Down Expand Up @@ -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;
};