| | 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 | | #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 | |
|
| 4 | 20 | | private void Awake() { button.onClick.AddListener(ReportBug); } |
| | 21 | |
|
| | 22 | | private void ReportBug() |
| | 23 | | { |
| 0 | 24 | | var userProfile = UserProfile.GetOwnUserProfile(); |
| 0 | 25 | | var nametag = UnityWebRequest.EscapeURL(userProfile.userName); |
| 0 | 26 | | var kernelConfig = KernelConfig.i.Get(); |
| 0 | 27 | | var realm = DataStore.i.realm.playerRealm.Get()?.serverName; |
| 0 | 28 | | var unityVersion = kernelConfig.rendererVersion; |
| 0 | 29 | | var kernelVersion = kernelConfig.kernelVersion; |
| | 30 | |
|
| 0 | 31 | | var os = UnityWebRequest.EscapeURL(GetOSInfo()); |
| 0 | 32 | | var cpu = UnityWebRequest.EscapeURL(GetCPUInfo()); |
| 0 | 33 | | var ram = UnityWebRequest.EscapeURL(GetMemoryInfo()); |
| 0 | 34 | | var gpu = UnityWebRequest.EscapeURL(GetGraphicsCardInfo()); |
| | 35 | |
|
| 0 | 36 | | 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 | |
|
| 0 | 47 | | WebInterface.OpenURL(url); |
| 0 | 48 | | } |
| | 49 | |
|
| | 50 | | private string GetLabels() |
| | 51 | | { |
| | 52 | | #if UNITY_WEBGL |
| | 53 | | return "explorer,new"; |
| | 54 | | #else |
| 0 | 55 | | return "new"; |
| | 56 | | #endif |
| | 57 | | } |
| | 58 | |
|
| | 59 | | private string GetOSInfo() |
| | 60 | | { |
| | 61 | | #if UNITY_WEBGL |
| | 62 | | return WebGLPlugin.GetUserAgent(); |
| | 63 | | #else |
| 0 | 64 | | return SystemInfo.operatingSystem; |
| | 65 | | #endif |
| | 66 | | } |
| | 67 | |
|
| | 68 | | private string GetCPUInfo() |
| | 69 | | { |
| | 70 | | #if UNITY_WEBGL |
| | 71 | | return ""; |
| | 72 | | #else |
| 0 | 73 | | return SystemInfo.processorType; |
| | 74 | | #endif |
| | 75 | | } |
| | 76 | |
|
| | 77 | | private string GetMemoryInfo() |
| | 78 | | { |
| | 79 | | #if UNITY_WEBGL |
| | 80 | | return ""; |
| | 81 | | #else |
| 0 | 82 | | return $"{SystemInfo.systemMemorySize}MB"; |
| | 83 | | #endif |
| | 84 | | } |
| | 85 | |
|
| | 86 | | private string GetGraphicsCardInfo() |
| | 87 | | { |
| 0 | 88 | | return $"{SystemInfo.graphicsDeviceName} " + |
| | 89 | | $"{SystemInfo.graphicsMemorySize}MB"; |
| | 90 | | } |
| | 91 | | } |
| | 92 | | } |