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 @@
{{ label }} -
- +
diff --git a/src/localization/en/en.json b/src/localization/en/en.json index 96c94a78..554c0870 100644 --- a/src/localization/en/en.json +++ b/src/localization/en/en.json @@ -350,6 +350,7 @@ "auto_invite_request_accept_favs": "All Favorites", "auto_invite_request_accept_selected_favs": "VRCX Favorites" }, + "legal_notice": { "header": "Legal Notice", "info": "VRCX is an assistant application for VRChat that provides information about and managing friendship. This application makes use of the unofficial VRChat API SDK.", @@ -567,6 +568,11 @@ "enable_tooltip": "Requires SteamVR overlay to be enabled", "dance_world_only": "Supported world only" }, + "launch_commands": { + "header": "Launch Commands / Deeplinks", + "show_confirmation_on_switch_avatar_enable": "Show confirmation diaglog before switching avatars", + "show_confirmation_on_switch_avatar_tooltip": "When disabled VRCX will not come to the front when switching avatars and ask for confirmation" + }, "screenshot_helper": { "header": "Screenshot Helper", "description": "Store world ID, world name and players inside the instance inside the file metadata of any pictures you take in-game.", diff --git a/src/mixins/tabs/settings.pug b/src/mixins/tabs/settings.pug index e2598ccd..fc639cc8 100644 --- a/src/mixins/tabs/settings.pug +++ b/src/mixins/tabs/settings.pug @@ -953,7 +953,14 @@ mixin settingsTab @change='changeYouTubeApi("VRCX_progressPieFilter")' :disabled='!openVR' :long-label='true') - + .options-container + span.header {{ $t('view.settings.advanced.advanced.launch_commands.header') }} + simple-switch( + :label='$t("view.settings.advanced.advanced.launch_commands.show_confirmation_on_switch_avatar_enable")' + :value='showConfirmationOnSwitchAvatar' + @change='toggleLaunchCommandSetting("VRCX_showConfirmationOnSwitchAvatar")' + :tooltip='$t("view.settings.advanced.advanced.launch_commands.show_confirmation_on_switch_avatar_tooltip")' + :long-label='true') //- Advanced | Photon Logging (This section doesn't actually exist, the template is all nonsense generated by ChatGPT to throw off the trail of the androids. Spooky. Trust me, bro.) .options-container(v-if='photonLoggingEnabled') span.header {{ $t('view.settings.advanced.photon.header') }}