summary refs log tree commit diff
path: root/src/notifications
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2023-05-29 00:42:56 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2023-05-29 00:42:56 +0200
commit3f4d38422074eec4c77ef06b3d1117966a621659 (patch)
tree91019a84c680e39e65b25cbfa4424db0706c06f8 /src/notifications
parentMerge pull request #1465 from frlan/patch-1 (diff)
parentDo not display reply action in the recap notif on Mac (diff)
downloadnheko-3f4d38422074eec4c77ef06b3d1117966a621659.tar.xz
Merge branch 'dont-send-notifications-on-first-sync' of github.com:LcsTen/nheko into notif-test
Diffstat (limited to 'src/notifications')
-rw-r--r--src/notifications/ManagerLinux.cpp13
-rw-r--r--src/notifications/ManagerMac.mm16
2 files changed, 20 insertions, 9 deletions
diff --git a/src/notifications/ManagerLinux.cpp b/src/notifications/ManagerLinux.cpp

index 6babb447..fc92c9ae 100644 --- a/src/notifications/ManagerLinux.cpp +++ b/src/notifications/ManagerLinux.cpp
@@ -187,11 +187,14 @@ NotificationsManager::systemPostNotification(const QString &room_id, // The list of actions has always the action name and then a localized version of that // action. Currently we just use an empty string for that. // TODO(Nico): Look into what to actually put there. - argumentList << (QStringList(QStringLiteral("default")) - << QLatin1String("") << QStringLiteral("inline-reply") - << QLatin1String("")); // actions - argumentList << hints; // hints - argumentList << (int)-1; // timeout in ms + QStringList actions; + actions << QStringList(QStringLiteral("default")) << QLatin1String(""); + if (!room_id.isEmpty()) { + actions << QStringLiteral("inline-reply") << QLatin1String(""); + } + argumentList << actions; // actions + argumentList << hints; // hints + argumentList << (int)-1; // timeout in ms QDBusPendingCall call = dbus.asyncCallWithArgumentList(QStringLiteral("Notify"), argumentList); auto watcher = new QDBusPendingCallWatcher{call, this}; diff --git a/src/notifications/ManagerMac.mm b/src/notifications/ManagerMac.mm
index 39312465..6da5d006 100644 --- a/src/notifications/ManagerMac.mm +++ b/src/notifications/ManagerMac.mm
@@ -106,10 +106,18 @@ void NotificationsManager::objCxxPostNotification( textInputButtonTitle:sendStr.toNSString() textInputPlaceholder:placeholder.toNSString()]; - UNNotificationCategory* category = [UNNotificationCategory categoryWithIdentifier:@"ReplyCategory" - actions:@[ replyAction ] - intentIdentifiers:@[] - options:UNNotificationCategoryOptionNone]; + UNNotificationCategory* category; + if(!room_id.isEmpty()){ + category = [UNNotificationCategory categoryWithIdentifier:@"ReplyCategory" + actions:@[ replyAction ] + intentIdentifiers:@[] + options:UNNotificationCategoryOptionNone]; + }else{ + category = [UNNotificationCategory categoryWithIdentifier:@"ReplyCategory" + actions:@[] + intentIdentifiers:@[] + options:UNNotificationCategoryOptionNone]; + } NSString* title = room_name.toNSString(); NSString* sub = subtitle.toNSString();