public void InvalidateDeviceCache() { using (_mutex.GetLock()) { _device = null; } }
public virtual async Task <Ingestion.Models.Device> GetDeviceInformationAsync() { var device = new Ingestion.Models.Device { SdkName = GetSdkName(), SdkVersion = GetSdkVersion(), Model = GetDeviceModel(), OemName = GetDeviceOemName(), OsName = GetOsName(), OsVersion = GetOsVersion(), Locale = GetLocale(), TimeZoneOffset = GetTimeZoneOffset(), ScreenSize = GetScreenSize(), AppVersion = GetAppVersion(), AppBuild = GetAppBuild(), WrapperSdkVersion = GetWrapperSdkVersion(), WrapperSdkName = GetWrapperSdkName(), OsBuild = GetOsBuild(), OsApiLevel = GetOsApiLevel(), CarrierName = GetCarrierName(), CarrierCountry = GetCarrierCountry(), AppNamespace = GetAppNamespace(), LiveUpdateReleaseLabel = GetLiveUpdateReleaseLabel(), LiveUpdateDeploymentKey = GetLiveUpdateDevelopmentKey(), LiveUpdatePackageHash = GetLiveUpdatePackageHash() }; return(await Task <Ingestion.Models.Device> .Factory.StartNew(() => device).ConfigureAwait(false)); }
private async Task PrepareLogAsync(Log log) { if (log.Device == null && _device == null) { _device = await _deviceInfoHelper.GetDeviceInformationAsync().ConfigureAwait(false); } log.Device = log.Device ?? _device; if (log.Toffset == 0L) { log.Toffset = TimeHelper.CurrentTimeInMilliseconds(); } }
private async Task PrepareLogAsync(Log log, State state) { if (log.Device == null && _device == null) { var device = await _deviceInfoHelper.GetDeviceInformationAsync().ConfigureAwait(false); using (await _mutex.GetLockAsync(state).ConfigureAwait(false)) { _device = device; } } log.Device = log.Device ?? _device; log.Timestamp = log.Timestamp ?? DateTime.Now; }
/// <summary> /// Creates a public device model from an ingestion device model. /// </summary> /// <param name="device">The ingestion device model.</param> public Device(Ingestion.Models.Device device) { SdkName = device.SdkName; SdkVersion = device.SdkVersion; Model = device.Model; OemName = device.OemName; OsName = device.OsName; OsVersion = device.OsVersion; OsBuild = device.OsBuild; OsApiLevel = device.OsApiLevel; Locale = device.Locale; TimeZoneOffset = device.TimeZoneOffset; ScreenSize = device.ScreenSize; AppVersion = device.AppVersion; CarrierName = device.CarrierName; CarrierCountry = device.CarrierCountry; AppBuild = device.AppBuild; AppNamespace = device.AppNamespace; }
public void InvalidateDeviceCache() { _mutex.Lock(); _device = null; _mutex.Unlock(); }