diff --git a/Adjust/example-app-java/src/main/java/com/adjust/examples/GlobalApplication.java b/Adjust/example-app-java/src/main/java/com/adjust/examples/GlobalApplication.java index 7c94a43bd..3ff7c24c3 100644 --- a/Adjust/example-app-java/src/main/java/com/adjust/examples/GlobalApplication.java +++ b/Adjust/example-app-java/src/main/java/com/adjust/examples/GlobalApplication.java @@ -26,6 +26,9 @@ import com.adjust.sdk.OnSessionTrackingFailedListener; import com.adjust.sdk.OnSessionTrackingSucceededListener; +import java.util.ArrayList; +import java.util.List; + /** * Created by pfms on 17/12/14. */ @@ -62,6 +65,14 @@ public void onFinishedEventTrackingSucceeded(AdjustEventSuccess eventSuccessResp } }); + + // Set url strategy +// List urlStrategy = new ArrayList<>(); +// urlStrategy.add("adjust.com"); +// urlStrategy.add("adjust.cn"); +// urlStrategy.add("eu.adjust.com"); +// config.setUrlStrategy(urlStrategy , true, false); + // Set event failure tracking delegate. config.setOnEventTrackingFailedListener(new OnEventTrackingFailedListener() { @Override diff --git a/Adjust/example-app-webbridge/src/main/assets/AdjustExample-WebView.html b/Adjust/example-app-webbridge/src/main/assets/AdjustExample-WebView.html index ca50acab6..bca5cfab1 100755 --- a/Adjust/example-app-webbridge/src/main/assets/AdjustExample-WebView.html +++ b/Adjust/example-app-webbridge/src/main/assets/AdjustExample-WebView.html @@ -72,6 +72,8 @@

