diff --git a/app/src/main/java/org/mian/gitnex/activities/AddRemoveAssigneesActivity.java b/app/src/main/java/org/mian/gitnex/activities/AddRemoveAssigneesActivity.java index 5c29c0aa..83774b0d 100644 --- a/app/src/main/java/org/mian/gitnex/activities/AddRemoveAssigneesActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/AddRemoveAssigneesActivity.java @@ -18,7 +18,7 @@ import org.mian.gitnex.helpers.Toasty; import org.mian.gitnex.models.Collaborators; import org.mian.gitnex.models.Issues; import org.mian.gitnex.models.MultiSelectModel; -import org.mian.gitnex.models.UpdateIssueAssignee; +import org.mian.gitnex.models.UpdateIssueAssignees; import org.mian.gitnex.util.TinyDB; import java.util.ArrayList; import java.util.List; @@ -234,14 +234,14 @@ public class AddRemoveAssigneesActivity extends AppCompatActivity { private void updateIssueAssignees(final String instanceUrl, final String instanceToken, String repoOwner, String repoName, String loginUid, int issueIndex, List issueAssigneesList) { - UpdateIssueAssignee updateAssigneeJson = new UpdateIssueAssignee(issueAssigneesList); + UpdateIssueAssignees updateAssigneeJson = new UpdateIssueAssignees(issueAssigneesList); Call call3; call3 = RetrofitClient .getInstance(instanceUrl, getApplicationContext()) .getApiInterface() - .patchIssueAssignee(Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName, issueIndex, updateAssigneeJson); + .patchIssueAssignees(Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName, issueIndex, updateAssigneeJson); call3.enqueue(new Callback() { diff --git a/app/src/main/java/org/mian/gitnex/activities/CreateIssueActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreateIssueActivity.java index b04f5014..16448ae3 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreateIssueActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreateIssueActivity.java @@ -78,6 +78,7 @@ public class CreateIssueActivity extends AppCompatActivity implements View.OnCli TinyDB tinyDb = new TinyDB(getApplicationContext()); final String instanceUrl = tinyDb.getString("instanceUrl"); final String loginUid = tinyDb.getString("loginUid"); + final String loginFullName = tinyDb.getString("userFullname"); String repoFullName = tinyDb.getString("repoFullName"); String[] parts = repoFullName.split("/"); final String repoOwner = parts[0]; @@ -110,7 +111,7 @@ public class CreateIssueActivity extends AppCompatActivity implements View.OnCli getMilestones(instanceUrl, instanceToken, repoOwner, repoName, loginUid); getLabels(instanceUrl, instanceToken, repoOwner, repoName, loginUid); - getCollaborators(instanceUrl, instanceToken, repoOwner, repoName, loginUid); + getCollaborators(instanceUrl, instanceToken, repoOwner, repoName, loginUid, loginFullName); disableProcessButton(); @@ -377,13 +378,15 @@ public class CreateIssueActivity extends AppCompatActivity implements View.OnCli } - private void getCollaborators(String instanceUrl, String instanceToken, String repoOwner, String repoName, String loginUid) { + private void getCollaborators(String instanceUrl, String instanceToken, String repoOwner, String repoName, String loginUid, String loginFullName) { Call> call = RetrofitClient .getInstance(instanceUrl, getApplicationContext()) .getApiInterface() .getCollaborators(Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName); + listOfAssignees.add(new MultiSelectModel(-1, loginFullName)); + call.enqueue(new Callback>() { @Override diff --git a/app/src/main/java/org/mian/gitnex/interfaces/ApiInterface.java b/app/src/main/java/org/mian/gitnex/interfaces/ApiInterface.java index deb2b053..54f0bd9d 100644 --- a/app/src/main/java/org/mian/gitnex/interfaces/ApiInterface.java +++ b/app/src/main/java/org/mian/gitnex/interfaces/ApiInterface.java @@ -8,7 +8,7 @@ import org.mian.gitnex.models.Files; import org.mian.gitnex.models.MergePullRequest; import org.mian.gitnex.models.NewFile; import org.mian.gitnex.models.PullRequests; -import org.mian.gitnex.models.UpdateIssueAssignee; +import org.mian.gitnex.models.UpdateIssueAssignees; import org.mian.gitnex.models.UpdateIssueState; import org.mian.gitnex.models.Collaborators; import org.mian.gitnex.models.CreateIssue; @@ -207,7 +207,7 @@ public interface ApiInterface { Call createNewRelease(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Body Releases jsonStr); @PATCH("repos/{owner}/{repo}/issues/{issueIndex}") // patch issue assignees - Call patchIssueAssignee(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Path("issueIndex") int issueIndex, @Body UpdateIssueAssignee jsonStr); + Call patchIssueAssignees(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Path("issueIndex") int issueIndex, @Body UpdateIssueAssignees jsonStr); @GET("admin/users") // get all users Call> adminGetUsers(@Header("Authorization") String token); diff --git a/app/src/main/java/org/mian/gitnex/models/CreateIssue.java b/app/src/main/java/org/mian/gitnex/models/CreateIssue.java index 3d81d7f3..e15252b9 100644 --- a/app/src/main/java/org/mian/gitnex/models/CreateIssue.java +++ b/app/src/main/java/org/mian/gitnex/models/CreateIssue.java @@ -8,7 +8,6 @@ import java.util.List; public class CreateIssue { - private String assignee; private String body; private boolean closed; private String due_date; @@ -19,7 +18,6 @@ public class CreateIssue { private int[] labels; public CreateIssue(String assignee, String body, boolean closed, String due_date, int milestone, String title, List assignees, int[] labels) { - this.assignee = assignee; this.body = body; this.closed = closed; this.due_date = due_date; diff --git a/app/src/main/java/org/mian/gitnex/models/Issues.java b/app/src/main/java/org/mian/gitnex/models/Issues.java index 234242b7..d6fa0d4b 100644 --- a/app/src/main/java/org/mian/gitnex/models/Issues.java +++ b/app/src/main/java/org/mian/gitnex/models/Issues.java @@ -25,7 +25,6 @@ public class Issues { private List labels; private pullRequestObject pull_request; private milestoneObject milestone; - private assigneeObject assignee; private List assignees; public Issues(String body) { @@ -154,45 +153,6 @@ public class Issues { } } - public class assigneeObject { - - private int id; - private String login; - private String full_name; - private String email; - private String avatar_url; - private String language; - private String username; - - public int getId() { - return id; - } - - public String getLogin() { - return login; - } - - public String getFull_name() { - return full_name; - } - - public String getEmail() { - return email; - } - - public String getAvatar_url() { - return avatar_url; - } - - public String getLanguage() { - return language; - } - - public String getUsername() { - return username; - } - } - public class assigneesObject { private int id; @@ -292,10 +252,6 @@ public class Issues { return milestone; } - public assigneeObject getAssignee() { - return assignee; - } - public List getAssignees() { return assignees; } diff --git a/app/src/main/java/org/mian/gitnex/models/UpdateIssueAssignee.java b/app/src/main/java/org/mian/gitnex/models/UpdateIssueAssignees.java similarity index 64% rename from app/src/main/java/org/mian/gitnex/models/UpdateIssueAssignee.java rename to app/src/main/java/org/mian/gitnex/models/UpdateIssueAssignees.java index f3f6ed4a..190895f0 100644 --- a/app/src/main/java/org/mian/gitnex/models/UpdateIssueAssignee.java +++ b/app/src/main/java/org/mian/gitnex/models/UpdateIssueAssignees.java @@ -6,11 +6,11 @@ import java.util.List; * Author M M Arif */ -public class UpdateIssueAssignee { +public class UpdateIssueAssignees { private List assignees; - public UpdateIssueAssignee(List assignees) { + public UpdateIssueAssignees(List assignees) { this.assignees = assignees; }