Search in sources :

Example 1 with KeptGeneratedUsernameEvent

use of com.waz.zclient.core.controllers.tracking.events.onboarding.KeptGeneratedUsernameEvent 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)1 BaseScalaActivity (com.waz.zclient.BaseScalaActivity)1 KeptGeneratedUsernameEvent (com.waz.zclient.core.controllers.tracking.events.onboarding.KeptGeneratedUsernameEvent)1