mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-03-27 15:55:55 +00:00
controller code
This commit is contained in:
parent
36ee386c82
commit
a438f9db6a
@ -1,7 +1,7 @@
|
|||||||
import config from './config'
|
import config from './config'
|
||||||
import { dispatcher } from './dispatcher'
|
import { dispatcher } from './dispatcher'
|
||||||
import snackbar from '../functional-components/snackbar.js'
|
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 initial = 0
|
||||||
let _state
|
let _state
|
||||||
@ -43,8 +43,8 @@ const notificationCheck = function () {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export const doNewMessage = function (req) {
|
export const doNewMessage = function (req) {
|
||||||
|
|
||||||
const newMessage = () => {
|
const newMessage = () => {
|
||||||
|
|
||||||
let data
|
let data
|
||||||
if (req.type && req.type === 'qapp') {
|
if (req.type && req.type === 'qapp') {
|
||||||
data = req
|
data = req
|
||||||
@ -74,9 +74,15 @@ export const doNewMessage = function (req) {
|
|||||||
_state = notificationState
|
_state = notificationState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const page = window.top.location.href
|
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()
|
newMessage()
|
||||||
} else {
|
} else {
|
||||||
if (page.includes(req.url) === false) {
|
if (page.includes(req.url) === false) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user