getMulitiMessageFileExt static method

String getMulitiMessageFileExt(
  1. Map<String, dynamic> elem,
  2. int image_type,
  3. bool isSnap
)

Implementation

static String getMulitiMessageFileExt(
  Map<String, dynamic> elem,
  int image_type,
  bool isSnap,
) {
  int elem_type = elem["elem_type"] ?? 0;
  String ext = "";
  if (elem_type == 1) {
    if (image_type == 0) {
      ext = getExtFormUrl(elem["image_elem_orig_url"] ?? "");
    } else if (image_type == 1) {
      ext = getExtFormUrl(elem["image_elem_thumb_url"] ?? "");
    } else {
      ext = getExtFormUrl(elem["image_elem_large_url"] ?? "");
    }
  } else if (elem_type == 2) {
    // 声音
    ext = getExtFormUrl(elem["sound_elem_url"] ?? "");
  } else if (elem_type == 4) {
    // file
    ext = getExtFormUrl(elem["file_elem_url"] ?? "");
  } else if (elem_type == 9) {
    if (isSnap) {
      ext = getExtFormUrl(elem["video_elem_image_url"] ?? "");
    } else {
      ext = getExtFormUrl(elem["video_elem_video_url"] ?? "");
    }
    // 视频
  }
  return ext;
}