From d647d8cc64e4e39287e6342b6ee76cf51af91cbe Mon Sep 17 00:00:00 2001 From: Sorunome Date: Tue, 21 Sep 2021 09:13:02 +0200 Subject: [PATCH] fix: Stop typing when switching sending client --- lib/pages/chat.dart | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/pages/chat.dart b/lib/pages/chat.dart index bc983703..bfe1cc4f 100644 --- a/lib/pages/chat.dart +++ b/lib/pages/chat.dart @@ -225,9 +225,18 @@ class ChatController extends State { TextEditingController sendController = TextEditingController(); - void setSendingClient(Client c) => setState(() { - sendingClient = c; - }); + void setSendingClient(Client c) { + // first cancle typing with the old sending client + if (currentlyTyping) { + // no need to have the setting typing to false be blocking + typingCoolDown?.cancel(); + typingCoolDown = null; + room.setTyping(false); + currentlyTyping = false; + } + // then set the new sending client + setState(() => sendingClient = c); + } void setActiveClient(Client c) => setState(() { Matrix.of(context).setActiveClient(c);