diff --git a/src/app.js b/src/app.js index 179105cd..573d38ab 100644 --- a/src/app.js +++ b/src/app.js @@ -9389,6 +9389,11 @@ console.log(`isLinux: ${LINUX}`); true ); + $app.data.showConfirmationOnSwitchAvatar = await configRepository.getBool( + 'VRCX_showConfirmationOnSwitchAvatar', + false + ); + $app.methods.updateVRConfigVars = function () { var notificationTheme = 'relax'; if (this.isDarkMode) { @@ -12405,19 +12410,23 @@ console.log(`isLinux: ${LINUX}`); if (action !== 'confirm') { return; } - API.selectAvatar({ - avatarId: id - }).then((args) => { - this.$message({ - message: 'Avatar changed', - type: 'success' - }); - return args; - }); + $app.selectAvatarWithoutConfirmation(id); } }); }; + $app.methods.selectAvatarWithoutConfirmation = function (id) { + API.selectAvatar({ + avatarId: id + }).then((args) => { + this.$message({ + message: 'Avatar changed', + type: 'success' + }); + return args; + }); + }; + $app.methods.avatarDialogCommand = function (command) { var D = this.avatarDialog; if (D.visible === false) { @@ -17361,6 +17370,25 @@ console.log(`isLinux: ${LINUX}`); D.visible = true; }; + // Launch Command Settings handling + + $app.methods.toggleLaunchCommandSetting = async function (configKey = '') { + switch (configKey) { + case 'VRCX_showConfirmationOnSwitchAvatar': + this.showConfirmationOnSwitchAvatar = + !this.showConfirmationOnSwitchAvatar; + await configRepository.setBool( + 'VRCX_showConfirmationOnSwitchAvatar', + this.showConfirmationOnSwitchAvatar + ); + break; + default: + throw new Error( + 'toggleLaunchCommandSetting: Unknown configKey' + ); + } + }; + // Asset Bundle Cacher $app.methods.updateVRChatWorldCache = function () { @@ -18634,7 +18662,7 @@ console.log(`isLinux: ${LINUX}`); console.log(`Print saved to file: ${monthFolder}\\${fileName}`); if (this.cropInstancePrints) { - if (!await AppApi.CropPrintImage(filePath)) { + if (!(await AppApi.CropPrintImage(filePath))) { console.error('Failed to crop print image'); } } @@ -19217,7 +19245,6 @@ console.log(`isLinux: ${LINUX}`); this.externalNotifierVersion = data.version; break; case 'LaunchCommand': - AppApi.FocusWindow(); this.eventLaunchCommand(data.command); break; case 'VRCXLaunch': @@ -19389,6 +19416,7 @@ console.log(`isLinux: ${LINUX}`); var args = input.split('/'); var command = args[0]; var commandArg = args[1]; + var shouldFocusWindow = true; switch (command) { case 'world': this.directAccessWorld(input.replace('world/', '')); @@ -19414,6 +19442,16 @@ console.log(`isLinux: ${LINUX}`); case 'addavatardb': this.addAvatarProvider(input.replace('addavatardb/', '')); break; + case 'switchavatar': + if (this.showConfirmationOnSwitchAvatar) { + this.selectAvatarWithConfirmation(commandArg); + // Makes sure the window is focused + shouldFocusWindow = true; + } else { + this.selectAvatarWithoutConfirmation(commandArg); + shouldFocusWindow = false; + } + break; case 'import': var type = args[1]; if (!type) break; @@ -19430,6 +19468,9 @@ console.log(`isLinux: ${LINUX}`); } break; } + if (shouldFocusWindow) { + AppApi.FocusWindow(); + } }; $app.methods.toggleAvatarCopying = function () { @@ -23392,14 +23433,15 @@ console.log(`isLinux: ${LINUX}`); if (friend.ref?.$location.isRealInstance) { locationTag = friend.ref.$location.tag; } else if (this.lastLocation.friendList.has(friend.id)) { - let $location = $utils.parseLocation(this.lastLocation.location); + let $location = $utils.parseLocation( + this.lastLocation.location + ); if ($location.isRealInstance) { if ($location.tag === 'private') { locationTag = this.lastLocation.name; } else { locationTag = $location.tag; } - } } if (!locationTag) return; diff --git a/src/components/settings/SimpleSwitch.vue b/src/components/settings/SimpleSwitch.vue index 0fa468a4..70ca98a8 100644 --- a/src/components/settings/SimpleSwitch.vue +++ b/src/components/settings/SimpleSwitch.vue @@ -2,21 +2,12 @@