From 0cd033366b0aa408778de6429c89508c59954751 Mon Sep 17 00:00:00 2001 From: Natsumi Date: Sun, 17 Jan 2021 05:30:58 +1300 Subject: [PATCH] Remove OnPlayerJoined on Location change option --- html/src/app.js | 10 +++++----- html/src/index.pug | 3 +++ html/src/vr.js | 25 ++++++++++++++++++++++++- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/html/src/app.js b/html/src/app.js index edd7f880..83d4bb93 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -3436,7 +3436,7 @@ speechSynthesis.getVoices(); var { data } = this.gameLogTable; var i = data.length; var j = 0; - while (j < 30) { + while (j < 100) { if (i <= 0) { break; } @@ -3466,7 +3466,7 @@ speechSynthesis.getVoices(); var { data } = this.feedTable; var i = data.length; var j = 0; - while (j < 30) { + while (j < 100) { if (i <= 0) { break; } @@ -3515,9 +3515,6 @@ speechSynthesis.getVoices(); } return 0; }); - if (arr.length > 30) { - arr.length = 30; - } sharedRepository.setArray('feeds', arr); }; @@ -5697,6 +5694,7 @@ speechSynthesis.getVoices(); $app.data.openVRAlways = configRepository.getBool('openVRAlways'); $app.data.overlaybutton = configRepository.getBool('VRCX_overlaybutton'); $app.data.hidePrivateFromFeed = configRepository.getBool('VRCX_hidePrivateFromFeed'); + $app.data.hideOnPlayerJoined = configRepository.getBool('VRCX_hideOnPlayerJoined'); $app.data.hideDevicesFromFeed = configRepository.getBool('VRCX_hideDevicesFromFeed'); $app.data.overlayNotifications = configRepository.getBool('VRCX_overlayNotifications'); $app.data.desktopToast = configRepository.getBool('VRCX_desktopToast'); @@ -5710,6 +5708,7 @@ speechSynthesis.getVoices(); configRepository.setBool('openVRAlways', this.openVRAlways); configRepository.setBool('VRCX_overlaybutton', this.overlaybutton); configRepository.setBool('VRCX_hidePrivateFromFeed', this.hidePrivateFromFeed); + configRepository.setBool('VRCX_hideOnPlayerJoined', this.hideOnPlayerJoined); configRepository.setBool('VRCX_hideDevicesFromFeed', this.hideDevicesFromFeed); configRepository.setBool('VRCX_overlayNotifications', this.overlayNotifications); configRepository.setBool('VRCX_desktopToast', this.desktopToast); @@ -5730,6 +5729,7 @@ speechSynthesis.getVoices(); $app.watch.openVRAlways = saveOpenVROption; $app.watch.overlaybutton = saveOpenVROption; $app.watch.hidePrivateFromFeed = saveOpenVROption; + $app.watch.hideOnPlayerJoined = saveOpenVROption; $app.watch.hideDevicesFromFeed = saveOpenVROption; $app.watch.overlayNotifications = saveOpenVROption; $app.watch.desktopToast = saveOpenVROption; diff --git a/html/src/index.pug b/html/src/index.pug index 8418e32a..8176f857 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -565,6 +565,9 @@ html div.options-container-item span.name Hide Private Worlds el-switch(v-model="hidePrivateFromFeed" :disabled="!openVR") + div.options-container-item + span.name Hide Joins When Joining + el-switch(v-model="hideOnPlayerJoined" :disabled="!openVR") div.options-container-item span.name Hide VR Devices el-switch(v-model="hideDevicesFromFeed" :disabled="!openVR") diff --git a/html/src/vr.js b/html/src/vr.js index 6e07077f..434c66b4 100644 --- a/html/src/vr.js +++ b/html/src/vr.js @@ -741,6 +741,7 @@ speechSynthesis.getVoices(); this.overlayNotificationsToggle = configRepository.getBool('VRCX_overlayNotifications'); this.desktopToastToggle = configRepository.getBool('VRCX_desktopToast'); this.hidePrivateFromFeed = configRepository.getBool('VRCX_hidePrivateFromFeed'); + this.hideOnPlayerJoined = configRepository.getBool('VRCX_hideOnPlayerJoined'); this.hideDevicesToggle = configRepository.getBool('VRCX_hideDevicesFromFeed'); this.isMinimalFeed = configRepository.getBool('VRCX_minimalFeed'); this.displayVRCPlusIconsAsAvatar = configRepository.getBool('displayVRCPlusIconsAsAvatar'); @@ -840,7 +841,8 @@ speechSynthesis.getVoices(); var joining = true; for (var k = 0; k < feeds.length; k++) { var feedItem = feeds[k]; - if ((feedItem.type === 'OnPlayerJoined') && (feedItem.data === ctx.displayName)) { + if (((feedItem.type === 'OnPlayerJoined') && (feedItem.data === ctx.displayName)) || + ((feedItem.type === 'Friend') && (feedItem.displayName === ctx.displayName))) { joining = false; break; } @@ -863,6 +865,26 @@ speechSynthesis.getVoices(); } } + //on Location change remove OnPlayerJoined + if (this.hideOnPlayerJoined) { + for (i = 0; i < feeds.length; i++) { + var ctx = feeds[i]; + if (ctx.type === 'Location') { + var bias = new Date(Date.parse(ctx.created_at) + 10000).toJSON(); + for (var k = i - 1; k > 0; k--) { + var feedItem = feeds[k]; + if (feedItem.type === 'OnPlayerJoined') { + feeds.splice(k, 1); + i--; + } + if ((feedItem.created_at > bias) || (feedItem.type === 'Location')) { + break; + } + } + } + } + } + if (this.hidePrivateFromFeed) { for (var i = 0; i < feeds.length; i++) { var feed = feeds[i]; @@ -873,6 +895,7 @@ speechSynthesis.getVoices(); } } + feeds.splice(25); if (this.appType === '1') { this.updateSharedFeedWrist(feeds); }