Rerender bubble if big emoji is being toggled
This commit is contained in:
parent
6c3956444c
commit
65c2b64f16
@ -18,7 +18,7 @@ import { CHAT_ANIMATION_GROUP } from "../../lib/appManagers/appImManager";
|
|||||||
import { getObjectKeysAndSort } from "../../helpers/object";
|
import { getObjectKeysAndSort } from "../../helpers/object";
|
||||||
import { isTouchSupported } from "../../helpers/touchSupport";
|
import { isTouchSupported } from "../../helpers/touchSupport";
|
||||||
import { logger } from "../../lib/logger";
|
import { logger } from "../../lib/logger";
|
||||||
import rootScope from "../../lib/rootScope";
|
import rootScope, { BroadcastEvents } from "../../lib/rootScope";
|
||||||
import AppMediaViewer from "../appMediaViewer";
|
import AppMediaViewer from "../appMediaViewer";
|
||||||
import BubbleGroups from "./bubbleGroups";
|
import BubbleGroups from "./bubbleGroups";
|
||||||
import PopupDatePicker from "../popups/datePicker";
|
import PopupDatePicker from "../popups/datePicker";
|
||||||
@ -521,6 +521,29 @@ export default class ChatBubbles {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.listenerSetter.add(rootScope, 'settings_updated', (e: BroadcastEvents['settings_updated']) => {
|
||||||
|
if(e.key === 'settings.emoji.big') {
|
||||||
|
const isScrolledDown = this.scrollable.isScrolledDown;
|
||||||
|
if(!isScrolledDown) {
|
||||||
|
this.setMessagesQueuePromise();
|
||||||
|
}
|
||||||
|
|
||||||
|
for(const mid in this.bubbles) {
|
||||||
|
const bubble = this.bubbles[mid];
|
||||||
|
if(bubble.classList.contains('can-have-big-emoji')) {
|
||||||
|
const message = this.chat.getMessage(+mid);
|
||||||
|
this.renderMessage(message, undefined, false, bubble);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isScrolledDown) {
|
||||||
|
this.scrollable.scrollTop = 99999;
|
||||||
|
} else {
|
||||||
|
this.performHistoryResult([], true, false, undefined);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
this.unreadedObserver = new IntersectionObserver((entries) => {
|
this.unreadedObserver = new IntersectionObserver((entries) => {
|
||||||
entries.forEach(entry => {
|
entries.forEach(entry => {
|
||||||
if(entry.isIntersecting) {
|
if(entry.isIntersecting) {
|
||||||
@ -1959,6 +1982,7 @@ export default class ChatBubbles {
|
|||||||
contentWrapper = bubble.lastElementChild as HTMLElement;
|
contentWrapper = bubble.lastElementChild as HTMLElement;
|
||||||
bubbleContainer = contentWrapper.firstElementChild as HTMLDivElement;
|
bubbleContainer = contentWrapper.firstElementChild as HTMLDivElement;
|
||||||
bubbleContainer.innerHTML = '';
|
bubbleContainer.innerHTML = '';
|
||||||
|
bubbleContainer.style.cssText = '';
|
||||||
contentWrapper.innerHTML = '';
|
contentWrapper.innerHTML = '';
|
||||||
contentWrapper.appendChild(bubbleContainer);
|
contentWrapper.appendChild(bubbleContainer);
|
||||||
//bubbleContainer.style.marginBottom = '';
|
//bubbleContainer.style.marginBottom = '';
|
||||||
@ -2043,12 +2067,14 @@ export default class ChatBubbles {
|
|||||||
|
|
||||||
let canHaveTail = true;
|
let canHaveTail = true;
|
||||||
|
|
||||||
if(totalEntities && !messageMedia && rootScope.settings.emoji.big) {
|
let needToSetHTML = true;
|
||||||
|
if(totalEntities && !messageMedia) {
|
||||||
let emojiEntities = totalEntities.filter((e) => e._ === 'messageEntityEmoji');
|
let emojiEntities = totalEntities.filter((e) => e._ === 'messageEntityEmoji');
|
||||||
let strLength = messageMessage.length;
|
let strLength = messageMessage.length;
|
||||||
let emojiStrLength = emojiEntities.reduce((acc: number, curr: any) => acc + curr.length, 0);
|
let emojiStrLength = emojiEntities.reduce((acc: number, curr: any) => acc + curr.length, 0);
|
||||||
|
|
||||||
if(emojiStrLength === strLength && emojiEntities.length <= 3) {
|
if(emojiStrLength === strLength && emojiEntities.length <= 3) {
|
||||||
|
if(rootScope.settings.emoji.big) {
|
||||||
let sticker = this.appStickersManager.getAnimatedEmojiSticker(messageMessage);
|
let sticker = this.appStickersManager.getAnimatedEmojiSticker(messageMessage);
|
||||||
if(emojiEntities.length === 1 && !messageMedia && sticker) {
|
if(emojiEntities.length === 1 && !messageMedia && sticker) {
|
||||||
messageMedia = {
|
messageMedia = {
|
||||||
@ -2068,15 +2094,19 @@ export default class ChatBubbles {
|
|||||||
|
|
||||||
bubble.classList.add('is-message-empty', 'emoji-big');
|
bubble.classList.add('is-message-empty', 'emoji-big');
|
||||||
canHaveTail = false;
|
canHaveTail = false;
|
||||||
} else {
|
needToSetHTML = false;
|
||||||
setInnerHTML(messageDiv, richText);
|
}
|
||||||
|
|
||||||
|
bubble.classList.add('can-have-big-emoji');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if(strLength === emojiStrLength) {
|
/* if(strLength === emojiStrLength) {
|
||||||
messageDiv.classList.add('emoji-only');
|
messageDiv.classList.add('emoji-only');
|
||||||
messageDiv.classList.add('message-empty');
|
messageDiv.classList.add('message-empty');
|
||||||
} */
|
} */
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if(needToSetHTML) {
|
||||||
setInnerHTML(messageDiv, richText);
|
setInnerHTML(messageDiv, richText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user