| Index: lib/notificationHelper.js |
| diff --git a/lib/notificationHelper.js b/lib/notificationHelper.js |
| index cfe93ae8611bf6a92e2f74f17f1f3de13b1d1756..c4b704e4da7528781e301a26008361f742a27ffd 100644 |
| --- a/lib/notificationHelper.js |
| +++ b/lib/notificationHelper.js |
| @@ -152,22 +152,6 @@ function notificationClosed() |
| activeNotification = null; |
| } |
| -function imgToBase64(url, callback) |
| -{ |
| - let canvas = document.createElement("canvas"), |
| - ctx = canvas.getContext("2d"), |
| - img = new Image; |
| - img.src = url; |
| - img.onload = function() |
| - { |
| - canvas.height = img.height; |
| - canvas.width = img.width; |
| - ctx.drawImage(img, 0, 0); |
| - callback(canvas.toDataURL("image/png")); |
| - canvas = null; |
| - }; |
| -} |
| - |
| function initChromeNotifications() |
| { |
| // Chrome hides notifications in notification center when clicked so we need to clear them |
| @@ -209,40 +193,32 @@ function showNotification(notification) |
| if (canUseChromeNotifications) |
| { |
| activeButtons = getNotificationButtons(activeNotification.type, texts.message); |
| - let opts = { |
| + chrome.notifications.create("", { |
| type: "basic", |
| title: title, |
| + iconUrl: iconUrl, |
| message: message, |
| buttons: activeButtons.map(button => ({title: button.title})), |
| priority: 2 // We use the highest priority to prevent the notification from closing automatically |
| - }; |
| - |
| - imgToBase64(iconUrl, function(iconData) |
| - { |
| - opts.iconUrl = iconData; |
| - chrome.notifications.create("", opts, function() {}); |
| - }); |
| + }, function() {}); |
|
Sebastian Noack
2016/01/26 17:23:14
While changing this code, note that the callback i
kzar
2016/01/26 17:35:10
Done.
|
| } |
| else if ("Notification" in window && activeNotification.type != "question") |
| { |
| if (linkCount > 0) |
| message += " " + ext.i18n.getMessage("notification_without_buttons"); |
| - imgToBase64(iconUrl, function(iconData) |
| - { |
| - let notification = new Notification( |
| - title, |
| - { |
| - lang: Utils.appLocale, |
| - dir: ext.i18n.getMessage("@@bidi_dir"), |
| - body: message, |
| - icon: iconData |
| - } |
| - ); |
| + let notification = new Notification( |
| + title, |
| + { |
| + lang: Utils.appLocale, |
| + dir: ext.i18n.getMessage("@@bidi_dir"), |
| + body: message, |
| + icon: iconUrl |
| + } |
| + ); |
| - notification.addEventListener("click", openNotificationLinks); |
| - notification.addEventListener("close", notificationClosed); |
| - }); |
| + notification.addEventListener("click", openNotificationLinks); |
| + notification.addEventListener("close", notificationClosed); |
| } |
| else |
| { |