Browse Source

Improved send order

master
Igor Zhukov 11 years ago
parent
commit
697d7ec9b3
  1. 11
      app/js/controllers.js
  2. 2
      app/js/lib/mtproto.js
  3. 9
      app/js/services.js

11
app/js/controllers.js

@ -913,9 +913,18 @@ angular.module('myApp.controllers', []) @@ -913,9 +913,18 @@ angular.module('myApp.controllers', [])
return all;
});
var timeout = 0;
do {
AppMessagesManager.sendText($scope.curDialog.peerID, text.substr(0, 4096));
(function (peerID, curText, curTimeout) {
setTimeout(function () {
AppMessagesManager.sendText(peerID, curText);
}, curTimeout)
})($scope.curDialog.peerID, text.substr(0, 4096), timeout);
text = text.substr(4096);
timeout += 100;
} while (text.length);
resetDraft();

2
app/js/lib/mtproto.js

@ -2623,7 +2623,7 @@ factory('MtpApiManager', function (AppConfigManager, MtpAuthorizer, MtpNetworker @@ -2623,7 +2623,7 @@ factory('MtpApiManager', function (AppConfigManager, MtpAuthorizer, MtpNetworker
if (!options.noErrorBox) {
error.input = method;
error.stack = error.stack || stack;
error.stack = error.stack || (new Error()).stack;
setTimeout(function () {
if (!error.handled) {
ErrorService.show({error: error});

9
app/js/services.js

@ -1191,9 +1191,6 @@ angular.module('myApp.services', []) @@ -1191,9 +1191,6 @@ angular.module('myApp.services', [])
message: text,
random_id: randomID
}, sentRequestOptions).then(function (result) {
if (pendingAfterMsgs[peerID] === sentRequestOptions) {
delete pendingAfterMsgs[peerID];
}
if (ApiUpdatesManager.saveSeq(result.seq)) {
ApiUpdatesManager.saveUpdate({
_: 'updateMessageID',
@ -1211,6 +1208,10 @@ angular.module('myApp.services', []) @@ -1211,6 +1208,10 @@ angular.module('myApp.services', [])
}
}, function (error) {
toggleError(true);
})['finally'](function () {
if (pendingAfterMsgs[peerID] === sentRequestOptions) {
delete pendingAfterMsgs[peerID];
}
});
pendingAfterMsgs[peerID] = sentRequestOptions;
@ -1475,6 +1476,8 @@ angular.module('myApp.services', []) @@ -1475,6 +1476,8 @@ angular.module('myApp.services', [])
}
function forwardMessages (peerID, msgIDs) {
msgIDs = $filter('orderBy')(msgIDs);
return MtpApiManager.invokeApi('messages.forwardMessages', {
peer: AppPeersManager.getInputPeerByID(peerID),
id: msgIDs

Loading…
Cancel
Save