use of com.fastaccess.data.dao.AssigneesRequestModel in project FastHub by k0shk0sh.
the class IssuePagerPresenter method onPutAssignees.
@Override
public void onPutAssignees(@NonNull ArrayList<User> users) {
AssigneesRequestModel assigneesRequestModel = new AssigneesRequestModel();
ArrayList<String> assignees = new ArrayList<>();
Stream.of(users).forEach(userModel -> assignees.add(userModel.getLogin()));
assigneesRequestModel.setAssignees(assignees.isEmpty() ? Stream.of(issueModel.getAssignees()).map(User::getLogin).toList() : assignees);
makeRestCall(!assignees.isEmpty() ? RestProvider.getIssueService(isEnterprise()).putAssignees(login, repoId, issueNumber, assigneesRequestModel) : RestProvider.getIssueService(isEnterprise()).deleteAssignees(login, repoId, issueNumber, assigneesRequestModel), issue -> {
UsersListModel assignee = new UsersListModel();
assignee.addAll(users);
issueModel.setAssignees(assignee);
manageObservable(issueModel.save(issueModel).toObservable());
sendToView(view -> updateTimeline(view, R.string.assignee_added));
});
}
use of com.fastaccess.data.dao.AssigneesRequestModel in project FastHub by k0shk0sh.
the class PullRequestPagerPresenter method onPutAssignees.
@Override
public void onPutAssignees(@NonNull ArrayList<User> users, boolean isAssignees) {
AssigneesRequestModel assigneesRequestModel = new AssigneesRequestModel();
ArrayList<String> assignees = Stream.of(users).map(User::getLogin).collect(Collectors.toCollection(ArrayList::new));
if (isAssignees) {
assigneesRequestModel.setAssignees(assignees.isEmpty() ? Stream.of(pullRequest.getAssignees()).map(User::getLogin).toList() : assignees);
makeRestCall(!assignees.isEmpty() ? RestProvider.getIssueService(isEnterprise()).putAssignees(login, repoId, issueNumber, assigneesRequestModel) : RestProvider.getIssueService(isEnterprise()).deleteAssignees(login, repoId, issueNumber, assigneesRequestModel), pullRequestResponse -> {
UsersListModel usersListModel = new UsersListModel();
usersListModel.addAll(users);
this.pullRequest.setAssignees(usersListModel);
manageObservable(pullRequest.save(pullRequest).toObservable());
sendToView(view -> updateTimeline(view, R.string.assignee_added));
});
} else {
assigneesRequestModel.setReviewers(assignees);
makeRestCall(RestProvider.getPullRequestService(isEnterprise()).putReviewers(login, repoId, issueNumber, assigneesRequestModel), pullRequestResponse -> sendToView(view -> updateTimeline(view, R.string.reviewer_added)));
}
}
Aggregations