2727import com .netease .im .uikit .contact .core .model .ContactDataList ;
2828import com .netease .im .uikit .contact .core .model .IContact ;
2929import com .netease .im .uikit .contact .core .model .TeamContact ;
30+ import com .netease .im .uikit .session .emoji .AitHelper ;
3031import com .netease .im .uikit .session .helper .TeamNotificationHelper ;
3132import com .netease .nimlib .sdk .NIMClient ;
3233import com .netease .nimlib .sdk .friend .FriendService ;
@@ -182,10 +183,20 @@ public static Object createRecentList(List<RecentContact> recents, int unreadNum
182183
183184 fromNick = TextUtils .isEmpty (fromNick ) ? NimUserInfoCache .getInstance ().getUserDisplayName (fromAccount ) : fromNick ;
184185 map .putString ("nick" , fromNick );
185- String nickName = "" ;
186+ String teamNick = "" ;
186187 if (contact .getSessionType () == SessionTypeEnum .Team && !TextUtils .equals (LoginService .getInstance ().getAccount (), fromAccount )) {
187- if (!TextUtils .isEmpty (fromNick )) {
188- nickName = fromNick + ":" ;
188+
189+ if ((contact .getAttachment () instanceof NotificationAttachment )) {
190+ String tid = contact .getContactId ();
191+ teamNick = getTeamUserDisplayName (tid , fromAccount );
192+ teamNick += ": " ;
193+ if (AitHelper .hasAitExtention (contact )) {
194+ if (contact .getUnreadCount () == 0 ) {
195+ AitHelper .clearRecentContactAited (contact );
196+ } else {
197+ content = AitHelper .getAitAlertString (content );
198+ }
199+ }
189200 }
190201 }
191202 CustomAttachment attachment = null ;
@@ -219,13 +230,13 @@ public static Object createRecentList(List<RecentContact> recents, int unreadNum
219230 break ;
220231 case CustomAttachmentType .RedPacketOpen :
221232 if (attachment instanceof RedPacketOpenAttachement ) {
233+ teamNick = "" ;
222234 RedPacketOpenAttachement rpOpen = (RedPacketOpenAttachement ) attachment ;
223- nickName = "" ;
224- // if (sessionType == SessionTypeEnum.Team && !rpOpen.isSelf()) {
225- // content = "";
226- // } else {
227- content = rpOpen .getTipMsg (false );
228- // }
235+ if (sessionType == SessionTypeEnum .Team && !rpOpen .isSelf ()) {
236+ content = "" ;
237+ } else {
238+ content = rpOpen .getTipMsg (false );
239+ }
229240 }
230241 break ;
231242 default :
@@ -238,7 +249,8 @@ public static Object createRecentList(List<RecentContact> recents, int unreadNum
238249 break ;
239250 }
240251 }
241- map .putString ("content" , nickName + content );
252+ content = teamNick + content ;
253+ map .putString ("content" , content );
242254 array .pushMap (map );
243255 }
244256 LogUtil .i (TAG , array + "" );
@@ -248,6 +260,10 @@ public static Object createRecentList(List<RecentContact> recents, int unreadNum
248260 return writableMap ;
249261 }
250262
263+ private static String getTeamUserDisplayName (String tid , String account ) {
264+ return TeamDataCache .getInstance ().getTeamMemberDisplayName (tid , account );
265+ }
266+
251267 static Pattern pattern = Pattern .compile ("\\ d{5}" );
252268
253269 static boolean hasFilterFriend (String contactId ) {
@@ -585,7 +601,7 @@ public static Object createMessageList(List<IMMessage> messageList) {
585601 }
586602 }
587603 }
588- return writableArray . size () > 0 ? writableArray : null ;
604+ return writableArray ;
589605 }
590606
591607 public static Object createTeamInfo (Team team ) {
@@ -701,7 +717,12 @@ public static WritableMap createMessage(IMMessage item) {
701717 String fromAccount = item .getFromAccount ();
702718 String fromNick = item .getFromNick ();
703719 user .putString ("_id" , fromAccount );
704- user .putString ("name" , !TextUtils .isEmpty (fromNick ) ? fromNick : NimUserInfoCache .getInstance ().getUserDisplayName (fromAccount ));
720+
721+ if (item .getSessionType () == SessionTypeEnum .Team && !TextUtils .equals (LoginService .getInstance ().getAccount (), fromAccount )) {
722+ user .putString ("name" , getTeamUserDisplayName (item .getSessionId (), fromAccount ));
723+ } else {
724+ user .putString ("name" , !TextUtils .isEmpty (fromNick ) ? fromNick : NimUserInfoCache .getInstance ().getUserDisplayName (fromAccount ));
725+ }
705726 String avatar = NimUserInfoCache .getInstance ().getAvatar (fromAccount );
706727 user .putString ("avatar" , avatar );
707728 user .putString ("avatarLocal" , ImageLoaderKit .getMemoryCachedAvatar (avatar ));
0 commit comments