Index: lib/notificationHelper.js |
=================================================================== |
--- a/lib/notificationHelper.js |
+++ b/lib/notificationHelper.js |
@@ -191,25 +191,38 @@ |
let message = (texts.message || "").replace(/<\/?(a|strong)>/g, ""); |
let iconUrl = browser.extension.getURL("icons/detailed/abp-128.png"); |
let linkCount = (activeNotification.links || []).length; |
if ("notifications" in browser) |
{ |
activeButtons = getNotificationButtons(activeNotification.type, |
texts.message); |
- browser.notifications.create("", { |
+ let notificationOptions = { |
type: "basic", |
title, |
iconUrl, |
message, |
buttons: activeButtons.map(button => ({title: button.title})), |
// We use the highest priority to prevent the notification |
// from closing automatically. |
priority: 2 |
+ }; |
+ browser.notifications.create("", notificationOptions, () => |
+ { |
+ // Opera does not support the addtition of buttons to notifications. |
+ // Question type notfications always include buttons. |
+ if (browser.runtime.lastError) |
+ { |
+ if (activeNotification.type != "question") |
Sebastian Noack
2017/10/30 22:46:43
You can just check both conditions in the same if-
Jon Sonesen
2017/11/01 18:21:44
Done.
|
+ { |
+ delete notificationOptions.buttons; |
+ browser.notifications.create("", notificationOptions); |
+ } |
+ } |
}); |
} |
else if ("Notification" in window && activeNotification.type != "question") |
{ |
if (linkCount > 0) |
{ |
message += " " + browser.i18n.getMessage( |
"notification_without_buttons" |