| | 1 | | using DCL; |
| | 2 | | using DCL.Interface; |
| | 3 | | using MainScripts.DCL.WebPlugin; |
| | 4 | | using UnityEngine; |
| | 5 | | using UnityEngine.Networking; |
| | 6 | | using UnityEngine.UI; |
| | 7 | |
|
| | 8 | | namespace MainScripts.DCL.Controllers.HUD.TaskbarHUD |
| | 9 | | { |
| | 10 | | public class ReportBugButton : MonoBehaviour |
| | 11 | | { |
| | 12 | | private const string ReportBugURL = "https://github.com/decentraland/issues/issues/new?assignees=&labels=new%2Ce |
| | 13 | |
|
| | 14 | | [SerializeField] private Button button; |
| | 15 | |
|
| 22 | 16 | | private void Awake() { button.onClick.AddListener(ReportBug); } |
| | 17 | |
|
| | 18 | | private void ReportBug() |
| | 19 | | { |
| 0 | 20 | | var userProfile = UserProfile.GetOwnUserProfile(); |
| 0 | 21 | | var nametag = UnityWebRequest.EscapeURL(userProfile.userName); |
| 0 | 22 | | var kernelConfig = KernelConfig.i.Get(); |
| 0 | 23 | | var realm = DataStore.i.playerRealm.Get()?.serverName; |
| 0 | 24 | | var unityVersion = kernelConfig.rendererVersion; |
| 0 | 25 | | var kernelVersion = kernelConfig.kernelVersion; |
| | 26 | |
|
| 0 | 27 | | var os = UnityWebRequest.EscapeURL(GetOSInfo()); |
| 0 | 28 | | var cpu = UnityWebRequest.EscapeURL(GetCPUInfo()); |
| 0 | 29 | | var ram = UnityWebRequest.EscapeURL(GetMemoryInfo()); |
| 0 | 30 | | var gpu = UnityWebRequest.EscapeURL(GetGraphicsCardInfo()); |
| | 31 | |
|
| 0 | 32 | | string url = $"{ReportBugURL}" + |
| | 33 | | $"&unity={unityVersion}" + |
| | 34 | | $"&kernel={kernelVersion}" + |
| | 35 | | $"&os={os}" + |
| | 36 | | $"&cpu={cpu}" + |
| | 37 | | $"&ram={ram}" + |
| | 38 | | $"&gpu={gpu}" + |
| | 39 | | $"&nametag={nametag}" + |
| | 40 | | $"&realm={realm}"; |
| | 41 | |
|
| 0 | 42 | | WebInterface.OpenURL(url); |
| 0 | 43 | | } |
| | 44 | | private string GetOSInfo() |
| | 45 | | { |
| | 46 | | #if UNITY_WEBGL |
| | 47 | | return WebGLPlugin.GetUserAgent(); |
| | 48 | | #else |
| 0 | 49 | | return SystemInfo.operatingSystem; |
| | 50 | | #endif |
| | 51 | | } |
| | 52 | |
|
| | 53 | | private string GetCPUInfo() |
| | 54 | | { |
| | 55 | | #if UNITY_WEBGL |
| | 56 | | return ""; |
| | 57 | | #else |
| 0 | 58 | | return SystemInfo.processorType; |
| | 59 | | #endif |
| | 60 | | } |
| | 61 | |
|
| | 62 | | private string GetMemoryInfo() |
| | 63 | | { |
| | 64 | | #if UNITY_WEBGL |
| | 65 | | return ""; |
| | 66 | | #else |
| 0 | 67 | | return $"{SystemInfo.systemMemorySize}MB"; |
| | 68 | | #endif |
| | 69 | | } |
| | 70 | |
|
| | 71 | | private string GetGraphicsCardInfo() |
| | 72 | | { |
| 0 | 73 | | return $"{SystemInfo.graphicsDeviceName} " + |
| | 74 | | $"{SystemInfo.graphicsMemorySize}MB"; |
| | 75 | | } |
| | 76 | | } |
| | 77 | | } |