tdesktop/Telegram/SourceFiles/platform/linux
Magnus Groß 4dd14b81e1 Do not remove notification reference on NotificationClosed
In general we need to keep a reference to the notification id, so that
we can delete the notification later from history - unless the
NotificationClosed reason was that the user actively dismissed it, in
which case it is not kept in history anyway (so we can dismiss our
reference too).

-- Background --
Some desktop environments such as KDE keep a history of notifications.
An API is provided to delete notifications from that history by calling
the org.freedesktop.Notifications.CloseNotification endpoint with the ID
of that notification. If the notification was already closed (timed
out), then this will delete the notification from history.

The intent is to clear these notifications from the notification history
as soon as a chat with notifications originating from that person is
opened, as the user is then not interested anymore in those
notifications and to prevent unnecessary clutter in the history widget.
It is also cleared when the chat is read on another device.

-- Problem --
Telegram already has all the code in place to support this
functionality, but unfortunately this did not work on Linux before,
because we listen to the NotificationClosed signal and remove our
reference to the notification id from our internal manager as soon as we
get that signal. This means that we do not clear that notification from
history once we open the chat with that person (unless we open the chat
before the notification has timed out, i.e. if we didn't get the
NotificationClosed signal).

-- Fix --
To fix this, we keep our notification reference (if the notification was
not dismissed by the user), which means that our reference will be kept
around until we open the chat with that person (or close Telegram
entirely).

Since all the needed functionality for deleting notifications was
already in place, this patch is quite short as we only need to keep the
reference around longer than we did before this patch.

Note also that code is already in place to clear notifications for
messages that were read on another device: History::inboxRead() calls
Core::App().notifications().clearIncomingFromHistory()

Fixes #17111
2022-03-05 16:51:02 +04:00
..
file_utilities_linux.cpp Don't link glib with DESKTOP_APP_DISABLE_DBUS_INTEGRATION 2021-09-12 00:12:13 +03:00
file_utilities_linux.h Move EscapeShell to specific_linux 2021-01-22 17:22:37 +04:00
integration_linux.cpp Add dummy Platform::Integration on Linux. 2022-01-06 15:44:02 +03:00
integration_linux.h Add dummy Platform::Integration on Linux. 2022-01-06 15:44:02 +03:00
launcher_linux.cpp Instantiate a local dbus server for webview IPC 2021-11-29 16:23:51 +04:00
launcher_linux.h Allow to build with -Werror and clang 2021-07-13 21:32:06 +03:00
linux_desktop_environment.cpp Fix desktop environment list deduplication 2022-02-02 09:23:14 +03:00
linux_desktop_environment.h Rework DE detection 2022-01-07 19:14:59 +03:00
linux_wayland_integration_dummy.cpp Move xdg-foreign support to lib_base 2022-02-04 16:31:40 +03:00
linux_wayland_integration.cpp Move xdg-foreign support to lib_base 2022-02-04 16:31:40 +03:00
linux_wayland_integration.h Move xdg-foreign support to lib_base 2022-02-04 16:31:40 +03:00
linux_xdp_file_dialog.cpp Move xdg-foreign support to lib_base 2022-02-04 16:31:40 +03:00
linux_xdp_file_dialog.h Make Linux file dialog API better 2021-06-24 11:26:24 +04:00
linux_xdp_open_with_dialog.cpp Move xdg-foreign support to lib_base 2022-02-04 16:31:40 +03:00
linux_xdp_open_with_dialog.h Add portal-based open with dialog implementation 2021-03-10 09:46:13 +04:00
main_window_linux.cpp Get rid of unneeded MainWindow::Private class on Linux 2022-03-05 16:47:38 +04:00
main_window_linux.h Get rid of unneeded MainWindow::Private class on Linux 2022-03-05 16:47:38 +04:00
notifications_manager_linux_dummy.cpp Fix build with dummy notifications manager on Linux. 2021-04-29 11:21:57 +04:00
notifications_manager_linux.cpp Do not remove notification reference on NotificationClosed 2022-03-05 16:51:02 +04:00
notifications_manager_linux.h Hide native notifications of deleted messages. 2021-10-21 23:01:13 +04:00
specific_linux.cpp Move xdg-foreign support to lib_base 2022-02-04 16:31:40 +03:00
specific_linux.h Support autostart in Windows Store version. 2021-11-04 12:36:28 +04:00