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', [])
return all; return all;
}); });
var timeout = 0;
do { 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); text = text.substr(4096);
timeout += 100;
} while (text.length); } while (text.length);
resetDraft(); resetDraft();

2
app/js/lib/mtproto.js

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

9
app/js/services.js

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

Loading…
Cancel
Save