|
|
@ -2584,6 +2584,11 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}, function () { |
|
|
|
}, function () { |
|
|
|
|
|
|
|
var cachedBlob = MtpApiFileManager.getCachedFile(inputFileLocation); |
|
|
|
|
|
|
|
if (cachedBlob) { |
|
|
|
|
|
|
|
return FileManager.download(cachedBlob, mimeType, fileName); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
MtpApiFileManager.downloadFile( |
|
|
|
MtpApiFileManager.downloadFile( |
|
|
|
fullPhotoSize.location.dc_id, inputFileLocation, fullPhotoSize.size, {mime: mimeType} |
|
|
|
fullPhotoSize.location.dc_id, inputFileLocation, fullPhotoSize.size, {mime: mimeType} |
|
|
|
).then(function (blob) { |
|
|
|
).then(function (blob) { |
|
|
@ -2803,7 +2808,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
.service('AppDocsManager', function ($sce, $rootScope, $modal, $window, $q, RichTextProcessor, MtpApiFileManager, FileManager) { |
|
|
|
.service('AppDocsManager', function ($sce, $rootScope, $modal, $window, $q, RichTextProcessor, MtpApiFileManager, FileManager, qSync) { |
|
|
|
var docs = {}, |
|
|
|
var docs = {}, |
|
|
|
docsForHistory = {}, |
|
|
|
docsForHistory = {}, |
|
|
|
windowW = $(window).width(), |
|
|
|
windowW = $(window).width(), |
|
|
@ -2918,8 +2923,6 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
access_hash: doc.access_hash |
|
|
|
access_hash: doc.access_hash |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// historyDoc.progress = {enabled: true, percent: 10, total: doc.size};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (historyDoc.downloaded === undefined) { |
|
|
|
if (historyDoc.downloaded === undefined) { |
|
|
|
MtpApiFileManager.getDownloadedFile(inputFileLocation, doc.size).then(function () { |
|
|
|
MtpApiFileManager.getDownloadedFile(inputFileLocation, doc.size).then(function () { |
|
|
|
historyDoc.downloaded = true; |
|
|
|
historyDoc.downloaded = true; |
|
|
@ -2938,6 +2941,13 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
access_hash: doc.access_hash |
|
|
|
access_hash: doc.access_hash |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (historyDoc.downloaded && !toFileEntry) { |
|
|
|
|
|
|
|
var cachedBlob = MtpApiFileManager.getCachedFile(inputFileLocation); |
|
|
|
|
|
|
|
if (cachedBlob) { |
|
|
|
|
|
|
|
return qSync.when(cachedBlob); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
historyDoc.progress = {enabled: !historyDoc.downloaded, percent: 1, total: doc.size}; |
|
|
|
historyDoc.progress = {enabled: !historyDoc.downloaded, percent: 1, total: doc.size}; |
|
|
|
|
|
|
|
|
|
|
|
var downloadPromise = MtpApiFileManager.downloadFile(doc.dc_id, inputFileLocation, doc.size, { |
|
|
|
var downloadPromise = MtpApiFileManager.downloadFile(doc.dc_id, inputFileLocation, doc.size, { |
|
|
@ -3011,7 +3021,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
.service('AppAudioManager', function ($sce, $rootScope, $modal, $window, MtpApiFileManager, FileManager) { |
|
|
|
.service('AppAudioManager', function ($sce, $rootScope, $modal, $window, MtpApiFileManager, FileManager, qSync) { |
|
|
|
var audios = {}; |
|
|
|
var audios = {}; |
|
|
|
var audiosForHistory = {}; |
|
|
|
var audiosForHistory = {}; |
|
|
|
|
|
|
|
|
|
|
@ -3059,6 +3069,13 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
access_hash: audio.access_hash |
|
|
|
access_hash: audio.access_hash |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (historyAudio.downloaded && !toFileEntry) { |
|
|
|
|
|
|
|
var cachedBlob = MtpApiFileManager.getCachedFile(inputFileLocation); |
|
|
|
|
|
|
|
if (cachedBlob) { |
|
|
|
|
|
|
|
return qSync.when(cachedBlob); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
historyAudio.progress = {enabled: !historyAudio.downloaded, percent: 1, total: audio.size}; |
|
|
|
historyAudio.progress = {enabled: !historyAudio.downloaded, percent: 1, total: audio.size}; |
|
|
|
|
|
|
|
|
|
|
|
var downloadPromise = MtpApiFileManager.downloadFile(audio.dc_id, inputFileLocation, audio.size, { |
|
|
|
var downloadPromise = MtpApiFileManager.downloadFile(audio.dc_id, inputFileLocation, audio.size, { |
|
|
|