Remove OnPlayerJoined on Location change option

This commit is contained in:
Natsumi
2021-01-17 05:30:58 +13:00
parent f81643ff41
commit 0cd033366b
3 changed files with 32 additions and 6 deletions

View File

@@ -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;

View File

@@ -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")

View File

@@ -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);
}