tdesktop/Telegram/SourceFiles
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
..
_other Revert "Use kernel accelerated sendfile to copy files on Linux" 2021-12-02 09:15:23 +04:00
api Moved out importChatInvite from ApiWrap. 2022-03-04 11:25:10 +03:00
boxes Fixed ability to send file to photo/video album from EditCaptionBox. 2022-03-04 18:58:07 +03:00
calls Improve title text in RTMP full screen. 2022-03-04 18:24:44 +04:00
chat_helpers Replaced EditLinkBox with generic box. 2022-03-04 11:25:10 +03:00
codegen/scheme
core Beta version 3.5.4. 2022-03-01 19:38:33 +03:00
countries Split qt_adapters to separated files. 2022-01-26 10:33:28 +03:00
data Handle documentLoadProgress instead of itemRepaintRequest. 2022-03-01 17:32:39 +03:00
dialogs Fix download bar close in a hidden window. 2022-03-04 15:37:50 +04:00
editor Fixed display photo with modifications as file in attach media preview. 2022-03-04 18:58:07 +03:00
export Removed Ui::ConfirmDontWarnBox. 2022-02-28 09:08:01 +03:00
ffmpeg Fix build against FFmpeg v5.0 2022-02-28 20:22:18 +03:00
history Do not remove notification reference on NotificationClosed 2022-03-05 16:51:02 +04:00
info Added to PeerListDelegate methods to show content. 2022-03-04 11:25:10 +03:00
inline_bots Remove unused variables 2022-02-28 23:11:07 +03:00
intro Replaced Ui::InformBox and Ui::ConfirmBox with GenericBox. 2022-02-28 09:08:01 +03:00
lang Removed Ui::ConfirmDontWarnBox. 2022-02-28 09:08:01 +03:00
layout Add support for SVG patterns in wallpapers. 2021-08-11 19:56:12 +03:00
main Handle documentLoadProgress instead of itemRepaintRequest. 2022-03-01 17:32:39 +03:00
media Added disable-autoplay-next option. 2022-03-05 12:40:49 +03:00
mtproto Update User-Agent for DNS to Chrome 98.0.4758.102. 2022-03-01 12:44:36 +03:00
overview Use nice media names in Downloads. 2022-02-27 20:26:52 +03:00
passport Support emoji in account names. 2022-03-01 13:25:42 +03:00
payments Fix empty state of Downloads section. 2022-02-27 20:26:52 +03:00
platform Do not remove notification reference on NotificationClosed 2022-03-05 16:51:02 +04:00
profile Replaced Ui::InformBox and Ui::ConfirmBox with GenericBox. 2022-02-28 09:08:01 +03:00
settings Added disable-autoplay-next option. 2022-03-05 12:40:49 +03:00
storage Beta version 3.5.3: Fix build with GCC. 2022-02-28 23:25:55 +03:00
support Move SendPreloadRequest out of HistoryWidget. 2022-02-10 15:20:37 +03:00
ui Fixed display photo with modifications as file in attach media preview. 2022-03-04 18:58:07 +03:00
window Update icons for folders. 2022-03-04 14:25:25 +04:00
apiwrap.cpp Moved out importChatInvite from ApiWrap. 2022-03-04 11:25:10 +03:00
apiwrap.h Moved out importChatInvite from ApiWrap. 2022-03-04 11:25:10 +03:00
config.h Moved some constants for peer editing to separated file. 2021-10-19 06:34:27 +03:00
facades.cpp Replaced Ui::InformBox and Ui::ConfirmBox with GenericBox. 2022-02-28 09:08:01 +03:00
facades.h Removed Main::Session forward declaration from data_types. 2021-09-01 01:23:20 +03:00
logs.cpp Decrypt shiftedDcId / protocolDcId in mtp_ logs. 2022-02-07 15:26:26 +03:00
logs.h
main.cpp
mainwidget.cpp Removed Ui::hideSettingsAndLayer(). 2022-03-04 11:25:10 +03:00
mainwidget.h Preload chats in support switch. 2022-02-08 00:24:11 +03:00
mainwindow.cpp Removed Ui::hideSettingsAndLayer(). 2022-03-04 11:25:10 +03:00
mainwindow.h Open specific chat only in one window. 2022-01-04 19:36:33 +03:00
settings.cpp Display dates with the system date format 2021-10-11 21:56:29 +04:00
settings.h Display dates with the system date format 2021-10-11 21:56:29 +04:00
stdafx.h Add Qt 6 support 2021-10-21 13:15:00 +04:00