getRecentName function

String getRecentName(
  1. RecentChatData item
)

Implementation

String getRecentName(RecentChatData item) {
  if (!Constants.enableContactSync) {
    /*return item.name.toString().checkNull().isEmpty
        ? item.nickName.toString()
        : item.name.toString();*/
    return item.profileName.checkNull().isEmpty
        ? item.nickName.checkNull().isNotEmpty
            ? item.nickName.checkNull()
            : getMobileNumberFromJid(item.jid.checkNull())
        : item.profileName.checkNull();
  } else {
    if (item.jid.checkNull() == SessionManagement.getUserJID()) {
      return Constants.you;
    } else if (item.isDeletedContact()) {
      mirrorFlyLog('isDeletedContact', item.isDeletedContact().toString());
      return Constants.deletedUser;
    } else if (item.isUnknownContact() || item.nickName.checkNull().isEmpty) {
      mirrorFlyLog('isUnknownContact', item.jid.toString());
      return getMobileNumberFromJid(item.jid.checkNull());
    } else {
      mirrorFlyLog('nickName', item.nickName.toString());
      return item.nickName.checkNull();
    }
  }
}