切换账号时:
ChatManagerHolder.gChatManager.connect(loginData.getData().getMemberId(), loginData.getData().getIm_token());
EventBus.getDefault().post(new MessageEvent("changeaccount"));
收到信息时:
case "changeaccount":
String customerId = PreferencesUtil.get(getActivity(), Constants.PreferencesUtilKey.KeFuId, "").toString();
Log.e("切换","==="+customerId);
String roomId = PreferencesUtil.get(getActivity(), Constants.PreferencesUtilKey.roomId, "").toString();
userViewModel.getUserInfoAsync(customerId, true)
.observe(this, info -> {
if (info != null) {
updateUserInfo(info);
}
});
conversation = new Conversation(Conversation.ConversationType.ChatRoom, roomId);
setupConversation(conversation, "", -1, null);