Commit Graph

142 Commits

Author SHA1 Message Date
John Preston 8937d732f6 Fix build with GCC. 2022-12-06 18:08:07 +04:00
John Preston cb653df0f6 Support adaptive forum userpic rounding radius. 2022-12-05 16:18:10 +04:00
23rd 4fabb3f2a2 Replaced some qsl with u""_q literal. 2022-11-30 17:17:14 +03:00
Ilya Fedin 05524c3f6c Don't show reply button in Linux native notifications when it's not supposed to
All modern notification daemons have support for the default action and it's a requirement with the portal spec
2022-11-28 21:55:00 +01:00
Ilya Fedin 2bda3c4e2b Don't save temp file for native notification userpics on Linux 2022-11-26 22:15:39 +01:00
Ilya Fedin ace363f432 Use GBytesIcon with GNotification
GFileIcon is not supported by xdg-desktop-portal
2022-11-26 17:26:52 +01:00
Ilya Fedin d6ed23b3dd Fix race condition between GApplication and GNotification 2022-11-26 17:26:52 +01:00
Ilya Fedin 9b66b76bac Use GNotification only in flatpak by default
The UX is not the best without sound, so there's no advantage in using GNotification on GNOME.

Remove mention about being native to GNOME as it's not true anymore.
2022-11-20 08:52:36 +00:00
Ilya Fedin b4d310fd1e Don't subscribe to inhibiton changes when not supported 2022-11-18 20:40:33 +04:00
Ilya Fedin f9dd2b4a0a Support GNotification
It's used if there's a gtk notification daemon or application is running sandboxed without access to the freedesktop protocol.

GNotification API is poor, but should feel native on environments using GNOME technologies.
2022-11-18 20:40:33 +04:00
Ilya Fedin 1336a7149b Update glibmm to latest version 2022-11-03 14:45:01 +04:00
John Preston fdf4129e5e Fix build with GCC. 2022-11-02 08:51:03 +04:00
John Preston 92a4b27e65 Support per-topic notification settings. 2022-11-01 19:25:37 +04:00
Ilya Fedin d9318c9935 Move icon name getter to cross-platform header 2022-09-19 14:23:27 +04:00
Ilya Fedin 66c9587650 Add fail callback to linux notifications exceptions handler 2022-07-31 12:21:24 +04:00
Ilya Fedin 8e8a209aad Guard linux notification inhibition checks 2022-07-28 20:18:51 +04:00
Ilya Fedin 9b8dcec26e Ensure notification manager is not null before first call to setManager in cross-platform code 2022-07-26 21:11:17 +04:00
Ilya Fedin 6718d238af Switch to the dummy notification manager when notification daemon is not running on Linux 2022-07-26 21:11:17 +04:00
Ilya Fedin dd70a6f659 IsQualifiedDaemon -> ByDefault 2022-07-26 21:11:17 +04:00
Ilya Fedin ff2bd86744 Have a central place for catch-based logging of linux native notifications 2022-07-26 21:11:17 +04:00
Ilya Fedin d2e3c01c11 Get linux notification inhibition state asynchronously
This is the last sync request in the D-Bus notifications
2022-07-26 21:11:17 +04:00
Ilya Fedin 798998203a Get XDG activation token from native notification on Linux 2022-06-15 12:55:59 +04:00
Ilya Fedin cee593c423 Check whether notification image has alpha channel 2022-04-25 22:33:22 +04:00
Ilya Fedin b39e4a3138 Do not call CloseNotification for activatable services
If the notification daemon is an activatable GApplication service (e.g.
on Mate), then the notification daemon may terminate a short time after
the notification has vanished (usually 15s). In that case the
notification daemon may reuse notification IDs, which is incompatible
with our notification clearing.
Also the service may not be running at all, when we call the
CloseNotification endpoint.

To fix this, we simply disable the entire notification history clearing
functionality on such desktops by proactively clearing all notification
references from our internal notification manager.

Signed-off-by: Magnus Groß <magnus.gross@rwth-aachen.de>
2022-03-05 16:51:02 +04:00
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
John Preston 389ea2af83 Fix compilation error on Linux. 2021-10-22 18:34:59 +04:00
John Preston d361f5c6b0 Hide native notifications of deleted messages. 2021-10-21 23:01:13 +04:00
Ilya Fedin 847c01d605 Add Qt 6 support
Tested only on Linux so far
2021-10-21 13:15:00 +04:00
John Preston 352768053d Beta version 3.1.6: Fix build on Linux. 2021-10-06 21:07:18 +04:00
John Preston 5cd0a3719e Beta version 3.1.6: Detach FastReply from MarkAsRead. 2021-10-06 19:24:30 +04:00
Ilya Fedin 087fbe89ce Add additional checks to NotificationData::setImage 2021-07-19 22:56:38 +03:00
Ilya Fedin 9b1d967967 Move NotificationServiceWatcher to notifications manager 2021-07-19 22:39:38 +03:00
John Preston 383acf0ffc Fix crash in native notifications on Linux. 2021-05-12 12:10:55 +04:00
Ilya Fedin 68dc00be27 Move weak_ptr include to .cpp in linux notifications 2021-05-03 14:39:24 +03:00
John Preston 98180d3a9e Always guard and send on_main in native notifications. 2021-05-03 13:08:50 +04:00
Ilya Fedin d87ea056c6 Fix a crash in NotificationData::show 2021-05-03 10:20:26 +03:00
John Preston 728b1efb9a Respect Focus Assist only for native notifications.
Fixes #16215.
2021-04-28 11:20:39 +04:00
Ilya Fedin cb930a89ce Silence ServiceUnknown and Disconnected errors for native notifications 2021-04-27 17:44:16 +03:00
John Preston e26e666135 Hide native notification details on lock screen. 2021-04-27 13:51:52 +04:00
John Preston 819ce06dfb Don't mark messages as read when screen is locked. 2021-04-27 13:31:51 +04:00
Ilya Fedin 6463890b11 Workaround snap's activation restriction 2021-04-05 08:25:47 +03:00
Ilya Fedin c4dcf064d5 Avoid multiple .arg usage as suggested by clazy 2021-03-13 19:08:33 +03:00
Ilya Fedin e493ab12dc Get rid of GetLauncherFilename
Use QGuiApplication::desktopFileName directly instead
2021-03-12 15:44:37 +04:00
Ilya Fedin b24cba99e2 Catch ListActivatableNames errors 2021-03-10 11:22:14 +04:00
Ilya Fedin 092b6e7c18 Fix spaces on ends of lines 2021-03-05 13:31:56 +04:00
Ilya Fedin 37a8afaddf Move remaining usage of dbus to glibmm in notifications_manager_linux 2021-03-04 12:07:54 +04:00
Ilya Fedin 8042a83fd2 Move glib usage to glibmm 2021-03-04 12:07:54 +04:00
Ilya Fedin bbf49b024a Fix implicit conversions from QByteArray 2021-02-19 14:15:09 +04:00
Ilya Fedin 6932d859c9 Get rid of unneeded QT_VERSION_CHECK in linux platform code 2021-02-19 14:15:09 +04:00
Ilya Fedin 03e8d28456 Check for null manager type 2021-02-09 16:51:25 +04:00