0

我不知道原因。但是应用程序停止了。完成下载文件后。在安卓设备上。

工作正常,直到你完成下载

有没有人有什么建议?

export const downloadFile = (userUid, video, teacher) => {
  return (dispatch) => {



let download = '';
RNFetchBlob
.config({
  fileCache : true,
})
.fetch('GET', video.video, {
  Authorization : 'Bearer access-token...',
})
.progress((received, total) => {
    //alert('progress' + (received / total) )
  let progress = (received / total) *100
  dispatch({
    type:'progressDownload',
    payload:{
      key: video.key,
      progress: progress
    }
  });
})
// when response status code is 200
.then((res) => {
  //FIM DO CARREGAMENTO
 dispatch({
    type:'finishDownload',
    payload:{
      key: video.key,
      progress: 100,
      status: 'completed',
      locate: {
        path: res.path(),
      }
    }
  });
})
// Status code is not 200
.catch((errorMessage, statusCode) => {
  alert(errorMessage)
}) 

} }

4

0 回答 0