protected void authenticateWithCachedToken () { showProgressDialog(getString(R.string.authenticating)); signInButton.setEnabled(false); ChatSDK.auth().authenticateWithCachedToken() .observeOn(AndroidSchedulers.mainThread()) .doFinally(() -> { signInButton.setEnabled(true); dismissProgressDialog(); }) .subscribe(() -> { ChatSDK.ui().startMainActivity(SplashScreenActivity.this); }, throwable -> { // startAuthenticationActivity(); }); }
@Override protected void onResume() { super.onResume(); initListeners(); // If the logged out flag isn't set... if (getIntent() == null || getIntent().getExtras() == null || getIntent().getExtras().get(InterfaceManager.ATTEMPT_CACHED_LOGIN) == null || (boolean) getIntent().getExtras().get(InterfaceManager.ATTEMPT_CACHED_LOGIN)) { showProgressDialog(getString(R.string.authenticating)); ChatSDK.auth().authenticateWithCachedToken() .observeOn(AndroidSchedulers.mainThread()) .doFinally(this::dismissProgressDialog) .subscribe(this::afterLogin, throwable -> { // ChatSDK.logError(throwable); dismissProgressDialog(); }); } }