forked from hippoz/brainlet
add notifications (?)
This commit is contained in:
parent
76e0433753
commit
98cb260ff5
1 changed files with 5 additions and 1 deletions
|
@ -195,6 +195,7 @@ const app = new Vue({
|
|||
this.showApp = true;
|
||||
this.performGatewayConnection();
|
||||
this.browseCategories();
|
||||
Notification.requestPermission();
|
||||
} else {
|
||||
this.showApp = false;
|
||||
this.snackbarEditButton('Manage', () => {
|
||||
|
@ -239,6 +240,9 @@ const app = new Vue({
|
|||
}
|
||||
|
||||
if (messageObject.author.username !== this.loggedInUser.username && messageObject.category._id !== this.selection.category._id) {
|
||||
if (Notification.permission === 'granted') {
|
||||
new Notification(`${messageObject.category.title}/${messageObject.author.username}`, messageObject.content);
|
||||
}
|
||||
this.okNotification(`${messageObject.category.title}/${messageObject.author.username}: ${messageObject.content}`);
|
||||
}
|
||||
},
|
||||
|
@ -251,7 +255,7 @@ const app = new Vue({
|
|||
this.selection.category._id = categoryId;
|
||||
},
|
||||
sendCurrentMessage: async function() {
|
||||
const status = this.gateway.sendMessage(this.selection.category._id, this.message.typed);
|
||||
const status = await this.gateway.sendMessage(this.selection.category._id, this.message.typed);
|
||||
if (status === 1) {
|
||||
this.okNotification('Failed to send message!');
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue