use of io.reark.rxgithubapp.shared.pojo.GitHubRepositorySearch in project reark by reark.
the class GitHubRepositorySearchFetcher method fetchGitHubSearch.
private void fetchGitHubSearch(@NonNull final String searchString) {
checkNotNull(searchString);
Log.d(TAG, "fetchGitHubSearch(" + searchString + ")");
if (isOngoingRequest(searchString.hashCode())) {
Log.d(TAG, "Found an ongoing request for repository " + searchString);
return;
}
final String uri = getUniqueId(searchString);
Subscription subscription = createNetworkObservable(searchString).subscribeOn(Schedulers.computation()).map((repositories) -> {
final List<Integer> repositoryIds = new ArrayList<>(repositories.size());
for (GitHubRepository repository : repositories) {
gitHubRepositoryStore.put(repository);
repositoryIds.add(repository.getId());
}
return new GitHubRepositorySearch(searchString, repositoryIds);
}).doOnSubscribe(() -> startRequest(uri)).doOnCompleted(() -> completeRequest(uri)).doOnError(doOnError(uri)).subscribe(gitHubRepositorySearchStore::put, e -> Log.e(TAG, "Error fetching GitHub repository search for '" + searchString + "'", e));
addRequest(searchString.hashCode(), subscription);
}
use of io.reark.rxgithubapp.shared.pojo.GitHubRepositorySearch in project reark by reark.
the class RepositoriesViewModelTest method testAnyValueReportedAsIdle.
@Test
public void testAnyValueReportedAsIdle() {
GitHubRepositorySearch value = new GitHubRepositorySearch("", Collections.emptyList());
assertEquals(IDLE, toProgressStatus().call(onNext(value)));
}
Aggregations