2
2
using System ;
3
3
using System . Collections ;
4
4
using System . Collections . Generic ;
5
+ using System . Reflection ;
5
6
using UnityEngine ;
6
7
7
8
#if UNITY_WSA_10_0
@@ -16,7 +17,7 @@ namespace com.adjust.sdk
16
17
{
17
18
public class AdjustWindows
18
19
{
19
- private const string sdkPrefix = "unity4.17.1 " ;
20
+ private const string sdkPrefix = "unity4.17.2 " ;
20
21
private static bool appLaunched = false ;
21
22
22
23
public static void Start ( AdjustConfig adjustConfig )
@@ -270,50 +271,69 @@ public static void SetTestOptions(Dictionary<string, string> testOptions)
270
271
bool deleteState = false ;
271
272
bool noBackoffWait = false ;
272
273
273
- if ( testOptions . ContainsKey ( AdjustUtils . KeyTestOptionsTimerIntervalInMilliseconds ) )
274
+ if ( testOptions . ContainsKey ( AdjustUtils . KeyTestOptionsTimerIntervalInMilliseconds ) )
274
275
{
275
- timerIntervalMls = long . Parse ( testOptions [ AdjustUtils . KeyTestOptionsTimerIntervalInMilliseconds ] ) ;
276
+ timerIntervalMls = long . Parse ( testOptions [ AdjustUtils . KeyTestOptionsTimerIntervalInMilliseconds ] ) ;
276
277
}
277
- if ( testOptions . ContainsKey ( AdjustUtils . KeyTestOptionsTimerStartInMilliseconds ) )
278
+ if ( testOptions . ContainsKey ( AdjustUtils . KeyTestOptionsTimerStartInMilliseconds ) )
278
279
{
279
- timerStartMls = long . Parse ( testOptions [ AdjustUtils . KeyTestOptionsTimerStartInMilliseconds ] ) ;
280
+ timerStartMls = long . Parse ( testOptions [ AdjustUtils . KeyTestOptionsTimerStartInMilliseconds ] ) ;
280
281
}
281
- if ( testOptions . ContainsKey ( AdjustUtils . KeyTestOptionsSessionIntervalInMilliseconds ) )
282
+ if ( testOptions . ContainsKey ( AdjustUtils . KeyTestOptionsSessionIntervalInMilliseconds ) )
282
283
{
283
- sessionIntMls = long . Parse ( testOptions [ AdjustUtils . KeyTestOptionsSessionIntervalInMilliseconds ] ) ;
284
+ sessionIntMls = long . Parse ( testOptions [ AdjustUtils . KeyTestOptionsSessionIntervalInMilliseconds ] ) ;
284
285
}
285
- if ( testOptions . ContainsKey ( AdjustUtils . KeyTestOptionsSubsessionIntervalInMilliseconds ) )
286
+ if ( testOptions . ContainsKey ( AdjustUtils . KeyTestOptionsSubsessionIntervalInMilliseconds ) )
286
287
{
287
- subsessionIntMls = long . Parse ( testOptions [ AdjustUtils . KeyTestOptionsSubsessionIntervalInMilliseconds ] ) ;
288
+ subsessionIntMls = long . Parse ( testOptions [ AdjustUtils . KeyTestOptionsSubsessionIntervalInMilliseconds ] ) ;
288
289
}
289
- if ( testOptions . ContainsKey ( AdjustUtils . KeyTestOptionsTeardown ) )
290
+ if ( testOptions . ContainsKey ( AdjustUtils . KeyTestOptionsTeardown ) )
290
291
{
291
- teardown = testOptions [ AdjustUtils . KeyTestOptionsTeardown ] . ToLower ( ) == "true" ;
292
+ teardown = testOptions [ AdjustUtils . KeyTestOptionsTeardown ] . ToLower ( ) == "true" ;
292
293
}
293
- if ( testOptions . ContainsKey ( AdjustUtils . KeyTestOptionsDeleteState ) )
294
+ if ( testOptions . ContainsKey ( AdjustUtils . KeyTestOptionsDeleteState ) )
294
295
{
295
- deleteState = testOptions [ AdjustUtils . KeyTestOptionsDeleteState ] . ToLower ( ) == "true" ;
296
+ deleteState = testOptions [ AdjustUtils . KeyTestOptionsDeleteState ] . ToLower ( ) == "true" ;
296
297
}
297
- if ( testOptions . ContainsKey ( AdjustUtils . KeyTestOptionsNoBackoffWait ) )
298
+ if ( testOptions . ContainsKey ( AdjustUtils . KeyTestOptionsNoBackoffWait ) )
298
299
{
299
- noBackoffWait = testOptions [ AdjustUtils . KeyTestOptionsNoBackoffWait ] . ToLower ( ) == "true" ;
300
+ noBackoffWait = testOptions [ AdjustUtils . KeyTestOptionsNoBackoffWait ] . ToLower ( ) == "true" ;
300
301
}
301
302
302
- TestLibraryInterface . TestLibraryInterface . SetTestOptions (
303
- new TestLibraryInterface . AdjustTestOptionsDto
304
- {
305
- BaseUrl = testOptions [ AdjustUtils . KeyTestOptionsBaseUrl ] ,
306
- GdprUrl = testOptions [ AdjustUtils . KeyTestOptionsGdprUrl ] ,
307
- BasePath = basePath ,
308
- GdprPath = gdprPath ,
309
- SessionIntervalInMilliseconds = sessionIntMls ,
310
- SubsessionIntervalInMilliseconds = subsessionIntMls ,
311
- TimerIntervalInMilliseconds = timerIntervalMls ,
312
- TimerStartInMilliseconds = timerStartMls ,
313
- DeleteState = deleteState ,
314
- Teardown = teardown ,
315
- NoBackoffWait = noBackoffWait
316
- } ) ;
303
+ Type testLibInterfaceType = Type . GetType ( "TestLibraryInterface.TestLibraryInterface, TestLibraryInterface" ) ;
304
+ Type adjustTestOptionsDtoType = Type . GetType ( "TestLibraryInterface.AdjustTestOptionsDto, TestLibraryInterface" ) ;
305
+ if ( testLibInterfaceType == null || adjustTestOptionsDtoType == null )
306
+ {
307
+ return ;
308
+ }
309
+
310
+ PropertyInfo baseUrlInfo = adjustTestOptionsDtoType . GetProperty ( "BaseUrl" ) ;
311
+ PropertyInfo gdprUrlInfo = adjustTestOptionsDtoType . GetProperty ( "GdprUrl" ) ;
312
+ PropertyInfo basePathInfo = adjustTestOptionsDtoType . GetProperty ( "BasePath" ) ;
313
+ PropertyInfo gdprPathInfo = adjustTestOptionsDtoType . GetProperty ( "GdprPath" ) ;
314
+ PropertyInfo sessionIntervalInMillisecondsInfo = adjustTestOptionsDtoType . GetProperty ( "SessionIntervalInMilliseconds" ) ;
315
+ PropertyInfo subsessionIntervalInMillisecondsInfo = adjustTestOptionsDtoType . GetProperty ( "SubsessionIntervalInMilliseconds" ) ;
316
+ PropertyInfo timerIntervalInMillisecondsInfo = adjustTestOptionsDtoType . GetProperty ( "TimerIntervalInMilliseconds" ) ;
317
+ PropertyInfo timerStartInMillisecondsInfo = adjustTestOptionsDtoType . GetProperty ( "TimerStartInMilliseconds" ) ;
318
+ PropertyInfo deleteStateInfo = adjustTestOptionsDtoType . GetProperty ( "DeleteState" ) ;
319
+ PropertyInfo teardownInfo = adjustTestOptionsDtoType . GetProperty ( "Teardown" ) ;
320
+ PropertyInfo noBackoffWaitInfo = adjustTestOptionsDtoType . GetProperty ( "NoBackoffWait" ) ;
321
+
322
+ object adjustTestOptionsDtoInstance = Activator . CreateInstance ( adjustTestOptionsDtoType ) ;
323
+ baseUrlInfo . SetValue ( adjustTestOptionsDtoInstance , testOptions [ AdjustUtils . KeyTestOptionsBaseUrl ] , null ) ;
324
+ gdprUrlInfo . SetValue ( adjustTestOptionsDtoInstance , testOptions [ AdjustUtils . KeyTestOptionsGdprUrl ] , null ) ;
325
+ basePathInfo . SetValue ( adjustTestOptionsDtoInstance , basePath , null ) ;
326
+ gdprPathInfo . SetValue ( adjustTestOptionsDtoInstance , gdprPath , null ) ;
327
+ sessionIntervalInMillisecondsInfo . SetValue ( adjustTestOptionsDtoInstance , sessionIntMls , null ) ;
328
+ subsessionIntervalInMillisecondsInfo . SetValue ( adjustTestOptionsDtoInstance , subsessionIntMls , null ) ;
329
+ timerIntervalInMillisecondsInfo . SetValue ( adjustTestOptionsDtoInstance , timerIntervalMls , null ) ;
330
+ timerStartInMillisecondsInfo . SetValue ( adjustTestOptionsDtoInstance , timerStartMls , null ) ;
331
+ deleteStateInfo . SetValue ( adjustTestOptionsDtoInstance , deleteState , null ) ;
332
+ teardownInfo . SetValue ( adjustTestOptionsDtoInstance , teardown , null ) ;
333
+ noBackoffWaitInfo . SetValue ( adjustTestOptionsDtoInstance , noBackoffWait , null ) ;
334
+
335
+ MethodInfo setTestOptionsMethodInfo = testLibInterfaceType . GetMethod ( "SetTestOptions" ) ;
336
+ setTestOptionsMethodInfo . Invoke ( null , new object [ ] { adjustTestOptionsDtoInstance } ) ;
317
337
}
318
338
}
319
339
}
0 commit comments