feat:完成消息撤回后本地删除消息等操作
This commit is contained in:
@@ -389,6 +389,7 @@ public class XChatApplication extends BaseApp {
|
||||
options.messageNotifierCustomization = messageNotifierCustomization;
|
||||
|
||||
options.appKey = Constants.nimAppKey;
|
||||
options.shouldConsiderRevokedMessageUnreadCount = true;
|
||||
|
||||
// 配置保存图片,文件,log 等数据的目录
|
||||
// 如果 options 中没有设置这个值,SDK 会使用下面代码示例中的位置作为 SDK 的数据目录。
|
||||
|
@@ -402,10 +402,10 @@ public class BottomView extends FrameLayout implements View.OnClickListener {
|
||||
}
|
||||
ImageView ivAvatar = contentView.findViewById(R.id.iv_avatar);
|
||||
TextView tvNickname = contentView.findViewById(R.id.tv_nickname);
|
||||
TextView tvContent = contentView.findViewById(R.id.tv_content);
|
||||
// TextView tvContent = contentView.findViewById(R.id.tv_content);
|
||||
ImageLoadUtils.loadAvatar(userInfo.getAvatar(), ivAvatar);
|
||||
tvNickname.setText(StringExtensionKt.subAndReplaceDot(userInfo.getName(), 4));
|
||||
tvContent.setText(ImHelperUtils.getMsgDigest(recentContact));
|
||||
// tvContent.setText(ImHelperUtils.getMsgDigest(recentContact));
|
||||
|
||||
contentView.setOnClickListener(v -> RoomMsgActivity.startForPrivateChat(getContext(), recentContact.getFromAccount()));
|
||||
int[] vLoc = new int[2];
|
||||
|
@@ -44,6 +44,6 @@
|
||||
android:lines="1"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="10dp"
|
||||
tools:text="一二三四五六七八" />
|
||||
android:text="收到一条新消息"/>
|
||||
|
||||
</LinearLayout>
|
@@ -27,6 +27,7 @@ import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum;
|
||||
import com.netease.nimlib.sdk.msg.model.IMMessage;
|
||||
import com.netease.nimlib.sdk.msg.model.QueryDirectionEnum;
|
||||
import com.netease.nimlib.sdk.msg.model.RecentContact;
|
||||
import com.netease.nimlib.sdk.msg.model.RevokeMsgNotification;
|
||||
import com.nnbc123.core.activity.event.ActivityEvent;
|
||||
import com.nnbc123.core.auth.AuthModel;
|
||||
import com.nnbc123.core.event.RoomInviteEvent;
|
||||
@@ -80,6 +81,7 @@ public class IMMessageManager {
|
||||
|
||||
registerMsgStatusObserver();
|
||||
|
||||
registerRevokeMessageObserver();
|
||||
// pullMessageHistory();
|
||||
}
|
||||
|
||||
@@ -96,6 +98,20 @@ public class IMMessageManager {
|
||||
msgStatusObserver, true);
|
||||
}
|
||||
|
||||
private void registerRevokeMessageObserver() {
|
||||
Observer<RevokeMsgNotification> revokeMessageObserver = new Observer<RevokeMsgNotification>() {
|
||||
@Override
|
||||
public void onEvent(RevokeMsgNotification notification) {
|
||||
if (notification == null || notification.getMessage() == null) {
|
||||
return;
|
||||
}
|
||||
IMMessage message = notification.getMessage();
|
||||
NIMClient.getService(MsgService.class).deleteRecentContact2(message.getSessionId(), message.getSessionType());
|
||||
}
|
||||
};
|
||||
NIMClient.getService(MsgServiceObserve.class).observeRevokeMessage(revokeMessageObserver, true);
|
||||
}
|
||||
|
||||
private void registerRecentContactObserver() {
|
||||
//会话改变监听
|
||||
Observer<List<RecentContact>> recentContactObserver = (Observer<List<RecentContact>>) recentContacts -> {
|
||||
|
Reference in New Issue
Block a user