use of com.gh4a.utils.RxUtils in project gh4a by slapperwan.
the class IssueEditActivity method loadPotentialAssignees.
private void loadPotentialAssignees() {
final RepositoryCollaboratorService service = ServiceFactory.get(RepositoryCollaboratorService.class, false);
registerTemporarySubscription(ApiHelpers.PageIterator.toSingle(page -> service.getCollaborators(mRepoOwner, mRepoName, page)).compose(RxUtils::doInBackground).compose(RxUtils.wrapWithProgressDialog(this, R.string.loading_msg)).subscribe(result -> {
mAllAssignee = result;
User creator = mEditIssue.user();
if (creator != null && !mAllAssignee.contains(creator)) {
mAllAssignee.add(creator);
}
showAssigneesDialog();
}, this::handleLoadFailure));
}
use of com.gh4a.utils.RxUtils in project gh4a by slapperwan.
the class IssueEditActivity method loadIssueTemplate.
private void loadIssueTemplate() {
RepositoryContentService service = ServiceFactory.get(RepositoryContentService.class, false);
registerTemporarySubscription(getIssueTemplateContentSingle("/.github").flatMap(opt -> opt.orOptionalSingle(() -> getIssueTemplateContentSingle(""))).flatMap(opt -> opt.orOptionalSingle(() -> getIssueTemplateContentSingle("/docs"))).flatMap(opt -> opt.flatMap(c -> {
// noinspection CodeBlock2Expr
return service.getContents(mRepoOwner, mRepoName, c.path(), null).map(ApiHelpers::throwOnFailure).compose(RxUtils::doInBackground);
})).map(opt -> opt.map(c -> StringUtils.fromBase64(c.content()))).compose(RxUtils.wrapWithProgressDialog(this, R.string.loading_msg)).subscribe(result -> {
mDescView.setHint(null);
mDescView.setEnabled(true);
mDescView.setText(result.orNull());
}, this::handleLoadFailure));
}
use of com.gh4a.utils.RxUtils in project gh4a by slapperwan.
the class IssueEditActivity method loadLabels.
private void loadLabels() {
final IssueLabelService service = ServiceFactory.get(IssueLabelService.class, false);
registerTemporarySubscription(ApiHelpers.PageIterator.toSingle(page -> service.getRepositoryLabels(mRepoOwner, mRepoName, page)).compose(RxUtils::doInBackground).compose(RxUtils.wrapWithProgressDialog(this, R.string.loading_msg)).subscribe(result -> {
mAllLabels = result;
showLabelDialog();
}, this::handleLoadFailure));
}
Aggregations