private void InitI(IActivityHandler activityHandler, IDeviceUtil deviceUtil, bool startPaused) { ReadPackageQueueI(); _internalWaitHandle = new ManualResetEvent(true); // door starts open (signaled) _requestHandler = AdjustFactory.GetRequestHandler(SendNextPackage, CloseFirstPackage); }
internal static HttpClient BuildHttpClient(string clientSdk) { var httpClient = new HttpClient(AdjustFactory.GetHttpMessageHandler()); httpClient.Timeout = new TimeSpan(0, 1, 0); httpClient.DefaultRequestHeaders.Add("Client-SDK", clientSdk); return(httpClient); }
private void InitInternal(IActivityHandler activityHandler, bool startPaused) { Init(activityHandler, startPaused); ReadPackageQueue(); InternalWaitHandle = new ManualResetEvent(true); // door starts open (signaled) RequestHandler = AdjustFactory.GetRequestHandler(this); }
private void InitInternal(AdjustConfig adjustConfig, DeviceUtil deviceUtil) { Init(adjustConfig, deviceUtil); DeviceInfo = DeviceUtil.GetDeviceInfo(); DeviceInfo.SdkPrefix = adjustConfig.SdkPrefix; TimerInterval = AdjustFactory.GetTimerInterval(); TimerStart = AdjustFactory.GetTimerStart(); SessionInterval = AdjustFactory.GetSessionInterval(); SubsessionInterval = AdjustFactory.GetSubsessionInterval(); if (AdjustConfig.Environment.Equals(AdjustConfig.EnvironmentProduction)) { // suppress all logs in production Logger.LogLevel = LogLevel.Suppress; } if (AdjustConfig.EventBufferingEnabled) { Logger.Info("Event buffering is enabled"); } if (AdjustConfig.DefaultTracker != null) { Logger.Info("Default tracker: '{0}'", AdjustConfig.DefaultTracker); } ReadAttribution(); ReadActivityState(); PackageHandler = AdjustFactory.GetPackageHandler(this, Paused()); var attributionPackage = GetAttributionPackage(); AttributionHandler = AdjustFactory.GetAttributionHandler(this, attributionPackage, Paused(), AdjustConfig.HasDelegate); Timer = new TimerCycle(InternalQueue, TimerFiredInternal, timeInterval: TimerInterval, timeStart: TimerStart); StartInternal(); }
public void SetTestOptions(IntegrationTesting.AdjustTestOptions testOptions) { if (testOptions.BasePath != null) { _basePath = testOptions.BasePath; } if (testOptions.GdprPath != null) { _gdprPath = testOptions.GdprPath; } if (testOptions.BaseUrl != null) { AdjustFactory.BaseUrl = testOptions.BaseUrl; } if (testOptions.GdprUrl != null) { AdjustFactory.GdprUrl = testOptions.GdprUrl; } if (testOptions.TimerIntervalInMilliseconds.HasValue) { var intervalMillis = testOptions.TimerIntervalInMilliseconds.Value; if (intervalMillis == -1) { AdjustFactory.SetTimerInterval(TimeSpan.FromMinutes(1)); } else { AdjustFactory.SetTimerInterval(TimeSpan.FromMilliseconds(intervalMillis)); } } if (testOptions.TimerStartInMilliseconds.HasValue) { var timerStartMillis = testOptions.TimerStartInMilliseconds.Value; if (timerStartMillis == -1) { AdjustFactory.SetTimerStart(TimeSpan.FromMinutes(1)); } else { AdjustFactory.SetTimerStart(TimeSpan.FromMilliseconds(timerStartMillis)); } } if (testOptions.SessionIntervalInMilliseconds.HasValue) { var sessionIntervalMillis = testOptions.SessionIntervalInMilliseconds.Value; if (sessionIntervalMillis == -1) { AdjustFactory.SetSessionInterval(TimeSpan.FromMinutes(30)); } else { AdjustFactory.SetSessionInterval(TimeSpan.FromMilliseconds(sessionIntervalMillis)); } } if (testOptions.SubsessionIntervalInMilliseconds.HasValue) { var subSessionIntervalMillis = testOptions.SubsessionIntervalInMilliseconds.Value; if (subSessionIntervalMillis == -1) { AdjustFactory.SetSubsessionInterval(TimeSpan.FromSeconds(1)); } else { AdjustFactory.SetSubsessionInterval(TimeSpan.FromMilliseconds(subSessionIntervalMillis)); } } if (testOptions.NoBackoffWait.HasValue && testOptions.NoBackoffWait.Value) { AdjustFactory.SetPackageHandlerBackoffStrategy(BackoffStrategy.NoWait); AdjustFactory.SetSdkClickHandlerBackoffStrategy(BackoffStrategy.NoWait); } }