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));
}
});
}
Aggregations