mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-02-11 17:55:51 +00:00
controller code
This commit is contained in:
parent
36ee386c82
commit
a438f9db6a
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user