public void safeReloadData () { if(getView() != null && ChatSDK.auth().userAuthenticated()) { reloadData(); } } public abstract void reloadData();
public User currentUserModel(){ String entityID = ChatSDK.auth().getCurrentUserEntityID(); if(cachedUser == null || !cachedUser.getEntityID().equals(entityID)) { if (StringUtils.isNotEmpty(entityID)) { cachedUser = DaoCore.fetchEntityWithEntityID(User.class, entityID); } else { cachedUser = null; } } return cachedUser; }
protected void logout () { disposableList.add(ChatSDK.auth().logout() .observeOn(AndroidSchedulers.mainThread()) .subscribe(() -> ChatSDK.ui().startLoginActivity(getApplicationContext(), false), throwable -> { ChatSDK.logError(throwable); Toast.makeText(EditProfileActivity.this, throwable.getLocalizedMessage(), Toast.LENGTH_SHORT).show(); })); }
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(); }); }
protected Completable requestNewPassword (String email) { return ChatSDK.auth().sendPasswordResetMail(email); }
if (ChatSDK.auth() == null || !ChatSDK.auth().userAuthenticatedThisSession() || ChatSDK.config().backgroundPushTestModeEnabled) { appIntent = new Intent(context, ChatSDK.ui().getLoginActivity()); } else if (AppBackgroundMonitor.shared().inBackground() && ChatSDK.auth().userAuthenticatedThisSession()) { appIntent = new Intent(context, ChatSDK.ui().getChatActivity());
if(!ChatSDK.auth().accountTypeEnabled(AccountDetails.Type.Facebook)) { ((ViewGroup) btnFacebook.getParent()).removeView(btnFacebook); if(!ChatSDK.auth().accountTypeEnabled(AccountDetails.Type.Twitter)) { ((ViewGroup) btnTwitter.getParent()).removeView(btnTwitter); if(!ChatSDK.auth().accountTypeEnabled(AccountDetails.Type.Google)) { ((ViewGroup) btnGoogle.getParent()).removeView(btnGoogle); if(!ChatSDK.auth().accountTypeEnabled(AccountDetails.Type.Anonymous)) { ((ViewGroup) btnAnonymous.getParent()).removeView(btnAnonymous);
public void authenticateWithDetails (AccountDetails details) { if(authenticating) { return; } authenticating = true; showProgressDialog(getString(R.string.connecting)); ChatSDK.auth().authenticate(details) .observeOn(AndroidSchedulers.mainThread()) .doFinally(() -> { authenticating = false; dismissProgressDialog(); }) .subscribe(this::afterLogin, e -> { toastErrorMessage(e, false); ChatSDK.logError(e); }); }
@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(); }); } }
@OnLifecycleEvent(Lifecycle.Event.ON_START) public void onAppForeground () { inBackground = false; if(ChatSDK.auth().userAuthenticated() && ChatSDK.config().disconnectFromFirebaseWhenInBackground) { ChatSDK.core().goOnline(); } }