From a438f9db6aa9fdef99c524ed0b03d88ed63e4696 Mon Sep 17 00:00:00 2001 From: Phillip Date: Thu, 10 Aug 2023 04:19:46 +0300 Subject: [PATCH] controller code --- core/src/notifications/controller.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/core/src/notifications/controller.js b/core/src/notifications/controller.js index f0b01060..20d4994d 100644 --- a/core/src/notifications/controller.js +++ b/core/src/notifications/controller.js @@ -1,7 +1,7 @@ import config from './config' import { dispatcher } from './dispatcher' import snackbar from '../functional-components/snackbar.js' -import { NEW_MESSAGE, NEW_MESSAGE_NOTIFICATION_QAPP } from './types' +import { NEW_MESSAGE, NEW_MESSAGE_NOTIFICATION_QAPP, NEW_MESSAGE_NOTIFICATION_QAPP_LOCAL } from './types' let initial = 0 let _state @@ -43,8 +43,8 @@ const notificationCheck = function () { */ export const doNewMessage = function (req) { - const newMessage = () => { + let data if (req.type && req.type === 'qapp') { data = req @@ -73,10 +73,16 @@ export const doNewMessage = function (req) { } else { _state = notificationState } - } - + } const page = window.top.location.href - if (!document.hasFocus()) { + if(req.type && req.type === 'qapp-local-notification'){ + try { + dispatcher({ type: NEW_MESSAGE_NOTIFICATION_QAPP_LOCAL, data: req }) + + } catch (error) { + console.log('error', error) + } + }else if (!document.hasFocus()) { newMessage() } else { if (page.includes(req.url) === false) {