Skip to content

Commit

Permalink
修复消息被远程更新时,会话界面消息可能显示错误
Browse files Browse the repository at this point in the history
  • Loading branch information
imndx committed Mar 4, 2025
1 parent f683f80 commit d0b5856
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package cn.wildfire.chat.kit.conversation;

import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand Down Expand Up @@ -47,6 +48,7 @@
import cn.wildfirechat.remote.ChatManager;

public class ConversationMessageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private static final String TAG = "ConvMsgAdapter";
private ConversationFragment fragment;

public static int MODE_NORMAL = 0;
Expand Down Expand Up @@ -160,6 +162,11 @@ public void addNewMessage(UiMessage message) {
if (index >= 0) {
updateMessage(index, message);
return;
}else {
if(!messages.isEmpty() && messages.get(0).message.serverTime > message.message.serverTime){
Log.d(TAG, "msg timestamp < the first msg's timestamp, maybe update old message content, ignore");
return;
}
}
messages.add(message);
notifyItemInserted(messages.size() - 1);
Expand Down

0 comments on commit d0b5856

Please sign in to comment.