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