use of com.fastaccess.data.dao.LockIssuePrModel in project FastHub by k0shk0sh.
the class IssuePagerPresenter method onLockUnlockIssue.
@Override
public void onLockUnlockIssue(String reason) {
Issue currentIssue = getIssue();
if (currentIssue == null)
return;
String login = getLogin();
String repoId = getRepoId();
int number = currentIssue.getNumber();
LockIssuePrModel model = null;
if (!isLocked() && !InputHelper.isEmpty(reason)) {
model = new LockIssuePrModel(true, reason);
}
IssueService issueService = RestProvider.getIssueService(isEnterprise());
Observable<Response<Boolean>> observable = RxHelper.getObservable(model == null ? issueService.unlockIssue(login, repoId, number) : issueService.lockIssue(model, login, repoId, number));
makeRestCall(observable, booleanResponse -> {
int code = booleanResponse.code();
if (code == 204) {
issueModel.setLocked(!isLocked());
sendToView(view -> view.onSetupIssue(true));
}
sendToView(IssuePagerMvp.View::hideProgress);
});
}
use of com.fastaccess.data.dao.LockIssuePrModel in project FastHub by k0shk0sh.
the class PullRequestPagerPresenter method onLockUnlockConversations.
@Override
public void onLockUnlockConversations(String reason) {
PullRequest currentPullRequest = getPullRequest();
if (currentPullRequest == null)
return;
IssueService service = RestProvider.getIssueService(isEnterprise());
LockIssuePrModel model = null;
if (!isLocked() && !InputHelper.isEmpty(reason)) {
model = new LockIssuePrModel(true, reason);
}
Observable<Response<Boolean>> observable = RxHelper.getObservable(model == null ? service.unlockIssue(login, repoId, issueNumber) : service.lockIssue(model, login, repoId, issueNumber));
makeRestCall(observable, booleanResponse -> {
int code = booleanResponse.code();
if (code == 204) {
pullRequest.setLocked(!isLocked());
sendToView(view -> view.onSetupIssue(false));
}
});
}
Aggregations