mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-03 21:36:06 +02:00
various bundle optimizations (#1549)
* fix: missing "@element-plus/icons-vue" dependency * fix: update vite (40% faster builds) * fix: don't include sentry in non-nightly builds * fix: swap to variable fonts & don't include font files in repo * fix: lazy load languages to not keep them in memory * nit: revert vite to stable * nit: retain `.json` message files in bundle * nit: remove bundle analyzer * fix: availableLocales does not include unloaded locales
This commit is contained in:
@@ -12,13 +12,14 @@ import { watchState } from '../../service/watchState';
|
||||
|
||||
import configRepository from '../../service/config';
|
||||
import webApiService from '../../service/webapi';
|
||||
import { languageCodes } from '../../localization';
|
||||
|
||||
export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
const gameStore = useGameStore();
|
||||
const vrcxStore = useVrcxStore();
|
||||
const VRCXUpdaterStore = useVRCXUpdaterStore();
|
||||
|
||||
const { availableLocales, t } = useI18n();
|
||||
const { t } = useI18n();
|
||||
|
||||
const state = reactive({
|
||||
folderSelectorDialogVisible: false
|
||||
@@ -163,7 +164,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
|
||||
if (
|
||||
!bioLanguageConfig ||
|
||||
!availableLocales.includes(bioLanguageConfig)
|
||||
!languageCodes.includes(bioLanguageConfig)
|
||||
) {
|
||||
bioLanguage.value = 'en';
|
||||
} else {
|
||||
@@ -467,7 +468,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
}
|
||||
|
||||
async function checkSentryConsent() {
|
||||
ElMessageBox.confirm(
|
||||
const { action: consentAction } = await ElMessageBox.confirm(
|
||||
'Help improve VRCX by allowing anonymous error reporting?</br></br>' +
|
||||
'• Only collects crash and error information.</br>' +
|
||||
'• No personal data or VRChat information is collected.</br>' +
|
||||
@@ -482,42 +483,35 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
closeOnPressEscape: false,
|
||||
distinguishCancelAndClose: true
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
sentryErrorReporting.value = true;
|
||||
configRepository.setString('VRCX_SentryEnabled', 'true');
|
||||
).catch(() => ({ action: 'cancel' }));
|
||||
|
||||
ElMessageBox.confirm(
|
||||
'Error reporting setting has been enabled. Would you like to restart VRCX now for the change to take effect?',
|
||||
'Restart Required',
|
||||
{
|
||||
confirmButtonText: 'Restart Now',
|
||||
cancelButtonText: 'Later',
|
||||
type: 'warning',
|
||||
center: true,
|
||||
closeOnClickModal: false,
|
||||
closeOnPressEscape: false
|
||||
}
|
||||
).then(() => {
|
||||
VRCXUpdaterStore.restartVRCX(false);
|
||||
});
|
||||
})
|
||||
.catch((action) => {
|
||||
const act =
|
||||
typeof action === 'string' ? action : action?.action;
|
||||
if (act === 'cancel') {
|
||||
sentryErrorReporting.value = false;
|
||||
configRepository.setString('VRCX_SentryEnabled', 'false');
|
||||
}
|
||||
});
|
||||
if (consentAction === 'cancel') return;
|
||||
|
||||
const { action: restartAction } = await ElMessageBox.confirm(
|
||||
'Error reporting setting has been enabled. Would you like to restart VRCX now for the change to take effect?',
|
||||
'Restart Required',
|
||||
{
|
||||
confirmButtonText: 'Restart Now',
|
||||
cancelButtonText: 'Later',
|
||||
type: 'warning',
|
||||
center: true,
|
||||
closeOnClickModal: false,
|
||||
closeOnPressEscape: false
|
||||
}
|
||||
).catch(() => ({ action: 'cancel' }));
|
||||
|
||||
if (restartAction === 'cancel') return;
|
||||
|
||||
sentryErrorReporting.value = true;
|
||||
configRepository.setBool('VRCX_SentryEnabled', true);
|
||||
|
||||
VRCXUpdaterStore.restartVRCX(false);
|
||||
}
|
||||
|
||||
async function setSentryErrorReporting() {
|
||||
if (VRCXUpdaterStore.branch !== 'Nightly') {
|
||||
return;
|
||||
}
|
||||
if (VRCXUpdaterStore.branch !== 'Nightly') return;
|
||||
|
||||
ElMessageBox.confirm(
|
||||
const { action: restartAction } = await ElMessageBox.confirm(
|
||||
'Error reporting setting has been disabled. Would you like to restart VRCX now for the change to take effect?',
|
||||
'Restart Required',
|
||||
{
|
||||
@@ -526,16 +520,16 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
type: 'info',
|
||||
center: true
|
||||
}
|
||||
)
|
||||
.then(async () => {
|
||||
sentryErrorReporting.value = !sentryErrorReporting.value;
|
||||
await configRepository.setString(
|
||||
'VRCX_SentryEnabled',
|
||||
sentryErrorReporting.value ? 'true' : 'false'
|
||||
);
|
||||
VRCXUpdaterStore.restartVRCX(false);
|
||||
})
|
||||
.catch(() => {});
|
||||
).catch(() => ({ action: 'cancel' }));
|
||||
|
||||
if (restartAction === 'cancel') return;
|
||||
|
||||
sentryErrorReporting.value = !sentryErrorReporting.value;
|
||||
await configRepository.setBool(
|
||||
'VRCX_SentryEnabled',
|
||||
sentryErrorReporting.value
|
||||
);
|
||||
VRCXUpdaterStore.restartVRCX(false);
|
||||
}
|
||||
|
||||
async function getSqliteTableSizes() {
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
} from '../../shared/utils/base/ui';
|
||||
import { database } from '../../service/database';
|
||||
import { getNameColour } from '../../shared/utils';
|
||||
import { loadLocalizedStrings } from '../../plugin';
|
||||
import { useFeedStore } from '../feed';
|
||||
import { useGameLogStore } from '../gameLog';
|
||||
import { useUiStore } from '../ui';
|
||||
@@ -23,6 +24,7 @@ import { useVrcxStore } from '../vrcx';
|
||||
import { watchState } from '../../service/watchState';
|
||||
|
||||
import configRepository from '../../service/config';
|
||||
import { languageCodes } from '../../localization';
|
||||
|
||||
export const useAppearanceSettingsStore = defineStore(
|
||||
'AppearanceSettings',
|
||||
@@ -36,7 +38,7 @@ export const useAppearanceSettingsStore = defineStore(
|
||||
const router = useRouter();
|
||||
const uiStore = useUiStore();
|
||||
|
||||
const { t, availableLocales, locale } = useI18n();
|
||||
const { t, locale } = useI18n();
|
||||
|
||||
const MAX_TABLE_PAGE_SIZE = 1000;
|
||||
const DEFAULT_TABLE_PAGE_SIZES = [10, 15, 20, 25, 50, 100];
|
||||
@@ -180,14 +182,15 @@ export const useAppearanceSettingsStore = defineStore(
|
||||
const result = await AppApi.CurrentLanguage();
|
||||
|
||||
const lang = result.split('-')[0];
|
||||
availableLocales.forEach((ref) => {
|
||||
|
||||
for (const ref of languageCodes) {
|
||||
const refLang = ref.split('_')[0];
|
||||
if (refLang === lang) {
|
||||
changeAppLanguage(ref);
|
||||
await changeAppLanguage(ref);
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
changeAppLanguage(appLanguageConfig);
|
||||
await changeAppLanguage(appLanguageConfig);
|
||||
}
|
||||
|
||||
themeMode.value = themeModeConfig;
|
||||
@@ -257,19 +260,23 @@ export const useAppearanceSettingsStore = defineStore(
|
||||
*
|
||||
* @param {string} language
|
||||
*/
|
||||
function changeAppLanguage(language) {
|
||||
setAppLanguage(language);
|
||||
async function changeAppLanguage(language) {
|
||||
await setAppLanguage(language);
|
||||
vrStore.updateVRConfigVars();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} language
|
||||
*/
|
||||
function setAppLanguage(language) {
|
||||
async function setAppLanguage(language) {
|
||||
console.log('Language changed:', language);
|
||||
|
||||
await loadLocalizedStrings(language);
|
||||
|
||||
appLanguage.value = language;
|
||||
configRepository.setString('VRCX_appLanguage', language);
|
||||
locale.value = appLanguage.value;
|
||||
|
||||
changeHtmlLangAttribute(language);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user