rx.exceptions.OnErrorNotImplementedException Java Examples
The following examples show how to use
rx.exceptions.OnErrorNotImplementedException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AppViewPresenter.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
private void claimApp() { view.getLifecycleEvent() .filter(lifecycleEvent -> lifecycleEvent == View.LifecycleEvent.CREATE) .flatMap(create -> view.claimAppClick() .flatMap(promotion -> { appViewAnalytics.sendClickOnClaimAppViewPromotion(promotion.getPromotionId()); return appViewManager.getAppModel() .toObservable() .doOnNext(app -> promotionsNavigator.navigateToClaimDialog(app.getPackageName(), promotion.getPromotionId())); }) .retry()) .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY)) .subscribe(created -> { }, error -> { throw new OnErrorNotImplementedException(error); }); }
Example #2
Source File: ResultOnSubscribe.java From okhttp-OkGo with Apache License 2.0 | 6 votes |
@Override public void onError(Throwable throwable) { try { subscriber.onNext(Result.<R>error(throwable)); } catch (Throwable t) { try { subscriber.onError(t); } catch (OnCompletedFailedException | OnErrorFailedException | OnErrorNotImplementedException e) { RxJavaHooks.getOnError().call(e); } catch (Throwable inner) { Exceptions.throwIfFatal(inner); RxJavaHooks.getOnError().call(new CompositeException(t, inner)); } return; } subscriber.onCompleted(); }
Example #3
Source File: HomeContainerPresenter.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@VisibleForTesting public void loadMainHomeContent() { view.getLifecycleEvent() .filter(event -> event.equals(View.LifecycleEvent.CREATE)) .flatMap(__ -> view.isChipChecked()) .doOnNext(checked -> { switch (checked) { case GAMES: homeContainerNavigator.loadGamesHomeContent(); break; case APPS: homeContainerNavigator.loadAppsHomeContent(); break; default: homeContainerNavigator.loadMainHomeContent(); break; } }) .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY)) .subscribe(__ -> { }, err -> { throw new OnErrorNotImplementedException(err); }); }
Example #4
Source File: HomeContainerPresenter.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
private void handleBottomNavigationEvents() { view.getLifecycleEvent() .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE)) .flatMap(created -> homeNavigator.bottomNavigation()) .observeOn(viewScheduler) .flatMap(__ -> homeContainerNavigator.navigateHome()) .doOnNext(shouldGoHome -> { view.expandChips(); if (shouldGoHome) { homeContainerNavigator.loadMainHomeContent(); chipManager.setCurrentChip(null); view.uncheckChips(); } }) .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY)) .subscribe(__ -> { }, err -> { throw new OnErrorNotImplementedException(err); }); }
Example #5
Source File: HomePresenter.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@VisibleForTesting public void handleBundleScrolledRight() { view.getLifecycleEvent() .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE)) .flatMap(created -> view.bundleScrolled() .doOnNext(click -> homeAnalytics.sendScrollRightInteractEvent(click.getBundlePosition(), click.getBundle() .getTag(), click.getBundle() .getContent() .size())) .doOnError(crashReporter::log) .retry()) .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY)) .subscribe(scroll -> { }, throwable -> { throw new OnErrorNotImplementedException(throwable); }); }
Example #6
Source File: HomePresenter.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@VisibleForTesting public void handleAdClick() { view.getLifecycleEvent() .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE)) .flatMap(created -> view.adClicked() .doOnNext(adHomeEvent -> homeAnalytics.sendAdClickEvent(adHomeEvent.getAdClick() .getAd() .getStars(), adHomeEvent.getAdClick() .getAd() .getPackageName(), adHomeEvent.getBundlePosition(), adHomeEvent.getBundle() .getTag(), adHomeEvent.getType(), ApplicationAd.Network.SERVER)) .map(adHomeEvent -> adHomeEvent.getAdClick()) .map(adMapper::mapAdToSearchAd) .observeOn(viewScheduler) .doOnError(throwable -> Logger.getInstance() .e(this.getClass() .getCanonicalName(), throwable)) .doOnNext(result -> homeNavigator.navigateToAppView(result.getTag(), result.getSearchAdResult())) .retry()) .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY)) .subscribe(homeClick -> { }, throwable -> { throw new OnErrorNotImplementedException(throwable); }); }
Example #7
Source File: RxNotification.java From satellite with MIT License | 6 votes |
/** * Returns an {@link Action1} that can be used to split {@link Notification} to appropriate * dematerialized onNext and onError calls. * * @param onNext a method that will be called in case of onNext notification, or null. * @param onError a method that will be called in case of onError notification, or null. * @param <T> a type of onNext value. * @return an {@link Action1} that can be used to split a {@link Notification} into appropriate * onNext, onError calls. */ public static <T> Action1<Notification<T>> split( @Nullable final Action1<T> onNext, @Nullable final Action1<Throwable> onError) { return new Action1<Notification<T>>() { @Override public void call(Notification<T> notification) { if (notification.isOnNext()) { if (onNext != null) onNext.call(notification.getValue()); } else if (notification.isOnError()) { if (onError != null) onError.call(notification.getThrowable()); else throw new OnErrorNotImplementedException(notification.getThrowable()); } } }; }
Example #8
Source File: HomePresenter.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@VisibleForTesting public void handleDismissClick() { view.getLifecycleEvent() .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE)) .flatMap(created -> view.dismissBundleClicked()) .filter(homeEvent -> homeEvent.getBundle() instanceof ActionBundle) .doOnNext(homeEvent -> homeAnalytics.sendActionItemDismissInteractEvent( homeEvent.getBundle() .getTag(), homeEvent.getBundlePosition())) .flatMap(homeEvent -> home.remove((ActionBundle) homeEvent.getBundle()) .andThen(Observable.just(homeEvent))) .observeOn(viewScheduler) .doOnNext(homeEvent -> view.hideBundle(homeEvent.getBundlePosition())) .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY)) .subscribe(lifecycleEvent -> { }, throwable -> { throw new OnErrorNotImplementedException(throwable); }); }
Example #9
Source File: HomePresenter.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@VisibleForTesting public void handleKnowMoreClick() { view.getLifecycleEvent() .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE)) .flatMap(created -> view.infoBundleKnowMoreClicked()) .observeOn(viewScheduler) .doOnNext(homeEvent -> { homeAnalytics.sendActionItemTapOnCardInteractEvent(homeEvent.getBundle() .getTag(), homeEvent.getBundlePosition()); homeNavigator.navigateToAppCoinsInformationView(); }) .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY)) .subscribe(lifecycleEvent -> { }, throwable -> { throw new OnErrorNotImplementedException(throwable); }); }
Example #10
Source File: HomePresenter.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
private void handleInstallWalletOfferClick() { view.getLifecycleEvent() .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE)) .flatMap(created -> view.walletOfferCardInstallWalletClick()) .observeOn(viewScheduler) .doOnNext(event -> homeAnalytics.sendActionItemTapOnCardInteractEvent(event.getBundle() .getTag(), event.getBundlePosition())) .map(HomeEvent::getBundle) .filter(homeBundle -> homeBundle instanceof ActionBundle) .cast(ActionBundle.class) .doOnNext(bundle -> view.sendDeeplinkToWalletAppView(bundle.getActionItem() .getUrl())) .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY)) .subscribe(lifecycleEvent -> { }, throwable -> { throw new OnErrorNotImplementedException(throwable); }); }
Example #11
Source File: BaseWeightingStrategyTest.java From ocelli with Apache License 2.0 | 6 votes |
/** * Run a simulation of 'count' selects and update the clients * @param strategy * @param N * @param count * @return * @throws Throwable */ static Integer[] simulate(LoadBalancer<IntClientAndMetrics> lb, int N, int count) throws Throwable { // Set up array of counts final Integer[] counts = new Integer[N]; for (int i = 0; i < N; i++) { counts[i] = 0; } // Run simulation for (int i = 0; i < count; i++) { try { lb.toObservable().subscribe(new Action1<IntClientAndMetrics>() { @Override public void call(IntClientAndMetrics t1) { counts[t1.getClient()] = counts[t1.getClient()] + 1; } }); } catch (OnErrorNotImplementedException e) { throw e.getCause(); } } return counts; }
Example #12
Source File: EventInitialPresenter.java From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void getSectionCompletion(@Nullable String sectionUid) { Flowable<List<FieldViewModel>> fieldsFlowable = eventSummaryRepository.list(sectionUid, eventId); Flowable<Result<RuleEffect>> ruleEffectFlowable = eventSummaryRepository.calculate() .subscribeOn(schedulerProvider.computation()) .onErrorReturn(throwable -> Result.failure(new Exception(throwable))); // Combining results of two repositories into a single stream. Flowable<List<FieldViewModel>> viewModelsFlowable = Flowable.zip(fieldsFlowable, ruleEffectFlowable, this::applyEffects); compositeDisposable.add(viewModelsFlowable.subscribeOn(schedulerProvider.ui()) .observeOn(schedulerProvider.ui()).subscribe(view.showFields(sectionUid), throwable -> { throw new OnErrorNotImplementedException(throwable); })); }
Example #13
Source File: HomeContainerPresenter.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@VisibleForTesting public void loadUserImage() { view.getLifecycleEvent() .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE)) .flatMap(created -> accountManager.accountStatus()) .flatMap(account -> getUserAvatar(account)) .observeOn(viewScheduler) .doOnNext(userAvatarUrl -> { if (userAvatarUrl != null) { view.setUserImage(userAvatarUrl); } else { view.setDefaultUserImage(); } view.showAvatar(); }) .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY)) .subscribe(__ -> { }, throwable -> { throw new OnErrorNotImplementedException(throwable); }); }
Example #14
Source File: HomeContainerPresenter.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@VisibleForTesting public void handlePromotionsClick() { view.getLifecycleEvent() .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE)) .flatMap(created -> view.toolbarPromotionsClick() .observeOn(viewScheduler) .doOnNext(account -> { homeAnalytics.sendPromotionsIconClickEvent(); homeNavigator.navigateToPromotions(); }) .retry()) .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY)) .subscribe(__ -> { }, throwable -> { throw new OnErrorNotImplementedException(throwable); }); }
Example #15
Source File: HomeContainerPresenter.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@VisibleForTesting public void handleClickOnPromotionsDialogContinue() { view.getLifecycleEvent() .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE)) .flatMap(__ -> view.promotionsHomeDialogClicked()) .filter(action -> action.equals("navigate")) .doOnNext(__ -> { homeAnalytics.sendPromotionsDialogNavigateEvent(); view.dismissPromotionsDialog(); homeNavigator.navigateToPromotions(); }) .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY)) .subscribe(__ -> { }, throwable -> { throw new OnErrorNotImplementedException(throwable); }); }
Example #16
Source File: AppViewPresenter.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
private void handleDonateCardImpressions() { view.getLifecycleEvent() .filter(event -> event.equals(View.LifecycleEvent.CREATE)) .flatMap(__ -> view.installAppClick()) .flatMapSingle(__ -> appViewManager.getAppModel()) .doOnNext(app -> { if (app.hasDonations()) { appViewAnalytics.sendDonateImpressionAfterInstall(app.getPackageName()); } }) .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY)) .subscribe(created -> { }, error -> { throw new OnErrorNotImplementedException(error); }); }
Example #17
Source File: HomeContainerPresenter.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@VisibleForTesting public void handleLoggedInAcceptTermsAndConditions() { view.getLifecycleEvent() .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE)) .flatMap(__ -> accountManager.accountStatus() .first()) .filter(Account::isLoggedIn) .filter( account -> !(account.acceptedPrivacyPolicy() && account.acceptedTermsAndConditions())) .observeOn(viewScheduler) .doOnNext(__ -> view.showTermsAndConditionsDialog()) .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY)) .subscribe(__ -> { }, throwable -> { throw new OnErrorNotImplementedException(throwable); }); }
Example #18
Source File: MoreBundlePresenter.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@VisibleForTesting public void handleBottomReached() { view.getLifecycleEvent() .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE)) .flatMap(created -> view.reachesBottom() .filter(__ -> moreBundleManager.hasMore(bundleEvent.getTitle())) .observeOn(viewScheduler) .doOnNext(bottomReached -> view.showLoadMore()) .flatMapSingle(bottomReached -> loadNextBundles()) .doOnNext(__ -> homeAnalytics.sendLoadMoreInteractEvent()) .retry()) .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY)) .subscribe(bundles -> { }, throwable -> { throw new OnErrorNotImplementedException(throwable); }); }
Example #19
Source File: MyStoresPresenter.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
private void loadUserImage() { view.getLifecycleEvent() .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE)) .flatMap(created -> accountManager.accountStatus()) .flatMap(account -> getUserAvatar(account)) .observeOn(viewScheduler) .doOnNext(userAvatarUrl -> { if (userAvatarUrl != null) { view.setUserImage(userAvatarUrl); } else { view.setDefaultUserImage(); } view.showAvatar(); }) .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY)) .subscribe(__ -> { }, throwable -> { throw new OnErrorNotImplementedException(throwable); }); }
Example #20
Source File: MoreBundlePresenter.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@VisibleForTesting public void handleBundleScrolledRight() { view.getLifecycleEvent() .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE)) .flatMap(created -> view.bundleScrolled() .doOnNext(click -> homeAnalytics.sendScrollRightInteractEvent(click.getBundlePosition(), click.getBundle() .getTag(), click.getBundle() .getContent() .size())) .doOnError(crashReporter::log) .retry()) .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY)) .subscribe(scroll -> { }, throwable -> { throw new OnErrorNotImplementedException(throwable); }); }
Example #21
Source File: MoreBundlePresenter.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@VisibleForTesting public void handleMoreClick() { view.getLifecycleEvent() .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE)) .flatMap(created -> view.moreClicked() .doOnNext(homeMoreClick -> { ChipManager.Chip chip = chipManager.getCurrentChip(); homeAnalytics.sendTapOnMoreInteractEvent(homeMoreClick.getBundlePosition(), homeMoreClick.getBundle() .getTag(), homeMoreClick.getBundle() .getContent() .size(), chip != null ? chip.getName() : null); if (chip != null) { homeAnalytics.sendChipTapOnMore(homeMoreClick.getBundle() .getTag(), chip.getName()); } }) .observeOn(viewScheduler) .doOnNext(homeNavigator::navigateWithAction) .retry()) .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY)) .subscribe(homeClick -> { }, throwable -> { throw new OnErrorNotImplementedException(throwable); }); }
Example #22
Source File: HomeContainerPresenter.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@VisibleForTesting public void handleClickOnGamesChip() { view.getLifecycleEvent() .filter(event -> event.equals(View.LifecycleEvent.CREATE)) .flatMap(__ -> view.gamesChipClicked()) .doOnNext(isChecked -> { if (isChecked) { homeContainerNavigator.loadGamesHomeContent(); chipManager.setCurrentChip(ChipManager.Chip.GAMES); } else { homeContainerNavigator.loadMainHomeContent(); chipManager.setCurrentChip(null); } homeAnalytics.sendChipInteractEvent(ChipManager.Chip.GAMES.getName()); homeAnalytics.sendChipHomeInteractEvent(ChipManager.Chip.GAMES.getName()); }) .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY)) .subscribe(__ -> { }, err -> { throw new OnErrorNotImplementedException(err); }); }
Example #23
Source File: HomeContainerPresenter.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@VisibleForTesting public void handleClickOnAppsChip() { view.getLifecycleEvent() .filter(event -> event.equals(View.LifecycleEvent.CREATE)) .flatMap(__ -> view.appsChipClicked()) .doOnNext(isChecked -> { if (isChecked) { homeContainerNavigator.loadAppsHomeContent(); chipManager.setCurrentChip(ChipManager.Chip.APPS); } else { homeContainerNavigator.loadMainHomeContent(); chipManager.setCurrentChip(null); } homeAnalytics.sendChipInteractEvent(ChipManager.Chip.APPS.getName()); homeAnalytics.sendChipHomeInteractEvent(ChipManager.Chip.APPS.getName()); }) .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY)) .subscribe(__ -> { }, err -> { throw new OnErrorNotImplementedException(err); }); }
Example #24
Source File: MoreBundlePresenter.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@VisibleForTesting public void handleAdClick() { view.getLifecycleEvent() .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE)) .flatMap(created -> view.adClicked() .map(AdHomeEvent::getAdClick) .map(adMapper::mapAdToSearchAd) .observeOn(viewScheduler) .doOnNext(result -> homeNavigator.navigateToAppView(result.getTag(), result.getSearchAdResult())) .retry()) .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY)) .subscribe(homeClick -> { }, throwable -> { throw new OnErrorNotImplementedException(throwable); }); }
Example #25
Source File: AppsPresenter.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
private void loadUserImage() { view.getLifecycleEvent() .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE)) .flatMap(created -> accountManager.accountStatus()) .flatMap(account -> getUserAvatar(account)) .observeOn(viewScheduler) .doOnNext(userAvatarUrl -> { if (userAvatarUrl != null) { view.setUserImage(userAvatarUrl); } else { view.setDefaultUserImage(); } view.showAvatar(); }) .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY)) .subscribe(__ -> { }, throwable -> { throw new OnErrorNotImplementedException(throwable); }); }
Example #26
Source File: RxSyncScheduler.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
private void schedulePeriodicSync(Sync sync) { if (isSyncScheduled(sync.getId())) { return; } subscriptionStorage.put(sync.getId(), Observable.interval(sync.getTrigger(), sync.getInterval(), TimeUnit.MILLISECONDS) .switchMap(__ -> sync.execute() .doOnError(throwable -> consoleLogger.log(throwable)) .onErrorComplete() .toObservable()) .subscribe(__ -> { }, throwable -> { throw new OnErrorNotImplementedException(throwable); })); }
Example #27
Source File: MainPresenter.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
private void setupUpdatesNumber() { view.getLifecycleEvent() .filter(lifecycleEvent -> lifecycleEvent == View.LifecycleEvent.CREATE) .flatMap(__ -> updatesManager.getUpdatesNumber()) .observeOn(viewScheduler) .doOnNext(updates -> { if (updates > 0) { view.showUpdatesNumber(updates); } else { view.hideUpdatesBadge(); } }) .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY)) .subscribe(__ -> { }, throwable -> { throw new OnErrorNotImplementedException(throwable); }); }
Example #28
Source File: SearchResultPresenter.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@VisibleForTesting public void handleClickOnBottomNavWithResults() { view.getLifecycleEvent() .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE)) .flatMap(created -> bottomNavigator.navigationEvent() .filter(navigationEvent -> bottomNavigationMapper.mapItemClicked(navigationEvent) .equals(BottomNavigationItem.SEARCH)) .observeOn(viewScheduler) .filter(navigated -> view.hasResults()) .doOnNext(__ -> view.scrollToTop()) .retry()) .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY)) .subscribe(__ -> { }, throwable -> { throw new OnErrorNotImplementedException(throwable); }); }
Example #29
Source File: SearchResultPresenter.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@VisibleForTesting public void handleClickOnBottomNavWithoutResults() { view.getLifecycleEvent() .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE)) .flatMap(created -> bottomNavigator.navigationEvent() .filter(navigationEvent -> bottomNavigationMapper.mapItemClicked(navigationEvent) .equals(BottomNavigationItem.SEARCH)) .observeOn(viewScheduler) .filter(navigated -> !view.hasResults()) .doOnNext(__ -> view.focusInSearchBar()) .retry()) .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY)) .subscribe(__ -> { }, throwable -> { throw new OnErrorNotImplementedException(throwable); }); }
Example #30
Source File: EventSummaryInteractor.java From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void getSectionCompletion(@Nullable String sectionUid) { Flowable<List<FieldViewModel>> fieldsFlowable = eventSummaryRepository.list(sectionUid, eventUid); Flowable<Result<RuleEffect>> ruleEffectFlowable = eventSummaryRepository.calculate().subscribeOn(schedulerProvider.computation()) .onErrorReturn(throwable -> Result.failure(new Exception(throwable))); // Combining results of two repositories into a single stream. Flowable<List<FieldViewModel>> viewModelsFlowable = Flowable.zip(fieldsFlowable, ruleEffectFlowable, this::applyEffects); compositeDisposable.add(viewModelsFlowable .subscribeOn(schedulerProvider.io()) .observeOn(schedulerProvider.ui()) .subscribe(view.showFields(sectionUid), throwable -> { throw new OnErrorNotImplementedException(throwable); })); }