Sequential file send
This commit is contained in:
parent
376c1173ff
commit
9048fad53f
@ -681,6 +681,7 @@ angular.module('myApp.services', [])
|
||||
var pendingByRandomID = {};
|
||||
var pendingByMessageID = {};
|
||||
var pendingAfterMsgs = {};
|
||||
var sendFilePromise = $q.when();
|
||||
var tempID = -1;
|
||||
|
||||
|
||||
@ -1214,6 +1215,9 @@ angular.module('myApp.services', [])
|
||||
}
|
||||
|
||||
message.send = function () {
|
||||
var sendFileDeferred = $q.defer();
|
||||
|
||||
sendFilePromise.then(function () {
|
||||
var uploaded = false,
|
||||
uploadPromise = MtpApiFileManager.uploadFile(file);
|
||||
|
||||
@ -1274,10 +1278,18 @@ angular.module('myApp.services', [])
|
||||
|
||||
media.progress.cancel = function () {
|
||||
if (!uploaded) {
|
||||
sendFileDeferred.resolve();
|
||||
uploadPromise.cancel();
|
||||
cancelPendingMessage(randomIDS);
|
||||
}
|
||||
}
|
||||
|
||||
uploadPromise['finally'](function () {
|
||||
sendFileDeferred.resolve();
|
||||
});
|
||||
});
|
||||
|
||||
sendFilePromise = sendFileDeferred.promise;
|
||||
};
|
||||
|
||||
saveMessages([message]);
|
||||
|
Loading…
Reference in New Issue
Block a user