< Summary

Class:MainScripts.DCL.Controllers.HUD.TaskbarHUD.ReportBugButton
Assembly:TaskbarHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/TaskbarHUD/ReportBugButton.cs
Covered lines:1
Uncovered lines:18
Coverable lines:19
Total lines:92
Line coverage:5.2% (1 of 19)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%110100%
ReportBug()0%12300%
GetLabels()0%2100%
GetOSInfo()0%2100%
GetCPUInfo()0%2100%
GetMemoryInfo()0%2100%
GetGraphicsCardInfo()0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/TaskbarHUD/ReportBugButton.cs

#LineLine coverage
 1using DCL;
 2using DCL.Interface;
 3using MainScripts.DCL.WebPlugin;
 4using UnityEngine;
 5using UnityEngine.Networking;
 6using UnityEngine.UI;
 7
 8namespace MainScripts.DCL.Controllers.HUD.TaskbarHUD
 9{
 10    public class ReportBugButton : MonoBehaviour
 11    {
 12#if UNITY_WEBGL
 13        private const string ReportBugURL = "https://github.com/decentraland/issues/issues/new?assignees=&labels=new%2Ce
 14#else
 15        private const string ReportBugURL = "https://github.com/decentraland/explorer-desktop/issues/new?assignees=&labe
 16#endif
 17
 18        [SerializeField] private Button button;
 19
 420        private void Awake() { button.onClick.AddListener(ReportBug); }
 21
 22        private void ReportBug()
 23        {
 024            var userProfile = UserProfile.GetOwnUserProfile();
 025            var nametag = UnityWebRequest.EscapeURL(userProfile.userName);
 026            var kernelConfig = KernelConfig.i.Get();
 027            var realm = DataStore.i.realm.playerRealm.Get()?.serverName;
 028            var unityVersion = kernelConfig.rendererVersion;
 029            var kernelVersion = kernelConfig.kernelVersion;
 30
 031            var os = UnityWebRequest.EscapeURL(GetOSInfo());
 032            var cpu = UnityWebRequest.EscapeURL(GetCPUInfo());
 033            var ram = UnityWebRequest.EscapeURL(GetMemoryInfo());
 034            var gpu = UnityWebRequest.EscapeURL(GetGraphicsCardInfo());
 35
 036            string url = $"{ReportBugURL}" +
 37                         $"&unity={unityVersion}" +
 38                         $"&kernel={kernelVersion}" +
 39                         $"&os={os}" +
 40                         $"&cpu={cpu}" +
 41                         $"&ram={ram}" +
 42                         $"&gpu={gpu}" +
 43                         $"&nametag={nametag}" +
 44                         $"&realm={realm}" +
 45                         $"&labels={GetLabels()}";
 46
 047            WebInterface.OpenURL(url);
 048        }
 49
 50        private string GetLabels()
 51        {
 52#if UNITY_WEBGL
 53            return "explorer,new";
 54#else
 055            return "new";
 56#endif
 57        }
 58
 59        private string GetOSInfo()
 60        {
 61#if UNITY_WEBGL
 62            return WebGLPlugin.GetUserAgent();
 63#else
 064            return SystemInfo.operatingSystem;
 65#endif
 66        }
 67
 68        private string GetCPUInfo()
 69        {
 70#if UNITY_WEBGL
 71            return "";
 72#else
 073            return SystemInfo.processorType;
 74#endif
 75        }
 76
 77        private string GetMemoryInfo()
 78        {
 79#if UNITY_WEBGL
 80            return "";
 81#else
 082            return $"{SystemInfo.systemMemorySize}MB";
 83#endif
 84        }
 85
 86        private string GetGraphicsCardInfo()
 87        {
 088            return $"{SystemInfo.graphicsDeviceName} " +
 89                   $"{SystemInfo.graphicsMemorySize}MB";
 90        }
 91    }
 92}