Create VRConfigVars

This commit is contained in:
Natsumi
2021-01-20 06:14:10 +13:00
parent af2897947e
commit 363d864534
3 changed files with 60 additions and 50 deletions

View File

@@ -5769,7 +5769,7 @@ speechSynthesis.getVoices();
configRepository.setBool('VRCX_desktopToast', this.desktopToast);
configRepository.setBool('VRCX_minimalFeed', this.minimalFeed);
configRepository.setBool('displayVRCPlusIconsAsAvatar', this.displayVRCPlusIconsAsAvatar);
AppApi.RefreshVR();
this.updateVRConfigVars();
};
$app.data.TTSvoices = speechSynthesis.getVoices();
var saveNotificationTTS = function () {
@@ -5778,7 +5778,7 @@ speechSynthesis.getVoices();
if (this.notificationTTS) {
this.speak('Notification text-to-speech enabled');
}
AppApi.RefreshVR();
this.updateVRConfigVars();
};
$app.watch.openVR = saveOpenVROption;
$app.watch.openVRAlways = saveOpenVROption;
@@ -5796,7 +5796,7 @@ speechSynthesis.getVoices();
$app.watch.isDarkMode = function () {
configRepository.setBool('isDarkMode', this.isDarkMode);
$appDarkStyle.disabled = this.isDarkMode === false;
AppApi.RefreshVR();
this.updateVRConfigVars();
};
$app.data.isStartAtWindowsStartup = configRepository.getBool('VRCX_StartAtWindowsStartup');
$app.data.isStartAsMinimizedState = (VRCXStorage.Get('VRCX_StartAsMinimizedState') === 'true');
@@ -5946,7 +5946,7 @@ speechSynthesis.getVoices();
this.notyFeedFiltersDialog.visible = false;
this.wristFeedFiltersDialog.visible = false;
configRepository.setString('sharedFeedFilters', JSON.stringify(this.sharedFeedFilters));
AppApi.RefreshVR();
this.updateVRConfigVars();
}
$app.methods.cancelSharedFeedFilters = function () {
@@ -5958,7 +5958,7 @@ speechSynthesis.getVoices();
$app.data.notificationPosition = configRepository.getString('VRCX_notificationPosition');
$app.methods.changeNotificationPosition = function () {
configRepository.setString('VRCX_notificationPosition', this.notificationPosition);
AppApi.RefreshVR();
this.updateVRConfigVars();
};
sharedRepository.setBool('is_game_running', false);
@@ -5987,6 +5987,34 @@ speechSynthesis.getVoices();
}
$app.watch.lastLocation = lastLocationStateChange;
$app.methods.updateVRConfigVars = function () {
if (configRepository.getBool('isDarkMode')) {
var notificationTheme = 'sunset';
} else {
var notificationTheme = 'relax';
}
var VRConfigVars = {
notificationTTS: this.notificationTTS,
notificationTTSVoice: this.notificationTTSVoice,
overlayNotifications: this.overlayNotifications,
desktopToast: this.desktopToast,
hidePrivateFromFeed: this.hidePrivateFromFeed,
hideOnPlayerJoined: this.hideOnPlayerJoined,
hideDevicesFromFeed: this.hideDevicesFromFeed,
minimalFeed: this.minimalFeed,
displayVRCPlusIconsAsAvatar: this.displayVRCPlusIconsAsAvatar,
sharedFeedFilters: this.sharedFeedFilters,
notificationPosition: this.notificationPosition,
notificationTimeout: this.notificationTimeout,
notificationTheme: notificationTheme
}
sharedRepository.setObject('VRConfigVars', VRConfigVars);
}
API.$on('LOGIN', function () {
$app.updateVRConfigVars();
});
API.$on('LOGIN', function () {
$app.currentUserTreeData = [];
$app.pastDisplayNameTable.data = [];
@@ -6053,7 +6081,7 @@ speechSynthesis.getVoices();
var voiceName = voices[index].name;
speechSynthesis.cancel();
this.speak(voiceName);
AppApi.RefreshVR();
this.updateVRConfigVars();
};
$app.methods.speak = function (text) {