Adjust Web View SDK Demo adjustConfig.setSessionFailureCallback(sessionFailureCallback); adjustConfig.setDeferredDeeplinkCallback(deferredDeeplinkCallback); + + Adjust.initSdk(adjustConfig); window.onload = function() { diff --git a/Adjust/sdk-core/src/main/java/com/adjust/sdk/ActivityHandler.java b/Adjust/sdk-core/src/main/java/com/adjust/sdk/ActivityHandler.java index eca861816..9b78a73fe 100644 --- a/Adjust/sdk-core/src/main/java/com/adjust/sdk/ActivityHandler.java +++ b/Adjust/sdk-core/src/main/java/com/adjust/sdk/ActivityHandler.java @@ -951,7 +951,8 @@ public void run() { IActivityPackageSender packageHandlerActivitySender = new ActivityPackageSender( - adjustConfig.urlStrategy, + adjustConfig.urlStrategyDomains, + adjustConfig.useSubdomains, adjustConfig.basePath, adjustConfig.gdprPath, adjustConfig.subscriptionPath, @@ -966,7 +967,8 @@ public void run() { IActivityPackageSender attributionHandlerActivitySender = new ActivityPackageSender( - adjustConfig.urlStrategy, + adjustConfig.urlStrategyDomains, + adjustConfig.useSubdomains, adjustConfig.basePath, adjustConfig.gdprPath, adjustConfig.subscriptionPath, @@ -981,7 +983,8 @@ public void run() { IActivityPackageSender sdkClickHandlerActivitySender = new ActivityPackageSender( - adjustConfig.urlStrategy, + adjustConfig.urlStrategyDomains, + adjustConfig.useSubdomains, adjustConfig.basePath, adjustConfig.gdprPath, adjustConfig.subscriptionPath, @@ -996,7 +999,8 @@ public void run() { IActivityPackageSender purchaseVerificationHandlerActivitySender = new ActivityPackageSender( - adjustConfig.urlStrategy, + adjustConfig.urlStrategyDomains, + adjustConfig.useSubdomains, adjustConfig.basePath, adjustConfig.gdprPath, adjustConfig.subscriptionPath, @@ -2496,11 +2500,13 @@ private void verifyPurchaseI(final AdjustPurchase purchase, final OnPurchaseVeri return; } // from this moment on we know that we can ping client callback in case of error - if (adjustConfig.urlStrategy != null && - (adjustConfig.urlStrategy.equals(AdjustConfig.DATA_RESIDENCY_EU) || - adjustConfig.urlStrategy.equals(AdjustConfig.DATA_RESIDENCY_US) || - adjustConfig.urlStrategy.equals(AdjustConfig.DATA_RESIDENCY_TR))) { + if (adjustConfig.isDataResidency) { logger.warn("Purchase verification not available for data residency users right now"); + AdjustPurchaseVerificationResult result = new AdjustPurchaseVerificationResult( + "not_verified", + 109, + "Purchase verification not available for data residency users right now"); + callback.onVerificationFinished(result); return; } if (!checkActivityStateI(activityState)) { diff --git a/Adjust/sdk-core/src/main/java/com/adjust/sdk/AdjustConfig.java b/Adjust/sdk-core/src/main/java/com/adjust/sdk/AdjustConfig.java index 04d5c6cd9..d9e103b6c 100644 --- a/Adjust/sdk-core/src/main/java/com/adjust/sdk/AdjustConfig.java +++ b/Adjust/sdk-core/src/main/java/com/adjust/sdk/AdjustConfig.java @@ -3,6 +3,7 @@ import android.content.Context; import java.util.ArrayList; +import java.util.List; /** * Created by pfms on 06/11/14. @@ -34,7 +35,9 @@ public class AdjustConfig { String externalDeviceId; boolean preinstallTrackingEnabled; Boolean needsCost; - String urlStrategy; + List urlStrategyDomains; + boolean useSubdomains; + boolean isDataResidency; String preinstallFilePath; String fbAppId; boolean shouldReadDeviceIdsOnce; @@ -46,14 +49,6 @@ public class AdjustConfig { public static final String ENVIRONMENT_SANDBOX = "sandbox"; public static final String ENVIRONMENT_PRODUCTION = "production"; - public static final String URL_STRATEGY_INDIA = "url_strategy_india"; - public static final String URL_STRATEGY_CHINA = "url_strategy_china"; - public static final String URL_STRATEGY_CN = "url_strategy_cn"; - public static final String URL_STRATEGY_CN_ONLY = "url_strategy_cn_only"; - public static final String DATA_RESIDENCY_EU = "data_residency_eu"; - public static final String DATA_RESIDENCY_TR = "data_residency_tr"; - public static final String DATA_RESIDENCY_US = "data_residency_us"; - public AdjustConfig(Context context, String appToken, String environment) { init(context, appToken, environment, false); } @@ -164,21 +159,14 @@ public boolean isValid() { return true; } - public void setUrlStrategy(String urlStrategy) { - if (urlStrategy == null || urlStrategy.isEmpty()) { + public void setUrlStrategy(List domains, boolean useSubdomains, boolean isDataResidency) { + if (domains == null || domains.isEmpty()) { logger.error("Invalid url strategy"); return; } - if (!urlStrategy.equals(URL_STRATEGY_INDIA) - && !urlStrategy.equals(URL_STRATEGY_CHINA) - && !urlStrategy.equals(URL_STRATEGY_CN) - && !urlStrategy.equals(URL_STRATEGY_CN_ONLY) - && !urlStrategy.equals(DATA_RESIDENCY_EU) - && !urlStrategy.equals(DATA_RESIDENCY_TR) - && !urlStrategy.equals(DATA_RESIDENCY_US)) { - logger.warn("Unrecognised url strategy %s", urlStrategy); - } - this.urlStrategy = urlStrategy; + this.urlStrategyDomains = domains; + this.useSubdomains = useSubdomains; + this.isDataResidency = isDataResidency; } public void readDeviceIdsOnce() { @@ -297,8 +285,8 @@ public Boolean getNeedsCost() { return needsCost; } - public String getUrlStrategy() { - return urlStrategy; + public List getUrlStrategyDomains() { + return urlStrategyDomains; } public String getPreinstallFilePath() { diff --git a/Adjust/sdk-core/src/main/java/com/adjust/sdk/Constants.java b/Adjust/sdk-core/src/main/java/com/adjust/sdk/Constants.java index 571153fbc..6b3ff6050 100644 --- a/Adjust/sdk-core/src/main/java/com/adjust/sdk/Constants.java +++ b/Adjust/sdk-core/src/main/java/com/adjust/sdk/Constants.java @@ -28,6 +28,13 @@ public interface Constants { String SUBSCRIPTION_URL = "https://subscription.adjust.com"; String PURCHASE_VERIFICATION_URL = "https://ssrv.adjust.com"; + String BASE_URL_FORMAT = "https://app.%s"; + String GDPR_URL_FORMAT = "https://gdpr.%s"; + String SUBSCRIPTION_URL_FORMAT = "https://subscription.%s"; + String PURCHASE_VERIFICATION_URL_FORMAT = "https://ssrv.%s"; + + String BASE_URL_NO_SUB_DOMAIN_FORMAT = "https://%s"; + String SCHEME = "https"; String AUTHORITY = "app.adjust.com"; String CLIENT_SDK = "android5.0.0"; diff --git a/Adjust/sdk-core/src/main/java/com/adjust/sdk/network/ActivityPackageSender.java b/Adjust/sdk-core/src/main/java/com/adjust/sdk/network/ActivityPackageSender.java index 759a5ece3..9eded4f26 100644 --- a/Adjust/sdk-core/src/main/java/com/adjust/sdk/network/ActivityPackageSender.java +++ b/Adjust/sdk-core/src/main/java/com/adjust/sdk/network/ActivityPackageSender.java @@ -35,6 +35,7 @@ import java.net.URLEncoder; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; import javax.net.ssl.HttpsURLConnection; @@ -54,7 +55,8 @@ public class ActivityPackageSender implements IActivityPackageSender { private IConnectionOptions connectionOptions; private Context context; - public ActivityPackageSender(final String adjustUrlStrategy, + public ActivityPackageSender(final List urlStrategyDomains, + final boolean useSubdomains, final String basePath, final String gdprPath, final String subscriptionPath, @@ -76,7 +78,8 @@ public ActivityPackageSender(final String adjustUrlStrategy, AdjustFactory.getGdprUrl(), AdjustFactory.getSubscriptionUrl(), AdjustFactory.getPurchaseVerificationUrl(), - adjustUrlStrategy); + urlStrategyDomains, + useSubdomains); httpsURLConnectionProvider = AdjustFactory.getHttpsURLConnectionProvider(); connectionOptions = AdjustFactory.getConnectionOptions(); } diff --git a/Adjust/sdk-core/src/main/java/com/adjust/sdk/network/UrlStrategy.java b/Adjust/sdk-core/src/main/java/com/adjust/sdk/network/UrlStrategy.java index ae434da78..56c909f0a 100644 --- a/Adjust/sdk-core/src/main/java/com/adjust/sdk/network/UrlStrategy.java +++ b/Adjust/sdk-core/src/main/java/com/adjust/sdk/network/UrlStrategy.java @@ -1,50 +1,29 @@ package com.adjust.sdk.network; +import static com.adjust.sdk.Constants.BASE_URL; +import static com.adjust.sdk.Constants.BASE_URL_FORMAT; +import static com.adjust.sdk.Constants.BASE_URL_NO_SUB_DOMAIN_FORMAT; +import static com.adjust.sdk.Constants.GDPR_URL; +import static com.adjust.sdk.Constants.GDPR_URL_FORMAT; +import static com.adjust.sdk.Constants.PURCHASE_VERIFICATION_URL; +import static com.adjust.sdk.Constants.PURCHASE_VERIFICATION_URL_FORMAT; +import static com.adjust.sdk.Constants.SUBSCRIPTION_URL; +import static com.adjust.sdk.Constants.SUBSCRIPTION_URL_FORMAT; + import com.adjust.sdk.ActivityKind; -import com.adjust.sdk.Constants; +import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.List; -import static com.adjust.sdk.AdjustConfig.DATA_RESIDENCY_TR; -import static com.adjust.sdk.AdjustConfig.DATA_RESIDENCY_US; -import static com.adjust.sdk.AdjustConfig.URL_STRATEGY_CHINA; -import static com.adjust.sdk.AdjustConfig.URL_STRATEGY_CN; -import static com.adjust.sdk.AdjustConfig.URL_STRATEGY_CN_ONLY; -import static com.adjust.sdk.AdjustConfig.URL_STRATEGY_INDIA; -import static com.adjust.sdk.AdjustConfig.DATA_RESIDENCY_EU; - public class UrlStrategy { - private static final String BASE_URL_INDIA = "https://app.adjust.net.in"; - private static final String GDPR_URL_INDIA = "https://gdpr.adjust.net.in"; - private static final String SUBSCRIPTION_URL_INDIA = "https://subscription.adjust.net.in"; - private static final String PURCHASE_VERIFICATION_URL_INDIA = "https://ssrv.adjust.net.in"; - - private static final String BASE_URL_CHINA = "https://app.adjust.world"; - private static final String GDPR_URL_CHINA = "https://gdpr.adjust.world"; - private static final String SUBSCRIPTION_URL_CHINA = "https://subscription.adjust.world"; - private static final String PURCHASE_VERIFICATION_URL_CHINA = "https://ssrv.adjust.world"; - - private static final String BASE_URL_CN = "https://app.adjust.cn"; - private static final String GDPR_URL_CN = "https://gdpr.adjust.cn"; - private static final String SUBSCRIPTION_URL_CN = "https://subscription.adjust.cn"; - private static final String PURCHASE_VERIFICATION_URL_CN = "https://ssrv.adjust.cn"; - - private static final String BASE_URL_EU = "https://app.eu.adjust.com"; - private static final String GDPR_URL_EU = "https://gdpr.eu.adjust.com"; - private static final String SUBSCRIPTION_URL_EU = "https://subscription.eu.adjust.com"; - private static final String PURCHASE_VERIFICATION_URL_EU = "https://ssrv.eu.adjust.com"; - - private static final String BASE_URL_TR = "https://app.tr.adjust.com"; - private static final String GDPR_URL_TR = "https://gdpr.tr.adjust.com"; - private static final String SUBSCRIPTION_URL_TR = "https://subscription.tr.adjust.com"; - private static final String PURCHASE_VERIFICATION_URL_TR = "https://ssrv.tr.adjust.com"; - - private static final String BASE_URL_US = "https://app.us.adjust.com"; - private static final String GDPR_URL_US = "https://gdpr.us.adjust.com"; - private static final String SUBSCRIPTION_URL_US = "https://subscription.us.adjust.com"; - private static final String PURCHASE_VERIFICATION_URL_US = "https://ssrv.us.adjust.com"; + private static final String BASE_URL_WORLD = "https://app.adjust.world"; + private static final String GDPR_URL_WORLD = "https://gdpr.adjust.world"; + private static final String SUBSCRIPTION_URL_WORLD = "https://subscription.adjust.world"; + private static final String PURCHASE_VERIFICATION_URL_WORLD = "https://ssrv.adjust.world"; + + private final List urlStrategyDomains; + private final boolean useSubdomains; private final String baseUrlOverwrite; private final String gdprUrlOverwrite; @@ -64,17 +43,21 @@ public UrlStrategy(final String baseUrlOverwrite, final String gdprUrlOverwrite, final String subscriptionUrlOverwrite, final String purchaseVerificationUrlOverwrite, - final String adjustUrlStrategy) + final List urlStrategyDomains, + final boolean useSubdomains) { + this.urlStrategyDomains = urlStrategyDomains; + this.useSubdomains = useSubdomains; + this.baseUrlOverwrite = baseUrlOverwrite; this.gdprUrlOverwrite = gdprUrlOverwrite; this.subscriptionUrlOverwrite = subscriptionUrlOverwrite; this.purchaseVerificationUrlOverwrite = purchaseVerificationUrlOverwrite; - baseUrlChoicesList = baseUrlChoices(adjustUrlStrategy); - gdprUrlChoicesList = gdprUrlChoices(adjustUrlStrategy); - subscriptionUrlChoicesList = subscriptionUrlChoices(adjustUrlStrategy); - purchaseVerificationUrlChoicesList = purchaseVerificationUrlChoices(adjustUrlStrategy); + baseUrlChoicesList = baseUrlChoices(); + gdprUrlChoicesList = gdprUrlChoices(); + subscriptionUrlChoicesList = subscriptionUrlChoices(); + purchaseVerificationUrlChoicesList = purchaseVerificationUrlChoices(); wasLastAttemptSuccess = false; choiceIndex = 0; @@ -154,84 +137,71 @@ public String targetUrlByActivityKind(final ActivityKind activityKind) { } } - private static List baseUrlChoices(final String urlStrategy) { - if (URL_STRATEGY_INDIA.equals(urlStrategy)) { - return Arrays.asList(BASE_URL_INDIA, Constants.BASE_URL); - } else if (URL_STRATEGY_CHINA.equals(urlStrategy)) { - return Arrays.asList(BASE_URL_CHINA, Constants.BASE_URL); - } else if (URL_STRATEGY_CN.equals(urlStrategy)) { - return Arrays.asList(BASE_URL_CN, Constants.BASE_URL); - } else if (URL_STRATEGY_CN_ONLY.equals(urlStrategy)) { - return Arrays.asList(BASE_URL_CN); - } else if (DATA_RESIDENCY_EU.equals(urlStrategy)) { - return Collections.singletonList(BASE_URL_EU); - } else if (DATA_RESIDENCY_TR.equals(urlStrategy)) { - return Collections.singletonList(BASE_URL_TR); - } else if (DATA_RESIDENCY_US.equals(urlStrategy)) { - return Collections.singletonList(BASE_URL_US); - } else { - return Arrays.asList(Constants.BASE_URL, BASE_URL_INDIA, BASE_URL_CHINA); + private List baseUrlChoices() { + + if (urlStrategyDomains == null || urlStrategyDomains.isEmpty()) { + return Arrays.asList(BASE_URL, BASE_URL_WORLD); + } + if (useSubdomains) { + List baseUrls = new ArrayList<>(); + for (String url : urlStrategyDomains) { + baseUrls.add(String.format(BASE_URL_FORMAT, url)); + } + return baseUrls; + }else { + List baseUrls = new ArrayList<>(); + for (String url : urlStrategyDomains) { + baseUrls.add(String.format(BASE_URL_NO_SUB_DOMAIN_FORMAT, url)); + } + return baseUrls; } } - private static List gdprUrlChoices(final String urlStrategy) { - if (URL_STRATEGY_INDIA.equals(urlStrategy)) { - return Arrays.asList(GDPR_URL_INDIA, Constants.GDPR_URL); - } else if (URL_STRATEGY_CHINA.equals(urlStrategy)) { - return Arrays.asList(GDPR_URL_CHINA, Constants.GDPR_URL); - } else if (URL_STRATEGY_CN.equals(urlStrategy)) { - return Arrays.asList(GDPR_URL_CN, Constants.GDPR_URL); - } else if (URL_STRATEGY_CN_ONLY.equals(urlStrategy)) { - return Arrays.asList(GDPR_URL_CN); - } else if (DATA_RESIDENCY_EU.equals(urlStrategy)) { - return Collections.singletonList(GDPR_URL_EU); - } else if (DATA_RESIDENCY_TR.equals(urlStrategy)) { - return Collections.singletonList(GDPR_URL_TR); - } else if (DATA_RESIDENCY_US.equals(urlStrategy)) { - return Collections.singletonList(GDPR_URL_US); - } else { - return Arrays.asList(Constants.GDPR_URL, GDPR_URL_INDIA, GDPR_URL_CHINA); + private List gdprUrlChoices() { + if (urlStrategyDomains == null || urlStrategyDomains.isEmpty()) { + return Arrays.asList(GDPR_URL, GDPR_URL_WORLD); } + List baseUrls = new ArrayList<>(); + if (useSubdomains) { + for (String url : urlStrategyDomains) { + baseUrls.add(String.format(GDPR_URL_FORMAT, url)); + } + }else { + for (String url : urlStrategyDomains) { + baseUrls.add(String.format(BASE_URL_NO_SUB_DOMAIN_FORMAT, url)); + } + } + return baseUrls; } - private static List subscriptionUrlChoices(final String urlStrategy) { - if (URL_STRATEGY_INDIA.equals(urlStrategy)) { - return Arrays.asList(SUBSCRIPTION_URL_INDIA, Constants.SUBSCRIPTION_URL); - } else if (URL_STRATEGY_CHINA.equals(urlStrategy)) { - return Arrays.asList(SUBSCRIPTION_URL_CHINA, Constants.SUBSCRIPTION_URL); - } else if (URL_STRATEGY_CN.equals(urlStrategy)) { - return Arrays.asList(SUBSCRIPTION_URL_CN, Constants.SUBSCRIPTION_URL); - } else if (URL_STRATEGY_CN_ONLY.equals(urlStrategy)) { - return Arrays.asList(SUBSCRIPTION_URL_CN); - } else if (DATA_RESIDENCY_EU.equals(urlStrategy)) { - return Collections.singletonList(SUBSCRIPTION_URL_EU); - } else if (DATA_RESIDENCY_TR.equals(urlStrategy)) { - return Collections.singletonList(SUBSCRIPTION_URL_TR); - } else if (DATA_RESIDENCY_US.equals(urlStrategy)) { - return Collections.singletonList(SUBSCRIPTION_URL_US); - } else { - return Arrays.asList(Constants.SUBSCRIPTION_URL, - SUBSCRIPTION_URL_INDIA, - SUBSCRIPTION_URL_CHINA); + private List subscriptionUrlChoices() { + if (urlStrategyDomains == null || urlStrategyDomains.isEmpty()) { + return Arrays.asList(SUBSCRIPTION_URL, SUBSCRIPTION_URL_WORLD); + } + List baseUrls = new ArrayList<>(); + if (useSubdomains) { + for (String url : urlStrategyDomains) { + baseUrls.add(String.format(SUBSCRIPTION_URL_FORMAT, url)); + } + }else { + for (String url : urlStrategyDomains) { + baseUrls.add(String.format(BASE_URL_NO_SUB_DOMAIN_FORMAT, url)); + } } + return baseUrls; } - private static List purchaseVerificationUrlChoices(final String urlStrategy) { - if (URL_STRATEGY_INDIA.equals(urlStrategy)) { - return Arrays.asList(PURCHASE_VERIFICATION_URL_INDIA, Constants.PURCHASE_VERIFICATION_URL); - } else if (URL_STRATEGY_CHINA.equals(urlStrategy)) { - return Arrays.asList(PURCHASE_VERIFICATION_URL_CHINA, Constants.PURCHASE_VERIFICATION_URL); - } else if (URL_STRATEGY_CN.equals(urlStrategy)) { - return Arrays.asList(PURCHASE_VERIFICATION_URL_CN, Constants.PURCHASE_VERIFICATION_URL); - } else if (URL_STRATEGY_CN_ONLY.equals(urlStrategy)) { - return Arrays.asList(PURCHASE_VERIFICATION_URL_CN); - } else if (DATA_RESIDENCY_EU.equals(urlStrategy)) { - return Collections.singletonList(PURCHASE_VERIFICATION_URL_EU); - } else if (DATA_RESIDENCY_TR.equals(urlStrategy)) { - return Collections.singletonList(PURCHASE_VERIFICATION_URL_TR); - } else if (DATA_RESIDENCY_US.equals(urlStrategy)) { - return Collections.singletonList(PURCHASE_VERIFICATION_URL_US); - } else { - return Arrays.asList(Constants.PURCHASE_VERIFICATION_URL, - PURCHASE_VERIFICATION_URL_INDIA, - PURCHASE_VERIFICATION_URL_CHINA); + private List purchaseVerificationUrlChoices() { + if (urlStrategyDomains == null || urlStrategyDomains.isEmpty()) { + return Arrays.asList(PURCHASE_VERIFICATION_URL, PURCHASE_VERIFICATION_URL_WORLD); + } + List baseUrls = new ArrayList<>(); + if (useSubdomains){ + for (String url : urlStrategyDomains) { + baseUrls.add(String.format(PURCHASE_VERIFICATION_URL_FORMAT, url)); + } + }else { + for (String url : urlStrategyDomains) { + baseUrls.add(String.format(BASE_URL_NO_SUB_DOMAIN_FORMAT, url)); + } } + return baseUrls; } } diff --git a/Adjust/sdk-plugin-webbridge/src/main/assets/adjust_config.js b/Adjust/sdk-plugin-webbridge/src/main/assets/adjust_config.js index e6c2133a0..a536c97e2 100644 --- a/Adjust/sdk-plugin-webbridge/src/main/assets/adjust_config.js +++ b/Adjust/sdk-plugin-webbridge/src/main/assets/adjust_config.js @@ -41,6 +41,9 @@ function AdjustConfig(appToken, environment, legacy) { this.deferredDeeplinkCallbackFunction = null; this.fbPixelDefaultEventToken = null; this.fbPixelMapping = []; + this.urlStrategy = []; + this.useSubDomain = null; + this.isDataResidency = null; this.preinstallTrackingEnabled = null; this.preinstallFilePath = null; this.fbAppId = null; @@ -200,6 +203,12 @@ AdjustConfig.prototype.addFbPixelMapping = function(fbEventNameKey, adjEventToke this.fbPixelMapping.push(adjEventTokenValue); }; +AdjustConfig.prototype.setUrlStrategy = function(urlStrategy, useSubDomain , isDataResidency) { + this.urlStrategy = urlStrategy; + this.useSubDomain = useSubDomain; + this.isDataResidency = isDataResidency; +}; + AdjustConfig.prototype.setPreinstallTrackingEnabled = function(preinstallTrackingEnabled) { this.preinstallTrackingEnabled = preinstallTrackingEnabled; }; diff --git a/Adjust/sdk-plugin-webbridge/src/main/java/com/adjust/sdk/webbridge/AdjustBridgeInstance.java b/Adjust/sdk-plugin-webbridge/src/main/java/com/adjust/sdk/webbridge/AdjustBridgeInstance.java index 1246316b2..b3b89855e 100644 --- a/Adjust/sdk-plugin-webbridge/src/main/java/com/adjust/sdk/webbridge/AdjustBridgeInstance.java +++ b/Adjust/sdk-plugin-webbridge/src/main/java/com/adjust/sdk/webbridge/AdjustBridgeInstance.java @@ -36,6 +36,10 @@ import org.json.JSONArray; import org.json.JSONObject; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + /** * Created by uerceg on 22/07/16. */ @@ -162,6 +166,9 @@ public void initSdk(String adjustConfigString) { Object deferredDeeplinkCallbackNameField = jsonAdjustConfig.get("deferredDeeplinkCallbackName"); Object fbPixelDefaultEventTokenField = jsonAdjustConfig.get("fbPixelDefaultEventToken"); Object fbPixelMappingField = jsonAdjustConfig.get("fbPixelMapping"); + Object urlStrategyField = jsonAdjustConfig.get("urlStrategy"); + Object useSubDomainField = jsonAdjustConfig.get("useSubDomain"); + Object isDataResidencyField = jsonAdjustConfig.get("isDataResidency"); Object preinstallTrackingEnabledField = jsonAdjustConfig.get("preinstallTrackingEnabled"); Object preinstallFilePathField = jsonAdjustConfig.get("preinstallFilePath"); Object fbAppIdField = jsonAdjustConfig.get("fbAppId"); @@ -331,6 +338,16 @@ public boolean launchReceivedDeeplink(Uri deeplink) { AdjustFactory.getLogger().error("AdjustBridgeInstance.configureFbPixel: %s", e.getMessage()); } + // Set url strategy + String[] urlStrategyArray = AdjustBridgeUtil.jsonArrayToArray((JSONArray) urlStrategyField); + List urlStrategy = Arrays.asList(urlStrategyArray); + + Boolean useSubDomain = AdjustBridgeUtil.fieldToBoolean(useSubDomainField); + Boolean isDataResidency = AdjustBridgeUtil.fieldToBoolean(isDataResidencyField); + if (urlStrategy != null && !urlStrategy.isEmpty() && useSubDomain != null && isDataResidency != null) { + adjustConfig.setUrlStrategy(urlStrategy,useSubDomain,isDataResidency); + } + // Preinstall tracking Boolean preinstallTrackingEnabled = AdjustBridgeUtil.fieldToBoolean(preinstallTrackingEnabledField); if (preinstallTrackingEnabled != null) {