Search in sources :

Example 6 with CredentialsUpdateListener

use of com.waz.api.CredentialsUpdateListener in project wire-android by wireapp.

the class ConversationListManagerFragment method onKeepUsernameChosen.

@Override
public void onKeepUsernameChosen(String username) {
    getControllerFactory().getUsernameController().closeFirstAssignUsernameScreen();
    hideFirstAssignUsernameScreen();
    getStoreFactory().getZMessagingApiStore().getApi().getSelf().setUsername(username, new CredentialsUpdateListener() {

        @Override
        public void onUpdated() {
            ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new KeptGeneratedUsernameEvent(true));
        }

        @Override
        public void onUpdateFailed(int code, String message, String label) {
            Toast.makeText(getActivity(), getString(R.string.username__set__toast_error), Toast.LENGTH_SHORT).show();
            getControllerFactory().getUsernameController().logout();
            getControllerFactory().getUsernameController().setUser(getStoreFactory().getZMessagingApiStore().getApi().getSelf());
            ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new KeptGeneratedUsernameEvent(false));
        }
    });
}
Also used : CredentialsUpdateListener(com.waz.api.CredentialsUpdateListener) BaseScalaActivity(com.waz.zclient.BaseScalaActivity) KeptGeneratedUsernameEvent(com.waz.zclient.core.controllers.tracking.events.onboarding.KeptGeneratedUsernameEvent)

Aggregations

CredentialsUpdateListener (com.waz.api.CredentialsUpdateListener)6 SuppressLint (android.annotation.SuppressLint)2 View (android.view.View)1 BaseScalaActivity (com.waz.zclient.BaseScalaActivity)1 KeptGeneratedUsernameEvent (com.waz.zclient.core.controllers.tracking.events.onboarding.KeptGeneratedUsernameEvent)1 LoadingIndicatorView (com.waz.zclient.views.LoadingIndicatorView)1