Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void initLogout() {
- RxNavi.observe(naviComponent, Event.VIEW_CREATED)
- .filter(viewCreated -> accountPresenter.isLoggedIn(getContext()))
- .observeOn(AndroidSchedulers.mainThread())
- .doOnNext(viewCreated -> viewCreated.view()
- .findViewById(R.id.account_divider_logout).setVisibility(View.VISIBLE))
- .map(viewCreated -> {
- View logoutButton = viewCreated.view().findViewById(R.id.account_logout);
- logoutButton.setVisibility(View.VISIBLE);
- return logoutButton;
- })
- .flatMap(RxView::clicks)
- .switchMap(aVoid -> getLogoutConfirmationObservable())
- .filter(confirmed -> confirmed)
- .doOnNext(aVoid -> showProgressDialog(false))
- .observeOn(Schedulers.io())
- .flatMap(aVoid -> accountPresenter.onLogoutConfirmedObservable(getContext()))
- .observeOn(AndroidSchedulers.mainThread())
- .doOnNext(confirmed -> hideProgressDialog())
- .takeUntil(RxNavi.observe(naviComponent, Event.DESTROY))
- .subscribe(
- confirmed -> {
- SkyfishUi.lure().launchSfeLoginForm(getContext());
- },
- throwable -> {
- LogUtils.error(TAG, "Error in initLogout", throwable);
- accountPresenter.handleErrorGenerally(throwable, baseActivity);
- }
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement