From a3fa3a051a8c14ebbf3dcb2de643ceb396d954b3 Mon Sep 17 00:00:00 2001 From: uerceg Date: Fri, 8 Jun 2018 15:23:16 +0200 Subject: [PATCH] Adjustments to use new appWillOpenUrl method signature --- Assets/Adjust/Android/AdjustAndroid.cs | 6 +++--- Assets/Adjust/Test/AdjustTestOptions.cs | 14 ++++++-------- Assets/Adjust/Test/CommandExecutor.cs | 10 +++++----- Assets/Adjust/iOS/AdjustUnity.mm | 6 +++++- Assets/Adjust/iOS/AdjustiOS.cs | 7 +++++-- 5 files changed, 24 insertions(+), 19 deletions(-) diff --git a/Assets/Adjust/Android/AdjustAndroid.cs b/Assets/Adjust/Android/AdjustAndroid.cs index 1fa37135..6e5eeba8 100644 --- a/Assets/Adjust/Android/AdjustAndroid.cs +++ b/Assets/Adjust/Android/AdjustAndroid.cs @@ -337,9 +337,9 @@ public static void ResetSessionCallbackParameters() public static void AppWillOpenUrl(string url) { - AndroidJavaClass ajcUri = new AndroidJavaClass ("android.net.Uri"); + AndroidJavaClass ajcUri = new AndroidJavaClass("android.net.Uri"); AndroidJavaObject ajoUri = ajcUri.CallStatic("parse", url); - ajcAdjust.CallStatic("appWillOpenUrl", ajoUri); + ajcAdjust.CallStatic("appWillOpenUrl", ajoUri, ajoCurrentActivity); } // Android specific methods. @@ -372,7 +372,7 @@ public static string GetAmazonAdId() // Used for testing only. public static void SetTestOptions(AdjustTestOptions testOptions) { - AndroidJavaObject ajoTestOptions = testOptions.ToAndroidJavaObject (ajoCurrentActivity); + AndroidJavaObject ajoTestOptions = testOptions.ToAndroidJavaObject(ajoCurrentActivity); ajcAdjust.CallStatic("setTestOptions", ajoTestOptions); } diff --git a/Assets/Adjust/Test/AdjustTestOptions.cs b/Assets/Adjust/Test/AdjustTestOptions.cs index a936021c..4bcfb300 100644 --- a/Assets/Adjust/Test/AdjustTestOptions.cs +++ b/Assets/Adjust/Test/AdjustTestOptions.cs @@ -12,6 +12,7 @@ public class AdjustTestOptions public bool? Teardown { get; set; } public bool? DeleteState { get; set; } public bool? UseTestConnectionOptions { get; set; } + public bool? NoBackoffWait { get; set; } // Default value => Constants.ONE_MINUTE public long? TimerIntervalInMilliseconds { get; set; } @@ -33,52 +34,49 @@ public AndroidJavaObject ToAndroidJavaObject(AndroidJavaObject ajoCurrentActivit { ajoTestOptions.Set("basePath", BasePath); } - if (!string.IsNullOrEmpty(GdprPath)) { ajoTestOptions.Set("gdprPath", GdprPath); } - if (DeleteState.GetValueOrDefault(false) && ajoCurrentActivity != null) { ajoTestOptions.Set("context", ajoCurrentActivity); } - if (UseTestConnectionOptions.HasValue) { AndroidJavaObject ajoUseTestConnectionOptions = new AndroidJavaObject("java.lang.Boolean", UseTestConnectionOptions.Value); ajoTestOptions.Set("useTestConnectionOptions", ajoUseTestConnectionOptions); } - if (TimerIntervalInMilliseconds.HasValue) { AndroidJavaObject ajoTimerIntervalInMilliseconds = new AndroidJavaObject("java.lang.Long", TimerIntervalInMilliseconds.Value); ajoTestOptions.Set("timerIntervalInMilliseconds", ajoTimerIntervalInMilliseconds); } - if (TimerStartInMilliseconds.HasValue) { AndroidJavaObject ajoTimerStartInMilliseconds = new AndroidJavaObject("java.lang.Long", TimerStartInMilliseconds.Value); ajoTestOptions.Set("timerStartInMilliseconds", ajoTimerStartInMilliseconds); } - if (SessionIntervalInMilliseconds.HasValue) { AndroidJavaObject ajoSessionIntervalInMilliseconds = new AndroidJavaObject("java.lang.Long", SessionIntervalInMilliseconds.Value); ajoTestOptions.Set("sessionIntervalInMilliseconds", ajoSessionIntervalInMilliseconds); } - if (SubsessionIntervalInMilliseconds.HasValue) { AndroidJavaObject ajoSubsessionIntervalInMilliseconds = new AndroidJavaObject("java.lang.Long", SubsessionIntervalInMilliseconds.Value); ajoTestOptions.Set("subsessionIntervalInMilliseconds", ajoSubsessionIntervalInMilliseconds); } - if (Teardown.HasValue) { AndroidJavaObject ajoTeardown = new AndroidJavaObject("java.lang.Boolean", Teardown.Value); ajoTestOptions.Set("teardown", ajoTeardown); } + if (NoBackoffWait.HasValue) + { + AndroidJavaObject ajoNoBackoffWait = new AndroidJavaObject("java.lang.Boolean", NoBackoffWait.Value); + ajoTestOptions.Set("noBackoffWait", ajoNoBackoffWait); + } return ajoTestOptions; } diff --git a/Assets/Adjust/Test/CommandExecutor.cs b/Assets/Adjust/Test/CommandExecutor.cs index fc209b5c..78846872 100644 --- a/Assets/Adjust/Test/CommandExecutor.cs +++ b/Assets/Adjust/Test/CommandExecutor.cs @@ -89,31 +89,31 @@ private void TestOptions() BasePath = _command.GetFirstParameterValue("basePath"); GdprPath = _command.GetFirstParameterValue("basePath"); } - if (_command.ContainsParameter("timerInterval")) { long timerInterval = long.Parse(_command.GetFirstParameterValue("timerInterval")); testOptions.TimerIntervalInMilliseconds = timerInterval; } - if (_command.ContainsParameter("timerStart")) { long timerStart = long.Parse(_command.GetFirstParameterValue("timerStart")); testOptions.TimerStartInMilliseconds = timerStart; } - if (_command.ContainsParameter("sessionInterval")) { long sessionInterval = long.Parse(_command.GetFirstParameterValue("sessionInterval")); testOptions.SessionIntervalInMilliseconds = sessionInterval; } - if (_command.ContainsParameter("subsessionInterval")) { long subsessionInterval = long.Parse(_command.GetFirstParameterValue("subsessionInterval")); testOptions.SubsessionIntervalInMilliseconds = subsessionInterval; } - + if (_command.ContainsParameter("noBackoffWait")) + { + bool noBackoffWait = bool.Parse(_command.GetFirstParameterValue("noBackoffWait")); + testOptions.NoBackoffWait = noBackoffWait; + } if (_command.ContainsParameter("teardown")) { List teardownOptions = _command.Parameters["teardown"]; diff --git a/Assets/Adjust/iOS/AdjustUnity.mm b/Assets/Adjust/iOS/AdjustUnity.mm index 81764d50..0886c422 100644 --- a/Assets/Adjust/iOS/AdjustUnity.mm +++ b/Assets/Adjust/iOS/AdjustUnity.mm @@ -395,7 +395,8 @@ void _AdjustSetTestOptions(const char* baseUrl, long sessionIntervalInMilliseconds, long subsessionIntervalInMilliseconds, int teardown, - int deleteState) { + int deleteState, + int noBackoffWait) { AdjustTestOptions *testOptions = [[AdjustTestOptions alloc] init]; NSString *stringBaseUrl = isStringValid(baseUrl) == true ? [NSString stringWithUTF8String:baseUrl] : nil; @@ -430,6 +431,9 @@ void _AdjustSetTestOptions(const char* baseUrl, if (deleteState != -1) { [testOptions setDeleteState:(BOOL)deleteState]; } + if (noBackoffWait != -1) { + [testOptions setNoBackoffWait:(BOOL)noBackoffWait]; + } [Adjust setTestOptions:testOptions]; } diff --git a/Assets/Adjust/iOS/AdjustiOS.cs b/Assets/Adjust/iOS/AdjustiOS.cs index de9de81d..cee4b3b5 100644 --- a/Assets/Adjust/iOS/AdjustiOS.cs +++ b/Assets/Adjust/iOS/AdjustiOS.cs @@ -109,7 +109,8 @@ private static extern void _AdjustSetTestOptions( long sessionIntervalInMilliseconds, long subsessionIntervalInMilliseconds, int teardown, - int deleteState); + int deleteState, + int noBackoffWait); [DllImport("__Internal")] private static extern void _AdjustTrackSubsessionStart(); @@ -287,6 +288,7 @@ public static void SetTestOptions(AdjustTestOptions testOptions) long subsessionIntMls = testOptions.SubsessionIntervalInMilliseconds.HasValue ? testOptions.SubsessionIntervalInMilliseconds.Value : -1; bool teardown = testOptions.Teardown.HasValue ? testOptions.Teardown.Value : false; bool deleteState = testOptions.DeleteState.HasValue ? testOptions.DeleteState.Value : false; + bool noBackoffWait = testOptions.NoBackoffWait.HasValue ? testOptions.NoBackoffWait.Value : false; _AdjustSetTestOptions( testOptions.BaseUrl, @@ -298,7 +300,8 @@ public static void SetTestOptions(AdjustTestOptions testOptions) sessionIntMls, subsessionIntMls, AdjustUtils.ConvertBool(teardown), - AdjustUtils.ConvertBool(deleteState)); + AdjustUtils.ConvertBool(deleteState), + AdjustUtils.ConvertBool(noBackoffWait)); } public static void TrackSubsessionStart()