退出登录调用 ChatManagerHolder.gChatManager.disconnect(true, false);退出连接,如果重新调用connect会显示connect status 为1,证明已经连接成功,但是调用ChatManager.Instance().getConversationListAsync方法毫无反应也不显示报错,打印日志的时候 KLog.d(TAG,"reloadConversationList:getWorkHandler");这个日志里面的打印也是没有调用;为什么连接成功了调用getConversationListAsync方法毫无反应;
ChatManager.Instance().getWorkHandler().post(() -> {
KLog.d(TAG,"reloadConversationList:getWorkHandler");
ChatManager.Instance().getConversationListAsync(types, lines, new GetConversationListCallback() {
@Override
public void onSuccess(List<ConversationInfo> conversationInfos) {
KLog.d(TAG,"reloadConversationList:"+conversationInfos.size());
conversationListLiveData.postValue(conversationInfos);
loadingCount.decrementAndGet();
}
@Override
public void onFail(int errorCode) {
KLog.d(TAG,"reloadConversationList errorCode:"+errorCode);
loadingCount.decrementAndGet();
}
});
});
测试过如果退出登录,手动杀死了app,再重新登录调用connect,连接成功而且调用这个getConversationListAsync会有数据返回;杀死就正常
这是调用退出登录的代码:
ChatManagerHolder.gChatManager.disconnect(true, false);
SharedPreferences sp = getSharedPreferences(Config.SP_CONFIG_FILE_NAME, Context.MODE_PRIVATE);
sp.edit().clear().apply();
sp = getSharedPreferences("moment", Context.MODE_PRIVATE);
sp.edit().clear().apply();
OKHttpHelper.clearCookies();
WebStorage.getInstance().deleteAllData();
CookieManager.getInstance().removeAllCookies(null);
CookieManager.getInstance().flush();