fix: Stop typing when switching sending client

This commit is contained in:
Sorunome 2021-09-21 09:13:02 +02:00
parent 396a433cae
commit d647d8cc64
No known key found for this signature in database
GPG Key ID: B19471D07FC9BE9C
1 changed files with 12 additions and 3 deletions

View File

@ -225,9 +225,18 @@ class ChatController extends State<Chat> {
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);