Browse Source

Fixed getDiff after new session create

master
Igor Zhukov 10 years ago
parent
commit
08ab86fe86
  1. 14
      app/js/lib/mtproto.js
  2. 2
      app/js/lib/utils.js
  3. 5
      app/js/services.js

14
app/js/lib/mtproto.js

@ -151,7 +151,7 @@ angular.module('izhukov.mtproto', ['izhukov.utils']) @@ -151,7 +151,7 @@ angular.module('izhukov.mtproto', ['izhukov.utils'])
lastMessageID = messageID;
// console.log('generated msg id', messageID);
// console.log('generated msg id', messageID, timeOffset);
return longFromInts(messageID[0], messageID[1]);
};
@ -1321,10 +1321,6 @@ angular.module('izhukov.mtproto', ['izhukov.utils']) @@ -1321,10 +1321,6 @@ angular.module('izhukov.mtproto', ['izhukov.utils'])
this.nextReq = nextReq;
};
MtpNetworker.prototype.onSessionCreate = function (sessionID, messageID) {
// console.log(dT(), 'New session created', bytesToHex(sessionID));
};
MtpNetworker.prototype.ackMessage = function (msgID) {
// console.log('ack message', msgID);
this.pendingAcks.push(msgID);
@ -1445,7 +1441,13 @@ angular.module('izhukov.mtproto', ['izhukov.utils']) @@ -1445,7 +1441,13 @@ angular.module('izhukov.mtproto', ['izhukov.utils'])
this.processMessageAck(message.first_msg_id);
this.applyServerSalt(message.server_salt);
this.onSessionCreate(sessionID, messageID);
var self = this;
Storage.get('dc').then(function (baseDcID) {
if (baseDcID == self.dcID && !self.upload && updatesProcessor) {
updatesProcessor(message);
}
});
break;
case 'msgs_ack':

2
app/js/lib/utils.js

@ -61,7 +61,7 @@ function onContentLoaded (cb) { @@ -61,7 +61,7 @@ function onContentLoaded (cb) {
};
function tsNow (seconds) {
var t = +new Date();
var t = +new Date() + (window.tsOffset || 0);
return seconds ? Math.floor(t / 1000) : t;
}

5
app/js/services.js

@ -2936,6 +2936,7 @@ angular.module('myApp.services', ['myApp.i18n']) @@ -2936,6 +2936,7 @@ angular.module('myApp.services', ['myApp.i18n'])
switch (updateMessage._) {
case 'updatesTooLong':
case 'new_session_created':
forceGetDifference();
break;
@ -3133,7 +3134,9 @@ angular.module('myApp.services', ['myApp.i18n']) @@ -3133,7 +3134,9 @@ angular.module('myApp.services', ['myApp.i18n'])
curState.seq = stateResult.seq;
curState.pts = stateResult.pts;
curState.date = stateResult.date;
isSynchronizing = false;
setTimeout(function () {
isSynchronizing = false;
}, 1000);
})
}

Loading…
Cancel
Save