|
|
@ -487,14 +487,14 @@ angular.module('izhukov.mtproto.wrapper', ['izhukov.utils', 'izhukov.mtproto']) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
console.log(dT(), 'Dload file', dcID, location, size); |
|
|
|
// console.log(dT(), 'Dload file', dcID, location, size);
|
|
|
|
var fileName = getFileName(location), |
|
|
|
var fileName = getFileName(location), |
|
|
|
toFileEntry = options.toFileEntry || null, |
|
|
|
toFileEntry = options.toFileEntry || null, |
|
|
|
cachedPromise = cachedSavePromises[fileName] || cachedDownloadPromises[fileName]; |
|
|
|
cachedPromise = cachedSavePromises[fileName] || cachedDownloadPromises[fileName]; |
|
|
|
|
|
|
|
|
|
|
|
var fileStorage = getFileStorage(); |
|
|
|
var fileStorage = getFileStorage(); |
|
|
|
|
|
|
|
|
|
|
|
console.log(dT(), 'fs', fileStorage.name, fileName, cachedPromise); |
|
|
|
// console.log(dT(), 'fs', fileStorage.name, fileName, cachedPromise);
|
|
|
|
|
|
|
|
|
|
|
|
if (cachedPromise) { |
|
|
|
if (cachedPromise) { |
|
|
|
if (toFileEntry) { |
|
|
|
if (toFileEntry) { |
|
|
@ -520,9 +520,7 @@ angular.module('izhukov.mtproto.wrapper', ['izhukov.utils', 'izhukov.mtproto']) |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(dT(), 'fs get file', fileName, size); |
|
|
|
|
|
|
|
fileStorage.getFile(fileName, size).then(function (blob) { |
|
|
|
fileStorage.getFile(fileName, size).then(function (blob) { |
|
|
|
console.log(dT(), 'fs got file', fileName, size); |
|
|
|
|
|
|
|
if (toFileEntry) { |
|
|
|
if (toFileEntry) { |
|
|
|
FileManager.copy(blob, toFileEntry).then(function () { |
|
|
|
FileManager.copy(blob, toFileEntry).then(function () { |
|
|
|
deferred.resolve(); |
|
|
|
deferred.resolve(); |
|
|
@ -531,7 +529,6 @@ angular.module('izhukov.mtproto.wrapper', ['izhukov.utils', 'izhukov.mtproto']) |
|
|
|
deferred.resolve(cachedDownloads[fileName] = blob); |
|
|
|
deferred.resolve(cachedDownloads[fileName] = blob); |
|
|
|
} |
|
|
|
} |
|
|
|
}, function () { |
|
|
|
}, function () { |
|
|
|
console.log(dT(), 'fs fail file', fileName, size); |
|
|
|
|
|
|
|
var fileWriterPromise = toFileEntry ? FileManager.getFileWriter(toFileEntry) : fileStorage.getFileWriter(fileName, mimeType); |
|
|
|
var fileWriterPromise = toFileEntry ? FileManager.getFileWriter(toFileEntry) : fileStorage.getFileWriter(fileName, mimeType); |
|
|
|
|
|
|
|
|
|
|
|
var processDownloaded = function (bytes) { |
|
|
|
var processDownloaded = function (bytes) { |
|
|
|