3131import com .netease .nimlib .sdk .NIMClient ;
3232import com .netease .nimlib .sdk .friend .FriendService ;
3333import com .netease .nimlib .sdk .friend .model .AddFriendNotify ;
34+ import com .netease .nimlib .sdk .msg .MsgService ;
3435import com .netease .nimlib .sdk .msg .attachment .AudioAttachment ;
3536import com .netease .nimlib .sdk .msg .attachment .ImageAttachment ;
3637import com .netease .nimlib .sdk .msg .attachment .LocationAttachment ;
3738import com .netease .nimlib .sdk .msg .attachment .MsgAttachment ;
39+ import com .netease .nimlib .sdk .msg .attachment .NotificationAttachment ;
3840import com .netease .nimlib .sdk .msg .attachment .VideoAttachment ;
3941import com .netease .nimlib .sdk .msg .constant .MsgDirectionEnum ;
4042import com .netease .nimlib .sdk .msg .constant .MsgTypeEnum ;
5052import com .netease .nimlib .sdk .uinfo .UserInfoProvider ;
5153import com .netease .nimlib .sdk .uinfo .model .NimUserInfo ;
5254
55+ import java .util .ArrayList ;
5356import java .util .HashMap ;
5457import java .util .List ;
5558import java .util .Map ;
@@ -67,6 +70,8 @@ public class ReactCache {
6770 public final static String observeFriend = "observeFriend" ;//'联系人'
6871 public final static String observeTeam = "observeTeam" ;//'群组'
6972 public final static String observeReceiveMessage = "observeReceiveMessage" ;//'接收消息'
73+
74+ public final static String observeDeleteMessage = "observeDeleteMessage" ;//'撤销后删除消息'
7075 public final static String observeReceiveSystemMsg = "observeReceiveSystemMsg" ;//'系统通知'
7176 public final static String observeMsgStatus = "observeMsgStatus" ;//'发送消息状态变化'
7277 public final static String observeAudioRecord = "observeAudioRecord" ;//'录音状态'
@@ -137,6 +142,35 @@ public static Object createRecentList(List<RecentContact> recents, int unreadNum
137142 map .putString ("fromAccount" , fromAccount );
138143
139144 String content = contact .getContent ();
145+ switch (contact .getMsgType ()) {
146+ case text :
147+ return contact .getContent ();
148+ case image :
149+ return "[图片]" ;
150+ case video :
151+ return "[视频]" ;
152+ case audio :
153+ return "[语音消息]" ;
154+ case location :
155+ return "[位置]" ;
156+ case tip :
157+ List <String > uuids = new ArrayList <>();
158+ uuids .add (contact .getRecentMessageId ());
159+ List <IMMessage > messages = NIMClient .getService (MsgService .class ).queryMessageListByUuidBlock (uuids );
160+ if (messages != null && messages .size () > 0 ) {
161+ content = messages .get (0 ).getContent ();
162+ }
163+ break ;
164+ case notification :
165+ if (sessionType == SessionTypeEnum .Team ) {
166+ content = TeamNotificationHelper .getTeamNotificationText (contact .getContactId (),
167+ contact .getFromAccount (),
168+ (NotificationAttachment ) contact .getAttachment ());
169+ }
170+ break ;
171+ default :
172+ break ;
173+ }
140174 map .putString ("time" , TimeUtil .getTimeShowString (contact .getTime (), true ));
141175
142176 String fromNick = "" ;
@@ -190,7 +224,7 @@ public static Object createRecentList(List<RecentContact> recents, int unreadNum
190224// if (sessionType == SessionTypeEnum.Team && !rpOpen.isSelf()) {
191225// content = "";
192226// } else {
193- content = rpOpen .getTipMsg (false );
227+ content = rpOpen .getTipMsg (false );
194228// }
195229 }
196230 break ;
0 commit comments