public AppState( Service neonDashboardService, IHttpContextAccessor httpContextAccessor, INeonLogger neonLogger, IJSRuntime jSRuntime, NavigationManager navigationManager, IWebHostEnvironment webHostEnv, IAnalytics analytics, ILocalStorageService localStorage, IDistributedCache cache) { this.NeonDashboardService = neonDashboardService; this.NavigationManager = navigationManager; this.Logger = neonLogger; this.JSRuntime = jSRuntime; this.HttpContextAccessor = httpContextAccessor; this.WebHostEnvironment = webHostEnv; this.Analytics = analytics; this.LocalStorage = localStorage; this.DistributedCache = cache; this.Kube = new __Kube(this); this.Metrics = new __Metrics(this); this.Cache = new __Cache(this); if (NeonDashboardService.DoNotTrack) { Analytics.Disable(); } if (DashboardFrames == null || DashboardFrames.Count == 0) { DashboardFrames = new List <Dashboard>(); if (string.IsNullOrEmpty(UserId)) { if (HttpContextAccessor.HttpContext.User.HasClaim(c => c.Type == ClaimTypes.NameIdentifier)) { UserId = HttpContextAccessor.HttpContext.User.Claims.Where(c => c.Type == ClaimTypes.NameIdentifier).First().Value; var traits = new Dictionary <string, object>() { { "Name", UserId }, { "Email", HttpContextAccessor.HttpContext.User.Claims.Where(c => c.Type == ClaimTypes.Email).First().Value } }; if (!HttpContextAccessor.HttpContext.WebSockets.IsWebSocketRequest) { Segment.Analytics.Client.Identify(UserId, traits); } } } } }