refactor auto change status

This commit is contained in:
pa
2026-02-14 17:07:22 +09:00
parent 64869a218e
commit 4e552bf3b9
5 changed files with 310 additions and 77 deletions
+40 -2
View File
@@ -39,7 +39,9 @@ export const useGeneralSettingsStore = defineStore('GeneralSettings', () => {
const autoStateChangeAloneDesc = ref('');
const autoStateChangeCompanyDescEnabled = ref(false);
const autoStateChangeCompanyDesc = ref('');
const autoStateChangeGroups = ref([]);
const autoAcceptInviteRequests = ref('Off');
const autoAcceptInviteGroups = ref([]);
async function initGeneralSettings() {
const [
@@ -64,7 +66,9 @@ export const useGeneralSettingsStore = defineStore('GeneralSettings', () => {
autoStateChangeAloneDescConfig,
autoStateChangeCompanyDescEnabledConfig,
autoStateChangeCompanyDescConfig,
autoAcceptInviteRequestsConfig
autoStateChangeGroupsStrConfig,
autoAcceptInviteRequestsConfig,
autoAcceptInviteGroupsStrConfig
] = await Promise.all([
configRepository.getBool('VRCX_StartAtWindowsStartup', false),
VRCXStorage.Get('VRCX_StartAsMinimizedState'),
@@ -102,7 +106,9 @@ export const useGeneralSettingsStore = defineStore('GeneralSettings', () => {
false
),
configRepository.getString('VRCX_autoStateChangeCompanyDesc', ''),
configRepository.getString('VRCX_autoAcceptInviteRequests', 'Off')
configRepository.getString('VRCX_autoStateChangeGroups', '[]'),
configRepository.getString('VRCX_autoAcceptInviteRequests', 'Off'),
configRepository.getString('VRCX_autoAcceptInviteGroups', '[]')
]);
isStartAtWindowsStartup.value = isStartAtWindowsStartupConfig;
@@ -146,7 +152,13 @@ export const useGeneralSettingsStore = defineStore('GeneralSettings', () => {
autoStateChangeCompanyDescEnabled.value =
autoStateChangeCompanyDescEnabledConfig;
autoStateChangeCompanyDesc.value = autoStateChangeCompanyDescConfig;
autoStateChangeGroups.value = JSON.parse(
autoStateChangeGroupsStrConfig
);
autoAcceptInviteRequests.value = autoAcceptInviteRequestsConfig;
autoAcceptInviteGroups.value = JSON.parse(
autoAcceptInviteGroupsStrConfig
);
}
initGeneralSettings();
@@ -322,6 +334,17 @@ export const useGeneralSettingsStore = defineStore('GeneralSettings', () => {
autoStateChangeCompanyDesc.value
);
}
/**
* @param {Array} value
*/
function setAutoStateChangeGroups(value) {
autoStateChangeGroups.value = value;
configRepository.setString(
'VRCX_autoStateChangeGroups',
JSON.stringify(autoStateChangeGroups.value)
);
}
/**
* @param {string} value
*/
@@ -333,6 +356,17 @@ export const useGeneralSettingsStore = defineStore('GeneralSettings', () => {
);
}
/**
* @param {string[]} value
*/
function setAutoAcceptInviteGroups(value) {
autoAcceptInviteGroups.value = value;
configRepository.setString(
'VRCX_autoAcceptInviteGroups',
JSON.stringify(autoAcceptInviteGroups.value)
);
}
function promptProxySettings() {
// Element Plus: prompt(message, title, options)
modalStore
@@ -398,7 +432,9 @@ export const useGeneralSettingsStore = defineStore('GeneralSettings', () => {
autoStateChangeAloneDesc,
autoStateChangeCompanyDescEnabled,
autoStateChangeCompanyDesc,
autoStateChangeGroups,
autoAcceptInviteRequests,
autoAcceptInviteGroups,
setIsStartAtWindowsStartup,
setIsStartAsMinimizedState,
@@ -420,7 +456,9 @@ export const useGeneralSettingsStore = defineStore('GeneralSettings', () => {
setAutoStateChangeAloneDesc,
setAutoStateChangeCompanyDescEnabled,
setAutoStateChangeCompanyDesc,
setAutoStateChangeGroups,
setAutoAcceptInviteRequests,
setAutoAcceptInviteGroups,
promptProxySettings
};
});