Browse Source

Fix sending message due to camelCase update name

master
Eduard Kuzmenko 4 years ago
parent
commit
f00be24bb2
  1. 4
      src/lib/appManagers/apiUpdatesManager.ts
  2. 20
      src/lib/appManagers/appMessagesManager.ts

4
src/lib/appManagers/apiUpdatesManager.ts

@ -239,7 +239,7 @@ export class ApiUpdatesManager {
appUsersManager.saveApiUsers(differenceResult.users); appUsersManager.saveApiUsers(differenceResult.users);
appChatsManager.saveApiChats(differenceResult.chats); appChatsManager.saveApiChats(differenceResult.chats);
// Should be first because of updateMessageId // Should be first because of updateMessageID
// this.log('applying', differenceResult.other_updates.length, 'other updates') // this.log('applying', differenceResult.other_updates.length, 'other updates')
differenceResult.other_updates.forEach((update) => { differenceResult.other_updates.forEach((update) => {
@ -329,7 +329,7 @@ export class ApiUpdatesManager {
appUsersManager.saveApiUsers(differenceResult.users); appUsersManager.saveApiUsers(differenceResult.users);
appChatsManager.saveApiChats(differenceResult.chats); appChatsManager.saveApiChats(differenceResult.chats);
// Should be first because of updateMessageId // Should be first because of updateMessageID
this.log('applying', differenceResult.other_updates.length, 'channel other updates'); this.log('applying', differenceResult.other_updates.length, 'channel other updates');
differenceResult.other_updates.forEach((update) => { differenceResult.other_updates.forEach((update) => {
this.saveUpdate(update); this.saveUpdate(update);

20
src/lib/appManagers/appMessagesManager.ts

@ -513,7 +513,7 @@ export class AppMessagesManager {
chats: [], chats: [],
seq: 0, seq: 0,
updates: [{ updates: [{
_: 'updateMessageId', _: 'updateMessageID',
random_id: randomIdS, random_id: randomIdS,
id: updates.id id: updates.id
}, { }, {
@ -3012,7 +3012,7 @@ export class AppMessagesManager {
case 'updateMessageID': { case 'updateMessageID': {
const randomId = update.random_id; const randomId = update.random_id;
const pendingData = this.pendingByRandomId[randomId]; const pendingData = this.pendingByRandomId[randomId];
//this.log('AMM updateMessageId:', update, pendingData); //this.log('AMM updateMessageID:', update, pendingData);
if(pendingData) { if(pendingData) {
const peerId: number = pendingData[0]; const peerId: number = pendingData[0];
const tempId = pendingData[1]; const tempId = pendingData[1];
@ -3827,22 +3827,22 @@ export class AppMessagesManager {
} }
public finalizePendingMessage(randomId: number, finalMessage: any) { public finalizePendingMessage(randomId: number, finalMessage: any) {
var pendingData = this.pendingByRandomId[randomId]; const pendingData = this.pendingByRandomId[randomId];
// this.log('pdata', randomID, pendingData) // this.log('pdata', randomID, pendingData)
if(pendingData) { if(pendingData) {
var peerId = pendingData[0]; const peerId = pendingData[0];
var tempId = pendingData[1]; const tempId = pendingData[1];
var historyStorage = this.historiesStorage[peerId], const historyStorage = this.historiesStorage[peerId];
message;
// this.log('pending', randomID, historyStorage.pending) // this.log('pending', randomID, historyStorage.pending)
var pos = historyStorage.pending.indexOf(tempId); const pos = historyStorage.pending.indexOf(tempId);
if(pos != -1) { if(pos != -1) {
historyStorage.pending.splice(pos, 1); historyStorage.pending.splice(pos, 1);
} }
if(message = this.messagesStorage[tempId]) { const message = this.messagesStorage[tempId];
if(message) {
delete message.pending; delete message.pending;
delete message.error; delete message.error;
delete message.random_id; delete message.random_id;
@ -3858,7 +3858,7 @@ export class AppMessagesManager {
return message; return message;
} }
return false return false;
} }
public finalizePendingMessageCallbacks(tempId: number, mid: number) { public finalizePendingMessageCallbacks(tempId: number, mid: number) {

Loading…
Cancel
Save