< Summary

Class:ExploreV2Analytics.ExploreV2Analytics
Assembly:ExploreV2Analytics
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Analytics/ExploreV2Analytics/ExploreV2Analytics.cs
Covered lines:0
Uncovered lines:44
Coverable lines:44
Total lines:106
Line coverage:0% (0 of 44)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
SendStartMenuVisibility(...)0%12300%
SendStartMenuSectionVisibility(...)0%12300%
SendEventTeleport(...)0%2100%
SendClickOnEventInfo(...)0%2100%
SendPlaceTeleport(...)0%2100%
SendClickOnPlaceInfo(...)0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Analytics/ExploreV2Analytics/ExploreV2Analytics.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using UnityEngine;
 4
 5namespace ExploreV2Analytics
 6{
 7    public interface IExploreV2Analytics
 8    {
 9        void SendStartMenuVisibility(bool isVisible, ExploreUIVisibilityMethod method);
 10        void SendStartMenuSectionVisibility(ExploreSection section, bool isVisible);
 11        void SendEventTeleport(string eventId, string eventName, Vector2Int coords);
 12        void SendClickOnEventInfo(string eventId, string eventName);
 13        void SendPlaceTeleport(string placeId, string placeName, Vector2Int coords);
 14        void SendClickOnPlaceInfo(string placeId, string placeName);
 15
 16    }
 17
 18    public class ExploreV2Analytics : IExploreV2Analytics
 19    {
 20        private const string START_MENU_VIBILILITY = "start_menu_visibility";
 21        private const string START_MENU_SECTION_VISIBILITY = "start_menu_section_visibility";
 22        private const string EXPLORE_EVENT_TELEPORT = "explore_event_teleport";
 23        private const string EXPLORE_CLICK_EVENT_INFO = "explore_click_event_info";
 24        private const string EXPLORE_PLACE_TELEPORT = "explore_place_teleport";
 25        private const string EXPLORE_CLICK_PLACE_INFO = "explore_click_place_info";
 26
 27        private static DateTime? exploreMainMenuSetVisibleTimeStamp = null;
 28        private static DateTime? exploreSectionSetVisibleTimeStamp = null;
 29
 30        public void SendStartMenuVisibility(bool isVisible, ExploreUIVisibilityMethod method)
 31        {
 032            Dictionary<string, string> data = new Dictionary<string, string>();
 033            data.Add("visible", isVisible.ToString());
 034            data.Add("method", method.ToString());
 35
 036            if (isVisible)
 037                exploreMainMenuSetVisibleTimeStamp = DateTime.Now;
 38            else
 39            {
 040                if (exploreMainMenuSetVisibleTimeStamp.HasValue)
 41                {
 042                    data.Add("open_duration_ms", (DateTime.Now - exploreMainMenuSetVisibleTimeStamp.Value).TotalMillisec
 043                    exploreMainMenuSetVisibleTimeStamp = null;
 44                }
 45            }
 46
 047            GenericAnalytics.SendAnalytic(START_MENU_VIBILILITY, data);
 048        }
 49
 50        public void SendStartMenuSectionVisibility(ExploreSection section, bool isVisible)
 51        {
 052            Dictionary<string, string> data = new Dictionary<string, string>();
 053            data.Add("section", section.ToString());
 054            data.Add("visible", isVisible.ToString());
 55
 056            if (isVisible)
 057                exploreSectionSetVisibleTimeStamp = DateTime.Now;
 58            else
 59            {
 060                if (exploreSectionSetVisibleTimeStamp.HasValue)
 61                {
 062                    data.Add("open_duration_ms", (DateTime.Now - exploreSectionSetVisibleTimeStamp.Value).TotalMilliseco
 063                    exploreSectionSetVisibleTimeStamp = null;
 64                }
 65            }
 66
 067            GenericAnalytics.SendAnalytic(START_MENU_SECTION_VISIBILITY, data);
 068        }
 69
 70        public void SendEventTeleport(string eventId, string eventName, Vector2Int coords)
 71        {
 072            Dictionary<string, string> data = new Dictionary<string, string>();
 073            data.Add("event_id", eventId);
 074            data.Add("event_name", eventName);
 075            data.Add("event_coords_x", coords.x.ToString());
 076            data.Add("event_coords_y", coords.y.ToString());
 077            GenericAnalytics.SendAnalytic(EXPLORE_EVENT_TELEPORT, data);
 078        }
 79
 80        public void SendClickOnEventInfo(string eventId, string eventName)
 81        {
 082            Dictionary<string, string> data = new Dictionary<string, string>();
 083            data.Add("event_id", eventId);
 084            data.Add("event_name", eventName);
 085            GenericAnalytics.SendAnalytic(EXPLORE_CLICK_EVENT_INFO, data);
 086        }
 87
 88        public void SendPlaceTeleport(string placeId, string placeName, Vector2Int coords)
 89        {
 090            Dictionary<string, string> data = new Dictionary<string, string>();
 091            data.Add("place_id", placeId);
 092            data.Add("place_name", placeName);
 093            data.Add("place_coords_x", coords.x.ToString());
 094            data.Add("place_coords_y", coords.y.ToString());
 095            GenericAnalytics.SendAnalytic(EXPLORE_PLACE_TELEPORT, data);
 096        }
 97
 98        public void SendClickOnPlaceInfo(string placeId, string placeName)
 99        {
 0100            Dictionary<string, string> data = new Dictionary<string, string>();
 0101            data.Add("event_id", placeId);
 0102            data.Add("event_name", placeName);
 0103            GenericAnalytics.SendAnalytic(EXPLORE_CLICK_PLACE_INFO, data);
 0104        }
 105    }
 106}