notifications added to events.notify
This commit is contained in:
parent
18f2ab5f7a
commit
76fb591844
@ -12,7 +12,7 @@
|
|||||||
// "player ";
|
// "player ";
|
||||||
}
|
}
|
||||||
|
|
||||||
.game .team {
|
.game .team, .faceoff .team {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(3, 1fr);
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
|
||||||
|
|||||||
@ -12,6 +12,13 @@ const { tutorialVbox } = require('./tutorial.utils');
|
|||||||
|
|
||||||
function registerEvents(store) {
|
function registerEvents(store) {
|
||||||
function notify(msg) {
|
function notify(msg) {
|
||||||
|
if (Notification && Notification.permission === 'granted') {
|
||||||
|
const n = new Notification('MNML', {
|
||||||
|
body: msg,
|
||||||
|
tag: 'MNML',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return infoToast(msg);
|
return infoToast(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,6 +137,10 @@ function registerEvents(store) {
|
|||||||
if (account) {
|
if (account) {
|
||||||
LogRocket.init('yh0dy3/mnml');
|
LogRocket.init('yh0dy3/mnml');
|
||||||
LogRocket.identify(account.id, account);
|
LogRocket.identify(account.id, account);
|
||||||
|
|
||||||
|
if (Notification) {
|
||||||
|
Notification.requestPermission();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
store.dispatch(actions.setAccount(account));
|
store.dispatch(actions.setAccount(account));
|
||||||
|
|||||||
@ -264,13 +264,14 @@ function createSocket(events) {
|
|||||||
Pong: onPong,
|
Pong: onPong,
|
||||||
Demo: onDemo,
|
Demo: onDemo,
|
||||||
|
|
||||||
QueueRequested: () => events.notify('pvp queue request received'),
|
QueueRequested: () => events.notify('PVP queue request received.'),
|
||||||
QueueJoined: () => events.notify('you have joined the pvp queue'),
|
QueueJoined: () => events.notify('You have joined the PVP queue.'),
|
||||||
InviteRequested: () => events.notify('pvp invite request received'),
|
QueueFound: () => events.notify('Your PVP game has started.'),
|
||||||
|
InviteRequested: () => events.notify('PVP invite request received.'),
|
||||||
Invite: code => events.setInvite(code),
|
Invite: code => events.setInvite(code),
|
||||||
InstanceChat: chat => events.setInstanceChat(chat),
|
InstanceChat: chat => events.setInstanceChat(chat),
|
||||||
ChatWheel: wheel => events.setChatWheel(wheel),
|
ChatWheel: wheel => events.setChatWheel(wheel),
|
||||||
Joining: () => events.notify('searching for instance...'),
|
// Joining: () => events.notify('Searching for instance...'),
|
||||||
|
|
||||||
Processing: () => true,
|
Processing: () => true,
|
||||||
Error: errHandler,
|
Error: errHandler,
|
||||||
|
|||||||
@ -65,6 +65,7 @@ pub enum RpcMessage {
|
|||||||
QueueRequested(()),
|
QueueRequested(()),
|
||||||
QueueJoined(()),
|
QueueJoined(()),
|
||||||
QueueCancelled(()),
|
QueueCancelled(()),
|
||||||
|
QueueFound(()),
|
||||||
|
|
||||||
InviteRequested(()),
|
InviteRequested(()),
|
||||||
Invite(String),
|
Invite(String),
|
||||||
|
|||||||
@ -112,6 +112,10 @@ impl Warden {
|
|||||||
pair.0.tx.send(msg.clone())?;
|
pair.0.tx.send(msg.clone())?;
|
||||||
pair.1.tx.send(msg)?;
|
pair.1.tx.send(msg)?;
|
||||||
|
|
||||||
|
// send msgs for browser notifications
|
||||||
|
pair.0.tx.send(RpcMessage::QueueFound(()))?;
|
||||||
|
pair.1.tx.send(RpcMessage::QueueFound(()))?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user