public void Add(string section, object newValue) { if (NativeClient != null) { if (newValue is Dictionary <string, string> stringValues) { base.Add(section, stringValues); NativeClient.SetMetadata(section, stringValues); } else if (newValue is Dictionary <string, object> objectValues) { var target = new Dictionary <string, string>(); foreach (var pair in objectValues) { target.Add(pair.Key, pair.Value.ToString()); } base.Add(section, target); NativeClient.SetMetadata(section, target); } } else { base.Add(section, newValue); } }
public Client(INativeClient nativeClient) { MainThread = Thread.CurrentThread; ForegroundStopwatch = new Stopwatch(); BackgroundStopwatch = new Stopwatch(); NativeClient = nativeClient; User = new User { Id = SystemInfo.deviceUniqueIdentifier }; Middleware = new List <Middleware>(); Metadata = new Metadata(nativeClient); UniqueCounter = new UniqueLogThrottle(Configuration); LogTypeCounter = new MaximumLogTypeCounter(Configuration); SessionTracking = new SessionTracker(this); UnityMetadata.InitDefaultMetadata(); Device.InitUnityVersion(); NativeClient.SetMetadata(UnityMetadataKey, UnityMetadata.ForNativeClient()); NativeClient.PopulateUser(User); SceneManager.sceneLoaded += SceneLoaded; Application.logMessageReceivedThreaded += MultiThreadedNotify; Application.logMessageReceived += Notify; User.PropertyChanged += (obj, args) => { NativeClient.SetUser(User); }; TimingTrackerObject = new GameObject("Bugsnag app lifecycle tracker"); TimingTrackerObject.AddComponent <TimingTrackerBehaviour>(); // Run initial session check in next frame to allow potential configuration // changes to be completed first. try { var asyncHandler = MainThreadDispatchBehaviour.Instance(); asyncHandler.Enqueue(RunInitialSessionCheck()); } catch (System.Exception ex) { // Async behavior is not available in a test environment } }
public Client(INativeClient nativeClient) { Stopwatch = new Stopwatch(); NativeClient = nativeClient; User = new User { Id = SystemInfo.deviceUniqueIdentifier }; Middleware = new List <Middleware>(); Metadata = new Metadata(); UniqueCounter = new UniqueLogThrottle(Configuration); LogTypeCounter = new MaximumLogTypeCounter(Configuration); SessionTracking = new SessionTracker(this); NativeClient.SetMetadata(UnityMetadataKey, UnityMetadata.ForNativeClient()); NativeClient.PopulateUser(User); SceneManager.sceneLoaded += SceneLoaded; Application.logMessageReceivedThreaded += Notify; }