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
+1 -1
View File
@@ -782,7 +782,7 @@ html
el-tab-pane(label="Info") 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(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") div(style="flex:none")
location(:location="userDialog.ref.location") location(:location="userDialog.ref.location")
template(#default v-if="userDialog.instance.occupants") ({{ userDialog.instance.occupants }}) template(#default v-if="userDialog.instance.occupants") ({{ userDialog.instance.occupants }})
launch(:location="userDialog.ref.location" style="margin-left:5px") launch(:location="userDialog.ref.location" style="margin-left:5px")
invite-yourself(:location="userDialog.ref.location" style="margin-left:5px") invite-yourself(:location="userDialog.ref.location" style="margin-left:5px")
+37 -49
View File
@@ -727,6 +727,14 @@ speechSynthesis.getVoices();
notys.push(feed); 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 bias = new Date(Date.now() - 60000).toJSON();
var theme = 'relax'; var theme = 'relax';
@@ -736,70 +744,44 @@ speechSynthesis.getVoices();
notys.forEach((noty) => { notys.forEach((noty) => {
if (noty.created_at > bias) { if (noty.created_at > bias) {
if (configRepository.getBool('VRCX_overlayNotifications')) { if (configRepository.getBool('VRCX_overlayNotifications')) {
var text = '';
switch (noty.type) { switch (noty.type) {
case 'OnPlayerJoined': case 'OnPlayerJoined':
new Noty({ text = `<strong>${noty.data}</strong> has joined`;
type: 'alert',
theme: theme,
timeout: notificationTimeout,
layout: notificationPosition,
text: `<strong>${noty.data}</strong> has joined`
}).show();
break; break;
case 'OnPlayerLeft': case 'OnPlayerLeft':
new Noty({ text = `<strong>${noty.data}</strong> has left`;
type: 'alert',
theme: theme,
timeout: notificationTimeout,
layout: notificationPosition,
text: `<strong>${noty.data}</strong> has left`
}).show();
break; break;
case 'Online': case 'Online':
new Noty({ text = `<strong>${noty.displayName}</strong> has logged in`;
type: 'alert',
theme: theme,
timeout: notificationTimeout,
layout: notificationPosition,
text: `<strong>${noty.displayName}</strong> has logged in`
}).show();
break; break;
case 'Offline': case 'Offline':
new Noty({ text = `<strong>${noty.displayName}</strong> has logged out`;
type: 'alert',
theme: theme,
timeout: notificationTimeout,
layout: notificationPosition,
text: `<strong>${noty.displayName}</strong> has logged out`
}).show();
break; break;
case 'invite': case 'invite':
new Noty({ text = `<strong>${noty.senderUsername}</strong> has invited you to ${noty.details.worldName}`;
type: 'alert',
theme: theme,
timeout: notificationTimeout,
layout: notificationPosition,
text: `<strong>${noty.senderUsername}</strong> has invited you to ${noty.details.worldName}`
}).show();
break; break;
case 'requestInvite': case 'requestInvite':
new Noty({ text = `<strong>${noty.senderUsername}</strong> has requested an invite`;
type: 'alert',
theme: theme,
timeout: notificationTimeout,
layout: notificationPosition,
text: `<strong>${noty.senderUsername}</strong> has requested an invite`
}).show();
break; break;
case 'friendRequest': case 'friendRequest':
new Noty({ text = `<strong>${noty.senderUsername}</strong> has sent you a friend request`;
type: 'alert',
theme: theme,
timeout: notificationTimeout,
layout: notificationPosition,
text: `<strong>${noty.senderUsername}</strong> has sent you a friend request`
}).show();
break; 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')) { if (configRepository.getBool('VRCX_notificationTTS')) {
@@ -825,6 +807,12 @@ speechSynthesis.getVoices();
case 'friendRequest': case 'friendRequest':
this.speak(`${noty.senderUsername} has sent you a friend request`); this.speak(`${noty.senderUsername} has sent you a friend request`);
break; break;
case 'Friend':
this.speak(`${noty.displayName} is now your friend`);
break;
case 'Unfriend':
this.speak(`${noty.displayName} has unfriended you`);
break;
} }
} }
} }