mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-23 00:33:50 +02:00
refactor: store state
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { computed, reactive, watch } from 'vue';
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import configRepository from '../../service/config';
|
||||
@@ -19,70 +19,80 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
const { t } = useI18n();
|
||||
|
||||
const state = reactive({
|
||||
enablePrimaryPassword: false,
|
||||
relaunchVRChatAfterCrash: false,
|
||||
vrcQuitFix: true,
|
||||
autoSweepVRChatCache: false,
|
||||
selfInviteOverride: false,
|
||||
saveInstancePrints: false,
|
||||
cropInstancePrints: false,
|
||||
saveInstanceStickers: false,
|
||||
avatarRemoteDatabase: true,
|
||||
enableAppLauncher: true,
|
||||
enableAppLauncherAutoClose: true,
|
||||
enableAppLauncherRunProcessOnce: true,
|
||||
screenshotHelper: true,
|
||||
screenshotHelperModifyFilename: false,
|
||||
screenshotHelperCopyToClipboard: false,
|
||||
youTubeApi: false,
|
||||
youTubeApiKey: '',
|
||||
progressPie: false,
|
||||
progressPieFilter: true,
|
||||
showConfirmationOnSwitchAvatar: false,
|
||||
gameLogDisabled: false,
|
||||
sqliteTableSizes: {},
|
||||
ugcFolderPath: '',
|
||||
currentUserInventory: new Map(),
|
||||
autoDeleteOldPrints: false,
|
||||
notificationOpacity: 100,
|
||||
folderSelectorDialogVisible: false,
|
||||
isVRChatConfigDialogVisible: false,
|
||||
saveInstanceEmoji: false,
|
||||
vrcRegistryAutoBackup: true,
|
||||
vrcRegistryAskRestore: true,
|
||||
sentryErrorReporting: false
|
||||
folderSelectorDialogVisible: false
|
||||
});
|
||||
|
||||
const enablePrimaryPassword = ref(false);
|
||||
const relaunchVRChatAfterCrash = ref(false);
|
||||
const vrcQuitFix = ref(true);
|
||||
const autoSweepVRChatCache = ref(false);
|
||||
const selfInviteOverride = ref(false);
|
||||
const saveInstancePrints = ref(false);
|
||||
const cropInstancePrints = ref(false);
|
||||
const saveInstanceStickers = ref(false);
|
||||
const avatarRemoteDatabase = ref(true);
|
||||
const enableAppLauncher = ref(true);
|
||||
const enableAppLauncherAutoClose = ref(true);
|
||||
const enableAppLauncherRunProcessOnce = ref(true);
|
||||
const screenshotHelper = ref(true);
|
||||
const screenshotHelperModifyFilename = ref(false);
|
||||
const screenshotHelperCopyToClipboard = ref(false);
|
||||
const youTubeApi = ref(false);
|
||||
const youTubeApiKey = ref('');
|
||||
const progressPie = ref(false);
|
||||
const progressPieFilter = ref(true);
|
||||
const showConfirmationOnSwitchAvatar = ref(false);
|
||||
const gameLogDisabled = ref(false);
|
||||
const sqliteTableSizes = ref({});
|
||||
const ugcFolderPath = ref('');
|
||||
const autoDeleteOldPrints = ref(false);
|
||||
const notificationOpacity = ref(100);
|
||||
const currentUserInventory = ref(new Map());
|
||||
const isVRChatConfigDialogVisible = ref(false);
|
||||
const saveInstanceEmoji = ref(false);
|
||||
const vrcRegistryAutoBackup = ref(true);
|
||||
const vrcRegistryAskRestore = ref(true);
|
||||
const sentryErrorReporting = ref(false);
|
||||
|
||||
watch(
|
||||
() => watchState.isLoggedIn,
|
||||
() => {
|
||||
currentUserInventory.value.clear();
|
||||
isVRChatConfigDialogVisible.value = false;
|
||||
},
|
||||
{ flush: 'sync' }
|
||||
);
|
||||
|
||||
async function initAdvancedSettings() {
|
||||
const [
|
||||
enablePrimaryPassword,
|
||||
relaunchVRChatAfterCrash,
|
||||
vrcQuitFix,
|
||||
autoSweepVRChatCache,
|
||||
selfInviteOverride,
|
||||
saveInstancePrints,
|
||||
cropInstancePrints,
|
||||
saveInstanceStickers,
|
||||
avatarRemoteDatabase,
|
||||
enableAppLauncher,
|
||||
enableAppLauncherAutoClose,
|
||||
enableAppLauncherRunProcessOnce,
|
||||
screenshotHelper,
|
||||
screenshotHelperModifyFilename,
|
||||
screenshotHelperCopyToClipboard,
|
||||
youTubeApi,
|
||||
youTubeApiKey,
|
||||
progressPie,
|
||||
progressPieFilter,
|
||||
showConfirmationOnSwitchAvatar,
|
||||
gameLogDisabled,
|
||||
ugcFolderPath,
|
||||
autoDeleteOldPrints,
|
||||
notificationOpacity,
|
||||
saveInstanceEmoji,
|
||||
vrcRegistryAutoBackup,
|
||||
vrcRegistryAskRestore,
|
||||
sentryErrorReporting
|
||||
enablePrimaryPasswordConfig,
|
||||
relaunchVRChatAfterCrashConfig,
|
||||
vrcQuitFixConfig,
|
||||
autoSweepVRChatCacheConfig,
|
||||
selfInviteOverrideConfig,
|
||||
saveInstancePrintsConfig,
|
||||
cropInstancePrintsConfig,
|
||||
saveInstanceStickersConfig,
|
||||
avatarRemoteDatabaseConfig,
|
||||
enableAppLauncherConfig,
|
||||
enableAppLauncherAutoCloseConfig,
|
||||
enableAppLauncherRunProcessOnceConfig,
|
||||
screenshotHelperConfig,
|
||||
screenshotHelperModifyFilenameConfig,
|
||||
screenshotHelperCopyToClipboardConfig,
|
||||
youTubeApiConfig,
|
||||
youTubeApiKeyConfig,
|
||||
progressPieConfig,
|
||||
progressPieFilterConfig,
|
||||
showConfirmationOnSwitchAvatarConfig,
|
||||
gameLogDisabledConfig,
|
||||
ugcFolderPathConfig,
|
||||
autoDeleteOldPrintsConfig,
|
||||
notificationOpacityConfig,
|
||||
saveInstanceEmojiConfig,
|
||||
vrcRegistryAutoBackupConfig,
|
||||
vrcRegistryAskRestoreConfig,
|
||||
sentryErrorReportingConfig
|
||||
] = await Promise.all([
|
||||
configRepository.getBool('enablePrimaryPassword', false),
|
||||
configRepository.getBool('VRCX_relaunchVRChatAfterCrash', false),
|
||||
@@ -126,41 +136,45 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
configRepository.getString('VRCX_SentryEnabled', '')
|
||||
]);
|
||||
|
||||
state.enablePrimaryPassword = enablePrimaryPassword;
|
||||
state.relaunchVRChatAfterCrash = relaunchVRChatAfterCrash;
|
||||
state.vrcQuitFix = vrcQuitFix;
|
||||
state.autoSweepVRChatCache = autoSweepVRChatCache;
|
||||
state.selfInviteOverride = selfInviteOverride;
|
||||
state.saveInstancePrints = saveInstancePrints;
|
||||
state.cropInstancePrints = cropInstancePrints;
|
||||
state.saveInstanceStickers = saveInstanceStickers;
|
||||
state.avatarRemoteDatabase = avatarRemoteDatabase;
|
||||
state.enableAppLauncher = enableAppLauncher;
|
||||
state.enableAppLauncherAutoClose = enableAppLauncherAutoClose;
|
||||
state.enableAppLauncherRunProcessOnce = enableAppLauncherRunProcessOnce;
|
||||
state.screenshotHelper = screenshotHelper;
|
||||
state.screenshotHelperModifyFilename = screenshotHelperModifyFilename;
|
||||
state.screenshotHelperCopyToClipboard = screenshotHelperCopyToClipboard;
|
||||
state.youTubeApi = youTubeApi;
|
||||
state.youTubeApiKey = youTubeApiKey;
|
||||
state.progressPie = progressPie;
|
||||
state.progressPieFilter = progressPieFilter;
|
||||
state.showConfirmationOnSwitchAvatar = showConfirmationOnSwitchAvatar;
|
||||
state.gameLogDisabled = gameLogDisabled;
|
||||
state.ugcFolderPath = ugcFolderPath;
|
||||
state.autoDeleteOldPrints = autoDeleteOldPrints;
|
||||
state.notificationOpacity = notificationOpacity;
|
||||
state.saveInstanceEmoji = saveInstanceEmoji;
|
||||
state.vrcRegistryAutoBackup = vrcRegistryAutoBackup;
|
||||
state.vrcRegistryAskRestore = vrcRegistryAskRestore;
|
||||
state.sentryErrorReporting = sentryErrorReporting === 'true';
|
||||
enablePrimaryPassword.value = enablePrimaryPasswordConfig;
|
||||
relaunchVRChatAfterCrash.value = relaunchVRChatAfterCrashConfig;
|
||||
vrcQuitFix.value = vrcQuitFixConfig;
|
||||
autoSweepVRChatCache.value = autoSweepVRChatCacheConfig;
|
||||
selfInviteOverride.value = selfInviteOverrideConfig;
|
||||
saveInstancePrints.value = saveInstancePrintsConfig;
|
||||
cropInstancePrints.value = cropInstancePrintsConfig;
|
||||
saveInstanceStickers.value = saveInstanceStickersConfig;
|
||||
avatarRemoteDatabase.value = avatarRemoteDatabaseConfig;
|
||||
enableAppLauncher.value = enableAppLauncherConfig;
|
||||
enableAppLauncherAutoClose.value = enableAppLauncherAutoCloseConfig;
|
||||
enableAppLauncherRunProcessOnce.value =
|
||||
enableAppLauncherRunProcessOnceConfig;
|
||||
screenshotHelper.value = screenshotHelperConfig;
|
||||
screenshotHelperModifyFilename.value =
|
||||
screenshotHelperModifyFilenameConfig;
|
||||
screenshotHelperCopyToClipboard.value =
|
||||
screenshotHelperCopyToClipboardConfig;
|
||||
youTubeApi.value = youTubeApiConfig;
|
||||
youTubeApiKey.value = youTubeApiKeyConfig;
|
||||
progressPie.value = progressPieConfig;
|
||||
progressPieFilter.value = progressPieFilterConfig;
|
||||
showConfirmationOnSwitchAvatar.value =
|
||||
showConfirmationOnSwitchAvatarConfig;
|
||||
gameLogDisabled.value = gameLogDisabledConfig;
|
||||
ugcFolderPath.value = ugcFolderPathConfig;
|
||||
autoDeleteOldPrints.value = autoDeleteOldPrintsConfig;
|
||||
notificationOpacity.value = notificationOpacityConfig;
|
||||
saveInstanceEmoji.value = saveInstanceEmojiConfig;
|
||||
vrcRegistryAutoBackup.value = vrcRegistryAutoBackupConfig;
|
||||
vrcRegistryAskRestore.value = vrcRegistryAskRestoreConfig;
|
||||
sentryErrorReporting.value = sentryErrorReportingConfig === 'true';
|
||||
|
||||
handleSetAppLauncherSettings();
|
||||
|
||||
setTimeout(() => {
|
||||
if (
|
||||
VRCXUpdaterStore.branch === 'Nightly' &&
|
||||
sentryErrorReporting === ''
|
||||
sentryErrorReportingConfig === ''
|
||||
) {
|
||||
checkSentryConsent();
|
||||
}
|
||||
@@ -169,79 +183,6 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
|
||||
initAdvancedSettings();
|
||||
|
||||
watch(
|
||||
() => watchState.isLoggedIn,
|
||||
() => {
|
||||
state.currentUserInventory.clear();
|
||||
state.isVRChatConfigDialogVisible = false;
|
||||
},
|
||||
{ flush: 'sync' }
|
||||
);
|
||||
|
||||
const enablePrimaryPassword = computed({
|
||||
get: () => state.enablePrimaryPassword,
|
||||
set: (value) => (state.enablePrimaryPassword = value)
|
||||
});
|
||||
const relaunchVRChatAfterCrash = computed(
|
||||
() => state.relaunchVRChatAfterCrash
|
||||
);
|
||||
const vrcQuitFix = computed(() => state.vrcQuitFix);
|
||||
const autoSweepVRChatCache = computed(() => state.autoSweepVRChatCache);
|
||||
const selfInviteOverride = computed(() => state.selfInviteOverride);
|
||||
const saveInstancePrints = computed(() => state.saveInstancePrints);
|
||||
const cropInstancePrints = computed(() => state.cropInstancePrints);
|
||||
const saveInstanceStickers = computed(() => state.saveInstanceStickers);
|
||||
const avatarRemoteDatabase = computed(() => state.avatarRemoteDatabase);
|
||||
const enableAppLauncher = computed(() => state.enableAppLauncher);
|
||||
const enableAppLauncherAutoClose = computed(
|
||||
() => state.enableAppLauncherAutoClose
|
||||
);
|
||||
const enableAppLauncherRunProcessOnce = computed(
|
||||
() => state.enableAppLauncherRunProcessOnce
|
||||
);
|
||||
const screenshotHelper = computed(() => state.screenshotHelper);
|
||||
``;
|
||||
const screenshotHelperModifyFilename = computed(
|
||||
() => state.screenshotHelperModifyFilename
|
||||
);
|
||||
const screenshotHelperCopyToClipboard = computed(
|
||||
() => state.screenshotHelperCopyToClipboard
|
||||
);
|
||||
const youTubeApi = computed(() => state.youTubeApi);
|
||||
const youTubeApiKey = computed({
|
||||
get: () => state.youTubeApiKey,
|
||||
set: (value) => (state.youTubeApiKey = value)
|
||||
});
|
||||
const progressPie = computed(() => state.progressPie);
|
||||
const progressPieFilter = computed(() => state.progressPieFilter);
|
||||
const showConfirmationOnSwitchAvatar = computed(
|
||||
() => state.showConfirmationOnSwitchAvatar
|
||||
);
|
||||
const gameLogDisabled = computed(() => state.gameLogDisabled);
|
||||
const sqliteTableSizes = computed(() => state.sqliteTableSizes);
|
||||
const ugcFolderPath = computed(() => state.ugcFolderPath);
|
||||
const autoDeleteOldPrints = computed(() => state.autoDeleteOldPrints);
|
||||
const notificationOpacity = computed(() => state.notificationOpacity);
|
||||
|
||||
const currentUserInventory = computed({
|
||||
get: () => state.currentUserInventory,
|
||||
set: (value) => {
|
||||
state.currentUserInventory = value;
|
||||
}
|
||||
});
|
||||
const isVRChatConfigDialogVisible = computed({
|
||||
get: () => state.isVRChatConfigDialogVisible,
|
||||
set: (value) => (state.isVRChatConfigDialogVisible = value)
|
||||
});
|
||||
|
||||
const saveInstanceEmoji = computed({
|
||||
get: () => state.saveInstanceEmoji,
|
||||
set: (value) => (state.saveInstanceEmoji = value)
|
||||
});
|
||||
const vrcRegistryAutoBackup = computed(() => state.vrcRegistryAutoBackup);
|
||||
const vrcRegistryAskRestore = computed(() => state.vrcRegistryAskRestore);
|
||||
const sentryErrorReporting = computed(() => state.sentryErrorReporting);
|
||||
|
||||
/**
|
||||
* @param {boolean} value
|
||||
*/
|
||||
@@ -249,155 +190,155 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
configRepository.setBool('enablePrimaryPassword', value);
|
||||
}
|
||||
function setRelaunchVRChatAfterCrash() {
|
||||
state.relaunchVRChatAfterCrash = !state.relaunchVRChatAfterCrash;
|
||||
relaunchVRChatAfterCrash.value = !relaunchVRChatAfterCrash.value;
|
||||
configRepository.setBool(
|
||||
'VRCX_relaunchVRChatAfterCrash',
|
||||
state.relaunchVRChatAfterCrash
|
||||
relaunchVRChatAfterCrash.value
|
||||
);
|
||||
}
|
||||
function setVrcQuitFix() {
|
||||
state.vrcQuitFix = !state.vrcQuitFix;
|
||||
configRepository.setBool('VRCX_vrcQuitFix', state.vrcQuitFix);
|
||||
vrcQuitFix.value = !vrcQuitFix.value;
|
||||
configRepository.setBool('VRCX_vrcQuitFix', vrcQuitFix.value);
|
||||
}
|
||||
function setAutoSweepVRChatCache() {
|
||||
state.autoSweepVRChatCache = !state.autoSweepVRChatCache;
|
||||
autoSweepVRChatCache.value = !autoSweepVRChatCache.value;
|
||||
configRepository.setBool(
|
||||
'VRCX_autoSweepVRChatCache',
|
||||
state.autoSweepVRChatCache
|
||||
autoSweepVRChatCache.value
|
||||
);
|
||||
}
|
||||
function setSelfInviteOverride() {
|
||||
state.selfInviteOverride = !state.selfInviteOverride;
|
||||
selfInviteOverride.value = !selfInviteOverride.value;
|
||||
configRepository.setBool(
|
||||
'VRCX_selfInviteOverride',
|
||||
state.selfInviteOverride
|
||||
selfInviteOverride.value
|
||||
);
|
||||
}
|
||||
function setSaveInstancePrints() {
|
||||
state.saveInstancePrints = !state.saveInstancePrints;
|
||||
saveInstancePrints.value = !saveInstancePrints.value;
|
||||
configRepository.setBool(
|
||||
'VRCX_saveInstancePrints',
|
||||
state.saveInstancePrints
|
||||
saveInstancePrints.value
|
||||
);
|
||||
}
|
||||
function setCropInstancePrints() {
|
||||
state.cropInstancePrints = !state.cropInstancePrints;
|
||||
cropInstancePrints.value = !cropInstancePrints.value;
|
||||
configRepository.setBool(
|
||||
'VRCX_cropInstancePrints',
|
||||
state.cropInstancePrints
|
||||
cropInstancePrints.value
|
||||
);
|
||||
}
|
||||
function setSaveInstanceStickers() {
|
||||
state.saveInstanceStickers = !state.saveInstanceStickers;
|
||||
saveInstanceStickers.value = !saveInstanceStickers.value;
|
||||
configRepository.setBool(
|
||||
'VRCX_saveInstanceStickers',
|
||||
state.saveInstanceStickers
|
||||
saveInstanceStickers.value
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @param {boolean} value
|
||||
*/
|
||||
function setAvatarRemoteDatabase(value) {
|
||||
state.avatarRemoteDatabase = value;
|
||||
avatarRemoteDatabase.value = value;
|
||||
configRepository.setBool(
|
||||
'VRCX_avatarRemoteDatabase',
|
||||
state.avatarRemoteDatabase
|
||||
avatarRemoteDatabase.value
|
||||
);
|
||||
}
|
||||
async function setEnableAppLauncher() {
|
||||
state.enableAppLauncher = !state.enableAppLauncher;
|
||||
enableAppLauncher.value = !enableAppLauncher.value;
|
||||
await configRepository.setBool(
|
||||
'VRCX_enableAppLauncher',
|
||||
state.enableAppLauncher
|
||||
enableAppLauncher.value
|
||||
);
|
||||
handleSetAppLauncherSettings();
|
||||
}
|
||||
async function setEnableAppLauncherAutoClose() {
|
||||
state.enableAppLauncherAutoClose = !state.enableAppLauncherAutoClose;
|
||||
enableAppLauncherAutoClose.value = !enableAppLauncherAutoClose.value;
|
||||
await configRepository.setBool(
|
||||
'VRCX_enableAppLauncherAutoClose',
|
||||
state.enableAppLauncherAutoClose
|
||||
enableAppLauncherAutoClose.value
|
||||
);
|
||||
handleSetAppLauncherSettings();
|
||||
}
|
||||
async function setEnableAppLauncherRunProcessOnce() {
|
||||
state.enableAppLauncherRunProcessOnce =
|
||||
!state.enableAppLauncherRunProcessOnce;
|
||||
enableAppLauncherRunProcessOnce.value =
|
||||
!enableAppLauncherRunProcessOnce.value;
|
||||
await configRepository.setBool(
|
||||
'VRCX_enableAppLauncherRunProcessOnce',
|
||||
state.enableAppLauncherRunProcessOnce
|
||||
enableAppLauncherRunProcessOnce.value
|
||||
);
|
||||
handleSetAppLauncherSettings();
|
||||
}
|
||||
async function setScreenshotHelper() {
|
||||
state.screenshotHelper = !state.screenshotHelper;
|
||||
screenshotHelper.value = !screenshotHelper.value;
|
||||
await configRepository.setBool(
|
||||
'VRCX_screenshotHelper',
|
||||
state.screenshotHelper
|
||||
screenshotHelper.value
|
||||
);
|
||||
}
|
||||
async function setScreenshotHelperModifyFilename() {
|
||||
state.screenshotHelperModifyFilename =
|
||||
!state.screenshotHelperModifyFilename;
|
||||
screenshotHelperModifyFilename.value =
|
||||
!screenshotHelperModifyFilename.value;
|
||||
await configRepository.setBool(
|
||||
'VRCX_screenshotHelperModifyFilename',
|
||||
state.screenshotHelperModifyFilename
|
||||
screenshotHelperModifyFilename.value
|
||||
);
|
||||
}
|
||||
async function setScreenshotHelperCopyToClipboard() {
|
||||
state.screenshotHelperCopyToClipboard =
|
||||
!state.screenshotHelperCopyToClipboard;
|
||||
screenshotHelperCopyToClipboard.value =
|
||||
!screenshotHelperCopyToClipboard.value;
|
||||
await configRepository.setBool(
|
||||
'VRCX_screenshotHelperCopyToClipboard',
|
||||
state.screenshotHelperCopyToClipboard
|
||||
screenshotHelperCopyToClipboard.value
|
||||
);
|
||||
}
|
||||
async function setYouTubeApi() {
|
||||
state.youTubeApi = !state.youTubeApi;
|
||||
await configRepository.setBool('VRCX_youtubeAPI', state.youTubeApi);
|
||||
youTubeApi.value = !youTubeApi.value;
|
||||
await configRepository.setBool('VRCX_youtubeAPI', youTubeApi.value);
|
||||
}
|
||||
/**
|
||||
* @param {string} value
|
||||
*/
|
||||
async function setYouTubeApiKey(value) {
|
||||
state.youTubeApiKey = value;
|
||||
youTubeApiKey.value = value;
|
||||
await configRepository.setString(
|
||||
'VRCX_youtubeAPIKey',
|
||||
state.youTubeApiKey
|
||||
youTubeApiKey.value
|
||||
);
|
||||
}
|
||||
async function setProgressPie() {
|
||||
state.progressPie = !state.progressPie;
|
||||
await configRepository.setBool('VRCX_progressPie', state.progressPie);
|
||||
progressPie.value = !progressPie.value;
|
||||
await configRepository.setBool('VRCX_progressPie', progressPie.value);
|
||||
}
|
||||
async function setProgressPieFilter() {
|
||||
state.progressPieFilter = !state.progressPieFilter;
|
||||
progressPieFilter.value = !progressPieFilter.value;
|
||||
await configRepository.setBool(
|
||||
'VRCX_progressPieFilter',
|
||||
state.progressPieFilter
|
||||
progressPieFilter.value
|
||||
);
|
||||
}
|
||||
async function setShowConfirmationOnSwitchAvatar() {
|
||||
state.showConfirmationOnSwitchAvatar =
|
||||
!state.showConfirmationOnSwitchAvatar;
|
||||
showConfirmationOnSwitchAvatar.value =
|
||||
!showConfirmationOnSwitchAvatar.value;
|
||||
await configRepository.setBool(
|
||||
'VRCX_showConfirmationOnSwitchAvatar',
|
||||
state.showConfirmationOnSwitchAvatar
|
||||
showConfirmationOnSwitchAvatar.value
|
||||
);
|
||||
}
|
||||
async function setGameLogDisabled() {
|
||||
state.gameLogDisabled = !state.gameLogDisabled;
|
||||
gameLogDisabled.value = !gameLogDisabled.value;
|
||||
await configRepository.setBool(
|
||||
'VRCX_gameLogDisabled',
|
||||
state.gameLogDisabled
|
||||
gameLogDisabled.value
|
||||
);
|
||||
}
|
||||
|
||||
async function setSaveInstanceEmoji() {
|
||||
state.saveInstanceEmoji = !state.saveInstanceEmoji;
|
||||
saveInstanceEmoji.value = !saveInstanceEmoji.value;
|
||||
await configRepository.setBool(
|
||||
'VRCX_saveInstanceEmoji',
|
||||
state.saveInstanceEmoji
|
||||
saveInstanceEmoji.value
|
||||
);
|
||||
}
|
||||
|
||||
@@ -405,36 +346,36 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
if (typeof path !== 'string') {
|
||||
path = '';
|
||||
}
|
||||
state.ugcFolderPath = path;
|
||||
ugcFolderPath.value = path;
|
||||
await configRepository.setString('VRCX_userGeneratedContentPath', path);
|
||||
}
|
||||
|
||||
async function setAutoDeleteOldPrints() {
|
||||
state.autoDeleteOldPrints = !state.autoDeleteOldPrints;
|
||||
autoDeleteOldPrints.value = !autoDeleteOldPrints.value;
|
||||
await configRepository.setBool(
|
||||
'VRCX_autoDeleteOldPrints',
|
||||
state.autoDeleteOldPrints
|
||||
autoDeleteOldPrints.value
|
||||
);
|
||||
}
|
||||
|
||||
async function setNotificationOpacity(value) {
|
||||
state.notificationOpacity = value;
|
||||
notificationOpacity.value = value;
|
||||
await configRepository.setInt('VRCX_notificationOpacity', value);
|
||||
}
|
||||
|
||||
async function setVrcRegistryAutoBackup() {
|
||||
state.vrcRegistryAutoBackup = !state.vrcRegistryAutoBackup;
|
||||
vrcRegistryAutoBackup.value = !vrcRegistryAutoBackup.value;
|
||||
await configRepository.setBool(
|
||||
'VRCX_vrcRegistryAutoBackup',
|
||||
state.vrcRegistryAutoBackup
|
||||
vrcRegistryAutoBackup.value
|
||||
);
|
||||
}
|
||||
|
||||
async function setVrcRegistryAskRestore() {
|
||||
state.vrcRegistryAskRestore = !state.vrcRegistryAskRestore;
|
||||
vrcRegistryAskRestore.value = !vrcRegistryAskRestore.value;
|
||||
await configRepository.setBool(
|
||||
'VRCX_vrcRegistryAskRestore',
|
||||
state.vrcRegistryAskRestore
|
||||
vrcRegistryAskRestore.value
|
||||
);
|
||||
}
|
||||
|
||||
@@ -456,7 +397,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
state.sentryErrorReporting = true;
|
||||
sentryErrorReporting.value = true;
|
||||
configRepository.setString('VRCX_SentryEnabled', 'true');
|
||||
|
||||
ElMessageBox.confirm(
|
||||
@@ -478,7 +419,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
const act =
|
||||
typeof action === 'string' ? action : action?.action;
|
||||
if (act === 'cancel') {
|
||||
state.sentryErrorReporting = false;
|
||||
sentryErrorReporting.value = false;
|
||||
configRepository.setString('VRCX_SentryEnabled', 'false');
|
||||
}
|
||||
});
|
||||
@@ -489,10 +430,10 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
return;
|
||||
}
|
||||
|
||||
state.sentryErrorReporting = !state.sentryErrorReporting;
|
||||
sentryErrorReporting.value = !sentryErrorReporting.value;
|
||||
await configRepository.setString(
|
||||
'VRCX_SentryEnabled',
|
||||
state.sentryErrorReporting ? 'true' : 'false'
|
||||
sentryErrorReporting.value ? 'true' : 'false'
|
||||
);
|
||||
|
||||
ElMessageBox.confirm(
|
||||
@@ -542,7 +483,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
database.getExternalTableSize()
|
||||
]);
|
||||
|
||||
state.sqliteTableSizes = {
|
||||
sqliteTableSizes.value = {
|
||||
gps,
|
||||
status,
|
||||
bio,
|
||||
@@ -561,9 +502,9 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
|
||||
function handleSetAppLauncherSettings() {
|
||||
AppApi.SetAppLauncherSettings(
|
||||
state.enableAppLauncher,
|
||||
state.enableAppLauncherAutoClose,
|
||||
state.enableAppLauncherRunProcessOnce
|
||||
enableAppLauncher.value,
|
||||
enableAppLauncherAutoClose.value,
|
||||
enableAppLauncherRunProcessOnce.value
|
||||
);
|
||||
}
|
||||
|
||||
@@ -571,14 +512,14 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
* @param {string} videoId
|
||||
*/
|
||||
async function lookupYouTubeVideo(videoId) {
|
||||
if (!state.youTubeApi) {
|
||||
if (!youTubeApi.value) {
|
||||
console.warn('no Youtube API key configured');
|
||||
return null;
|
||||
}
|
||||
let data = null;
|
||||
let apiKey = '';
|
||||
if (state.youTubeApiKey) {
|
||||
apiKey = state.youTubeApiKey;
|
||||
if (youTubeApiKey.value) {
|
||||
apiKey = youTubeApiKey.value;
|
||||
}
|
||||
try {
|
||||
const response = await webApiService.execute({
|
||||
@@ -606,7 +547,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
}
|
||||
|
||||
function cropPrintsChanged() {
|
||||
if (!state.cropInstancePrints) return;
|
||||
if (!cropInstancePrints.value) return;
|
||||
ElMessageBox.confirm(
|
||||
t(
|
||||
'view.settings.advanced.advanced.save_instance_prints_to_file.crop_convert_old'
|
||||
@@ -629,7 +570,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
duration: 0
|
||||
});
|
||||
try {
|
||||
await AppApi.CropAllPrints(state.ugcFolderPath);
|
||||
await AppApi.CropAllPrints(ugcFolderPath.value);
|
||||
ElMessage({
|
||||
message: 'Batch print cropping complete',
|
||||
type: 'success'
|
||||
@@ -715,10 +656,10 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
}
|
||||
|
||||
async function openUGCFolder() {
|
||||
if (LINUX && state.ugcFolderPath == null) {
|
||||
if (LINUX && ugcFolderPath.value == null) {
|
||||
resetUGCFolder();
|
||||
}
|
||||
await AppApi.OpenUGCPhotosFolder(state.ugcFolderPath);
|
||||
await AppApi.OpenUGCPhotosFolder(ugcFolderPath.value);
|
||||
}
|
||||
|
||||
async function folderSelectorDialog(oldPath) {
|
||||
@@ -740,12 +681,12 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
}
|
||||
|
||||
async function openUGCFolderSelector() {
|
||||
const path = await folderSelectorDialog(state.ugcFolderPath);
|
||||
const path = await folderSelectorDialog(ugcFolderPath.value);
|
||||
await setUGCFolderPath(path);
|
||||
}
|
||||
|
||||
async function showVRChatConfig() {
|
||||
state.isVRChatConfigDialogVisible = true;
|
||||
isVRChatConfigDialogVisible.value = true;
|
||||
if (!gameStore.VRChatUsedCacheSize) {
|
||||
gameStore.getVRChatCacheSize();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user