void ToggleUserAssignee(object data) { BugReporterPlugin.UserEntry user = data as BugReporterPlugin.UserEntry; if (ArrayUtility.Contains(entry.assignees, user)) { ArrayUtility.Remove(ref entry.assignees, user); } else { ArrayUtility.Add(ref entry.assignees, user); } entry.BuildCommaStrings(); }
void RequestUsers() { var settings = BugReporterPlugin.settings.GetBackendSettings(backendName); var request = UnityWebRequest.Get(baseURL + "/repos/" + settings.projectPath + "/assignees"); request.SetRequestHeader("Accept", "application/vnd.github.v3+json"); request.SetRequestHeader("Authorization", "token " + _token); var async = request.SendWebRequest(); async.completed += op => { UnityWebRequestAsyncOperation asyncop = op as UnityWebRequestAsyncOperation; if (asyncop.webRequest.isHttpError) { Debug.Log(asyncop.webRequest.error); } else { _users.Clear(); string newJson = "{ \"array\": " + asyncop.webRequest.downloadHandler.text + "}"; GithubUserData[] usersData = JsonUtility.FromJson <Wrapper <GithubUserData> >(newJson).array; Debug.LogFormat("[Github Backend] Found {0} users in that project", usersData.Length); for (int i = 0; i < usersData.Length; ++i) { BugReporterPlugin.UserEntry entry = new BugReporterPlugin.UserEntry(); entry.id = usersData[i].id.ToString(); entry.name = usersData[i].login; if (usersData[i].id == _userID) { _userInfo = entry; } _users.Add(entry); } } }; }