AyuGramDesktop/Telegram/SourceFiles/history
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
..
admin_log Replaced Ui::InformBox and Ui::ConfirmBox with GenericBox. 2022-02-28 09:08:01 +03:00
view Fixed unexpected copyright reason from top bar in sections. 2022-03-02 06:11:44 +03:00
history.cpp Reaction notifications only from non-blocked contacts. 2022-01-31 16:18:40 +03:00
history.h Reaction notifications only from non-blocked contacts. 2022-01-31 16:18:40 +03:00
history_drag_area.cpp Moved ConfirmBox to td_ui. 2021-10-19 06:34:27 +03:00
history_drag_area.h Added ability to drag and drop images in photo editor. 2021-07-06 12:13:06 +03:00
history_inner_widget.cpp Do not remove notification reference on NotificationClosed 2022-03-05 16:51:02 +04:00
history_inner_widget.h Get rid of Q_OBJECT in HistoryInner 2022-03-05 16:47:38 +04:00
history_item.cpp Show correct downloads elements context menu. 2022-02-27 20:26:52 +03:00
history_item.h Show correct downloads elements context menu. 2022-02-27 20:26:52 +03:00
history_item_components.cpp Fix scroll state management in Downloads. 2022-02-27 20:26:52 +03:00
history_item_components.h Added userpics support to sponsored messages. 2022-02-25 19:41:16 +03:00
history_item_edition.cpp Apply reactions from message edit updates. 2021-12-29 21:22:34 +03:00
history_item_edition.h Apply reactions from message edit updates. 2021-12-29 21:22:34 +03:00
history_item_reply_markup.cpp Update API scheme to layer 135. 2021-11-26 18:00:18 +04:00
history_item_reply_markup.h Update API scheme to layer 135. 2021-11-26 18:00:18 +04:00
history_item_text.cpp Get rid of deprecated ranges::view usage 2021-03-13 19:14:58 +03:00
history_item_text.h Copy text with expanded links only to external. 2019-04-08 19:10:06 +04:00
history_location_manager.cpp Use UrlClickHandler::Open instead of File::OpenUrl 2020-10-30 11:52:10 +03:00
history_location_manager.h Handle located groups as public. 2019-06-21 14:27:46 +02:00
history_message.cpp Replaced Ui::InformBox and Ui::ConfirmBox with GenericBox. 2022-02-28 09:08:01 +03:00
history_message.h Track unread mentions and unread reactions the same way. 2022-01-28 19:10:07 +03:00
history_service.cpp Replaced args for Calls::Instance::startOrJoinGroupCall with struct. 2022-02-28 08:04:46 +03:00
history_service.h Removed text commands from history item components. 2022-01-12 11:54:24 +03:00
history_unread_things.cpp Improve unread reactions list consistency. 2022-01-31 23:16:56 +03:00
history_unread_things.h Improve unread reactions list consistency. 2022-01-31 23:16:56 +03:00
history_widget.cpp Provided window controller to box of converting channel to gigagroup. 2022-03-04 11:25:10 +03:00
history_widget.h Added simple animation of static stickers sending. 2022-02-25 19:41:15 +03:00