[FIX] uploadProgress is not a function (#656)
This commit is contained in:
parent
b1236f2f21
commit
025c5cba74
|
@ -51,7 +51,7 @@ export async function sendFileMessage(rid, fileInfo) {
|
||||||
try {
|
try {
|
||||||
database.create('uploads', fileInfo, true);
|
database.create('uploads', fileInfo, true);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log('sendFileMessage -> create uploads 1', e);
|
return log('sendFileMessage -> create uploads 1', e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -62,16 +62,18 @@ export async function sendFileMessage(rid, fileInfo) {
|
||||||
}, data);
|
}, data);
|
||||||
// Workaround for https://github.com/joltup/rn-fetch-blob/issues/96
|
// Workaround for https://github.com/joltup/rn-fetch-blob/issues/96
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
if (promises[fileInfo.path] && promises[fileInfo.path].uploadProgress) {
|
||||||
promises[fileInfo.path].uploadProgress((loaded, total) => {
|
promises[fileInfo.path].uploadProgress((loaded, total) => {
|
||||||
database.write(() => {
|
database.write(() => {
|
||||||
fileInfo.progress = Math.floor((loaded / total) * 100);
|
fileInfo.progress = Math.floor((loaded / total) * 100);
|
||||||
try {
|
try {
|
||||||
database.create('uploads', fileInfo, true);
|
database.create('uploads', fileInfo, true);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log('sendFileMessage -> create uploads 2', e);
|
return log('sendFileMessage -> create uploads 2', e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
await promises[fileInfo.path];
|
await promises[fileInfo.path];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue