[fractal/621-typing-notif-noise: 2/2] Send only typing notifications for text
- From: Alexandre Franke <afranke src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal/621-typing-notif-noise: 2/2] Send only typing notifications for text
- Date: Mon, 27 Apr 2020 17:28:09 +0000 (UTC)
commit fc61f561045f4943790444831046a15f825b8dc6
Author: Alexandre Franke <afranke gnome org>
Date: Mon Apr 27 19:21:19 2020 +0200
Send only typing notifications for text
Any key would trigger them before, e.g. ctrl or shift.
Fixes #621
fractal-gtk/src/app/connect/send.rs | 6 ++++--
fractal-matrix-api/src/backend/room.rs | 3 ++-
2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/fractal-gtk/src/app/connect/send.rs b/fractal-gtk/src/app/connect/send.rs
index a3805cd0..df99c10d 100644
--- a/fractal-gtk/src/app/connect/send.rs
+++ b/fractal-gtk/src/app/connect/send.rs
@@ -46,8 +46,10 @@ impl App {
});
let mut op = self.op.clone();
- msg_entry.connect_key_release_event(move |_, _| {
- op.lock().unwrap().send_typing();
+ msg_entry.connect_key_release_event(move |_, ev| {
+ if gdk::keyval_to_unicode(ev.get_keyval()).is_some() {
+ op.lock().unwrap().send_typing();
+ }
Inhibit(false)
});
diff --git a/fractal-matrix-api/src/backend/room.rs b/fractal-matrix-api/src/backend/room.rs
index 56b02ffd..8e2b1e7f 100644
--- a/fractal-matrix-api/src/backend/room.rs
+++ b/fractal-matrix-api/src/backend/room.rs
@@ -1,4 +1,4 @@
-use log::error;
+use log::{error, info};
use serde_json::json;
use ruma_identifiers::{Error as IdError, RoomId, RoomIdOrAliasId, UserId};
@@ -291,6 +291,7 @@ pub fn send_typing(
let params = TypingNotificationParameters { access_token };
let body = TypingNotificationBody::Typing(Duration::from_secs(4));
+ info!("Sending typing notification");
send_typing_notification(base, &room_id, &user_id, ¶ms, &body)
.map_err(Into::into)
.and_then(|request| {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]