use of com.meisolsson.githubsdk.model.request.issue.CreateMilestone in project gh4a by slapperwan.
the class IssueMilestoneEditActivity method setMilestoneState.
private void setMilestoneState(boolean open) {
@StringRes int dialogMessageResId = open ? R.string.opening_msg : R.string.closing_msg;
String errorMessage = getString(open ? R.string.issue_milestone_reopen_error : R.string.issue_milestone_close_error, mMilestone.title());
IssueMilestoneService service = ServiceFactory.get(IssueMilestoneService.class, false);
CreateMilestone request = CreateMilestone.builder().state(open ? IssueState.Open : IssueState.Closed).build();
service.editMilestone(mRepoOwner, mRepoName, mMilestone.id(), request).map(ApiHelpers::throwOnFailure).compose(RxUtils.wrapForBackgroundTask(this, dialogMessageResId, errorMessage)).subscribe(result -> {
mMilestone = result;
updateHighlightColor();
supportInvalidateOptionsMenu();
setResult(RESULT_OK);
}, error -> handleActionFailure("Updating milestone failed", error));
}
use of com.meisolsson.githubsdk.model.request.issue.CreateMilestone 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