use of com.fastaccess.data.dao.CommentRequestModel in project FastHub by k0shk0sh.
the class PullRequestFilesFragment method onCommentAdded.
@Override
public void onCommentAdded(@NonNull String comment, @NonNull CommitLinesModel item, Bundle bundle) {
if (bundle != null) {
String path = bundle.getString(BundleConstant.ITEM);
if (path == null)
return;
CommentRequestModel commentRequestModel = new CommentRequestModel();
commentRequestModel.setBody(comment);
commentRequestModel.setPath(path);
commentRequestModel.setPosition(item.getPosition());
if (viewCallback != null)
viewCallback.onAddComment(commentRequestModel);
int groupPosition = bundle.getInt(BundleConstant.EXTRA_TWO);
int childPosition = bundle.getInt(BundleConstant.EXTRA_THREE);
CommitFileChanges commitFileChanges = adapter.getItem(groupPosition);
List<CommitLinesModel> models = commitFileChanges.getLinesModel();
if (models != null && !models.isEmpty()) {
CommitLinesModel current = models.get(childPosition);
if (current != null) {
current.setHasCommentedOn(true);
}
models.set(childPosition, current);
adapter.notifyItemChanged(groupPosition);
}
}
}
use of com.fastaccess.data.dao.CommentRequestModel in project FastHub by k0shk0sh.
the class PullRequestTimelinePresenter method onHandleComment.
@Override
public void onHandleComment(@NonNull String text, @Nullable Bundle bundle) {
if (getView() == null)
return;
PullRequest pullRequest = getView().getPullRequest();
if (pullRequest != null) {
if (bundle == null) {
CommentRequestModel commentRequestModel = new CommentRequestModel();
commentRequestModel.setBody(text);
manageDisposable(RxHelper.getObservable(RestProvider.getIssueService(isEnterprise()).createIssueComment(pullRequest.getLogin(), pullRequest.getRepoId(), pullRequest.getNumber(), commentRequestModel)).doOnSubscribe(disposable -> sendToView(view -> view.showBlockingProgress(0))).subscribe(comment -> sendToView(view -> view.addComment(TimelineModel.constructComment(comment))), throwable -> {
onError(throwable);
sendToView(PullRequestTimelineMvp.View::onHideBlockingProgress);
}));
}
}
}
use of com.fastaccess.data.dao.CommentRequestModel in project FastHub by k0shk0sh.
the class IssuePopupPresenter method onSubmit.
@Override
public void onSubmit(@NonNull String login, @NonNull String repoId, int issueNumber, @NonNull String text) {
CommentRequestModel requestModel = new CommentRequestModel();
requestModel.setBody(text);
makeRestCall(RestProvider.getIssueService(isEnterprise()).createIssueComment(login, repoId, issueNumber, requestModel), comment -> sendToView(IssuePopupMvp.View::onSuccessfullySubmitted));
}
use of com.fastaccess.data.dao.CommentRequestModel in project FastHub by k0shk0sh.
the class CommitCommentsPresenter method onHandleComment.
@Override
public void onHandleComment(@NonNull String text, @Nullable Bundle bundle) {
CommentRequestModel model = new CommentRequestModel();
model.setBody(text);
manageDisposable(RxHelper.getObservable(RestProvider.getRepoService(isEnterprise()).postCommitComment(login, repoId, sha, model)).doOnSubscribe(disposable -> sendToView(view -> view.showBlockingProgress(0))).subscribe(comment -> sendToView(view -> view.addComment(comment)), throwable -> {
onError(throwable);
sendToView(CommitCommentsMvp.View::hideBlockingProgress);
}));
}
use of com.fastaccess.data.dao.CommentRequestModel in project FastHub by k0shk0sh.
the class CommitFilesPresenter method onSubmitComment.
@Override
public void onSubmitComment(@NonNull String comment, @NonNull CommitLinesModel item, @Nullable Bundle bundle) {
if (bundle != null) {
String blob = bundle.getString(BundleConstant.ITEM);
String path = bundle.getString(BundleConstant.EXTRA);
if (path == null || sha == null)
return;
CommentRequestModel commentRequestModel = new CommentRequestModel();
commentRequestModel.setBody(comment);
commentRequestModel.setPath(path);
commentRequestModel.setPosition(item.getPosition());
commentRequestModel.setLine(item.getRightLineNo() > 0 ? item.getRightLineNo() : item.getLeftLineNo());
NameParser nameParser = new NameParser(blob);
onSubmit(nameParser.getUsername(), nameParser.getName(), commentRequestModel);
}
}
Aggregations