< Summary

Class:DCLPlugins.SentryPlugin.SentryController
Assembly:DCL.Plugins.SentryPlugin
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/SentryPlugin/SentryController.cs
Covered lines:0
Uncovered lines:33
Coverable lines:33
Total lines:68
Line coverage:0% (0 of 33)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
SentryController(...)0%2100%
RealmNameOnOnChange(...)0%2100%
LastTeleportPositionOnOnChange(...)0%2100%
OtherPlayersOnChanged(...)0%2100%
PlayerGridPositionOnOnChange(...)0%2100%
Dispose()0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/SentryPlugin/SentryController.cs

#LineLine coverage
 1using DCL;
 2using Sentry;
 3using System;
 4using UnityEngine;
 5
 6namespace DCLPlugins.SentryPlugin
 7{
 8    public class SentryController : IDisposable
 9    {
 10        private readonly DataStore_Player playerStore;
 11        private readonly DataStore_Realm realmStore;
 12        private readonly IHub sentryHub;
 13
 014        public SentryController(DataStore_Player playerStore, DataStore_Realm realmStore, IHub sentryHub)
 15        {
 016            this.playerStore = playerStore;
 017            this.realmStore = realmStore;
 018            this.sentryHub = sentryHub;
 19
 020            this.playerStore.playerGridPosition.OnChange += PlayerGridPositionOnOnChange;
 021            this.playerStore.otherPlayers.OnAdded += OtherPlayersOnChanged;
 022            this.playerStore.otherPlayers.OnRemoved += OtherPlayersOnChanged;
 023            this.playerStore.lastTeleportPosition.OnChange += LastTeleportPositionOnOnChange;
 024            this.realmStore.realmName.OnChange += RealmNameOnOnChange;
 025        }
 26
 27        private void RealmNameOnOnChange(string current, string previous)
 28        {
 029            sentryHub.ConfigureScope(scope =>
 30            {
 031                scope.SetTag("Current Realm", current);
 032                scope.SetTag("Previous Realm", previous);
 033            });
 034        }
 35
 36        private void LastTeleportPositionOnOnChange(Vector3 current, Vector3 previous)
 37        {
 038            sentryHub.ConfigureScope(scope =>
 39            {
 040                scope.Contexts["Current Teleport Position"] = $"{current.x},{current.y}";
 041                scope.Contexts["Last Teleport Position"] = $"{previous.x},{previous.y}";
 042            });
 043        }
 44
 45        private void OtherPlayersOnChanged(string _, Player __)
 46        {
 047            sentryHub.ConfigureScope(scope => { scope.Contexts["Total Other Players"] = $"{playerStore.otherPlayers.Coun
 048        }
 49
 50        private void PlayerGridPositionOnOnChange(Vector2Int current, Vector2Int previous)
 51        {
 052            sentryHub.ConfigureScope(scope =>
 53            {
 054                scope.SetTag("Current Position", $"{current.x},{current.y}");
 055                scope.SetTag("Previous Position", $"{previous.x},{previous.y}");
 056            });
 057        }
 58
 59        public void Dispose()
 60        {
 061            playerStore.playerGridPosition.OnChange -= PlayerGridPositionOnOnChange;
 062            playerStore.otherPlayers.OnAdded -= OtherPlayersOnChanged;
 063            playerStore.otherPlayers.OnRemoved -= OtherPlayersOnChanged;
 064            playerStore.lastTeleportPosition.OnChange -= LastTeleportPositionOnOnChange;
 065            realmStore.realmName.OnChange -= RealmNameOnOnChange;
 066        }
 67    }
 68}