|
|
@ -77,7 +77,7 @@ function disable() {
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param forceRefresh Should only be set when the user triggers a test notification from the settings
|
|
|
|
* @param forceRefresh Should only be set when the user triggers a test notification from the settings
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function addNotification(notif: SessionNotification, forceRefresh = false) {
|
|
|
|
function addNotification(notif: SessionNotification) {
|
|
|
|
const alreadyThere = currentNotifications.find(
|
|
|
|
const alreadyThere = currentNotifications.find(
|
|
|
|
n => n.conversationId === notif.conversationId && n.messageId === notif.messageId
|
|
|
|
n => n.conversationId === notif.conversationId && n.messageId === notif.messageId
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -86,11 +86,15 @@ function addNotification(notif: SessionNotification, forceRefresh = false) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
currentNotifications.push(notif);
|
|
|
|
currentNotifications.push(notif);
|
|
|
|
if (forceRefresh) {
|
|
|
|
debouncedUpdate();
|
|
|
|
update(true);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
|
|
|
|
debouncedUpdate();
|
|
|
|
/**
|
|
|
|
}
|
|
|
|
* Special case when we want to display a preview of what notifications looks like
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
function addPreviewNotification(notif: SessionNotification) {
|
|
|
|
|
|
|
|
currentNotifications.push(notif);
|
|
|
|
|
|
|
|
update(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function clearByConversationID(convoId: string) {
|
|
|
|
function clearByConversationID(convoId: string) {
|
|
|
@ -251,6 +255,7 @@ function onRemove() {
|
|
|
|
|
|
|
|
|
|
|
|
export const Notifications = {
|
|
|
|
export const Notifications = {
|
|
|
|
addNotification,
|
|
|
|
addNotification,
|
|
|
|
|
|
|
|
addPreviewNotification,
|
|
|
|
disable,
|
|
|
|
disable,
|
|
|
|
enable,
|
|
|
|
enable,
|
|
|
|
clear,
|
|
|
|
clear,
|
|
|
|