Browse Source

fixed file downloads for chrome app

master
Igor Zhukov 10 years ago
parent
commit
d31f4f0476
  1. 8
      app/js/lib/mtproto_wrapper.js
  2. 4
      app/js/services.js

8
app/js/lib/mtproto_wrapper.js

@ -467,6 +467,14 @@ angular.module('izhukov.mtproto.wrapper', ['izhukov.utils', 'izhukov.mtproto'])
writeFileDeferred; writeFileDeferred;
if (fileWriter.length) { if (fileWriter.length) {
startOffset = fileWriter.length; startOffset = fileWriter.length;
if (startOffset >= size) {
if (toFileEntry) {
deferred.resolve(fileWriter.finalize());
} else {
deferred.resolve(cachedDownloads[fileName] = fileWriter.finalize());
}
return;
}
fileWriter.seek(startOffset); fileWriter.seek(startOffset);
deferred.notify({done: startOffset, total: size}); deferred.notify({done: startOffset, total: size});
} }

4
app/js/services.js

@ -2855,11 +2855,13 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
}); });
downloadPromise.then(function (blob) { downloadPromise.then(function (blob) {
delete historyDoc.progress;
if (blob) {
FileManager.getFileCorrectUrl(blob, doc.mime_type).then(function (url) { FileManager.getFileCorrectUrl(blob, doc.mime_type).then(function (url) {
historyDoc.url = $sce.trustAsResourceUrl(url); historyDoc.url = $sce.trustAsResourceUrl(url);
}) })
delete historyDoc.progress;
historyDoc.downloaded = true; historyDoc.downloaded = true;
}
console.log('file save done'); console.log('file save done');
}, function (e) { }, function (e) {
console.log('document download failed', e); console.log('document download failed', e);

Loading…
Cancel
Save