mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-05-08 08:58:38 +01:00
Move notification listeners to background
Otherwise they will be re-registered by the frontend page. // FREEBIE
This commit is contained in:
@@ -4,6 +4,25 @@
|
|||||||
|
|
||||||
;(function() {
|
;(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
// register some chrome listeners
|
||||||
|
if (chrome.notifications) {
|
||||||
|
chrome.notifications.onClicked.addListener(function() {
|
||||||
|
chrome.notifications.clear('signal');
|
||||||
|
Whisper.Notifications.onclick();
|
||||||
|
});
|
||||||
|
chrome.notifications.onButtonClicked.addListener(function() {
|
||||||
|
chrome.notifications.clear('signal');
|
||||||
|
Whisper.Notifications.clear();
|
||||||
|
getInboxCollection().each(function(model) {
|
||||||
|
model.markRead();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
chrome.notifications.onClosed.addListener(function(id, byUser) {
|
||||||
|
if (byUser) {
|
||||||
|
Whisper.Notifications.clear();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
if (chrome && chrome.alarms) {
|
if (chrome && chrome.alarms) {
|
||||||
chrome.alarms.onAlarm.addListener(function() {
|
chrome.alarms.onAlarm.addListener(function() {
|
||||||
// nothing to do.
|
// nothing to do.
|
||||||
|
|||||||
@@ -170,24 +170,6 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (chrome.notifications) {
|
|
||||||
chrome.notifications.onClicked.addListener(function() {
|
|
||||||
chrome.notifications.clear('signal');
|
|
||||||
Whisper.Notifications.onclick();
|
|
||||||
});
|
|
||||||
chrome.notifications.onButtonClicked.addListener(function() {
|
|
||||||
chrome.notifications.clear('signal');
|
|
||||||
Whisper.Notifications.clear();
|
|
||||||
getInboxCollection().each(function(model) {
|
|
||||||
model.markRead();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
chrome.notifications.onClosed.addListener(function(id, byUser) {
|
|
||||||
if (byUser) {
|
|
||||||
Whisper.Notifications.clear();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
extension.notify = function(options) {
|
extension.notify = function(options) {
|
||||||
if (chrome) {
|
if (chrome) {
|
||||||
chrome.notifications.clear('signal');
|
chrome.notifications.clear('signal');
|
||||||
|
|||||||
Reference in New Issue
Block a user