|
|
@ -480,7 +480,7 @@ export class AppMessagesManager { |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const toggleError = (on: any) => { |
|
|
|
const toggleError = (on: boolean) => { |
|
|
|
if(on) { |
|
|
|
if(on) { |
|
|
|
message.error = true; |
|
|
|
message.error = true; |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -525,7 +525,9 @@ export class AppMessagesManager { |
|
|
|
} */ |
|
|
|
} */ |
|
|
|
|
|
|
|
|
|
|
|
//this.log('sendText', message.mid);
|
|
|
|
//this.log('sendText', message.mid);
|
|
|
|
apiPromise.then((updates: Updates) => { |
|
|
|
this.pendingAfterMsgs[peerId] = sentRequestOptions; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return apiPromise.then((updates: Updates) => { |
|
|
|
//this.log('sendText sent', message.mid);
|
|
|
|
//this.log('sendText sent', message.mid);
|
|
|
|
//if(is<Updates.updateShortSentMessage>(updates, updates._ === 'updateShortSentMessage')) {
|
|
|
|
//if(is<Updates.updateShortSentMessage>(updates, updates._ === 'updateShortSentMessage')) {
|
|
|
|
if(updates._ === 'updateShortSentMessage') { |
|
|
|
if(updates._ === 'updateShortSentMessage') { |
|
|
@ -579,9 +581,7 @@ export class AppMessagesManager { |
|
|
|
delete this.pendingAfterMsgs[peerId]; |
|
|
|
delete this.pendingAfterMsgs[peerId]; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
}; |
|
|
|
this.pendingAfterMsgs[peerId] = sentRequestOptions; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.beforeMessageSending(message, { |
|
|
|
this.beforeMessageSending(message, { |
|
|
|
isScheduled: !!options.scheduleDate || undefined, |
|
|
|
isScheduled: !!options.scheduleDate || undefined, |
|
|
@ -831,7 +831,7 @@ export class AppMessagesManager { |
|
|
|
_: 'messageMediaDocument', |
|
|
|
_: 'messageMediaDocument', |
|
|
|
pFlags: {}, |
|
|
|
pFlags: {}, |
|
|
|
document: file |
|
|
|
document: file |
|
|
|
} : media; |
|
|
|
} as MessageMedia.messageMediaDocument : media as any; |
|
|
|
|
|
|
|
|
|
|
|
const toggleError = (on: boolean) => { |
|
|
|
const toggleError = (on: boolean) => { |
|
|
|
if(on) { |
|
|
|
if(on) { |
|
|
@ -888,6 +888,7 @@ export class AppMessagesManager { |
|
|
|
this.log('appMessagesManager: sendFile uploaded:', inputFile); |
|
|
|
this.log('appMessagesManager: sendFile uploaded:', inputFile); |
|
|
|
} */ |
|
|
|
} */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
delete message.media.preloader; |
|
|
|
delete message.media.preloader; |
|
|
|
|
|
|
|
|
|
|
|
inputFile.name = apiFileName; |
|
|
|
inputFile.name = apiFileName; |
|
|
@ -1163,7 +1164,7 @@ export class AppMessagesManager { |
|
|
|
const message = this.generateOutgoingMessage(peerId, options); |
|
|
|
const message = this.generateOutgoingMessage(peerId, options); |
|
|
|
const replyToMsgId = options.replyToMsgId ? this.getServerMessageId(options.replyToMsgId) : undefined; |
|
|
|
const replyToMsgId = options.replyToMsgId ? this.getServerMessageId(options.replyToMsgId) : undefined; |
|
|
|
|
|
|
|
|
|
|
|
let media; |
|
|
|
let media: MessageMedia; |
|
|
|
switch(inputMedia._) { |
|
|
|
switch(inputMedia._) { |
|
|
|
case 'inputMediaPoll': { |
|
|
|
case 'inputMediaPoll': { |
|
|
|
inputMedia.poll.id = message.id; |
|
|
|
inputMedia.poll.id = message.id; |
|
|
@ -1291,7 +1292,9 @@ export class AppMessagesManager { |
|
|
|
}, sentRequestOptions); |
|
|
|
}, sentRequestOptions); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
apiPromise.then((updates) => { |
|
|
|
this.pendingAfterMsgs[peerId] = sentRequestOptions; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return apiPromise.then((updates) => { |
|
|
|
if(updates.updates) { |
|
|
|
if(updates.updates) { |
|
|
|
updates.updates.forEach((update: any) => { |
|
|
|
updates.updates.forEach((update: any) => { |
|
|
|
if(update._ === 'updateDraftMessage') { |
|
|
|
if(update._ === 'updateDraftMessage') { |
|
|
@ -1308,8 +1311,7 @@ export class AppMessagesManager { |
|
|
|
delete this.pendingAfterMsgs[peerId]; |
|
|
|
delete this.pendingAfterMsgs[peerId]; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.pendingAfterMsgs[peerId] = sentRequestOptions; |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.beforeMessageSending(message, { |
|
|
|
this.beforeMessageSending(message, { |
|
|
|
isScheduled: !!options.scheduleDate || undefined, |
|
|
|
isScheduled: !!options.scheduleDate || undefined, |
|
|
@ -1402,7 +1404,7 @@ export class AppMessagesManager { |
|
|
|
options.replyToMsgId = options.threadId; |
|
|
|
options.replyToMsgId = options.threadId; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const message: any = { |
|
|
|
const message: Message.message = { |
|
|
|
_: 'message', |
|
|
|
_: 'message', |
|
|
|
id: this.generateTempMessageId(peerId), |
|
|
|
id: this.generateTempMessageId(peerId), |
|
|
|
from_id: this.generateFromId(peerId), |
|
|
|
from_id: this.generateFromId(peerId), |
|
|
@ -5102,17 +5104,18 @@ export class AppMessagesManager { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private handleReleasingMessage(message: MyMessage) { |
|
|
|
private handleReleasingMessage(message: MyMessage) { |
|
|
|
if('media' in message) { |
|
|
|
const media = (message as Message.message).media; |
|
|
|
|
|
|
|
if(media) { |
|
|
|
// @ts-ignore
|
|
|
|
// @ts-ignore
|
|
|
|
const c = message.media.webpage || message.media; |
|
|
|
const c = media.webpage || media; |
|
|
|
const smth: Photo.photo | MyDocument = c.photo || c.document; |
|
|
|
const smth: Photo.photo | MyDocument = c.photo || c.document; |
|
|
|
|
|
|
|
|
|
|
|
if(smth?.file_reference) { |
|
|
|
if(smth?.file_reference) { |
|
|
|
referenceDatabase.deleteContext(smth.file_reference, {type: 'message', peerId: message.peerId, messageId: message.mid}); |
|
|
|
referenceDatabase.deleteContext(smth.file_reference, {type: 'message', peerId: message.peerId, messageId: message.mid}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if('webpage' in message.media) { |
|
|
|
if('webpage' in media) { |
|
|
|
appWebPagesManager.deleteWebPageFromPending(message.media.webpage, message.mid); |
|
|
|
appWebPagesManager.deleteWebPageFromPending(media.webpage, message.mid); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|