use of com.meisolsson.githubsdk.service.issues.IssueMilestoneService in project gh4a by slapperwan.
the class IssueMilestoneEditActivity method saveMilestone.
private void saveMilestone(String title, String desc) {
String errorMessage = getString(R.string.issue_error_create_milestone, title);
IssueMilestoneService service = ServiceFactory.get(IssueMilestoneService.class, false);
CreateMilestone request = CreateMilestone.builder().title(title).description(desc).state(mMilestone.state()).dueOn(mMilestone.dueOn()).build();
Single<Response<Milestone>> responseSingle = isInEditMode() ? service.editMilestone(mRepoOwner, mRepoName, mMilestone.id(), request) : service.createMilestone(mRepoOwner, mRepoName, request);
responseSingle.map(ApiHelpers::throwOnFailure).compose(RxUtils.wrapForBackgroundTask(this, R.string.saving_msg, errorMessage)).subscribe(result -> {
mMilestone = result;
setResult(RESULT_OK);
finish();
}, error -> handleActionFailure("Saving milestone failed", error));
}
Aggregations