Add an option to toggle VR overlay notifications

Whoops

Whoops 2
This commit is contained in:
Natsumi
2020-10-22 02:40:29 +13:00
committed by pypy
parent d6a5b3a26d
commit d560aa9836
3 changed files with 51 additions and 43 deletions
+3
View File
@@ -5482,18 +5482,21 @@ CefSharp.BindObjectAsync(
$app.data.hidePrivateFromFeed = VRCXStorage.GetBool('VRCX_hidePrivateFromFeed'); $app.data.hidePrivateFromFeed = VRCXStorage.GetBool('VRCX_hidePrivateFromFeed');
$app.data.hideLoginsFromFeed = VRCXStorage.GetBool('VRCX_hideLoginsFromFeed'); $app.data.hideLoginsFromFeed = VRCXStorage.GetBool('VRCX_hideLoginsFromFeed');
$app.data.hideDevicesFromFeed = VRCXStorage.GetBool('VRCX_hideDevicesFromFeed'); $app.data.hideDevicesFromFeed = VRCXStorage.GetBool('VRCX_hideDevicesFromFeed');
$app.data.vipNotifications = VRCXStorage.GetBool('VRCX_VIPNotifications');
var saveOpenVROption = function () { var saveOpenVROption = function () {
VRCXStorage.SetBool('openVR', this.openVR); VRCXStorage.SetBool('openVR', this.openVR);
VRCXStorage.SetBool('openVRAlways', this.openVRAlways); VRCXStorage.SetBool('openVRAlways', this.openVRAlways);
VRCXStorage.SetBool('VRCX_hidePrivateFromFeed', this.hidePrivateFromFeed); VRCXStorage.SetBool('VRCX_hidePrivateFromFeed', this.hidePrivateFromFeed);
VRCXStorage.SetBool('VRCX_hideLoginsFromFeed', this.hideLoginsFromFeed); VRCXStorage.SetBool('VRCX_hideLoginsFromFeed', this.hideLoginsFromFeed);
VRCXStorage.SetBool('VRCX_hideDevicesFromFeed', this.hideDevicesFromFeed); VRCXStorage.SetBool('VRCX_hideDevicesFromFeed', this.hideDevicesFromFeed);
VRCXStorage.SetBool('VRCX_VIPNotifications', this.vipNotifications);
}; };
$app.watch.openVR = saveOpenVROption; $app.watch.openVR = saveOpenVROption;
$app.watch.openVRAlways = saveOpenVROption; $app.watch.openVRAlways = saveOpenVROption;
$app.watch.hidePrivateFromFeed = saveOpenVROption; $app.watch.hidePrivateFromFeed = saveOpenVROption;
$app.watch.hideLoginsFromFeed = saveOpenVROption; $app.watch.hideLoginsFromFeed = saveOpenVROption;
$app.watch.hideDevicesFromFeed = saveOpenVROption; $app.watch.hideDevicesFromFeed = saveOpenVROption;
$app.watch.vipNotifications = saveOpenVROption;
$app.data.isDarkMode = VRCXStorage.GetBool('isDarkMode'); $app.data.isDarkMode = VRCXStorage.GetBool('isDarkMode');
$appDarkStyle.disabled = $app.data.isDarkMode === false; $appDarkStyle.disabled = $app.data.isDarkMode === false;
$app.watch.isDarkMode = function () { $app.watch.isDarkMode = function () {
+3
View File
@@ -506,6 +506,9 @@ html
div(style="font-size:12px;margin-top:5px") div(style="font-size:12px;margin-top:5px")
span(style="display:inline-block;min-width:150px") Hide Private worlds span(style="display:inline-block;min-width:150px") Hide Private worlds
el-switch(v-model="hidePrivateFromFeed") el-switch(v-model="hidePrivateFromFeed")
div(style="font-size:12px;margin-top:5px")
span(style="display:inline-block;min-width:150px") Overlay notifications
el-switch(v-model="vipNotifications")
div(style="margin-top:30px") div(style="margin-top:30px")
span(style="font-weight:bold") Window span(style="font-weight:bold") Window
div(style="font-size:12px;margin-top:5px") div(style="font-size:12px;margin-top:5px")
+45 -43
View File
@@ -705,52 +705,54 @@ CefSharp.BindObjectAsync(
if (this.currentUser.status === 'busy') { if (this.currentUser.status === 'busy') {
return; return;
} }
var notys = []; if (VRCXStorage.GetBool('VRCX_VIPNotifications') === true) {
this.feeds.forEach((feed) => { var notys = [];
if (feed.isFavorite) { this.feeds.forEach((feed) => {
if (feed.type === 'Online' || if (feed.isFavorite) {
feed.type === 'Offline') { if (feed.type === 'Online' ||
if (!map[feed.displayName] || feed.type === 'Offline') {
map[feed.displayName] < feed.created_at) { if (!map[feed.displayName] ||
map[feed.displayName] = feed.created_at; map[feed.displayName] < feed.created_at) {
notys.push(feed); map[feed.displayName] = feed.created_at;
} notys.push(feed);
} else if (feed.type === 'OnPlayerJoined' || }
feed.type === 'OnPlayerLeft') { } else if (feed.type === 'OnPlayerJoined' ||
if (!map[feed.data] || feed.type === 'OnPlayerLeft') {
map[feed.data] < feed.created_at) { if (!map[feed.data] ||
map[feed.data] = feed.created_at; map[feed.data] < feed.created_at) {
notys.push(feed); map[feed.data] = feed.created_at;
notys.push(feed);
}
} }
} }
} });
}); var bias = new Date(Date.now() - 60000).toJSON();
var bias = new Date(Date.now() - 60000).toJSON(); notys.forEach((noty) => {
notys.forEach((noty) => { if (noty.created_at > bias) {
if (noty.created_at > bias) { if (noty.type === 'OnPlayerJoined') {
if (noty.type === 'OnPlayerJoined') { new Noty({
new Noty({ type: 'alert',
type: 'alert', text: `<strong>${noty.data}</strong> has joined`
text: `<strong>${noty.data}</strong> has joined` }).show();
}).show(); } else if (noty.type === 'OnPlayerLeft') {
} else if (noty.type === 'OnPlayerLeft') { new Noty({
new Noty({ type: 'alert',
type: 'alert', text: `<strong>${noty.data}</strong> has left`
text: `<strong>${noty.data}</strong> has left` }).show();
}).show(); } else if (noty.type === 'Online') {
} else if (noty.type === 'Online') { new Noty({
new Noty({ type: 'alert',
type: 'alert', text: `<strong>${noty.displayName}</strong> has logged in`
text: `<strong>${noty.displayName}</strong> has logged in` }).show();
}).show(); } else if (noty.type === 'Offline') {
} else if (noty.type === 'Offline') { new Noty({
new Noty({ type: 'alert',
type: 'alert', text: `<strong>${noty.displayName}</strong> has logged out`
text: `<strong>${noty.displayName}</strong> has logged out` }).show();
}).show(); }
} }
} });
}); }
} }
}; };