|
|
@ -43,7 +43,7 @@ import LazyLoadQueue from "../lazyLoadQueue"; |
|
|
|
import ListenerSetter from "../../helpers/listenerSetter"; |
|
|
|
import ListenerSetter from "../../helpers/listenerSetter"; |
|
|
|
import PollElement from "../poll"; |
|
|
|
import PollElement from "../poll"; |
|
|
|
import AudioElement from "../audio"; |
|
|
|
import AudioElement from "../audio"; |
|
|
|
import { Message, MessageEntity, MessageReplyHeader, ReplyMarkup, Update } from "../../layer"; |
|
|
|
import { Message, MessageEntity, MessageReplyHeader, Photo, PhotoSize, ReplyMarkup, Update, WebPage } from "../../layer"; |
|
|
|
import { REPLIES_PEER_ID } from "../../lib/mtproto/mtproto_config"; |
|
|
|
import { REPLIES_PEER_ID } from "../../lib/mtproto/mtproto_config"; |
|
|
|
import { FocusDirection } from "../../helpers/fastSmoothScroll"; |
|
|
|
import { FocusDirection } from "../../helpers/fastSmoothScroll"; |
|
|
|
import useHeavyAnimationCheck, { getHeavyAnimationPromise, dispatchHeavyAnimationEvent, interruptHeavyAnimation } from "../../hooks/useHeavyAnimationCheck"; |
|
|
|
import useHeavyAnimationCheck, { getHeavyAnimationPromise, dispatchHeavyAnimationEvent, interruptHeavyAnimation } from "../../hooks/useHeavyAnimationCheck"; |
|
|
@ -841,11 +841,8 @@ export default class ChatBubbles { |
|
|
|
const message = this.chat.getMessage(bubbleMid) as Message.message; |
|
|
|
const message = this.chat.getMessage(bubbleMid) as Message.message; |
|
|
|
const peerId = this.appPeersManager.getPeerId(message.reply_to.reply_to_peer_id); |
|
|
|
const peerId = this.appPeersManager.getPeerId(message.reply_to.reply_to_peer_id); |
|
|
|
const threadId = message.reply_to.reply_to_top_id; |
|
|
|
const threadId = message.reply_to.reply_to_top_id; |
|
|
|
|
|
|
|
const lastMsgId = message.fwd_from.saved_from_msg_id; |
|
|
|
this.appMessagesManager.wrapSingleMessage(peerId, threadId).then(() => { |
|
|
|
this.chat.appImManager.openThread(peerId, lastMsgId, threadId); |
|
|
|
this.appMessagesManager.generateThreadServiceStartMessage(this.appMessagesManager.getMessageByPeer(peerId, threadId)); |
|
|
|
|
|
|
|
this.chat.appImManager.setInnerPeer(peerId, message.fwd_from.saved_from_msg_id, 'discussion', threadId); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
const message = this.appMessagesManager.filterMessages(this.chat.getMessage(bubbleMid), message => !!(message as Message.message).replies)[0] as Message.message; |
|
|
|
const message = this.appMessagesManager.filterMessages(this.chat.getMessage(bubbleMid), message => !!(message as Message.message).replies)[0] as Message.message; |
|
|
|
const replies = message.replies; |
|
|
|
const replies = message.replies; |
|
|
@ -2424,7 +2421,7 @@ export default class ChatBubbles { |
|
|
|
case 'messageMediaWebPage': { |
|
|
|
case 'messageMediaWebPage': { |
|
|
|
processingWebPage = true; |
|
|
|
processingWebPage = true; |
|
|
|
|
|
|
|
|
|
|
|
let webpage = messageMedia.webpage; |
|
|
|
let webpage: WebPage.webPage | WebPage.webPageEmpty = messageMedia.webpage; |
|
|
|
////////this.log('messageMediaWebPage', webpage);
|
|
|
|
////////this.log('messageMediaWebPage', webpage);
|
|
|
|
if(webpage._ === 'webPageEmpty') { |
|
|
|
if(webpage._ === 'webPageEmpty') { |
|
|
|
break; |
|
|
|
break; |
|
|
@ -2439,7 +2436,8 @@ export default class ChatBubbles { |
|
|
|
quote.classList.add('quote'); |
|
|
|
quote.classList.add('quote'); |
|
|
|
|
|
|
|
|
|
|
|
let previewResizer: HTMLDivElement, preview: HTMLDivElement; |
|
|
|
let previewResizer: HTMLDivElement, preview: HTMLDivElement; |
|
|
|
if(webpage.photo || webpage.document) { |
|
|
|
const photo: Photo.photo = webpage.photo as any; |
|
|
|
|
|
|
|
if(photo || webpage.document) { |
|
|
|
previewResizer = document.createElement('div'); |
|
|
|
previewResizer = document.createElement('div'); |
|
|
|
previewResizer.classList.add('preview-resizer'); |
|
|
|
previewResizer.classList.add('preview-resizer'); |
|
|
|
preview = document.createElement('div'); |
|
|
|
preview = document.createElement('div'); |
|
|
@ -2487,15 +2485,14 @@ export default class ChatBubbles { |
|
|
|
quoteTextDiv.append(previewResizer); |
|
|
|
quoteTextDiv.append(previewResizer); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// let t: HTMLElement;
|
|
|
|
let t: HTMLElement; |
|
|
|
if(webpage.site_name) { |
|
|
|
if(webpage.site_name) { |
|
|
|
let nameEl = document.createElement('a'); |
|
|
|
const html = RichTextProcessor.wrapRichText(webpage.url); |
|
|
|
nameEl.classList.add('webpage-name'); |
|
|
|
const a: HTMLAnchorElement = htmlToDocumentFragment(html).firstElementChild as any; |
|
|
|
nameEl.setAttribute('target', '_blank'); |
|
|
|
a.classList.add('webpage-name'); |
|
|
|
nameEl.href = webpage.url || '#'; |
|
|
|
setInnerHTML(a, RichTextProcessor.wrapEmojiText(webpage.site_name)); |
|
|
|
setInnerHTML(nameEl, RichTextProcessor.wrapEmojiText(webpage.site_name)); |
|
|
|
quoteTextDiv.append(a); |
|
|
|
quoteTextDiv.append(nameEl); |
|
|
|
t = a; |
|
|
|
// t = nameEl;
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(webpage.rTitle) { |
|
|
|
if(webpage.rTitle) { |
|
|
@ -2503,7 +2500,7 @@ export default class ChatBubbles { |
|
|
|
titleDiv.classList.add('title'); |
|
|
|
titleDiv.classList.add('title'); |
|
|
|
setInnerHTML(titleDiv, webpage.rTitle); |
|
|
|
setInnerHTML(titleDiv, webpage.rTitle); |
|
|
|
quoteTextDiv.append(titleDiv); |
|
|
|
quoteTextDiv.append(titleDiv); |
|
|
|
// t = titleDiv;
|
|
|
|
t = titleDiv; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(webpage.rDescription) { |
|
|
|
if(webpage.rDescription) { |
|
|
@ -2511,7 +2508,7 @@ export default class ChatBubbles { |
|
|
|
textDiv.classList.add('text'); |
|
|
|
textDiv.classList.add('text'); |
|
|
|
setInnerHTML(textDiv, webpage.rDescription); |
|
|
|
setInnerHTML(textDiv, webpage.rDescription); |
|
|
|
quoteTextDiv.append(textDiv); |
|
|
|
quoteTextDiv.append(textDiv); |
|
|
|
// t = textDiv;
|
|
|
|
t = textDiv; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* if(t) { |
|
|
|
/* if(t) { |
|
|
@ -2522,15 +2519,15 @@ export default class ChatBubbles { |
|
|
|
|
|
|
|
|
|
|
|
quote.append(quoteTextDiv); |
|
|
|
quote.append(quoteTextDiv); |
|
|
|
|
|
|
|
|
|
|
|
if(webpage.photo && !doc) { |
|
|
|
if(photo && !doc) { |
|
|
|
bubble.classList.add('photo'); |
|
|
|
bubble.classList.add('photo'); |
|
|
|
|
|
|
|
|
|
|
|
const size = webpage.photo.sizes[webpage.photo.sizes.length - 1]; |
|
|
|
const size: PhotoSize.photoSize = photo.sizes[photo.sizes.length - 1] as any; |
|
|
|
let isSquare = false; |
|
|
|
let isSquare = false; |
|
|
|
if(size.w === size.h && quoteTextDiv.childElementCount) { |
|
|
|
if(size.w === size.h && t) { |
|
|
|
bubble.classList.add('is-square-photo'); |
|
|
|
bubble.classList.add('is-square-photo'); |
|
|
|
isSquare = true; |
|
|
|
isSquare = true; |
|
|
|
this.appPhotosManager.setAttachmentSize(webpage.photo, preview, 32, 32, false); |
|
|
|
this.appPhotosManager.setAttachmentSize(photo, preview, 32, 32, false); |
|
|
|
|
|
|
|
|
|
|
|
/* if(t) { |
|
|
|
/* if(t) { |
|
|
|
t.append(timeSpan); |
|
|
|
t.append(timeSpan); |
|
|
@ -2540,7 +2537,7 @@ export default class ChatBubbles { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
wrapPhoto({ |
|
|
|
wrapPhoto({ |
|
|
|
photo: webpage.photo, |
|
|
|
photo, |
|
|
|
message, |
|
|
|
message, |
|
|
|
container: preview, |
|
|
|
container: preview, |
|
|
|
boxWidth: isSquare ? 0 : mediaSizes.active.webpage.width, |
|
|
|
boxWidth: isSquare ? 0 : mediaSizes.active.webpage.width, |
|
|
|