AyuGramDesktop/Telegram
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
..
build Beta version 3.5.4. 2022-03-01 19:38:33 +03:00
cmake Update tgcalls. 2022-02-27 20:26:50 +03:00
codegen@a46f293fc4 Add support for Clipperton Island flag emoji. 2022-02-28 19:43:36 +03:00
lib_base@3827b6186e Show downloaded files in Downloads. 2022-02-27 20:26:52 +03:00
lib_crl@4e620bc383 Move libdl/libpthread handling to common_options 2022-01-05 13:18:08 +03:00
lib_lottie@e052821270 Use QColor instead of optional<QColor> in lottie. 2022-01-28 19:10:07 +03:00
lib_qr@501f4c3502 Update submodules. 2022-02-28 19:43:51 +03:00
lib_rpl@94a42b775a Start SendAsButton in HistoryWidget. 2021-11-26 18:00:18 +04:00
lib_spellcheck@9bf8cd7fc8 Split qt_adapters to separated files. 2022-01-26 10:33:28 +03:00
lib_storage@73d57840ac Use base/random.h instead of openssl::RandomValue. 2021-09-15 13:42:22 +03:00
lib_tl@45faed44e7 Start proper payments processing. 2021-04-06 18:41:15 +04:00
lib_ui@d2e482dac3 Added Ui::Show implementation for Window::SessionController. 2022-03-04 11:25:10 +03:00
lib_waylandshells@928501605f Update submodules 2021-10-24 20:01:55 +04:00
lib_webrtc@b2e6841058 Fix tg_owt@M98 build with MSVC. 2022-01-29 15:18:23 +03:00
lib_webview@d08b8cc840 Move libdl/libpthread handling to common_options 2022-01-05 13:18:08 +03:00
Resources Improve title text in RTMP full screen. 2022-03-04 18:24:44 +04:00
SetupFiles
SourceFiles Do not remove notification reference on NotificationClosed 2022-03-05 16:51:02 +04:00
Telegram Fix build for Mac App Store. 2021-10-30 17:19:24 +04:00
ThirdParty Beta version 3.5.4: Fix build with Xcode. 2022-03-01 19:43:37 +03:00
CMakeLists.txt Added ability to start livestream with RTMP. 2022-02-28 08:05:02 +03:00
configure.bat Fix build scripts. 2020-01-02 13:45:21 +03:00
configure.py Use Ninja Multi-Config generator on Linux. 2021-11-17 10:03:14 +04:00
configure.sh Closed alpha version 1.9.1.8: Fix macOS build. 2019-12-06 14:22:46 +03:00
create.bat Use single LEGAL file with license and copyright. 2018-01-03 13:23:14 +03:00
Telegram.plist Request camera permissions on macOS. 2020-08-11 18:21:40 +04:00