return
}
//资源打包成zip文件放到了服务器上,所以下载下来要解压缩
LottieAnimationUtils.unZip(download.file, parentPath)
downloadCount(true)
}
override fun onError(download: Download, error: Error, throwable: Throwable?) {
if (download.group != groupId) {
return
}
downloadCount(false)
}
private val downloadCount: (Boolean) -> Unit = {
downloaded++
if (downloaded == num) {
callback?.invoke(it)
fetch.removeListener(this)
}
}
}
fun downloadList(pathList: List, priority: Priority = Priority.NORMAL, callback: ((Boolean) -> Unit)? = null) {
val groupId = Random.nextInt()
pathList.filter {
//本地文件不存在的才下载
!File(parentPath + File.separator + it).exists()
}.flatMap { path ->
arrayListOf(Request(“ F i l e D o w n l o a d C o n s t a n t . B a s e C o n f i g . G I F T P A T H / {FileDownloadConstant.BaseConfig.GIFT_PATH}/ FileDownloa