Browse Source

Fixed invalid dimensions problem

Now sending as document if fails as photo

Closes #726
master
Igor Zhukov 10 years ago
parent
commit
40c8fd11a7
  1. 17
      app/js/services.js

17
app/js/services.js

@ -1569,12 +1569,17 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
$rootScope.$broadcast('messages_pending'); $rootScope.$broadcast('messages_pending');
} }
var uploaded = false,
uploadPromise;
message.send = function () { message.send = function () {
var sendFileDeferred = $q.defer(); var sendFileDeferred = $q.defer();
sendFilePromise.then(function () { sendFilePromise.then(function () {
var uploaded = false, if (!uploaded || message.error) {
uploadPromise = MtpApiFileManager.uploadFile(file); uploaded = false;
uploadPromise = MtpApiFileManager.uploadFile(file);
}
uploadPromise.then(function (inputFile) { uploadPromise.then(function (inputFile) {
inputFile.name = apiFileName; inputFile.name = apiFileName;
@ -1626,6 +1631,14 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
}] }]
}); });
}, function (error) { }, function (error) {
if (attachType == 'photo' &&
error.code == 400 &&
error.type == 'PHOTO_INVALID_DIMENSIONS') {
error.handled = true;
attachType = 'document';
message.send();
return;
}
toggleError(true); toggleError(true);
}); });
}, function (error) { }, function (error) {

Loading…
Cancel
Save