清除全部未读数

This commit is contained in:
18401019693 2022-09-05 14:54:21 +08:00
parent 52363a887d
commit ef9c218f87
2 changed files with 10 additions and 7 deletions

View File

@ -192,7 +192,7 @@ public class PDLiveConversationListActivity extends AbsActivity implements View.
container.post(new Runnable() { container.post(new Runnable() {
@Override @Override
public void run() { public void run() {
showGuideView(); // showGuideView();
} }
}); });
} }
@ -418,7 +418,9 @@ public class PDLiveConversationListActivity extends AbsActivity implements View.
.setMessageReadAll(new com.yunbao.common.http.base.HttpCallback<String>() { .setMessageReadAll(new com.yunbao.common.http.base.HttpCallback<String>() {
@Override @Override
public void onSuccess(String data) { public void onSuccess(String data) {
textNewsNotice.setVisibility(View.GONE);
textNewsInteraction.setVisibility(View.GONE);
textNewsOnline.setVisibility(View.GONE);
} }
@Override @Override
@ -427,6 +429,8 @@ public class PDLiveConversationListActivity extends AbsActivity implements View.
} }
}); });
// IMCenter.getInstance().clearMessagesUnreadStatus(); // IMCenter.getInstance().clearMessagesUnreadStatus();
MessageIMManager.get(mContext).setSystemNumber(0);
EventBus.getDefault().post(new MessageIMEvent().setNumber(0));
} }
@Override @Override

View File

@ -286,11 +286,11 @@ public class ConversationIMListManager {
RongIMClient.getInstance().getConversationListByPage(new RongIMClient.ResultCallback<List<Conversation>>() { RongIMClient.getInstance().getConversationListByPage(new RongIMClient.ResultCallback<List<Conversation>>() {
@Override @Override
public void onSuccess(List<Conversation> conversations) { public void onSuccess(List<Conversation> conversations) {
if (conversations.size() < 10) { if (conversations != null && conversations.size() < 10) {
if (!clearMessages) { if (!clearMessages) {
for (Conversation conversation : conversations) { for (Conversation conversation : conversations) {
UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(conversation.getTargetId()); UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(conversation.getTargetId());
if (!TextUtils.isEmpty(userInfo.getExtra())) { if (userInfo != null && !TextUtils.isEmpty(userInfo.getExtra())) {
IMLoginModel model = GsonUtils.fromJson(userInfo.getExtra(), IMLoginModel.class); IMLoginModel model = GsonUtils.fromJson(userInfo.getExtra(), IMLoginModel.class);
if (TextUtils.equals(model.getIsAdmin(), "1")) { if (TextUtils.equals(model.getIsAdmin(), "1")) {
targetId = userInfo.getUserId(); targetId = userInfo.getUserId();
@ -299,11 +299,10 @@ public class ConversationIMListManager {
} }
} else { } else {
for (Conversation conversation : conversations) { for (Conversation conversation : conversations) {
RongIMClient.getInstance() IMCenter.getInstance()
.clearMessagesUnreadStatus( .clearMessagesUnreadStatus(
Conversation.ConversationType.PRIVATE, Conversation.ConversationType.PRIVATE,
conversation.getTargetId(), conversation.getTargetId(), null);
conversation.getSentTime(), null);
} }
} }