private IEnumerator _AddOwnership() { User currentUser = UserService.user; int groupId = GroupsService.group._id; bool isAdmin = true; WWW createRequest = GroupsService.AddMember(currentUser.email, groupId, isAdmin); while (!createRequest.isDone) { yield return(new WaitForSeconds(0.1f)); } AlertsService.removeLoadingAlert(); Debug.Log("Header: " + createRequest.responseHeaders["STATUS"]); Debug.Log("Text: " + createRequest.text); if (createRequest.responseHeaders["STATUS"] == HTML.HTTP_200) { LoadView("Groups"); } else { AlertsService.makeAlert("Erro", "Falha em sua conexão. Tente novamente mais tarde.", ""); yield return(new WaitForSeconds(3f)); LoadView("Groups"); } yield return(null); }
private IEnumerator _AddMember() { AlertsService.makeLoadingAlert("Adicionando"); string userEmail = newMemberEmail.text; int groupId = GroupsService.group._id; bool isAdmin = false; WWW createRequest = GroupsService.AddMember(userEmail, groupId, isAdmin); while (!createRequest.isDone) { yield return(new WaitForSeconds(0.1f)); } AlertsService.removeLoadingAlert(); Debug.Log("Header: " + createRequest.responseHeaders["STATUS"]); Debug.Log("Text: " + createRequest.text); if (createRequest.responseHeaders["STATUS"] == HTML.HTTP_200) { AlertsService.makeAlert("Sucesso", "O usuário foi adicionado com sucesso em seu grupo.", ""); yield return(new WaitForSeconds(3f)); LoadView("Group"); yield return(null); } else { AlertsService.makeAlert("Falha ao adicionar", "Verifique se inseriu o endereço de e-mail do usuário corretamente.", "Entendi"); } yield return(null); }