|
|
@ -1119,8 +1119,8 @@ angular.module('myApp.services', []) |
|
|
|
attachType, fileName, fileName; |
|
|
|
attachType, fileName, fileName; |
|
|
|
|
|
|
|
|
|
|
|
if (!options.isMedia) { |
|
|
|
if (!options.isMedia) { |
|
|
|
attachType = 'doc'; |
|
|
|
attachType = 'document'; |
|
|
|
fileName = 'doc.' + file.type.split('/')[1]; |
|
|
|
fileName = 'document.' + file.type.split('/')[1]; |
|
|
|
} else if (['image/jpeg', 'image/gif', 'image/png', 'image/bmp'].indexOf(file.type) >= 0) { |
|
|
|
} else if (['image/jpeg', 'image/gif', 'image/png', 'image/bmp'].indexOf(file.type) >= 0) { |
|
|
|
attachType = 'photo'; |
|
|
|
attachType = 'photo'; |
|
|
|
fileName = 'photo.' + file.type.split('/')[1]; |
|
|
|
fileName = 'photo.' + file.type.split('/')[1]; |
|
|
@ -1131,8 +1131,8 @@ angular.module('myApp.services', []) |
|
|
|
attachType = 'audio'; |
|
|
|
attachType = 'audio'; |
|
|
|
fileName = 'audio.mp3'; |
|
|
|
fileName = 'audio.mp3'; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
attachType = 'doc'; |
|
|
|
attachType = 'document'; |
|
|
|
fileName = 'doc.' + file.type.split('/')[1]; |
|
|
|
fileName = 'document.' + file.type.split('/')[1]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!file.name) { |
|
|
|
if (!file.name) { |
|
|
@ -1197,7 +1197,7 @@ angular.module('myApp.services', []) |
|
|
|
inputMedia = {_: 'inputMediaUploadedAudio', file: inputFile, duration: 0}; |
|
|
|
inputMedia = {_: 'inputMediaUploadedAudio', file: inputFile, duration: 0}; |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case 'doc': |
|
|
|
case 'document': |
|
|
|
default: |
|
|
|
default: |
|
|
|
inputMedia = {_: 'inputMediaUploadedDocument', file: inputFile, file_name: file.name, mime_type: file.type}; |
|
|
|
inputMedia = {_: 'inputMediaUploadedDocument', file: inputFile, file_name: file.name, mime_type: file.type}; |
|
|
|
} |
|
|
|
} |
|
|
@ -1935,7 +1935,7 @@ angular.module('myApp.services', []) |
|
|
|
height = 100, |
|
|
|
height = 100, |
|
|
|
thumbPhotoSize = doc.thumb, |
|
|
|
thumbPhotoSize = doc.thumb, |
|
|
|
thumb = { |
|
|
|
thumb = { |
|
|
|
placeholder: 'img/placeholders/DocThumbConversation.jpg', |
|
|
|
// placeholder: 'img/placeholders/DocThumbConversation.jpg',
|
|
|
|
width: width, |
|
|
|
width: width, |
|
|
|
height: height |
|
|
|
height: height |
|
|
|
}; |
|
|
|
}; |
|
|
@ -1952,13 +1952,15 @@ angular.module('myApp.services', []) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
thumb = false; |
|
|
|
thumb = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
doc.thumb = thumb; |
|
|
|
doc.thumb = thumb; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
doc.canDownload = !(window.chrome && chrome.fileSystem && chrome.fileSystem.chooseEntry); |
|
|
|
|
|
|
|
doc.withPreview = doc.canDownload && doc.mime_type.match(/^(image\/|application\/pdf)/); |
|
|
|
|
|
|
|
|
|
|
|
return docsForHistory[docID] = doc; |
|
|
|
return docsForHistory[docID] = doc; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function openDoc (docID, accessHash) { |
|
|
|
function openDoc (docID, accessHash, popup) { |
|
|
|
var doc = docs[docID], |
|
|
|
var doc = docs[docID], |
|
|
|
historyDoc = docsForHistory[docID] || doc || {}, |
|
|
|
historyDoc = docsForHistory[docID] || doc || {}, |
|
|
|
inputFileLocation = { |
|
|
|
inputFileLocation = { |
|
|
@ -2000,6 +2002,11 @@ angular.module('myApp.services', []) |
|
|
|
MtpApiFileManager.downloadFile(doc.dc_id, inputFileLocation, doc.size, null, {mime: doc.mime_type}).then(function (url) { |
|
|
|
MtpApiFileManager.downloadFile(doc.dc_id, inputFileLocation, doc.size, null, {mime: doc.mime_type}).then(function (url) { |
|
|
|
delete historyDoc.progress; |
|
|
|
delete historyDoc.progress; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (popup) { |
|
|
|
|
|
|
|
window.open(url, '_blank'); |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var a = $('<a>Download</a>').css({position: 'absolute', top: 1, left: 1}).attr('href', url).attr('target', '_blank').attr('download', doc.file_name).appendTo('body'); |
|
|
|
var a = $('<a>Download</a>').css({position: 'absolute', top: 1, left: 1}).attr('href', url).attr('target', '_blank').attr('download', doc.file_name).appendTo('body'); |
|
|
|
a[0].dataset.downloadurl = ['png', doc.file_name, url].join(':'); |
|
|
|
a[0].dataset.downloadurl = ['png', doc.file_name, url].join(':'); |
|
|
|
a[0].click(); |
|
|
|
a[0].click(); |
|
|
|