mirror of
https://github.com/vrcx-team/VRCX.git
synced 2026-04-06 00:32:02 +02:00
Small fixes, fix open instance game crash
This commit is contained in:
3
.vscode/extensions.json
vendored
3
.vscode/extensions.json
vendored
@@ -4,7 +4,6 @@
|
||||
"lokalise.i18n-ally",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"esbenp.prettier-vscode",
|
||||
"lllllllqw.jsdoc",
|
||||
"mgmcdermott.vscode-language-babel"
|
||||
"lllllllqw.jsdoc"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ div.x-friend-list
|
||||
.el-tag.el-tag--info {
|
||||
background-color: $--theme-bg-5;
|
||||
border-color: $--theme-border-2;
|
||||
color: $--theme-info;
|
||||
color: $--theme-text-2;
|
||||
}
|
||||
|
||||
.el-tag.el-tag--warning {
|
||||
|
||||
@@ -7,16 +7,22 @@
|
||||
<el-button v-show="isVisible" @click="confirmInvite" size="small" :icon="Message" circle />
|
||||
</el-tooltip>
|
||||
<el-tooltip v-else placement="top" :content="t('dialog.user.info.open_in_vrchat_tooltip')">
|
||||
<el-button @click="openInstance" size="small" :icon="Message" circle />
|
||||
<el-button v-if="isOpeningInstance" size="small" circle>
|
||||
<el-icon class="is-loading">
|
||||
<Loading />
|
||||
</el-icon>
|
||||
</el-button>
|
||||
<el-button v-else @click="openInstance" size="small" :icon="Message" circle />
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { Message } from '@element-plus/icons-vue';
|
||||
import { Loading, Message } from '@element-plus/icons-vue';
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { instanceRequest } from '../api';
|
||||
import { checkCanInviteSelf, parseLocation } from '../shared/utils';
|
||||
import { useInviteStore, useLaunchStore } from '../stores';
|
||||
@@ -31,6 +37,8 @@
|
||||
const { canOpenInstanceInGame } = useInviteStore();
|
||||
const { tryOpenInstanceInVrc } = useLaunchStore();
|
||||
|
||||
const { isOpeningInstance } = storeToRefs(useLaunchStore());
|
||||
|
||||
const isVisible = computed(() => checkCanInviteSelf(props.location));
|
||||
|
||||
function confirmInvite() {
|
||||
|
||||
@@ -531,10 +531,9 @@
|
||||
const { currentUserGroups } = storeToRefs(useGroupStore());
|
||||
const { cachedGroups, handleGroupPermissions } = useGroupStore();
|
||||
const { lastLocation } = storeToRefs(useLocationStore());
|
||||
const { showLaunchDialog } = useLaunchStore();
|
||||
const { showLaunchDialog, tryOpenInstanceInVrc } = useLaunchStore();
|
||||
const { createNewInstance } = useInstanceStore();
|
||||
const { currentUser } = storeToRefs(useUserStore());
|
||||
const { tryOpenInstanceInVrc } = useLaunchStore();
|
||||
const { canOpenInstanceInGame } = useInviteStore();
|
||||
|
||||
const newInstanceDialogIndex = ref(2000);
|
||||
|
||||
@@ -9,6 +9,7 @@ import { parseLocation } from '../shared/utils';
|
||||
export const useLaunchStore = defineStore('Launch', () => {
|
||||
const state = reactive({
|
||||
isLaunchOptionsDialogVisible: false,
|
||||
isOpeningInstance: false,
|
||||
launchDialogData: {
|
||||
visible: false,
|
||||
loading: false,
|
||||
@@ -24,6 +25,13 @@ export const useLaunchStore = defineStore('Launch', () => {
|
||||
}
|
||||
});
|
||||
|
||||
const isOpeningInstance = computed({
|
||||
get: () => state.isOpeningInstance,
|
||||
set: (value) => {
|
||||
state.isOpeningInstance = value;
|
||||
}
|
||||
});
|
||||
|
||||
const launchDialogData = computed({
|
||||
get: () => state.launchDialogData,
|
||||
set: (value) => {
|
||||
@@ -102,9 +110,14 @@ export const useLaunchStore = defineStore('Launch', () => {
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function tryOpenInstanceInVrc(location, shortName) {
|
||||
const launchUrl = await getLaunchUrl(location, shortName);
|
||||
if (state.isOpeningInstance) {
|
||||
return;
|
||||
}
|
||||
state.isOpeningInstance = true;
|
||||
let launchUrl = '';
|
||||
let result = false;
|
||||
try {
|
||||
launchUrl = await getLaunchUrl(location, shortName);
|
||||
result = await AppApi.TryOpenInstanceInVrc(launchUrl);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
@@ -117,17 +130,24 @@ export const useLaunchStore = defineStore('Launch', () => {
|
||||
type: 'warning'
|
||||
});
|
||||
// self invite fallback
|
||||
const L = parseLocation(location);
|
||||
await instanceRequest.selfInvite({
|
||||
instanceId: L.instanceId,
|
||||
worldId: L.worldId,
|
||||
shortName
|
||||
});
|
||||
ElMessage({
|
||||
message: 'Self invite sent',
|
||||
type: 'success'
|
||||
});
|
||||
try {
|
||||
const L = parseLocation(location);
|
||||
await instanceRequest.selfInvite({
|
||||
instanceId: L.instanceId,
|
||||
worldId: L.worldId,
|
||||
shortName
|
||||
});
|
||||
ElMessage({
|
||||
message: 'Self invite sent',
|
||||
type: 'success'
|
||||
});
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
setTimeout(() => {
|
||||
state.isOpeningInstance = false;
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,6 +212,7 @@ export const useLaunchStore = defineStore('Launch', () => {
|
||||
state,
|
||||
|
||||
isLaunchOptionsDialogVisible,
|
||||
isOpeningInstance,
|
||||
launchDialogData,
|
||||
showLaunchOptions,
|
||||
showLaunchDialog,
|
||||
|
||||
Reference in New Issue
Block a user