notifications added to events.notify
This commit is contained in:
@@ -12,6 +12,13 @@ const { tutorialVbox } = require('./tutorial.utils');
|
||||
|
||||
function registerEvents(store) {
|
||||
function notify(msg) {
|
||||
if (Notification && Notification.permission === 'granted') {
|
||||
const n = new Notification('MNML', {
|
||||
body: msg,
|
||||
tag: 'MNML',
|
||||
});
|
||||
}
|
||||
|
||||
return infoToast(msg);
|
||||
}
|
||||
|
||||
@@ -130,6 +137,10 @@ function registerEvents(store) {
|
||||
if (account) {
|
||||
LogRocket.init('yh0dy3/mnml');
|
||||
LogRocket.identify(account.id, account);
|
||||
|
||||
if (Notification) {
|
||||
Notification.requestPermission();
|
||||
}
|
||||
}
|
||||
|
||||
store.dispatch(actions.setAccount(account));
|
||||
|
||||
@@ -264,13 +264,14 @@ function createSocket(events) {
|
||||
Pong: onPong,
|
||||
Demo: onDemo,
|
||||
|
||||
QueueRequested: () => events.notify('pvp queue request received'),
|
||||
QueueJoined: () => events.notify('you have joined the pvp queue'),
|
||||
InviteRequested: () => events.notify('pvp invite request received'),
|
||||
QueueRequested: () => events.notify('PVP queue request received.'),
|
||||
QueueJoined: () => events.notify('You have joined the PVP queue.'),
|
||||
QueueFound: () => events.notify('Your PVP game has started.'),
|
||||
InviteRequested: () => events.notify('PVP invite request received.'),
|
||||
Invite: code => events.setInvite(code),
|
||||
InstanceChat: chat => events.setInstanceChat(chat),
|
||||
ChatWheel: wheel => events.setChatWheel(wheel),
|
||||
Joining: () => events.notify('searching for instance...'),
|
||||
// Joining: () => events.notify('Searching for instance...'),
|
||||
|
||||
Processing: () => true,
|
||||
Error: errHandler,
|
||||
|
||||
Reference in New Issue
Block a user