Desktop notification multi switch

This commit is contained in:
Natsumi
2021-01-29 15:17:07 +13:00
parent f869a4721e
commit 75ca58010b
3 changed files with 41 additions and 13 deletions

View File

@@ -5752,7 +5752,7 @@ speechSynthesis.getVoices();
$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');
$app.data.desktopToast = configRepository.getString('VRCX_desktopToast');
$app.data.minimalFeed = configRepository.getBool('VRCX_minimalFeed');
$app.data.displayVRCPlusIconsAsAvatar = configRepository.getBool('displayVRCPlusIconsAsAvatar');
$app.data.notificationTTS = configRepository.getBool('VRCX_notificationTTS');
@@ -5766,7 +5766,7 @@ speechSynthesis.getVoices();
configRepository.setBool('VRCX_hideOnPlayerJoined', this.hideOnPlayerJoined);
configRepository.setBool('VRCX_hideDevicesFromFeed', this.hideDevicesFromFeed);
configRepository.setBool('VRCX_overlayNotifications', this.overlayNotifications);
configRepository.setBool('VRCX_desktopToast', this.desktopToast);
configRepository.setString('VRCX_desktopToast', this.desktopToast);
configRepository.setBool('VRCX_minimalFeed', this.minimalFeed);
configRepository.setBool('displayVRCPlusIconsAsAvatar', this.displayVRCPlusIconsAsAvatar);
this.updateVRConfigVars();
@@ -5831,6 +5831,10 @@ speechSynthesis.getVoices();
$app.data.notificationTTSVoice = '0';
configRepository.setString('VRCX_notificationTTSVoice', $app.data.notificationTTSVoice);
}
if (!configRepository.getString('VRCX_desktopToast')) {
$app.data.desktopToast = 'Never';
configRepository.setString('VRCX_desktopToast', $app.data.desktopToast);
}
if (!configRepository.getString('sharedFeedFilters')) {
var sharedFeedFilters = {
noty: {},
@@ -5941,6 +5945,26 @@ speechSynthesis.getVoices();
labels: [{ name: 'Off' }, { name: 'On' }]
}
};
$app.data.desktopToastToggleSwitchOption = {
layout: {
backgroundColor: 'white',
selectedBackgroundColor: '#409eff',
selectedColor: 'white',
color: '#409eff',
borderColor: '#409eff',
fontWeight: 'bold',
fontFamily: '"Noto Sans JP", "Noto Sans KR", "Meiryo UI", "Malgun Gothic", "Segoe UI", "sans-serif"'
},
size: {
height: 1.5,
width: 22,
padding: 0.1,
fontSize: 0.75
},
items: {
labels: [{ name: 'Never' }, { name: 'Desktop Mode' }, { name: 'Game Closed' }, { name: 'Always' }]
}
};
$app.methods.saveSharedFeedFilters = function () {
this.notyFeedFiltersDialog.visible = false;

View File

@@ -573,20 +573,22 @@ html
el-switch(v-model="hideDevicesFromFeed" :disabled="!openVR")
div.options-container-item
el-button(size="small" icon="el-icon-notebook-2" @click="showWristFeedFiltersDialog()" :disabled="!openVR") Wrist Feed Filters
el-button(size="small" icon="el-icon-chat-square" @click="showNotyFeedFiltersDialog()" :disabled="!openVR") Notification Filters
br
span.sub-header Notification Options
span.sub-header VR Notifications
div.options-container-item
span.name Overlay Notifications
el-switch(v-model="overlayNotifications" :disabled="!openVR")
div.options-container-item
span.name Desktop Notifications
el-switch(v-model="desktopToast" :disabled="!openVR")
div.options-container-item
el-button(size="small" icon="el-icon-chat-square" @click="showNotyFeedFiltersDialog()" :disabled="!openVR") Notification Filters
el-button(size="small" icon="el-icon-time" @click="promptNotificationTimeout()" :disabled="!overlayNotifications || !openVR") Notification Timeout
el-button(size="small" icon="el-icon-rank" @click="showNotificationPositionDialog()" :disabled="!overlayNotifications || !openVR") Notification Position
br
span.sub-header Desktop Notifications
div.options-container-item
span.name When to display notifications:
br
toggle-switch(:options="desktopToastToggleSwitchOption" group="desktopToastToggleSwitchOption" v-model="desktopToast" class="toggle-switch" :disabled="!openVR")
br
span.sub-header TTS Options
div.options-container-item
span.name Notification TTS

View File

@@ -944,8 +944,8 @@ speechSynthesis.getVoices();
}
});
// disable notifications when busy or game isn't running
if ((this.currentUserStatus === 'busy') || (!this.isGameRunning)) {
// disable notifications when busy
if (this.currentUserStatus === 'busy') {
return;
}
var bias = new Date(Date.now() - 60000).toJSON();
@@ -955,7 +955,7 @@ speechSynthesis.getVoices();
if (noty.created_at < bias) {
continue;
}
if ((this.config.overlayNotifications) && (!this.isGameNoVR)) {
if ((this.config.overlayNotifications) && (!this.isGameNoVR) && (this.isGameRunning)) {
var text = '';
switch (noty.type) {
case 'OnPlayerJoined':
@@ -1028,7 +1028,7 @@ speechSynthesis.getVoices();
}).show();
}
}
if (this.config.notificationTTS) {
if ((this.config.notificationTTS) && (this.isGameRunning)) {
switch (noty.type) {
case 'OnPlayerJoined':
this.speak(`${noty.data} has joined`);
@@ -1091,7 +1091,9 @@ speechSynthesis.getVoices();
break;
}
}
if ((this.config.desktopToast) && (this.isGameNoVR)) {
if ((this.config.desktopToast === 'Always') ||
((this.config.desktopToast === 'Game Closed') && (!this.isGameRunning)) ||
((this.config.desktopToast === 'Desktop Mode') && (this.isGameNoVR) && (this.isGameRunning))) {
var imageURL = '';
if (noty.userId) {
imageURL = await API.getCachedUser({