use of com.meisolsson.githubsdk.service.pull_request.PullRequestReviewCommentService in project gh4a by slapperwan.
the class EditPullRequestCommentActivity method createComment.
@Override
protected Single<GitHubCommentBase> createComment(String repoOwner, String repoName, String body, long replyToCommentId) {
int prNumber = getIntent().getIntExtra("pr", 0);
PullRequestReviewCommentService service = ServiceFactory.get(PullRequestReviewCommentService.class, false);
CreateReviewComment request = CreateReviewComment.builder().body(body).inReplyTo(replyToCommentId).build();
return service.createReviewComment(repoOwner, repoName, prNumber, request).map(ApiHelpers::throwOnFailure);
}
use of com.meisolsson.githubsdk.service.pull_request.PullRequestReviewCommentService in project gh4a by slapperwan.
the class ReviewFragment method onEditorDoSend.
@Override
public Single<?> onEditorDoSend(String comment) {
PullRequestReviewCommentService service = ServiceFactory.get(PullRequestReviewCommentService.class, false);
CreateReviewComment request = CreateReviewComment.builder().body(comment).inReplyTo(mSelectedReplyCommentId).build();
return service.createReviewComment(mRepoOwner, mRepoName, mIssueNumber, request).map(ApiHelpers::throwOnFailure);
}
use of com.meisolsson.githubsdk.service.pull_request.PullRequestReviewCommentService in project gh4a by slapperwan.
the class ReviewFragment method handleDeleteComment.
private void handleDeleteComment(GitHubCommentBase comment) {
final Single<Response<Void>> responseSingle;
if (comment instanceof ReviewComment) {
PullRequestReviewCommentService service = ServiceFactory.get(PullRequestReviewCommentService.class, false);
responseSingle = service.deleteComment(mRepoOwner, mRepoName, comment.id());
} else {
IssueCommentService service = ServiceFactory.get(IssueCommentService.class, false);
responseSingle = service.deleteIssueComment(mRepoOwner, mRepoName, comment.id());
}
responseSingle.map(ApiHelpers::mapToBooleanOrThrowOnFailure).compose(RxUtils.wrapForBackgroundTask(getBaseActivity(), R.string.deleting_msg, R.string.error_delete_comment)).subscribe(result -> reloadComments(false), error -> handleActionFailure("Deleting comment failed", error));
}
use of com.meisolsson.githubsdk.service.pull_request.PullRequestReviewCommentService in project gh4a by slapperwan.
the class PullRequestFilesFragment method loadComments.
private void loadComments(boolean force) {
final PullRequestReviewCommentService service = ServiceFactory.get(PullRequestReviewCommentService.class, force);
ApiHelpers.PageIterator.toSingle(page -> service.getPullRequestComments(mRepoOwner, mRepoName, mPullRequestNumber, page)).compose(RxUtils.filter(c -> c.position() != null && c.position() >= 0)).compose(makeLoaderSingle(ID_LOADER_COMMENTS, force)).subscribe(result -> {
mComments = result;
populateUiIfReady();
}, this::handleLoadFailure);
}
use of com.meisolsson.githubsdk.service.pull_request.PullRequestReviewCommentService in project gh4a by slapperwan.
the class PullRequestReviewDiffLoadTask method getSingle.
@Override
protected Single<Optional<Intent>> getSingle() {
final PullRequestReviewCommentService service = ServiceFactory.get(PullRequestReviewCommentService.class, false);
final PullRequestReviewService reviewService = ServiceFactory.get(PullRequestReviewService.class, false);
long diffCommentId = Long.parseLong(mDiffId.fileHash);
return ApiHelpers.PageIterator.toSingle(page -> service.getPullRequestComments(mRepoOwner, mRepoName, mPullRequestNumber, page)).compose(RxUtils.filterAndMapToFirst(c -> c.id() == diffCommentId)).flatMap(commentOpt -> commentOpt.flatMap(comment -> {
long reviewId = comment.pullRequestReviewId();
return reviewService.getReview(mRepoOwner, mRepoName, mPullRequestNumber, reviewId).map(ApiHelpers::throwOnFailure);
})).map(reviewOpt -> reviewOpt.map(review -> ReviewActivity.makeIntent(mActivity, mRepoOwner, mRepoName, mPullRequestNumber, review, new IntentUtils.InitialCommentMarker(diffCommentId))));
}
Aggregations