27
This commit is contained in:
@@ -245,6 +245,23 @@ const get_absolute_path = (fn)=>{
|
||||
return plus.io.convertLocalFileSystemURL(fn);
|
||||
}
|
||||
const pendingDownloads = new Map();
|
||||
const getCachePath = (url,saveDir)=>{
|
||||
if(!url || !url.startsWith('http')){
|
||||
return url;
|
||||
}
|
||||
const key = md5(url);
|
||||
var ext = "png"
|
||||
if(url.toLowerCase().indexOf('.mp4')!==-1){
|
||||
ext = "mp4";
|
||||
}
|
||||
let cacheDir = plus.io.convertLocalFileSystemURL(`_doc/{{dir}}/{{key}}.{{ext}}`);
|
||||
if(uni.getSystemInfoSync().osName == 'android'){
|
||||
cacheDir = cacheDir.replace('apps/'+plus.runtime.appid+'/doc','cache');
|
||||
}
|
||||
return cacheDir.replace('{{dir}}',saveDir)
|
||||
.replace('{{key}}',key)
|
||||
.replace('{{ext}}',ext);
|
||||
}
|
||||
const cacheFile = (url, saveDir,progressCallback) => {
|
||||
//console.log(url);
|
||||
// #ifndef APP
|
||||
@@ -462,6 +479,7 @@ export default{
|
||||
toMapAPP,
|
||||
cacheFile,
|
||||
fileExsit,
|
||||
getCachePath,
|
||||
get_absolute_path,
|
||||
// #ifdef APP
|
||||
downloadFile,
|
||||
|
||||
Reference in New Issue
Block a user