private void SetUserInfo(RaygunIdentifierMessage userInfo) { if (_activeBatch != null) { // Each batch is tied to the UserInfo at the time it's created. // So when the user info changes, we end any current batch, so the next one can pick up the new user info. _activeBatch.Done(); } if (string.IsNullOrWhiteSpace(userInfo?.Identifier) || string.IsNullOrEmpty(userInfo.Identifier)) { userInfo = GetAnonymousUserInfo(); } // Has the user changed ? if (_userInfo != null && _userInfo.Identifier != userInfo.Identifier && _userInfo.IsAnonymous == false) { if (!string.IsNullOrEmpty(_sessionId)) { SendPulseSessionEventNow(RaygunPulseSessionEventType.SessionEnd); _userInfo = userInfo; _user = userInfo.Identifier; SendPulseSessionEventNow(RaygunPulseSessionEventType.SessionStart); } } else { _userInfo = userInfo; _user = userInfo.Identifier; } }
internal void SetUserInfo(RaygunIdentifierMessage userInfo) { if (_activeBatch != null) { // Each batch is tied to the UserInfo at the time it's created. // So when the user info changes, we end any current batch, so the next one can pick up the new user info. _activeBatch.Done(); } // Check info is valid if (string.IsNullOrWhiteSpace(userInfo?.Identifier) || string.IsNullOrEmpty(userInfo.Identifier)) { userInfo = GetAnonymousUserInfo(); } // Has the user changed ? if (_userInfo != null && _userInfo.Identifier != userInfo.Identifier && _userInfo.IsAnonymous == false) { if (!string.IsNullOrEmpty(_sessionId)) { SendPulseSessionEventNow(RaygunPulseSessionEventType.SessionEnd); _userInfo = userInfo; _user = userInfo.Identifier; SendPulseSessionEventNow(RaygunPulseSessionEventType.SessionStart); } } else { _userInfo = userInfo; _user = userInfo.Identifier; } // Pass on the info to the native Raygun reporter. if (NativeClient != null) { var info = new NativeRaygunUserInfo(); info.Identifier = _userInfo.Identifier; info.IsAnonymous = _userInfo.IsAnonymous; info.Email = _userInfo.Email; info.FullName = _userInfo.FullName; info.FirstName = _userInfo.FirstName; NativeClient.UserInformation = info; } }