qbChatDialogToMap static method

Map<String, Object?> qbChatDialogToMap(
  1. QBDialog? dialog
)

Implementation

static Map<String, Object?> qbChatDialogToMap(QBDialog? dialog) {
  Map<String, Object?> map = Map();

  if (dialog == null) {
    return map;
  }

  map["isJoined"] = dialog.isJoined;
  map["createdAt"] = dialog.createdAt;
  map["lastMessage"] = dialog.lastMessage;
  map["lastMessageDateSent"] = dialog.lastMessageDateSent;
  map["lastMessageUserId"] = dialog.lastMessageUserId;
  map["name"] = dialog.name;
  map["photo"] = dialog.photo;
  map["type"] = dialog.type;
  map["unreadMessagesCount"] = dialog.unreadMessagesCount;
  map["updatedAt"] = dialog.updatedAt;
  map["userId"] = dialog.userId;
  map["roomJid"] = dialog.roomJid;
  map["id"] = dialog.id;
  map["occupantsIds"] = dialog.occupantsIds;

  // TODO: 2019-10-21 need to check this logic
  /*if (dialog.getCustomData() != null &&
      !TextUtils.isEmpty(dialog.getCustomData().getClassName())) {
    Map customDataMap = qbDialogCustomDataToMap(dialog.getCustomData());
    String className = dialog.getCustomData().getClassName();
    Map<String, Object> data = HashMap<>();
    data.put(className, customDataMap);
    map.put("customData", data);
  }*/

  return map;
}