Skip to content
Snippets Groups Projects
Unverified Commit 025c5cba authored by Diego Mello's avatar Diego Mello Committed by GitHub
Browse files

[FIX] uploadProgress is not a function (#656)

parent b1236f2f
No related branches found
No related tags found
No related merge requests found
......@@ -51,7 +51,7 @@ export async function sendFileMessage(rid, fileInfo) {
try {
database.create('uploads', fileInfo, true);
} 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);
// Workaround for https://github.com/joltup/rn-fetch-blob/issues/96
setTimeout(() => {
promises[fileInfo.path].uploadProgress((loaded, total) => {
database.write(() => {
fileInfo.progress = Math.floor((loaded / total) * 100);
try {
database.create('uploads', fileInfo, true);
} catch (e) {
log('sendFileMessage -> create uploads 2', e);
}
if (promises[fileInfo.path] && promises[fileInfo.path].uploadProgress) {
promises[fileInfo.path].uploadProgress((loaded, total) => {
database.write(() => {
fileInfo.progress = Math.floor((loaded / total) * 100);
try {
database.create('uploads', fileInfo, true);
} catch (e) {
return log('sendFileMessage -> create uploads 2', e);
}
});
});
});
}
});
await promises[fileInfo.path];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment