Browse Source

Fixed gif in packed mode

Closes #495
master
Igor Zhukov 10 years ago
parent
commit
9dd1baca93
  1. 1
      app/js/background.js
  2. 20
      app/js/services.js

1
app/js/background.js

@ -8,7 +8,6 @@
chrome.app.runtime.onLaunched.addListener(function(launchData) { chrome.app.runtime.onLaunched.addListener(function(launchData) {
chrome.app.window.create('../index.html', { chrome.app.window.create('../index.html', {
id: 'webogram-chat', id: 'webogram-chat',
hidden: true,
innerBounds: { innerBounds: {
width: 1000, width: 1000,
height: 700 height: 700

20
app/js/services.js

@ -2451,6 +2451,10 @@ angular.module('myApp.services', ['myApp.i18n'])
}; };
FileManager.chooseSave(fileName, ext, mimeType).then(function (writableFileEntry) { FileManager.chooseSave(fileName, ext, mimeType).then(function (writableFileEntry) {
if (!writableFileEntry) {
return;
}
MtpApiFileManager.downloadFile( MtpApiFileManager.downloadFile(
fullPhotoSize.location.dc_id, inputFileLocation, fullPhotoSize.size, { fullPhotoSize.location.dc_id, inputFileLocation, fullPhotoSize.size, {
mime: mimeType, mime: mimeType,
@ -2612,6 +2616,10 @@ angular.module('myApp.services', ['myApp.i18n'])
fileName = 'video' + videoID + '.' + ext; fileName = 'video' + videoID + '.' + ext;
FileManager.chooseSave(fileName, ext, mimeType).then(function (writableFileEntry) { FileManager.chooseSave(fileName, ext, mimeType).then(function (writableFileEntry) {
if (!writableFileEntry) {
return;
}
var downloadPromise = MtpApiFileManager.downloadFile(video.dc_id, inputFileLocation, video.size, { var downloadPromise = MtpApiFileManager.downloadFile(video.dc_id, inputFileLocation, video.size, {
mime: mimeType, mime: mimeType,
toFileEntry: writableFileEntry toFileEntry: writableFileEntry
@ -2715,7 +2723,7 @@ angular.module('myApp.services', ['myApp.i18n'])
doc.canDownload = !(window.chrome && chrome.fileSystem && chrome.fileSystem.chooseEntry); doc.canDownload = !(window.chrome && chrome.fileSystem && chrome.fileSystem.chooseEntry);
doc.withPreview = doc.canDownload && doc.mime_type.match(/^(image\/|application\/pdf)/) ? 1 : 0; doc.withPreview = doc.canDownload && doc.mime_type.match(/^(image\/|application\/pdf)/) ? 1 : 0;
if (isGif && doc.withPreview && doc.thumb) { if (isGif && doc.thumb) {
doc.isSpecial = 'gif'; doc.isSpecial = 'gif';
} }
else if (isAudio) { else if (isAudio) {
@ -2734,8 +2742,6 @@ angular.module('myApp.services', ['myApp.i18n'])
access_hash: doc.access_hash access_hash: doc.access_hash
}; };
historyDoc.progress = {enabled: true, percent: 1, total: doc.size};
function updateDownloadProgress (progress) { function updateDownloadProgress (progress) {
console.log('dl progress', progress); console.log('dl progress', progress);
historyDoc.progress.done = progress.done; historyDoc.progress.done = progress.done;
@ -2745,6 +2751,12 @@ angular.module('myApp.services', ['myApp.i18n'])
var ext = (doc.file_name.split('.', 2) || [])[1] || ''; var ext = (doc.file_name.split('.', 2) || [])[1] || '';
FileManager.chooseSave(doc.file_name, ext, doc.mime_type).then(function (writableFileEntry) { FileManager.chooseSave(doc.file_name, ext, doc.mime_type).then(function (writableFileEntry) {
if (!writableFileEntry) {
return;
}
historyDoc.progress = {enabled: true, 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, {
mime: doc.mime_type, mime: doc.mime_type,
toFileEntry: writableFileEntry toFileEntry: writableFileEntry
@ -2760,6 +2772,8 @@ angular.module('myApp.services', ['myApp.i18n'])
historyDoc.progress.cancel = downloadPromise.cancel; historyDoc.progress.cancel = downloadPromise.cancel;
}, function () { }, function () {
historyDoc.progress = {enabled: true, percent: 1, total: doc.size};
var downloadPromise = MtpApiFileManager.downloadFile(doc.dc_id, inputFileLocation, doc.size, {mime: doc.mime_type}); var downloadPromise = MtpApiFileManager.downloadFile(doc.dc_id, inputFileLocation, doc.size, {mime: doc.mime_type});
downloadPromise.then(function (url) { downloadPromise.then(function (url) {

Loading…
Cancel
Save