friend log notifications

This commit is contained in:
Natsumi
2021-01-03 02:29:57 +13:00
parent a80fb04c72
commit 54f7f5154f
2 changed files with 38 additions and 50 deletions

View File

@@ -782,7 +782,7 @@ html
el-tab-pane(label="Info")
div(v-if="userDialog.ref.location" style="display:flex;flex-direction:column;margin-bottom:10px;padding-bottom:10px;border-bottom:1px solid #eee")
div(style="flex:none")
location(:location="userDialog.ref.location")
location(:location="userDialog.ref.location")
template(#default v-if="userDialog.instance.occupants") ({{ userDialog.instance.occupants }})
launch(:location="userDialog.ref.location" style="margin-left:5px")
invite-yourself(:location="userDialog.ref.location" style="margin-left:5px")

View File

@@ -727,6 +727,14 @@ speechSynthesis.getVoices();
notys.push(feed);
}
}
if (feed.type === 'Friend' ||
feed.type === 'Unfriend') {
if (!map[feed.displayName] ||
map[feed.displayName] < feed.created_at) {
map[feed.displayName] = feed.created_at;
notys.push(feed);
}
}
});
var bias = new Date(Date.now() - 60000).toJSON();
var theme = 'relax';
@@ -736,70 +744,44 @@ speechSynthesis.getVoices();
notys.forEach((noty) => {
if (noty.created_at > bias) {
if (configRepository.getBool('VRCX_overlayNotifications')) {
var text = '';
switch (noty.type) {
case 'OnPlayerJoined':
new Noty({
type: 'alert',
theme: theme,
timeout: notificationTimeout,
layout: notificationPosition,
text: `<strong>${noty.data}</strong> has joined`
}).show();
text = `<strong>${noty.data}</strong> has joined`;
break;
case 'OnPlayerLeft':
new Noty({
type: 'alert',
theme: theme,
timeout: notificationTimeout,
layout: notificationPosition,
text: `<strong>${noty.data}</strong> has left`
}).show();
text = `<strong>${noty.data}</strong> has left`;
break;
case 'Online':
new Noty({
type: 'alert',
theme: theme,
timeout: notificationTimeout,
layout: notificationPosition,
text: `<strong>${noty.displayName}</strong> has logged in`
}).show();
text = `<strong>${noty.displayName}</strong> has logged in`;
break;
case 'Offline':
new Noty({
type: 'alert',
theme: theme,
timeout: notificationTimeout,
layout: notificationPosition,
text: `<strong>${noty.displayName}</strong> has logged out`
}).show();
text = `<strong>${noty.displayName}</strong> has logged out`;
break;
case 'invite':
new Noty({
type: 'alert',
theme: theme,
timeout: notificationTimeout,
layout: notificationPosition,
text: `<strong>${noty.senderUsername}</strong> has invited you to ${noty.details.worldName}`
}).show();
text = `<strong>${noty.senderUsername}</strong> has invited you to ${noty.details.worldName}`;
break;
case 'requestInvite':
new Noty({
type: 'alert',
theme: theme,
timeout: notificationTimeout,
layout: notificationPosition,
text: `<strong>${noty.senderUsername}</strong> has requested an invite`
}).show();
text = `<strong>${noty.senderUsername}</strong> has requested an invite`;
break;
case 'friendRequest':
new Noty({
type: 'alert',
theme: theme,
timeout: notificationTimeout,
layout: notificationPosition,
text: `<strong>${noty.senderUsername}</strong> has sent you a friend request`
}).show();
text = `<strong>${noty.senderUsername}</strong> has sent you a friend request`;
break;
case 'Friend':
text = `<strong>${noty.displayName}</strong> is now your friend`;
break;
case 'Unfriend':
text = `<strong>${noty.displayName}</strong> has unfriended you`;
break;
}
if (text) {
new Noty({
type: 'alert',
theme: theme,
timeout: notificationTimeout,
layout: notificationPosition,
text: text
}).show();
}
}
if (configRepository.getBool('VRCX_notificationTTS')) {
@@ -825,6 +807,12 @@ speechSynthesis.getVoices();
case 'friendRequest':
this.speak(`${noty.senderUsername} has sent you a friend request`);
break;
case 'Friend':
this.speak(`${noty.displayName} is now your friend`);
break;
case 'Unfriend':
this.speak(`${noty.displayName} has unfriended you`);
break;
}
}
}