diff --git a/Assets/Adjust/Android/AdjustAndroid.cs b/Assets/Adjust/Android/AdjustAndroid.cs index bbbf4f6b..4ec64db9 100644 --- a/Assets/Adjust/Android/AdjustAndroid.cs +++ b/Assets/Adjust/Android/AdjustAndroid.cs @@ -8,7 +8,7 @@ namespace com.adjust.sdk #if UNITY_ANDROID public class AdjustAndroid { - private const string sdkPrefix = "unity4.21.3"; + private const string sdkPrefix = "unity4.22.0"; private static bool launchDeferredDeeplink = true; private static AndroidJavaClass ajcAdjust = new AndroidJavaClass("com.adjust.sdk.Adjust"); private static AndroidJavaObject ajoCurrentActivity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic("currentActivity"); @@ -374,6 +374,48 @@ public static void TrackAdRevenue(string source, string payload) ajcAdjust.CallStatic("trackAdRevenue", source, jsonPayload); } + public static void TrackPlayStoreSubscription(AdjustPlayStoreSubscription subscription) + { + AndroidJavaObject ajoSubscription = new AndroidJavaObject("com.adjust.sdk.AdjustPlayStoreSubscription", + Convert.ToInt64(subscription.price), + subscription.currency, + subscription.sku, + subscription.orderId, + subscription.signature, + subscription.purchaseToken); + + // Check if user has set purchase time for subscription. + if (subscription.purchaseTime != null) + { + ajoSubscription.Call("setPurchaseTime", Convert.ToInt64(subscription.purchaseTime)); + } + + // Check if user has added any callback parameters to the subscription. + if (subscription.callbackList != null) + { + for (int i = 0; i < subscription.callbackList.Count; i += 2) + { + string key = subscription.callbackList[i]; + string value = subscription.callbackList[i + 1]; + ajoSubscription.Call("addCallbackParameter", key, value); + } + } + + // Check if user has added any partner parameters to the subscription. + if (subscription.partnerList != null) + { + for (int i = 0; i < subscription.partnerList.Count; i += 2) + { + string key = subscription.partnerList[i]; + string value = subscription.partnerList[i + 1]; + ajoSubscription.Call("addPartnerParameter", key, value); + } + } + + // Track the subscription. + ajcAdjust.CallStatic("trackPlayStoreSubscription", ajoSubscription); + } + // Android specific methods. public static void OnPause() { diff --git a/Assets/Adjust/Android/Test/Java-WebSocket-1.4.0.jar.meta b/Assets/Adjust/Android/Test/Java-WebSocket-1.4.0.jar.meta new file mode 100644 index 00000000..7abfc5c1 --- /dev/null +++ b/Assets/Adjust/Android/Test/Java-WebSocket-1.4.0.jar.meta @@ -0,0 +1,29 @@ +fileFormatVersion: 2 +guid: e16880198afee4a3eabecd09eef41ed2 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Adjust/Android/Test/adjust-test.jar b/Assets/Adjust/Android/Test/adjust-test.jar index 82853a90..dabaa80e 100644 Binary files a/Assets/Adjust/Android/Test/adjust-test.jar and b/Assets/Adjust/Android/Test/adjust-test.jar differ diff --git a/Assets/Adjust/Android/Test/gson-2.8.6.jar.meta b/Assets/Adjust/Android/Test/gson-2.8.6.jar.meta new file mode 100644 index 00000000..a58c9fba --- /dev/null +++ b/Assets/Adjust/Android/Test/gson-2.8.6.jar.meta @@ -0,0 +1,29 @@ +fileFormatVersion: 2 +guid: b9fc97b4047d64da8bfdd4dba2c1f356 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Adjust/Android/Test/slf4j-api-1.7.30.jar.meta b/Assets/Adjust/Android/Test/slf4j-api-1.7.30.jar.meta new file mode 100644 index 00000000..2f827829 --- /dev/null +++ b/Assets/Adjust/Android/Test/slf4j-api-1.7.30.jar.meta @@ -0,0 +1,29 @@ +fileFormatVersion: 2 +guid: 96649bd10ee17492b87adc742ea8740d +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Adjust/Android/adjust-android.jar b/Assets/Adjust/Android/adjust-android.jar index dd0acc4d..1279e085 100644 Binary files a/Assets/Adjust/Android/adjust-android.jar and b/Assets/Adjust/Android/adjust-android.jar differ diff --git a/Assets/Adjust/Editor/AdjustEditor.cs b/Assets/Adjust/Editor/AdjustEditor.cs index 9a09350b..34b96132 100644 --- a/Assets/Adjust/Editor/AdjustEditor.cs +++ b/Assets/Adjust/Editor/AdjustEditor.cs @@ -57,6 +57,7 @@ static void ExportAdjustUnityPackage() assetsToExport.Add(assetsPath + "/iOS/ADJLogger.h"); assetsToExport.Add(assetsPath + "/iOS/ADJSessionFailure.h"); assetsToExport.Add(assetsPath + "/iOS/ADJSessionSuccess.h"); + assetsToExport.Add(assetsPath + "/iOS/ADJSubscription.h"); assetsToExport.Add(assetsPath + "/iOS/Adjust.h"); assetsToExport.Add(assetsPath + "/iOS/AdjustiOS.cs"); assetsToExport.Add(assetsPath + "/iOS/AdjustSdk.a"); @@ -68,6 +69,7 @@ static void ExportAdjustUnityPackage() assetsToExport.Add(assetsPath + "/Prefab/Adjust.prefab"); assetsToExport.Add(assetsPath + "/Unity/Adjust.cs"); + assetsToExport.Add(assetsPath + "/Unity/AdjustAppStoreSubscription.cs"); assetsToExport.Add(assetsPath + "/Unity/AdjustAttribution.cs"); assetsToExport.Add(assetsPath + "/Unity/AdjustConfig.cs"); assetsToExport.Add(assetsPath + "/Unity/AdjustEnvironment.cs"); @@ -75,6 +77,7 @@ static void ExportAdjustUnityPackage() assetsToExport.Add(assetsPath + "/Unity/AdjustEventFailure.cs"); assetsToExport.Add(assetsPath + "/Unity/AdjustEventSuccess.cs"); assetsToExport.Add(assetsPath + "/Unity/AdjustLogLevel.cs"); + assetsToExport.Add(assetsPath + "/Unity/AdjustPlayStoreSubscription.cs"); assetsToExport.Add(assetsPath + "/Unity/AdjustSessionFailure.cs"); assetsToExport.Add(assetsPath + "/Unity/AdjustSessionSuccess.cs"); assetsToExport.Add(assetsPath + "/Unity/AdjustUtils.cs"); diff --git a/Assets/Adjust/Test/CommandExecutor.cs b/Assets/Adjust/Test/CommandExecutor.cs index 36a240f6..2e331b03 100644 --- a/Assets/Adjust/Test/CommandExecutor.cs +++ b/Assets/Adjust/Test/CommandExecutor.cs @@ -13,19 +13,21 @@ public class CommandExecutor : IAdjustCommandExecutor public class CommandExecutor #endif { + public string ExtraPath { get; set; } + private Dictionary _savedConfigs = new Dictionary(); private Dictionary _savedEvents = new Dictionary(); - public string BasePath { get; set; } - public string GdprPath { get; set; } private string _baseUrl; private string _gdprUrl; + private string _subscriptionUrl; private Command _command; private ITestLibrary _testLibrary; - public CommandExecutor(ITestLibrary testLibrary, string baseUrl, string gdprUrl) + public CommandExecutor(ITestLibrary testLibrary, string baseUrl, string gdprUrl, string subscriptionUrl) { _baseUrl = baseUrl; _gdprUrl = gdprUrl; + _subscriptionUrl = subscriptionUrl; _testLibrary = testLibrary; } @@ -38,7 +40,7 @@ public void ExecuteCommand(Command command) { _command = command; - TestApp.Log(string.Format("\t>>> EXECUTING METHOD: [{0}.{1}] <<<", _command.ClassName, _command.MethodName)); + TestApp.Log(string.Format("\tEXECUTING METHOD: [{0}.{1}]", _command.ClassName, _command.MethodName)); try { @@ -67,29 +69,27 @@ public void ExecuteCommand(Command command) case "gdprForgetMe": GdprForgetMe(); break; case "trackAdRevenue": TrackAdRevenue(); break; case "disableThirdPartySharing": DisableThirdPartySharing(); break; - + case "trackSubscription": TrackSubscription(); break; default: CommandNotFound(_command.ClassName, _command.MethodName); break; } } catch (Exception ex) { - TestApp.LogError(string.Format("{0} ---- {1}", + TestApp.LogError(string.Format("{0} -- {1}", "executeCommand: failed to parse command. Check commands' syntax", ex.ToString())); } } private void TestOptions() { - TestApp.Log("Configuring and setting Testing Options..."); - Dictionary testOptions = new Dictionary(); testOptions[AdjustUtils.KeyTestOptionsBaseUrl] = _baseUrl; testOptions[AdjustUtils.KeyTestOptionsGdprUrl] = _gdprUrl; + testOptions[AdjustUtils.KeyTestOptionsSubscriptionUrl] = _subscriptionUrl; if (_command.ContainsParameter("basePath")) { - BasePath = _command.GetFirstParameterValue("basePath"); - GdprPath = _command.GetFirstParameterValue("basePath"); + ExtraPath = _command.GetFirstParameterValue("basePath"); } if (_command.ContainsParameter("timerInterval")) { @@ -124,8 +124,7 @@ private void TestOptions() if (teardownOption == "resetSdk") { testOptions[AdjustUtils.KeyTestOptionsTeardown] = "true"; - testOptions[AdjustUtils.KeyTestOptionsBasePath] = BasePath; - testOptions[AdjustUtils.KeyTestOptionsGdprPath] = GdprPath; + testOptions[AdjustUtils.KeyTestOptionsExtraPath] = ExtraPath; testOptions[AdjustUtils.KeyTestOptionsUseTestConnectionOptions] = "true"; } if (teardownOption == "deleteState") @@ -144,8 +143,7 @@ private void TestOptions() if (teardownOption == "sdk") { testOptions[AdjustUtils.KeyTestOptionsTeardown] = "true"; - testOptions[AdjustUtils.KeyTestOptionsBasePath] = null; - testOptions[AdjustUtils.KeyTestOptionsGdprPath] = null; + testOptions[AdjustUtils.KeyTestOptionsExtraPath] = null; testOptions[AdjustUtils.KeyTestOptionsUseTestConnectionOptions] = "false"; } if (teardownOption == "test") @@ -261,15 +259,12 @@ private void Config() { var delayStartStr = _command.GetFirstParameterValue("delayStart"); var delayStart = double.Parse(delayStartStr); - TestApp.Log("Delay start set to: " + delayStart); adjustConfig.setDelayStart(delayStart); } if (_command.ContainsParameter("appSecret")) { var appSecretList = _command.Parameters["appSecret"]; - TestApp.Log("Received AppSecret array: " + string.Join(",", appSecretList.ToArray())); - if (!string.IsNullOrEmpty(appSecretList[0]) && appSecretList.Count == 5) { long secretId, info1, info2, info3, info4; @@ -281,10 +276,6 @@ private void Config() adjustConfig.setAppSecret(secretId, info1, info2, info3, info4); } - else - { - TestApp.LogError("App secret list does not contain 5 elements! Skip setting app secret."); - } } if (_command.ContainsParameter("deviceKnown")) @@ -339,22 +330,19 @@ private void Config() { bool launchDeferredDeeplink = _command.GetFirstParameterValue("deferredDeeplinkCallback") == "true"; adjustConfig.setLaunchDeferredDeeplink(launchDeferredDeeplink); - string localBasePath = BasePath; + string localExtraPath = ExtraPath; adjustConfig.setDeferredDeeplinkDelegate(uri => { - TestApp.Log("deferred_deep_link = " + uri); _testLibrary.AddInfoToSend("deeplink", uri); - _testLibrary.SendInfoToServer(localBasePath); + _testLibrary.SendInfoToServer(localExtraPath); }); } if (_command.ContainsParameter("attributionCallbackSendAll")) { - string localBasePath = BasePath; + string localExtraPath = ExtraPath; adjustConfig.setAttributionChangedDelegate(attribution => { - TestApp.Log("AttributionChanged, attribution = " + attribution); - _testLibrary.AddInfoToSend("trackerToken", attribution.trackerToken); _testLibrary.AddInfoToSend("trackerName", attribution.trackerName); _testLibrary.AddInfoToSend("network", attribution.network); @@ -363,17 +351,15 @@ private void Config() _testLibrary.AddInfoToSend("creative", attribution.creative); _testLibrary.AddInfoToSend("clickLabel", attribution.clickLabel); _testLibrary.AddInfoToSend("adid", attribution.adid); - _testLibrary.SendInfoToServer(localBasePath); + _testLibrary.SendInfoToServer(localExtraPath); }); } if (_command.ContainsParameter("sessionCallbackSendSuccess")) { - string localBasePath = BasePath; + string localExtraPath = ExtraPath; adjustConfig.setSessionSuccessDelegate(sessionSuccessResponseData => { - TestApp.Log("SesssionTrackingSucceeded, sessionSuccessResponseData = " + sessionSuccessResponseData); - _testLibrary.AddInfoToSend("message", sessionSuccessResponseData.Message); _testLibrary.AddInfoToSend("timestamp", sessionSuccessResponseData.Timestamp); _testLibrary.AddInfoToSend("adid", sessionSuccessResponseData.Adid); @@ -381,17 +367,15 @@ private void Config() { _testLibrary.AddInfoToSend("jsonResponse", sessionSuccessResponseData.GetJsonResponse()); } - _testLibrary.SendInfoToServer(localBasePath); + _testLibrary.SendInfoToServer(localExtraPath); }); } if (_command.ContainsParameter("sessionCallbackSendFailure")) { - string localBasePath = BasePath; + string localExtraPath = ExtraPath; adjustConfig.setSessionFailureDelegate(sessionFailureResponseData => { - TestApp.Log("SesssionTrackingFailed, sessionFailureResponseData = " + sessionFailureResponseData); - _testLibrary.AddInfoToSend("message", sessionFailureResponseData.Message); _testLibrary.AddInfoToSend("timestamp", sessionFailureResponseData.Timestamp); _testLibrary.AddInfoToSend("adid", sessionFailureResponseData.Adid); @@ -400,17 +384,15 @@ private void Config() { _testLibrary.AddInfoToSend("jsonResponse", sessionFailureResponseData.GetJsonResponse()); } - _testLibrary.SendInfoToServer(localBasePath); + _testLibrary.SendInfoToServer(localExtraPath); }); } if (_command.ContainsParameter("eventCallbackSendSuccess")) { - string localBasePath = BasePath; + string localExtraPath = ExtraPath; adjustConfig.setEventSuccessDelegate(eventSuccessResponseData => { - TestApp.Log("EventTrackingSucceeded, eventSuccessResponseData = " + eventSuccessResponseData); - _testLibrary.AddInfoToSend("message", eventSuccessResponseData.Message); _testLibrary.AddInfoToSend("timestamp", eventSuccessResponseData.Timestamp); _testLibrary.AddInfoToSend("adid", eventSuccessResponseData.Adid); @@ -420,17 +402,15 @@ private void Config() { _testLibrary.AddInfoToSend("jsonResponse", eventSuccessResponseData.GetJsonResponse()); } - _testLibrary.SendInfoToServer(localBasePath); + _testLibrary.SendInfoToServer(localExtraPath); }); } if (_command.ContainsParameter("eventCallbackSendFailure")) { - string localBasePath = BasePath; + string localExtraPath = ExtraPath; adjustConfig.setEventFailureDelegate(eventFailureResponseData => { - TestApp.Log("EventTrackingFailed, eventFailureResponseData = " + eventFailureResponseData); - _testLibrary.AddInfoToSend("message", eventFailureResponseData.Message); _testLibrary.AddInfoToSend("timestamp", eventFailureResponseData.Timestamp); _testLibrary.AddInfoToSend("adid", eventFailureResponseData.Adid); @@ -441,7 +421,7 @@ private void Config() { _testLibrary.AddInfoToSend("jsonResponse", eventFailureResponseData.GetJsonResponse()); } - _testLibrary.SendInfoToServer(localBasePath); + _testLibrary.SendInfoToServer(localExtraPath); }); } } @@ -715,9 +695,94 @@ private void TrackAdRevenue() Adjust.trackAdRevenue(source, payload); } + private void TrackSubscription() + { +#if UNITY_IOS + string price = _command.GetFirstParameterValue("revenue"); + string currency = _command.GetFirstParameterValue("currency"); + string transactionId = _command.GetFirstParameterValue("transactionId"); + string receipt = _command.GetFirstParameterValue("receipt"); + string transactionDate = _command.GetFirstParameterValue("transactionDate"); + string salesRegion = _command.GetFirstParameterValue("salesRegion"); + + AdjustAppStoreSubscription subscription = new AdjustAppStoreSubscription( + price, + currency, + transactionId, + receipt); + subscription.setTransactionDate(transactionDate); + subscription.setSalesRegion(salesRegion); + + if (_command.ContainsParameter("callbackParams")) + { + var callbackParams = _command.Parameters["callbackParams"]; + for (var i = 0; i < callbackParams.Count; i = i + 2) + { + var key = callbackParams[i]; + var value = callbackParams[i + 1]; + subscription.addCallbackParameter(key, value); + } + } + + if (_command.ContainsParameter("partnerParams")) + { + var partnerParams = _command.Parameters["partnerParams"]; + for (var i = 0; i < partnerParams.Count; i = i + 2) + { + var key = partnerParams[i]; + var value = partnerParams[i + 1]; + subscription.addPartnerParameter(key, value); + } + } + + Adjust.trackAppStoreSubscription(subscription); +#elif UNITY_ANDROID + string price = _command.GetFirstParameterValue("revenue"); + string currency = _command.GetFirstParameterValue("currency"); + string purchaseTime = _command.GetFirstParameterValue("transactionDate"); + string sku = _command.GetFirstParameterValue("productId"); + string signature = _command.GetFirstParameterValue("receipt"); + string purchaseToken = _command.GetFirstParameterValue("purchaseToken"); + string orderId = _command.GetFirstParameterValue("transactionId"); + + AdjustPlayStoreSubscription subscription = new AdjustPlayStoreSubscription( + price, + currency, + sku, + orderId, + signature, + purchaseToken); + subscription.setPurchaseTime(purchaseTime); + + if (_command.ContainsParameter("callbackParams")) + { + var callbackParams = _command.Parameters["callbackParams"]; + for (var i = 0; i < callbackParams.Count; i = i + 2) + { + var key = callbackParams[i]; + var value = callbackParams[i + 1]; + subscription.addCallbackParameter(key, value); + } + } + + if (_command.ContainsParameter("partnerParams")) + { + var partnerParams = _command.Parameters["partnerParams"]; + for (var i = 0; i < partnerParams.Count; i = i + 2) + { + var key = partnerParams[i]; + var value = partnerParams[i + 1]; + subscription.addPartnerParameter(key, value); + } + } + + Adjust.trackPlayStoreSubscription(subscription); +#endif + } + private void CommandNotFound(string className, string methodName) { - TestApp.Log("adjust test: Method '" + methodName + "' not found for class '" + className + "'"); + TestApp.Log("Adjust Test: Method '" + methodName + "' not found for class '" + className + "'"); } } } diff --git a/Assets/Adjust/Test/TestApp.cs b/Assets/Adjust/Test/TestApp.cs index 399ee226..ee49e56d 100644 --- a/Assets/Adjust/Test/TestApp.cs +++ b/Assets/Adjust/Test/TestApp.cs @@ -16,15 +16,16 @@ public class TestApp : MonoBehaviour #elif UNITY_ANDROID private const string PORT = ":8443"; private const string PROTOCOL = "https://"; - private const string IP = "192.168.2.101"; + private const string IP = "192.168.86.32"; #elif UNITY_IOS private const string PORT = ":8080"; private const string PROTOCOL = "http://"; - private const string IP = "192.168.2.101"; + private const string IP = "192.168.86.32"; private TestLibraryiOS _testLibraryiOS; #endif private const string BASE_URL = PROTOCOL + IP + PORT; private const string GDPR_URL = PROTOCOL + IP + PORT; + private const string SUBSCRIPTION_URL = PROTOCOL + IP + PORT; private const string CONTROL_URL = "ws://" + IP + ":1987"; void OnGUI() @@ -53,9 +54,9 @@ private void StartTestSession() private ITestLibrary GetPlatformSpecificTestLibrary() { #if UNITY_IOS - return new TestLibraryiOS(BASE_URL, CONTROL_URL, GDPR_URL); + return new TestLibraryiOS(BASE_URL, GDPR_URL, SUBSCRIPTION_URL, CONTROL_URL); #elif UNITY_ANDROID - return new TestLibraryAndroid(BASE_URL, CONTROL_URL, GDPR_URL); + return new TestLibraryAndroid(BASE_URL, GDPR_URL, SUBSCRIPTION_URL, CONTROL_URL); #elif (UNITY_WSA || UNITY_WP8) return new TestLibraryWindows(BASE_URL, CONTROL_URL, GDPR_URL); #else diff --git a/Assets/Adjust/Test/TestLibraryAndroid.cs b/Assets/Adjust/Test/TestLibraryAndroid.cs index 732ae1ce..bd3fdf06 100644 --- a/Assets/Adjust/Test/TestLibraryAndroid.cs +++ b/Assets/Adjust/Test/TestLibraryAndroid.cs @@ -2,14 +2,15 @@ namespace com.adjust.sdk.test { +#if UNITY_ANDROID public class TestLibraryAndroid : ITestLibrary { private AndroidJavaObject ajoTestLibrary; private CommandListenerAndroid onCommandReceivedListener; - public TestLibraryAndroid(string baseUrl, string controlUrl, string gdprUrl) + public TestLibraryAndroid(string baseUrl, string gdprUrl, string subscriptionUrl, string controlUrl) { - CommandExecutor commandExecutor = new CommandExecutor(this, baseUrl, gdprUrl); + CommandExecutor commandExecutor = new CommandExecutor(this, baseUrl, gdprUrl, subscriptionUrl); onCommandReceivedListener = new CommandListenerAndroid(commandExecutor); ajoTestLibrary = new AndroidJavaObject( "com.adjust.test.TestLibrary", @@ -43,4 +44,5 @@ public void AddTestDirectory(string testDirectory) ajoTestLibrary.Call("addTestDirectory", testDirectory); } } +#endif } diff --git a/Assets/Adjust/Test/TestLibraryiOS.cs b/Assets/Adjust/Test/TestLibraryiOS.cs index 6095a6c0..92fc810f 100644 --- a/Assets/Adjust/Test/TestLibraryiOS.cs +++ b/Assets/Adjust/Test/TestLibraryiOS.cs @@ -8,9 +8,9 @@ public class TestLibraryiOS : ITestLibrary #if UNITY_IOS private CommandExecutor _commandExecutor; - public TestLibraryiOS(string baseUrl, string controlUrl, string gdprUrl) + public TestLibraryiOS(string baseUrl, string gdprUrl, string subscriptionUrl, string controlUrl) { - _commandExecutor = new CommandExecutor(this, baseUrl, gdprUrl); + _commandExecutor = new CommandExecutor(this, baseUrl, gdprUrl, subscriptionUrl); TestLibraryBridgeiOS.Initialize(baseUrl, controlUrl); } diff --git a/Assets/Adjust/Unity/Adjust.cs b/Assets/Adjust/Unity/Adjust.cs index 02e687a4..a44528b8 100644 --- a/Assets/Adjust/Unity/Adjust.cs +++ b/Assets/Adjust/Unity/Adjust.cs @@ -204,7 +204,7 @@ public static void disableThirdPartySharing() #elif UNITY_ANDROID AdjustAndroid.DisableThirdPartySharing(); #elif (UNITY_WSA || UNITY_WP8) - Debug.Log("Disable third party sharing is only supported for Android and iOS platforms."); + Debug.Log("[Adjust]: Disable third party sharing is only supported for Android and iOS platforms."); #else Debug.Log(errorMsgPlatform); #endif @@ -339,7 +339,37 @@ public static void trackAdRevenue(string source, string payload) #elif UNITY_ANDROID AdjustAndroid.TrackAdRevenue(source, payload); #elif (UNITY_WSA || UNITY_WP8) - Debug.Log("Ad revenue tracking is only supported for Android and iOS platforms."); + Debug.Log("[Adjust]: Ad revenue tracking is only supported for Android and iOS platforms."); +#else + Debug.Log(errorMsgPlatform); +#endif + } + + public static void trackAppStoreSubscription(AdjustAppStoreSubscription subscription) + { + if (IsEditor()) { return; } + +#if UNITY_IOS + AdjustiOS.TrackAppStoreSubscription(subscription); +#elif UNITY_ANDROID + Debug.Log("[Adjust]: App Store subscription tracking is only supported for iOS platform."); +#elif (UNITY_WSA || UNITY_WP8) + Debug.Log("[Adjust]: App Store subscription tracking is only supported for iOS platform."); +#else + Debug.Log(errorMsgPlatform); +#endif + } + + public static void trackPlayStoreSubscription(AdjustPlayStoreSubscription subscription) + { + if (IsEditor()) { return; } + +#if UNITY_IOS + Debug.Log("[Adjust]: Play Store subscription tracking is only supported for Android platform."); +#elif UNITY_ANDROID + AdjustAndroid.TrackPlayStoreSubscription(subscription); +#elif (UNITY_WSA || UNITY_WP8) + Debug.Log("[Adjust]: Play Store subscription tracking is only supported for Android platform."); #else Debug.Log(errorMsgPlatform); #endif @@ -586,7 +616,7 @@ public static void SetTestOptions(Dictionary testOptions) #elif (UNITY_WSA || UNITY_WP8) AdjustWindows.SetTestOptions(testOptions); #else - Debug.Log("Cannot run integration tests. None of the supported platforms selected."); + Debug.Log("[Adjust]: Cannot run integration tests. None of the supported platforms selected."); #endif } } diff --git a/Assets/Adjust/Unity/AdjustAppStoreSubscription.cs b/Assets/Adjust/Unity/AdjustAppStoreSubscription.cs new file mode 100644 index 00000000..73ec83a8 --- /dev/null +++ b/Assets/Adjust/Unity/AdjustAppStoreSubscription.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; + +namespace com.adjust.sdk +{ + public class AdjustAppStoreSubscription + { + internal string price; + internal string currency; + internal string transactionId; + internal string receipt; + internal string billingStore; + internal string transactionDate; + internal string salesRegion; + internal List partnerList; + internal List callbackList; + + public AdjustAppStoreSubscription(string price, string currency, string transactionId, string receipt) + { + this.price = price; + this.currency = currency; + this.transactionId = transactionId; + this.receipt = receipt; + } + + public void setTransactionDate(string transactionDate) + { + this.transactionDate = transactionDate; + } + + public void setSalesRegion(string salesRegion) + { + this.salesRegion = salesRegion; + } + + public void addCallbackParameter(string key, string value) + { + if (callbackList == null) + { + callbackList = new List(); + } + callbackList.Add(key); + callbackList.Add(value); + } + + public void addPartnerParameter(string key, string value) + { + if (partnerList == null) + { + partnerList = new List(); + } + partnerList.Add(key); + partnerList.Add(value); + } + } +} diff --git a/Assets/Adjust/Unity/AdjustAppStoreSubscription.cs.meta b/Assets/Adjust/Unity/AdjustAppStoreSubscription.cs.meta new file mode 100644 index 00000000..f5af3305 --- /dev/null +++ b/Assets/Adjust/Unity/AdjustAppStoreSubscription.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7e2d69221b1124370a4c016edce5a95a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Adjust/Unity/AdjustPlayStoreSubscription.cs b/Assets/Adjust/Unity/AdjustPlayStoreSubscription.cs new file mode 100644 index 00000000..c86e45cb --- /dev/null +++ b/Assets/Adjust/Unity/AdjustPlayStoreSubscription.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; + +namespace com.adjust.sdk +{ + public class AdjustPlayStoreSubscription + { + internal string price; + internal string currency; + internal string sku; + internal string orderId; + internal string signature; + internal string purchaseToken; + internal string billingStore; + internal string purchaseTime; + internal List partnerList; + internal List callbackList; + + public AdjustPlayStoreSubscription(string price, string currency, string sku, string orderId, string signature, string purchaseToken) + { + this.price = price; + this.currency = currency; + this.sku = sku; + this.orderId = orderId; + this.signature = signature; + this.purchaseToken = purchaseToken; + } + + public void setPurchaseTime(string purchaseTime) + { + this.purchaseTime = purchaseTime; + } + + public void addCallbackParameter(string key, string value) + { + if (callbackList == null) + { + callbackList = new List(); + } + callbackList.Add(key); + callbackList.Add(value); + } + + public void addPartnerParameter(string key, string value) + { + if (partnerList == null) + { + partnerList = new List(); + } + partnerList.Add(key); + partnerList.Add(value); + } + } +} diff --git a/Assets/Adjust/Unity/AdjustPlayStoreSubscription.cs.meta b/Assets/Adjust/Unity/AdjustPlayStoreSubscription.cs.meta new file mode 100644 index 00000000..8b827323 --- /dev/null +++ b/Assets/Adjust/Unity/AdjustPlayStoreSubscription.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 69e7a4074abb44758b3f011d8352a57a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Adjust/Unity/AdjustUtils.cs b/Assets/Adjust/Unity/AdjustUtils.cs index 898d85e8..11d7ceca 100644 --- a/Assets/Adjust/Unity/AdjustUtils.cs +++ b/Assets/Adjust/Unity/AdjustUtils.cs @@ -25,6 +25,8 @@ public class AdjustUtils // For testing purposes. public static string KeyTestOptionsBaseUrl = "baseUrl"; public static string KeyTestOptionsGdprUrl = "gdprUrl"; + public static string KeyTestOptionsSubscriptionUrl = "subscriptionUrl"; + public static string KeyTestOptionsExtraPath = "extraPath"; public static string KeyTestOptionsBasePath = "basePath"; public static string KeyTestOptionsGdprPath = "gdprPath"; public static string KeyTestOptionsDeleteState = "deleteState"; @@ -225,14 +227,13 @@ public static AndroidJavaObject TestOptionsMap2AndroidJavaObject(Dictionary("baseUrl", testOptionsMap[KeyTestOptionsBaseUrl]); ajoTestOptions.Set("gdprUrl", testOptionsMap[KeyTestOptionsGdprUrl]); + ajoTestOptions.Set("subscriptionUrl", testOptionsMap[KeyTestOptionsSubscriptionUrl]); - if (testOptionsMap.ContainsKey(KeyTestOptionsBasePath) && !string.IsNullOrEmpty(testOptionsMap[KeyTestOptionsBasePath])) + if (testOptionsMap.ContainsKey(KeyTestOptionsExtraPath) && !string.IsNullOrEmpty(testOptionsMap[KeyTestOptionsExtraPath])) { - ajoTestOptions.Set("basePath", testOptionsMap[KeyTestOptionsBasePath]); - } - if (testOptionsMap.ContainsKey(KeyTestOptionsGdprPath) && !string.IsNullOrEmpty(testOptionsMap[KeyTestOptionsGdprPath])) - { - ajoTestOptions.Set("gdprPath", testOptionsMap[KeyTestOptionsGdprPath]); + ajoTestOptions.Set("basePath", testOptionsMap[KeyTestOptionsExtraPath]); + ajoTestOptions.Set("gdprPath", testOptionsMap[KeyTestOptionsExtraPath]); + ajoTestOptions.Set("subscriptionPath", testOptionsMap[KeyTestOptionsExtraPath]); } if (testOptionsMap.ContainsKey(KeyTestOptionsDeleteState) && ajoCurrentActivity != null) { diff --git a/Assets/Adjust/Windows/AdjustWindows.cs b/Assets/Adjust/Windows/AdjustWindows.cs index f7e734ec..e7d3a882 100644 --- a/Assets/Adjust/Windows/AdjustWindows.cs +++ b/Assets/Adjust/Windows/AdjustWindows.cs @@ -17,7 +17,7 @@ namespace com.adjust.sdk { public class AdjustWindows { - private const string sdkPrefix = "unity4.21.3"; + private const string sdkPrefix = "unity4.22.0"; private static bool appLaunched = false; public static void Start(AdjustConfig adjustConfig) diff --git a/Assets/Adjust/iOS/ADJSubscription.h b/Assets/Adjust/iOS/ADJSubscription.h new file mode 100644 index 00000000..92f5395e --- /dev/null +++ b/Assets/Adjust/iOS/ADJSubscription.h @@ -0,0 +1,44 @@ +// +// ADJSubscription.h +// Adjust +// +// Created by Uglješa Erceg on 16.04.20. +// Copyright © 2020 adjust GmbH. All rights reserved. +// + +#import + +@interface ADJSubscription : NSObject + +@property (nonatomic, copy, readonly, nonnull) NSDecimalNumber *price; // [M] revenue + +@property (nonatomic, copy, readonly, nonnull) NSString *currency; // [M] currency + +@property (nonatomic, copy, readonly, nonnull) NSString *transactionId; // [M] transaction_id + +@property (nonatomic, copy, readonly, nonnull) NSData *receipt; // [M] receipt + +@property (nonatomic, copy, readonly, nonnull) NSString *billingStore; // [M] billing_store + +@property (nonatomic, copy, readonly, nonnull) NSDate *transactionDate; // [O] transaction_date + +@property (nonatomic, copy, readonly, nonnull) NSString *salesRegion; // [O] sales_region + +@property (nonatomic, copy, readonly, nonnull) NSDictionary *callbackParameters; // [O] callback_params + +@property (nonatomic, copy, readonly, nonnull) NSDictionary *partnerParameters; // [O] partner_params + +- (nullable id)initWithPrice:(nonnull NSDecimalNumber *)price + currency:(nonnull NSString *)currency + transactionId:(nonnull NSString *)transactionId + andReceipt:(nonnull NSData *)receipt; + +- (void)setTransactionDate:(nonnull NSDate *)transactionDate; + +- (void)setSalesRegion:(nonnull NSString *)salesRegion; + +- (void)addCallbackParameter:(nonnull NSString *)key value:(nonnull NSString *)value; + +- (void)addPartnerParameter:(nonnull NSString *)key value:(nonnull NSString *)value; + +@end diff --git a/Assets/Adjust/iOS/ADJSubscription.h.meta b/Assets/Adjust/iOS/ADJSubscription.h.meta new file mode 100644 index 00000000..67385628 --- /dev/null +++ b/Assets/Adjust/iOS/ADJSubscription.h.meta @@ -0,0 +1,24 @@ +fileFormatVersion: 2 +guid: 15bc7056a22f34382aea2497343c3509 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Adjust/iOS/Adjust.h b/Assets/Adjust/iOS/Adjust.h index 6e9c5ad7..6e6acda5 100644 --- a/Assets/Adjust/iOS/Adjust.h +++ b/Assets/Adjust/iOS/Adjust.h @@ -2,7 +2,7 @@ // Adjust.h // Adjust // -// V4.21.3 +// V4.22.0 // Created by Christian Wellenbrock (wellle) on 23rd July 2013. // Copyright © 2012-2017 Adjust GmbH. All rights reserved. // @@ -10,13 +10,14 @@ #import "ADJEvent.h" #import "ADJConfig.h" #import "ADJAttribution.h" +#import "ADJSubscription.h" @interface AdjustTestOptions : NSObject @property (nonatomic, copy, nullable) NSString *baseUrl; @property (nonatomic, copy, nullable) NSString *gdprUrl; -@property (nonatomic, copy, nullable) NSString *basePath; -@property (nonatomic, copy, nullable) NSString *gdprPath; +@property (nonatomic, copy, nullable) NSString *subscriptionUrl; +@property (nonatomic, copy, nullable) NSString *extraPath; @property (nonatomic, copy, nullable) NSNumber *timerIntervalInMilliseconds; @property (nonatomic, copy, nullable) NSNumber *timerStartInMilliseconds; @property (nonatomic, copy, nullable) NSNumber *sessionIntervalInMilliseconds; @@ -266,6 +267,13 @@ extern NSString * __nonnull const ADJAdRevenueSourceTapdaq; */ + (void)disableThirdPartySharing; +/** + * @brief Track subscription. + * + * @param subscription Subscription object. + */ ++ (void)trackSubscription:(nonnull ADJSubscription *)subscription; + /** * Obtain singleton Adjust object. */ @@ -311,6 +319,8 @@ extern NSString * __nonnull const ADJAdRevenueSourceTapdaq; - (void)trackAdRevenue:(nonnull NSString *)source payload:(nonnull NSData *)payload; +- (void)trackSubscription:(nonnull ADJSubscription *)subscription; + - (BOOL)isEnabled; - (nullable NSString *)adid; diff --git a/Assets/Adjust/iOS/AdjustSdk.a b/Assets/Adjust/iOS/AdjustSdk.a index 2ac2cf16..e16326fb 100644 Binary files a/Assets/Adjust/iOS/AdjustSdk.a and b/Assets/Adjust/iOS/AdjustSdk.a differ diff --git a/Assets/Adjust/iOS/AdjustUnity.mm b/Assets/Adjust/iOS/AdjustUnity.mm index e87813f3..2b0ac49c 100644 --- a/Assets/Adjust/iOS/AdjustUnity.mm +++ b/Assets/Adjust/iOS/AdjustUnity.mm @@ -452,10 +452,97 @@ void _AdjustTrackAdRevenue(const char* source, const char* payload) { } } + void _AdjustTrackAppStoreSubscription(const char* price, + const char* currency, + const char* transactionId, + const char* receipt, + const char* billingStore, + const char* transactionDate, + const char* salesRegion, + const char* jsonCallbackParameters, + const char* jsonPartnerParameters) { + // Mandatory fields. + NSDecimalNumber *mPrice; + NSString *mCurrency; + NSString *mTransactionId; + NSData *mReceipt; + NSString *mBillingStore; + + // Price. + if (price != NULL) { + mPrice = [NSDecimalNumber decimalNumberWithString:[NSString stringWithUTF8String:price]]; + } + + // Currency. + if (currency != NULL) { + mCurrency = [NSString stringWithUTF8String:currency]; + } + + // Transaction ID. + if (transactionId != NULL) { + mTransactionId = [NSString stringWithUTF8String:transactionId]; + } + + // Receipt. + if (receipt != NULL) { + mReceipt = [[NSString stringWithUTF8String:receipt] dataUsingEncoding:NSUTF8StringEncoding]; + } + + // Billing store (not used ATM, maybe in the future). + if (billingStore != NULL) { + mBillingStore = [NSString stringWithUTF8String:billingStore]; + } + + ADJSubscription *subscription = [[ADJSubscription alloc] initWithPrice:mPrice + currency:mCurrency + transactionId:mTransactionId + andReceipt:mReceipt]; + + // Optional fields. + + // Transaction date. + if (transactionDate != NULL) { + NSTimeInterval transactionDateInterval = [[NSString stringWithUTF8String:transactionDate] doubleValue]; + NSDate *oTransactionDate = [NSDate dateWithTimeIntervalSince1970:transactionDateInterval]; + [subscription setTransactionDate:oTransactionDate]; + } + + // Sales region. + if (salesRegion != NULL) { + NSString *oSalesRegion = [NSString stringWithUTF8String:salesRegion]; + [subscription setSalesRegion:oSalesRegion]; + } + + // Callback parameters. + NSArray *arrayCallbackParameters = convertArrayParameters(jsonCallbackParameters); + if (arrayCallbackParameters != nil) { + NSUInteger count = [arrayCallbackParameters count]; + for (int i = 0; i < count;) { + NSString *key = arrayCallbackParameters[i++]; + NSString *value = arrayCallbackParameters[i++]; + [subscription addCallbackParameter:key value:value]; + } + } + + // Partner parameters. + NSArray *arrayPartnerParameters = convertArrayParameters(jsonPartnerParameters); + if (arrayPartnerParameters != nil) { + NSUInteger count = [arrayPartnerParameters count]; + for (int i = 0; i < count;) { + NSString *key = arrayPartnerParameters[i++]; + NSString *value = arrayPartnerParameters[i++]; + [subscription addPartnerParameter:key value:value]; + } + } + + // Track subscription. + [Adjust trackSubscription:subscription]; + } + void _AdjustSetTestOptions(const char* baseUrl, - const char* basePath, const char* gdprUrl, - const char* gdprPath, + const char* subscriptionUrl, + const char* extraPath, long timerIntervalInMilliseconds, long timerStartInMilliseconds, long sessionIntervalInMilliseconds, @@ -476,14 +563,14 @@ void _AdjustSetTestOptions(const char* baseUrl, [testOptions setGdprUrl:stringGdprUrl]; } - NSString *stringBasePath = isStringValid(basePath) == true ? [NSString stringWithUTF8String:basePath] : nil; - if (stringBasePath != nil && [stringBasePath length] > 0) { - [testOptions setBasePath:stringBasePath]; + NSString *stringSubscriptionUrl = isStringValid(baseUrl) == true ? [NSString stringWithUTF8String:subscriptionUrl] : nil; + if (stringSubscriptionUrl != nil) { + [testOptions setSubscriptionUrl:stringSubscriptionUrl]; } - NSString *stringGdprPath = isStringValid(gdprPath) == true ? [NSString stringWithUTF8String:gdprPath] : nil; - if (stringGdprPath != nil && [stringGdprPath length] > 0) { - [testOptions setGdprPath:stringGdprPath]; + NSString *stringExtraPath = isStringValid(extraPath) == true ? [NSString stringWithUTF8String:extraPath] : nil; + if (stringExtraPath != nil && [stringExtraPath length] > 0) { + [testOptions setExtraPath:stringExtraPath]; } testOptions.timerIntervalInMilliseconds = [NSNumber numberWithLong:timerIntervalInMilliseconds]; diff --git a/Assets/Adjust/iOS/AdjustiOS.cs b/Assets/Adjust/iOS/AdjustiOS.cs index c981fdba..6e613a5b 100644 --- a/Assets/Adjust/iOS/AdjustiOS.cs +++ b/Assets/Adjust/iOS/AdjustiOS.cs @@ -8,7 +8,7 @@ namespace com.adjust.sdk #if UNITY_IOS public class AdjustiOS { - private const string sdkPrefix = "unity4.21.3"; + private const string sdkPrefix = "unity4.22.0"; [DllImport("__Internal")] private static extern void _AdjustLaunchApp( @@ -109,12 +109,24 @@ private static extern void _AdjustTrackEvent( [DllImport("__Internal")] private static extern void _AdjustTrackAdRevenue(string source, string payload); + [DllImport("__Internal")] + private static extern void _AdjustTrackAppStoreSubscription( + string price, + string currency, + string transactionId, + string receipt, + string billingStore, + string transactionDate, + string salesRegion, + string jsonCallbackParameters, + string jsonPartnerParameters); + [DllImport("__Internal")] private static extern void _AdjustSetTestOptions( string baseUrl, - string basePath, string gdprUrl, - string gdprPath, + string subscriptionUrl, + string extraPath, long timerIntervalInMilliseconds, long timerStartInMilliseconds, long sessionIntervalInMilliseconds, @@ -200,10 +212,10 @@ public static void TrackEvent(AdjustEvent adjustEvent) string receipt = adjustEvent.receipt; string transactionId = adjustEvent.transactionId; string callbackId = adjustEvent.callbackId; - string stringJsonCallBackParameters = AdjustUtils.ConvertListToJson(adjustEvent.callbackList); + string stringJsonCallbackParameters = AdjustUtils.ConvertListToJson(adjustEvent.callbackList); string stringJsonPartnerParameters = AdjustUtils.ConvertListToJson(adjustEvent.partnerList); - _AdjustTrackEvent(eventToken, revenue, currency, receipt, transactionId, callbackId, isReceiptSet, stringJsonCallBackParameters, stringJsonPartnerParameters); + _AdjustTrackEvent(eventToken, revenue, currency, receipt, transactionId, callbackId, isReceiptSet, stringJsonCallbackParameters, stringJsonPartnerParameters); } public static void SetEnabled(bool enabled) @@ -267,6 +279,30 @@ public static void TrackAdRevenue(string source, string payload) _AdjustTrackAdRevenue(source, payload); } + public static void TrackAppStoreSubscription(AdjustAppStoreSubscription subscription) + { + string price = subscription.price; + string currency = subscription.currency; + string transactionId = subscription.transactionId; + string receipt = subscription.receipt; + string billingStore = subscription.billingStore; + string transactionDate = subscription.transactionDate; + string salesRegion = subscription.salesRegion; + string stringJsonCallbackParameters = AdjustUtils.ConvertListToJson(subscription.callbackList); + string stringJsonPartnerParameters = AdjustUtils.ConvertListToJson(subscription.partnerList); + + _AdjustTrackAppStoreSubscription( + price, + currency, + transactionId, + receipt, + billingStore, + transactionDate, + salesRegion, + stringJsonCallbackParameters, + stringJsonPartnerParameters); + } + public static void SetDeviceToken(string deviceToken) { _AdjustSetDeviceToken(deviceToken); @@ -314,8 +350,8 @@ public static void SetTestOptions(Dictionary testOptions) { string baseUrl = testOptions[AdjustUtils.KeyTestOptionsBaseUrl]; string gdprUrl = testOptions[AdjustUtils.KeyTestOptionsGdprUrl]; - string basePath = testOptions.ContainsKey(AdjustUtils.KeyTestOptionsBasePath) ? testOptions[AdjustUtils.KeyTestOptionsBasePath] : null; - string gdprPath = testOptions.ContainsKey(AdjustUtils.KeyTestOptionsGdprPath) ? testOptions[AdjustUtils.KeyTestOptionsGdprPath] : null; + string subscriptionUrl = testOptions[AdjustUtils.KeyTestOptionsSubscriptionUrl]; + string extraPath = testOptions.ContainsKey(AdjustUtils.KeyTestOptionsExtraPath) ? testOptions[AdjustUtils.KeyTestOptionsExtraPath] : null; long timerIntervalMilis = -1; long timerStartMilis = -1; long sessionIntMilis = -1; @@ -360,9 +396,9 @@ public static void SetTestOptions(Dictionary testOptions) _AdjustSetTestOptions( baseUrl, - basePath, gdprUrl, - gdprPath, + subscriptionUrl, + extraPath, timerIntervalMilis, timerStartMilis, sessionIntMilis, diff --git a/Assets/Adjust/iOS/Test/AdjustTestLibrary.a b/Assets/Adjust/iOS/Test/AdjustTestLibrary.a index c48ccc01..d444b735 100644 Binary files a/Assets/Adjust/iOS/Test/AdjustTestLibrary.a and b/Assets/Adjust/iOS/Test/AdjustTestLibrary.a differ diff --git a/Assets/AdjustOaid/Android/adjust-android-oaid.jar b/Assets/AdjustOaid/Android/adjust-android-oaid.jar index bea7a387..856fa6bb 100644 Binary files a/Assets/AdjustOaid/Android/adjust-android-oaid.jar and b/Assets/AdjustOaid/Android/adjust-android-oaid.jar differ diff --git a/CHANGELOG.md b/CHANGELOG.md index 305528b9..0140f217 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +### Version 4.22.0 (5th June 2020) +#### Added +- Added subscription tracking feature. + +#### Native SDKs +- [iOS@v4.22.0][ios_sdk_v4.22.0] +- [Android@v4.22.0][android_sdk_v4.22.0] +- [Windows@v4.17.0][windows_sdk_v4.17.0] + +--- + ### Version 4.21.3 (4th May 2020) #### Fixed - Removed iAd timer from iOS native SDK. @@ -721,6 +732,7 @@ [ios_sdk_v4.21.0]: https://github.com/adjust/ios_sdk/tree/v4.21.0 [ios_sdk_v4.21.1]: https://github.com/adjust/ios_sdk/tree/v4.21.1 [ios_sdk_v4.21.2]: https://github.com/adjust/ios_sdk/tree/v4.21.2 +[ios_sdk_v4.22.0]: https://github.com/adjust/ios_sdk/tree/v4.22.0 [android_sdk_v3.5.0]: https://github.com/adjust/android_sdk/tree/v3.5.0 [android_sdk_v4.1.0]: https://github.com/adjust/android_sdk/tree/v4.1.0 @@ -747,6 +759,7 @@ [android_sdk_v4.20.0]: https://github.com/adjust/android_sdk/tree/v4.20.0 [android_sdk_v4.21.0]: https://github.com/adjust/android_sdk/tree/v4.21.0 [android_sdk_v4.21.1]: https://github.com/adjust/android_sdk/tree/v4.21.1 +[android_sdk_v4.22.0]: https://github.com/adjust/android_sdk/tree/v4.22.0 [windows_sdk_v4.12.0]: https://github.com/adjust/windows_sdk/tree/v4.12.0 [windows_sdk_v4.13.0]: https://github.com/adjust/windows_sdk/tree/v4.13.0 diff --git a/README.md b/README.md index db4f74d4..0cd73bef 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ Read this in other languages: [English][en-readme], [中文][zh-readme], [日本 * [Push token (uninstall tracking)](#ad-push-token) * [Attribution callback](#ad-attribution-callback) * [Ad revenue tracking](#ad-ad-revenue) + * [Subscription tracking](#ad-subscriptions) * [Session and event callbacks](#ad-session-event-callbacks) * [User attribution](#ad-user-attribution) * [Device IDs](#ad-device-ids) @@ -592,6 +593,109 @@ Currently we support the following `source` parameter values: - `AdjustConfig.AdjustAdRevenueSourceMopub` - represents the [MoPub mediation platform][sdk2sdk-mopub] +### Subscription tracking + +**Note**: This feature is only available in the SDK v4.22.0 and above. + +You can track App Store and Play Store subscriptions and verify their validity with the Adjust SDK. After a subscription has been successfully purchased, make the following call to the Adjust SDK: + +**For App Store subscription:** + +```csharp +AdjustAppStoreSubscription subscription = new AdjustAppStoreSubscription( + price, + currency, + transactionId, + receipt); +subscription.setTransactionDate(transactionDate); +subscription.setSalesRegion(salesRegion); + +Adjust.trackAppStoreSubscription(subscription); +``` + +**For Play Store subscription:** + +```csharp +AdjustPlayStoreSubscription subscription = new AdjustPlayStoreSubscription( + price, + currency, + sku, + orderId, + signature, + purchaseToken); +subscription.setPurchaseTime(purchaseTime); + +Adjust.trackPlayStoreSubscription(subscription); +``` + +Subscription tracking parameters for App Store subscription: + +- [price](https://developer.apple.com/documentation/storekit/skproduct/1506094-price?language=objc) +- currency (you need to pass [currencyCode](https://developer.apple.com/documentation/foundation/nslocale/1642836-currencycode?language=objc) of the [priceLocale](https://developer.apple.com/documentation/storekit/skproduct/1506145-pricelocale?language=objc) object) +- [transactionId](https://developer.apple.com/documentation/storekit/skpaymenttransaction/1411288-transactionidentifier?language=objc) +- [receipt](https://developer.apple.com/documentation/foundation/nsbundle/1407276-appstorereceipturl) +- [transactionDate](https://developer.apple.com/documentation/storekit/skpaymenttransaction/1411273-transactiondate?language=objc) +- salesRegion (you need to pass [countryCode](https://developer.apple.com/documentation/foundation/nslocale/1643060-countrycode?language=objc) of the [priceLocale](https://developer.apple.com/documentation/storekit/skproduct/1506145-pricelocale?language=objc) object) + +Subscription tracking parameters for Play Store subscription: + +- [price](https://developer.android.com/reference/com/android/billingclient/api/SkuDetails#getpriceamountmicros) +- [currency](https://developer.android.com/reference/com/android/billingclient/api/SkuDetails#getpricecurrencycode) +- [sku](https://developer.android.com/reference/com/android/billingclient/api/Purchase#getsku) +- [orderId](https://developer.android.com/reference/com/android/billingclient/api/Purchase#getorderid) +- [signature](https://developer.android.com/reference/com/android/billingclient/api/Purchase#getsignature) +- [purchaseToken](https://developer.android.com/reference/com/android/billingclient/api/Purchase#getpurchasetoken) +- [purchaseTime](https://developer.android.com/reference/com/android/billingclient/api/Purchase#getpurchasetime) + +**Note:** Subscription tracking API offered by Adjust SDK expects all parameters to be passed as `string` values. Parameters described above are the ones which API exects you to pass to subscription object prior to tracking subscription. There are various libraries which are handling in app purchases in Unity and each one of them should return information described above in some form upon successfully completed subscription purchase. You should locate where these parameters are placed in response you are getting from library you are using for in app purchases, extract those values and pass them to Adjust API as string values. + +Just like with event tracking, you can attach callback and partner parameters to the subscription object as well: + +**For App Store subscription:** + +```csharp +AdjustAppStoreSubscription subscription = new AdjustAppStoreSubscription( + price, + currency, + transactionId, + receipt); +subscription.setTransactionDate(transactionDate); +subscription.setSalesRegion(salesRegion); + +// add callback parameters +subscription.addCallbackParameter("key", "value"); +subscription.addCallbackParameter("foo", "bar"); + +// add partner parameters +subscription.addPartnerParameter("key", "value"); +subscription.addPartnerParameter("foo", "bar"); + +Adjust.trackAppStoreSubscription(subscription); +``` + +**For Play Store subscription:** + +```csharp +AdjustPlayStoreSubscription subscription = new AdjustPlayStoreSubscription( + price, + currency, + sku, + orderId, + signature, + purchaseToken); +subscription.setPurchaseTime(purchaseTime); + +// add callback parameters +subscription.addCallbackParameter("key", "value"); +subscription.addCallbackParameter("foo", "bar"); + +// add partner parameters +subscription.addPartnerParameter("key", "value"); +subscription.addPartnerParameter("foo", "bar"); + +Adjust.trackPlayStoreSubscription(subscription); +``` + ### Session and event callbacks You can set up callbacks to notify you of successful and failed events and/or sessions. diff --git a/VERSION b/VERSION index fedb1134..d7638f37 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.21.3 +4.22.0 diff --git a/doc/english/migration/migrate.md b/doc/english/migration/migrate.md index b8d5117d..6e0e7e65 100644 --- a/doc/english/migration/migrate.md +++ b/doc/english/migration/migrate.md @@ -1,4 +1,4 @@ -## Migrate your Adjust SDK for Unity3d to 4.21.3 from 3.4.4 +## Migrate your Adjust SDK for Unity3d to 4.22.0 from 3.4.4 ### Migration procedure diff --git a/ext/android/sdk b/ext/android/sdk index 91ca35fa..79a92a56 160000 --- a/ext/android/sdk +++ b/ext/android/sdk @@ -1 +1 @@ -Subproject commit 91ca35faa359e58b801f5aa280d797d2ff7daee7 +Subproject commit 79a92a56f641ea0f6286a4b9ddf43e50561a95a9 diff --git a/ext/ios/sdk b/ext/ios/sdk index 8c1f10be..69891bd6 160000 --- a/ext/ios/sdk +++ b/ext/ios/sdk @@ -1 +1 @@ -Subproject commit 8c1f10bedf54e9581365555194dd80b0a7914877 +Subproject commit 69891bd62cd9a9e954eb1bd30b5a9d9bf4516204