Index: lib/notificationHelper.js |
=================================================================== |
--- a/lib/notificationHelper.js |
+++ b/lib/notificationHelper.js |
@@ -188,25 +188,35 @@ |
let message = (texts.message || "").replace(/<\/?(a|strong)>/g, ""); |
let iconUrl = ext.getURL("icons/detailed/abp-128.png"); |
let linkCount = (activeNotification.links || []).length; |
if ("notifications" in chrome) |
{ |
activeButtons = getNotificationButtons(activeNotification.type, |
texts.message); |
- chrome.notifications.create("", { |
+ let options = { |
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 |
+ }; |
+ chrome.notifications.create("", options, () => |
+ { |
+ if (chrome.runtime.lastError && chrome.runtime.lastError.message === ` |
+ Adding buttons to notifications is not supported.`) |
Sebastian Noack
2017/10/21 21:04:28
I would skip the check for the error message. If i
Jon Sonesen
2017/10/30 22:41:41
Done.
|
+ { |
+ delete options.buttons; |
Jon Sonesen
2017/10/19 21:59:17
perhaps it is better to move this down or put all
Sebastian Noack
2017/10/21 21:04:28
Yeah, I guess this operation makes more sense in t
Jon Sonesen
2017/10/30 22:41:41
Done.
|
+ if (activeNotification.type != "question") |
+ chrome.notifications.create("", options); |
+ } |
}); |
} |
else if ("Notification" in window && activeNotification.type != "question") |
{ |
if (linkCount > 0) |
message += " " + ext.i18n.getMessage("notification_without_buttons"); |
let widget = new Notification( |