notifications added to events.notify
This commit is contained in:
parent
18f2ab5f7a
commit
76fb591844
@ -12,7 +12,7 @@
|
||||
// "player ";
|
||||
}
|
||||
|
||||
.game .team {
|
||||
.game .team, .faceoff .team {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -65,6 +65,7 @@ pub enum RpcMessage {
|
||||
QueueRequested(()),
|
||||
QueueJoined(()),
|
||||
QueueCancelled(()),
|
||||
QueueFound(()),
|
||||
|
||||
InviteRequested(()),
|
||||
Invite(String),
|
||||
|
||||
@ -112,6 +112,10 @@ impl Warden {
|
||||
pair.0.tx.send(msg.clone())?;
|
||||
pair.1.tx.send(msg)?;
|
||||
|
||||
// send msgs for browser notifications
|
||||
pair.0.tx.send(RpcMessage::QueueFound(()))?;
|
||||
pair.1.tx.send(RpcMessage::QueueFound(()))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user