From 432e209b16f37ae1524e7816f177ddb59a6ca0c7 Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Fri, 8 Apr 2022 20:32:48 +0200 Subject: [PATCH] Try fixing stuck read notifications --- imports/NeoChat/Component/ChatBox/ChatBar.qml | 18 ++++-------------- src/neochatroom.cpp | 2 +- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/imports/NeoChat/Component/ChatBox/ChatBar.qml b/imports/NeoChat/Component/ChatBox/ChatBar.qml index ec5c750e0..ae8797adb 100644 --- a/imports/NeoChat/Component/ChatBox/ChatBar.qml +++ b/imports/NeoChat/Component/ChatBox/ChatBar.qml @@ -120,22 +120,9 @@ ToolBar { room: currentRoom ?? null } - Timer { - id: timeoutTimer - repeat: false - interval: 2000 - onTriggered: { - repeatTimer.stop() - currentRoom.sendTypingNotification(false) - } - } - Timer { id: repeatTimer - repeat: true interval: 3000 - triggeredOnStart: true - onTriggered: currentRoom.sendTypingNotification(true) } function sendMessage(event) { @@ -241,8 +228,11 @@ ToolBar { } onTextChanged: { - timeoutTimer.restart() + if (!repeatTimer.running) { + currentRoom.sendTypingNotification(true) + } repeatTimer.start() + currentRoom.cachedInput = text autoAppeared = false; diff --git a/src/neochatroom.cpp b/src/neochatroom.cpp index b8dc184e4..09d527770 100644 --- a/src/neochatroom.cpp +++ b/src/neochatroom.cpp @@ -130,7 +130,7 @@ QVariantList NeoChatRoom::getUsersTyping() const void NeoChatRoom::sendTypingNotification(bool isTyping) { - connection()->callApi(BackgroundRequest, localUser()->id(), id(), isTyping, 5000); + connection()->callApi(BackgroundRequest, localUser()->id(), id(), isTyping, 3000); } const RoomMessageEvent *NeoChatRoom::lastEvent(bool ignoreStateEvent) const