From d7c6af4b3c482da35ae183427877285c17496c5b Mon Sep 17 00:00:00 2001 From: Eduard Kuzmenko Date: Tue, 22 Jun 2021 19:27:07 +0300 Subject: [PATCH] Disable double click reply on mobile devices --- src/components/chat/bubbles.ts | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/components/chat/bubbles.ts b/src/components/chat/bubbles.ts index ea0b2982..9931f2e9 100644 --- a/src/components/chat/bubbles.ts +++ b/src/components/chat/bubbles.ts @@ -30,7 +30,7 @@ import StickyIntersector from "../stickyIntersector"; import animationIntersector from "../animationIntersector"; import RichTextProcessor from "../../lib/richtextprocessor"; import mediaSizes from "../../helpers/mediaSizes"; -import { isAndroid, isApple, isSafari } from "../../helpers/userAgent"; +import { isAndroid, isApple, isMobile, isSafari } from "../../helpers/userAgent"; import I18n, { i18n, langPack } from "../../lib/langPack"; import AvatarElement from "../avatar"; import { formatPhoneNumber } from "../misc"; @@ -422,17 +422,19 @@ export default class ChatBubbles { }); } - this.listenerSetter.add(this.bubblesContainer, 'dblclick', (e) => { - if(this.chat.selection.isSelecting || !this.appMessagesManager.canWriteToPeer(this.peerId, this.chat.threadId)) { - return; - } - - const bubble = (e.target as HTMLElement).classList.contains('bubble') ? e.target as HTMLElement : null; - if(bubble) { - const mid = +bubble.dataset.mid - this.chat.input.initMessageReply(mid); - } - }); + if(!isMobile) { + this.listenerSetter.add(this.bubblesContainer, 'dblclick', (e) => { + if(this.chat.selection.isSelecting || !this.appMessagesManager.canWriteToPeer(this.peerId, this.chat.threadId)) { + return; + } + + const bubble = (e.target as HTMLElement).classList.contains('bubble') ? e.target as HTMLElement : null; + if(bubble) { + const mid = +bubble.dataset.mid + this.chat.input.initMessageReply(mid); + } + }); + } /* if(false) */this.stickyIntersector = new StickyIntersector(this.scrollable.container, (stuck, target) => { for(const timestamp in this.dateMessages) {