use of com.meisolsson.githubsdk.service.repositories.RepositoryStatusService in project gh4a by slapperwan.
the class PullRequestFragment method loadCommitStatusesIfOpen.
private void loadCommitStatusesIfOpen(boolean force) {
if (mPullRequest.state() != IssueState.Open) {
return;
}
RepositoryStatusService service = ServiceFactory.get(RepositoryStatusService.class, force);
String sha = mPullRequest.head().sha();
ApiHelpers.PageIterator.toSingle(page -> service.getStatuses(mRepoOwner, mRepoName, sha, page)).compose(RxUtils.sortList(STATUS_TIMESTAMP_COMPARATOR)).map(statuses -> {
Set<String> seenContexts = new HashSet<>();
Iterator<Status> iter = statuses.iterator();
while (iter.hasNext()) {
Status status = iter.next();
if (seenContexts.contains(status.context())) {
iter.remove();
} else {
seenContexts.add(status.context());
}
}
return statuses;
}).compose(RxUtils.sortList(STATUS_AND_CONTEXT_COMPARATOR)).compose(makeLoaderSingle(ID_LOADER_STATUS, force)).subscribe(this::fillStatus, this::handleLoadFailure);
}
Aggregations