< 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:89
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%2100%
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
 13        private const string ReportBugURL = "https://github.com/decentraland/issues/issues/new?assignees=&labels=new%2Ce
 14
 15        [SerializeField] private Button button;
 16
 417        private void Awake() { button.onClick.AddListener(ReportBug); }
 18
 19        private void ReportBug()
 20        {
 021            var userProfile = UserProfile.GetOwnUserProfile();
 022            var nametag = UnityWebRequest.EscapeURL(userProfile.userName);
 023            var kernelConfig = KernelConfig.i.Get();
 024            var realm = DataStore.i.realm.realmName.Get();
 025            var unityVersion = kernelConfig.rendererVersion;
 026            var kernelVersion = kernelConfig.kernelVersion;
 27
 028            var os = UnityWebRequest.EscapeURL(GetOSInfo());
 029            var cpu = UnityWebRequest.EscapeURL(GetCPUInfo());
 030            var ram = UnityWebRequest.EscapeURL(GetMemoryInfo());
 031            var gpu = UnityWebRequest.EscapeURL(GetGraphicsCardInfo());
 32
 033            string url = $"{ReportBugURL}" +
 34                         $"&unity={unityVersion}" +
 35                         $"&kernel={kernelVersion}" +
 36                         $"&os={os}" +
 37                         $"&cpu={cpu}" +
 38                         $"&ram={ram}" +
 39                         $"&gpu={gpu}" +
 40                         $"&nametag={nametag}" +
 41                         $"&realm={realm}" +
 42                         $"&labels={GetLabels()}";
 43
 044            WebInterface.OpenURL(url);
 045        }
 46
 47        private string GetLabels()
 48        {
 49#if UNITY_WEBGL
 050            return "explorer,new";
 51#else
 52            return "explorer-desktop,new";
 53#endif
 54        }
 55
 56        private string GetOSInfo()
 57        {
 58#if UNITY_WEBGL
 059            return WebGLPlugin.GetUserAgent();
 60#else
 61            return SystemInfo.operatingSystem;
 62#endif
 63        }
 64
 65        private string GetCPUInfo()
 66        {
 67#if UNITY_WEBGL
 068            return "";
 69#else
 70            return SystemInfo.processorType;
 71#endif
 72        }
 73
 74        private string GetMemoryInfo()
 75        {
 76#if UNITY_WEBGL
 077            return "";
 78#else
 79            return $"{SystemInfo.systemMemorySize}MB";
 80#endif
 81        }
 82
 83        private string GetGraphicsCardInfo()
 84        {
 085            return $"{SystemInfo.graphicsDeviceName} " +
 86                   $"{SystemInfo.graphicsMemorySize}MB";
 87        }
 88    }
 89}