diff --git a/html/src/app.js b/html/src/app.js
index 786aed88..18e1fe9d 100644
--- a/html/src/app.js
+++ b/html/src/app.js
@@ -6191,9 +6191,20 @@ speechSynthesis.getVoices();
return length;
};
+ $app.data.instanceTypes = [
+ 'invite',
+ 'invite+',
+ 'friends',
+ 'friends+',
+ 'public',
+ 'groupPublic',
+ 'groupPlus',
+ 'groupOnly'
+ ];
+
$app.methods.updateAutoStateChange = function () {
if (
- this.autoStateChange === 'Off' ||
+ !this.autoStateChangeEnabled ||
!this.isGameRunning ||
!this.lastLocation.playerList.size ||
this.lastLocation.location === '' ||
@@ -6202,38 +6213,50 @@ speechSynthesis.getVoices();
return;
}
- const otherPeopleExists = this.lastLocation.playerList.size > 1;
- const prevStatus = API.currentUser.status;
- let nextStatus = prevStatus;
-
- switch (this.autoStateChange) {
- case 'Active or Ask Me':
- nextStatus = otherPeopleExists ? 'ask me' : 'active';
- break;
-
- case 'Active or Busy':
- nextStatus = otherPeopleExists ? 'busy' : 'active';
- break;
-
- case 'Join Me or Ask Me':
- nextStatus = otherPeopleExists ? 'ask me' : 'join me';
- break;
-
- case 'Join Me or Busy':
- nextStatus = otherPeopleExists ? 'busy' : 'join me';
- break;
-
- case 'Ask Me or Busy':
- nextStatus = otherPeopleExists ? 'ask me' : 'busy';
- break;
+ var $location = $utils.parseLocation(this.lastLocation.location);
+ var instanceType = $location.accessType;
+ if (instanceType === 'group') {
+ if ($location.groupAccessType === 'members') {
+ instanceType = 'groupOnly';
+ } else if ($location.groupAccessType === 'plus') {
+ instanceType = 'groupPlus';
+ } else {
+ instanceType = 'groupPublic';
+ }
+ }
+ if (
+ this.autoStateChangeInstanceTypes.length > 0 &&
+ !this.autoStateChangeInstanceTypes.includes(instanceType)
+ ) {
+ return;
}
- if (prevStatus === nextStatus) {
+ var withCompany = this.lastLocation.playerList.size > 1;
+ if (this.autoStateChangeNoFriends) {
+ withCompany = this.lastLocation.friendList.size > 1;
+ }
+
+ var currentStatus = API.currentUser.status;
+ var newStatus = withCompany
+ ? this.autoStateChangeCompanyStatus
+ : this.autoStateChangeAloneStatus;
+
+ if (currentStatus === newStatus) {
return;
}
API.saveCurrentUser({
- status: nextStatus
+ status: newStatus
+ }).then(() => {
+ var text = `Status automaticly changed to ${newStatus}`;
+ if (this.errorNoty) {
+ this.errorNoty.close();
+ }
+ this.errorNoty = new Noty({
+ type: 'info',
+ text
+ }).show();
+ console.log(text);
});
};
@@ -7434,7 +7457,15 @@ speechSynthesis.getVoices();
ref.senderUserId
)
.then((_args) => {
- $app.$message(`Auto invite sent to ${ref.senderUsername}`);
+ var text = `Auto invite sent to ${ref.senderUsername}`;
+ if (this.errorNoty) {
+ this.errorNoty.close();
+ }
+ this.errorNoty = new Noty({
+ type: 'info',
+ text
+ }).show();
+ console.log(text);
API.hideNotification({
notificationId: ref.id
});
@@ -8371,18 +8402,52 @@ speechSynthesis.getVoices();
this.logEmptyAvatars
);
};
- $app.data.autoStateChange = await configRepository.getString(
- 'VRCX_autoStateChange',
- 'Off'
+ $app.data.autoStateChangeEnabled = await configRepository.getBool(
+ 'VRCX_autoStateChangeEnabled',
+ false
+ );
+ $app.data.autoStateChangeNoFriends = await configRepository.getBool(
+ 'VRCX_autoStateChangeNoFriends',
+ false
+ );
+ $app.data.autoStateChangeInstanceTypes = JSON.parse(
+ await configRepository.getString(
+ 'VRCX_autoStateChangeInstanceTypes',
+ '[]'
+ )
+ );
+ $app.data.autoStateChangeAloneStatus = await configRepository.getString(
+ 'VRCX_autoStateChangeAloneStatus',
+ 'join me'
+ );
+ $app.data.autoStateChangeCompanyStatus = await configRepository.getString(
+ 'VRCX_autoStateChangeCompanyStatus',
+ 'busy'
);
$app.data.autoAcceptInviteRequests = await configRepository.getString(
'VRCX_autoAcceptInviteRequests',
'Off'
);
$app.methods.saveAutomationOptions = async function () {
+ await configRepository.setBool(
+ 'VRCX_autoStateChangeEnabled',
+ this.autoStateChangeEnabled
+ );
+ await configRepository.setBool(
+ 'VRCX_autoStateChangeNoFriends',
+ this.autoStateChangeNoFriends
+ );
await configRepository.setString(
- 'VRCX_autoStateChange',
- this.autoStateChange
+ 'VRCX_autoStateChangeInstanceTypes',
+ JSON.stringify(this.autoStateChangeInstanceTypes)
+ );
+ await configRepository.setString(
+ 'VRCX_autoStateChangeAloneStatus',
+ this.autoStateChangeAloneStatus
+ );
+ await configRepository.setString(
+ 'VRCX_autoStateChangeCompanyStatus',
+ this.autoStateChangeCompanyStatus
);
await configRepository.setString(
'VRCX_autoAcceptInviteRequests',
diff --git a/html/src/localization/en/en.json b/html/src/localization/en/en.json
index 3c2ad6c2..faef939b 100644
--- a/html/src/localization/en/en.json
+++ b/html/src/localization/en/en.json
@@ -242,14 +242,15 @@
},
"automation": {
"header": "Automation",
- "auto_state_change": "Auto Status Change",
+ "auto_change_status": "Auto Change Status",
"auto_state_change_tooltip": "Automatically change status when there are other people in the instance (Alone / Company)",
- "auto_state_change_off": "Off",
- "auto_state_change_active_or_ask_me": "Active / Ask Me",
- "auto_state_change_active_or_busy": "Active / Busy",
- "auto_state_change_join_me_or_ask_me": "Join Me / Ask Me",
- "auto_state_change_join_me_or_busy": "Join Me / Busy",
- "auto_state_change_ask_me_or_busy": "Ask Me / Busy",
+ "alone_condition": "Alone Condition",
+ "alone": "Alone",
+ "no_friends": "No Friends",
+ "alone_status": "Alone Status",
+ "company_status": "Company Status",
+ "allowed_instance_types": "Allowed Instance Types",
+ "instance_type_placeholder": "All Instance Types",
"auto_invite_request_accept": "Auto Accept Invite Requests",
"auto_invite_request_accept_tooltip": "Automatically accept invite requests from favorite friends",
"auto_invite_request_accept_off": "Off",
diff --git a/html/src/mixins/tabs/settings.pug b/html/src/mixins/tabs/settings.pug
index f7e1f6cc..f4bc51eb 100644
--- a/html/src/mixins/tabs/settings.pug
+++ b/html/src/mixins/tabs/settings.pug
@@ -116,15 +116,47 @@ mixin settingsTab()
span.name(style="min-width:225px") {{ $t('view.settings.general.logging.empty_avatar') }}
el-switch(v-model="logEmptyAvatars" @change="saveLoggingOptions")
//- General | Automation
- +simpleSettingsCategory("view.settings.general.automation.header")
- +simpleRadioGroupWithTooltip("view.settings.general.automation.auto_state_change", "$t('view.settings.general.automation.auto_state_change_tooltip')", "autoStateChange", [
- { label: "Off", translationKey: "view.settings.general.automation.auto_state_change_off" },
- { label: "Active or Ask Me", translationKey: "view.settings.general.automation.auto_state_change_active_or_ask_me" },
- { label: "Active or Busy", translationKey: "view.settings.general.automation.auto_state_change_active_or_busy" },
- { label: "Join Me or Ask Me", translationKey: "view.settings.general.automation.auto_state_change_join_me_or_ask_me" },
- { label: "Join Me or Busy", translationKey: "view.settings.general.automation.auto_state_change_join_me_or_busy" },
- { label: "Ask Me or Busy", translationKey: "view.settings.general.automation.auto_state_change_ask_me_or_busy" },
- ], "saveAutomationOptions")
+ div.options-container
+ span.header {{ $t('view.settings.general.automation.header') }}
+ div.options-container-item
+ span.name {{ $t('view.settings.general.automation.auto_change_status') }}
+ el-tooltip(placement="top" style="margin-left:5px" :content="$t('view.settings.general.automation.auto_state_change_tooltip')")
+ i.el-icon-info
+ el-switch(v-model="autoStateChangeEnabled" @change="saveAutomationOptions")
+ div.options-container-item
+ span.name {{ $t('view.settings.general.automation.alone_status') }}
+ el-select(v-model="autoStateChangeAloneStatus" :disabled="!autoStateChangeEnabled" @change="saveAutomationOptions" style="margin-top:8px")
+ el-option(:label="$t('dialog.user.status.join_me')" value="join me").
+ #[i.x-user-status.joinme] {{ $t('dialog.user.status.join_me') }}
+ el-option(:label="$t('dialog.user.status.online')" value="active").
+ #[i.x-user-status.online] {{ $t('dialog.user.status.online') }}
+ el-option(:label="$t('dialog.user.status.ask_me')" value="ask me").
+ #[i.x-user-status.askme] {{ $t('dialog.user.status.ask_me') }}
+ el-option(:label="$t('dialog.user.status.busy')" value="busy").
+ #[i.x-user-status.busy] {{ $t('dialog.user.status.busy') }}
+ div.options-container-item
+ span.name {{ $t('view.settings.general.automation.company_status') }}
+ el-select(v-model="autoStateChangeCompanyStatus" :disabled="!autoStateChangeEnabled" @change="saveAutomationOptions" style="margin-top:8px")
+ el-option(:label="$t('dialog.user.status.join_me')" value="join me").
+ #[i.x-user-status.joinme] {{ $t('dialog.user.status.join_me') }}
+ el-option(:label="$t('dialog.user.status.online')" value="active").
+ #[i.x-user-status.online] {{ $t('dialog.user.status.online') }}
+ el-option(:label="$t('dialog.user.status.ask_me')" value="ask me").
+ #[i.x-user-status.askme] {{ $t('dialog.user.status.ask_me') }}
+ el-option(:label="$t('dialog.user.status.busy')" value="busy").
+ #[i.x-user-status.busy] {{ $t('dialog.user.status.busy') }}
+ div.options-container-item
+ span.name {{ $t('view.settings.general.automation.allowed_instance_types') }}
+ el-select(v-model="autoStateChangeInstanceTypes" :disabled="!autoStateChangeEnabled" multiple clearable :placeholder="$t('view.settings.general.automation.instance_type_placeholder')" @change="saveAutomationOptions" style="margin-top:8px")
+ el-option-group(:label="$t('view.settings.general.automation.allowed_instance_types')")
+ el-option.x-friend-item(v-for="instanceType in instanceTypes" :key="instanceType" :label="instanceType" :value="instanceType")
+ .detail
+ span.name(v-text="instanceType")
+ div.options-container-item
+ span.name {{ $t('view.settings.general.automation.alone_condition') }}
+ el-switch(v-model="autoStateChangeNoFriends" :disabled="!autoStateChangeEnabled" @change="saveAutomationOptions" :inactive-text="$t('view.settings.general.automation.alone')" :active-text="$t('view.settings.general.automation.no_friends')")
+ br
+ br
+simpleRadioGroupWithTooltip("view.settings.general.automation.auto_invite_request_accept", "$t('view.settings.general.automation.auto_invite_request_accept_tooltip')", "autoAcceptInviteRequests", [
{ label: "Off", translationKey: "view.settings.general.automation.auto_invite_request_accept_off" },
{ label: "All Favorites", translationKey: "view.settings.general.automation.auto_invite_request_accept_favs" },