Fix group name and access type

This commit is contained in:
Natsumi
2023-06-02 10:39:50 +12:00
parent 7d6ca28f86
commit d45f9ad001
2 changed files with 66 additions and 46 deletions
+41 -38
View File
@@ -692,6 +692,7 @@ speechSynthesis.getVoices();
instanceId: '', instanceId: '',
instanceName: '', instanceName: '',
accessType: '', accessType: '',
accessTypeName: '',
region: '', region: '',
shortName: '', shortName: '',
userId: null, userId: null,
@@ -772,6 +773,14 @@ speechSynthesis.getVoices();
// Group // Group
ctx.accessType = 'group'; ctx.accessType = 'group';
} }
ctx.accessTypeName = ctx.accessType;
if (ctx.groupAccessType !== null) {
if (ctx.groupAccessType === 'public') {
ctx.accessTypeName = 'groupPublic';
} else if (ctx.groupAccessType === 'plus') {
ctx.accessTypeName = 'groupPlus';
}
}
} else { } else {
ctx.worldId = _tag; ctx.worldId = _tag;
} }
@@ -837,7 +846,7 @@ speechSynthesis.getVoices();
"<span><span @click=\"showWorldDialog\" :class=\"{ 'x-link': link && this.location !== 'private' && this.location !== 'offline'}\">" + "<span><span @click=\"showWorldDialog\" :class=\"{ 'x-link': link && this.location !== 'private' && this.location !== 'offline'}\">" +
'<i v-if="isTraveling" class="el-icon el-icon-loading" style="display:inline-block;margin-right:5px"></i>' + '<i v-if="isTraveling" class="el-icon el-icon-loading" style="display:inline-block;margin-right:5px"></i>' +
'<span>{{ text }}</span></span>' + '<span>{{ text }}</span></span>' +
'<span v-if="groupName" @click="showGroupDialog" class="x-link">({{ groupName }})</span>' + '<span v-if="groupName" @click.stop="showGroupDialog" class="x-link">({{ groupName }})</span>' +
'<span class="flags" :class="region" style="display:inline-block;margin-left:5px"></span>' + '<span class="flags" :class="region" style="display:inline-block;margin-left:5px"></span>' +
'<i v-if="strict" class="el-icon el-icon-lock" style="display:inline-block;margin-left:5px"></i></span>', '<i v-if="strict" class="el-icon el-icon-lock" style="display:inline-block;margin-left:5px"></i></span>',
props: { props: {
@@ -879,14 +888,6 @@ speechSynthesis.getVoices();
} }
this.text = instanceId; this.text = instanceId;
var L = API.parseLocation(instanceId); var L = API.parseLocation(instanceId);
var groupAccessType = '';
if (L.groupAccessType) {
if (L.groupAccessType === 'public') {
groupAccessType = 'Public';
} else if (L.groupAccessType === 'plus') {
groupAccessType = 'Plus';
}
}
if (L.isOffline) { if (L.isOffline) {
this.text = 'Offline'; this.text = 'Offline';
} else if (L.isPrivate) { } else if (L.isPrivate) {
@@ -895,7 +896,7 @@ speechSynthesis.getVoices();
this.text = 'Traveling'; this.text = 'Traveling';
} else if (typeof this.hint === 'string' && this.hint !== '') { } else if (typeof this.hint === 'string' && this.hint !== '') {
if (L.instanceId) { if (L.instanceId) {
this.text = `${this.hint} #${L.instanceName} ${L.accessType}${groupAccessType}`; this.text = `${this.hint} #${L.instanceName} ${L.accessTypeName}`;
} else { } else {
this.text = this.hint; this.text = this.hint;
} }
@@ -905,14 +906,14 @@ speechSynthesis.getVoices();
$app.getWorldName(L.worldId).then((worldName) => { $app.getWorldName(L.worldId).then((worldName) => {
if (L.tag === instanceId) { if (L.tag === instanceId) {
if (L.instanceId) { if (L.instanceId) {
this.text = `${worldName} #${L.instanceName} ${L.accessType}${groupAccessType}`; this.text = `${worldName} #${L.instanceName} ${L.accessTypeName}`;
} else { } else {
this.text = worldName; this.text = worldName;
} }
} }
}); });
} else if (L.instanceId) { } else if (L.instanceId) {
this.text = `${ref.name} #${L.instanceName} ${L.accessType}${groupAccessType}`; this.text = `${ref.name} #${L.instanceName} ${L.accessTypeName}`;
} else { } else {
this.text = ref.name; this.text = ref.name;
} }
@@ -973,7 +974,7 @@ speechSynthesis.getVoices();
template: template:
'<span><span @click="showLaunchDialog" class="x-link">' + '<span><span @click="showLaunchDialog" class="x-link">' +
'<i v-if="isUnlocked" class="el-icon el-icon-unlock" style="display:inline-block;margin-right:5px"></i>' + '<i v-if="isUnlocked" class="el-icon el-icon-unlock" style="display:inline-block;margin-right:5px"></i>' +
'<span>#{{ instanceName }} {{ accessType }}{{ groupAccessType }}</span></span>' + '<span>#{{ instanceName }} {{ accessTypeName }}</span></span>' +
'<span v-if="groupName" @click="showGroupDialog" class="x-link">({{ groupName }})</span>' + '<span v-if="groupName" @click="showGroupDialog" class="x-link">({{ groupName }})</span>' +
'<span class="flags" :class="region" style="display:inline-block;margin-left:5px"></span>' + '<span class="flags" :class="region" style="display:inline-block;margin-left:5px"></span>' +
'<i v-if="strict" class="el-icon el-icon-lock" style="display:inline-block;margin-left:5px"></i></span>', '<i v-if="strict" class="el-icon el-icon-lock" style="display:inline-block;margin-left:5px"></i></span>',
@@ -990,8 +991,7 @@ speechSynthesis.getVoices();
return { return {
location: this.location, location: this.location,
instanceName: this.instanceName, instanceName: this.instanceName,
accessType: this.accessType, accessTypeName: this.accessTypeName,
groupAccessType: this.groupAccessType,
region: this.region, region: this.region,
shortName: this.shortName, shortName: this.shortName,
isUnlocked: this.isUnlocked, isUnlocked: this.isUnlocked,
@@ -1003,7 +1003,7 @@ speechSynthesis.getVoices();
parse() { parse() {
this.location = this.locationobject.tag; this.location = this.locationobject.tag;
this.instanceName = this.locationobject.instanceName; this.instanceName = this.locationobject.instanceName;
this.accessType = this.locationobject.accessType; this.accessTypeName = this.locationobject.accessTypeName;
this.strict = this.locationobject.strict; this.strict = this.locationobject.strict;
this.shortName = this.locationobject.shortName; this.shortName = this.locationobject.shortName;
@@ -1018,15 +1018,6 @@ speechSynthesis.getVoices();
this.isUnlocked = true; this.isUnlocked = true;
} }
this.groupAccessType = '';
if (this.locationobject.groupAccessType) {
if (this.locationobject.groupAccessType === 'public') {
this.groupAccessType = 'Public';
} else if (this.locationobject.groupAccessType === 'plus') {
this.groupAccessType = 'Plus';
}
}
this.region = this.locationobject.region; this.region = this.locationobject.region;
if (!this.region) { if (!this.region) {
this.region = 'us'; this.region = 'us';
@@ -6115,7 +6106,8 @@ speechSynthesis.getVoices();
this.speak( this.speak(
`${noty.displayName} is in ${this.displayLocation( `${noty.displayName} is in ${this.displayLocation(
noty.location, noty.location,
noty.worldName noty.worldName,
noty.groupName
)}` )}`
); );
break; break;
@@ -6124,7 +6116,8 @@ speechSynthesis.getVoices();
if (noty.worldName) { if (noty.worldName) {
locationName = ` to ${this.displayLocation( locationName = ` to ${this.displayLocation(
noty.location, noty.location,
noty.worldName noty.worldName,
noty.groupName
)}`; )}`;
} }
this.speak(`${noty.displayName} has logged in${locationName}`); this.speak(`${noty.displayName} has logged in${locationName}`);
@@ -6143,7 +6136,8 @@ speechSynthesis.getVoices();
noty.senderUsername noty.senderUsername
} has invited you to ${this.displayLocation( } has invited you to ${this.displayLocation(
noty.details.worldId, noty.details.worldId,
noty.details.worldName noty.details.worldName,
noty.groupName
)}${message}` )}${message}`
); );
break; break;
@@ -6202,7 +6196,8 @@ speechSynthesis.getVoices();
noty.displayName noty.displayName
} has spawned a portal to ${this.displayLocation( } has spawned a portal to ${this.displayLocation(
noty.instanceId, noty.instanceId,
noty.worldName noty.worldName,
noty.groupName
)}` )}`
); );
} else { } else {
@@ -6282,7 +6277,8 @@ speechSynthesis.getVoices();
'VRCX', 'VRCX',
`${noty.displayName} is in ${this.displayLocation( `${noty.displayName} is in ${this.displayLocation(
noty.location, noty.location,
noty.worldName noty.worldName,
noty.groupName
)}`, )}`,
timeout, timeout,
image image
@@ -6293,7 +6289,8 @@ speechSynthesis.getVoices();
if (noty.worldName) { if (noty.worldName) {
locationName = ` to ${this.displayLocation( locationName = ` to ${this.displayLocation(
noty.location, noty.location,
noty.worldName noty.worldName,
noty.groupName
)}`; )}`;
} }
AppApi.XSNotification( AppApi.XSNotification(
@@ -6416,7 +6413,8 @@ speechSynthesis.getVoices();
noty.displayName noty.displayName
} has spawned a portal to ${this.displayLocation( } has spawned a portal to ${this.displayLocation(
noty.instanceId, noty.instanceId,
noty.worldName noty.worldName,
noty.groupName
)}`, )}`,
timeout, timeout,
image image
@@ -6548,7 +6546,8 @@ speechSynthesis.getVoices();
noty.displayName, noty.displayName,
`is in ${this.displayLocation( `is in ${this.displayLocation(
noty.location, noty.location,
noty.worldName noty.worldName,
noty.groupName
)}`, )}`,
image image
); );
@@ -6558,7 +6557,8 @@ speechSynthesis.getVoices();
if (noty.worldName) { if (noty.worldName) {
locationName = ` to ${this.displayLocation( locationName = ` to ${this.displayLocation(
noty.location, noty.location,
noty.worldName noty.worldName,
noty.groupName
)}`; )}`;
} }
AppApi.DesktopNotification( AppApi.DesktopNotification(
@@ -6677,7 +6677,8 @@ speechSynthesis.getVoices();
noty.displayName, noty.displayName,
`has spawned a portal to ${this.displayLocation( `has spawned a portal to ${this.displayLocation(
noty.instanceId, noty.instanceId,
noty.worldName noty.worldName,
noty.groupName
)}`, )}`,
image image
); );
@@ -6768,7 +6769,7 @@ speechSynthesis.getVoices();
} }
}; };
$app.methods.displayLocation = function (location, worldName) { $app.methods.displayLocation = function (location, worldName, groupName) {
var text = worldName; var text = worldName;
var L = API.parseLocation(location); var L = API.parseLocation(location);
if (L.isOffline) { if (L.isOffline) {
@@ -6778,8 +6779,10 @@ speechSynthesis.getVoices();
} else if (L.isTraveling) { } else if (L.isTraveling) {
text = 'Traveling'; text = 'Traveling';
} else if (L.worldId) { } else if (L.worldId) {
if (L.instanceId) { if (groupName) {
text = `${worldName} ${L.accessType}`; text = `${worldName} ${L.accessTypeName}(${groupName})`;
} else if (L.instanceId) {
text = `${worldName} ${L.accessTypeName}`;
} }
} }
return text; return text;
+25 -8
View File
@@ -125,13 +125,13 @@ Vue.component('marquee-text', MarqueeText);
this.text = 'Traveling'; this.text = 'Traveling';
} else if (typeof this.hint === 'string' && this.hint !== '') { } else if (typeof this.hint === 'string' && this.hint !== '') {
if (L.instanceId) { if (L.instanceId) {
this.text = `${this.hint} #${L.instanceName} ${L.accessType}`; this.text = `${this.hint} #${L.instanceName} ${L.accessTypeName}`;
} else { } else {
this.text = this.hint; this.text = this.hint;
} }
} else if (L.worldId) { } else if (L.worldId) {
if (L.instanceId) { if (L.instanceId) {
this.text = ` #${L.instanceName} ${L.accessType}`; this.text = ` #${L.instanceName} ${L.accessTypeName}`;
} else { } else {
this.text = this.location; this.text = this.location;
} }
@@ -235,6 +235,7 @@ Vue.component('marquee-text', MarqueeText);
instanceId: '', instanceId: '',
instanceName: '', instanceName: '',
accessType: '', accessType: '',
accessTypeName: '',
region: '', region: '',
shortName: '', shortName: '',
userId: null, userId: null,
@@ -242,6 +243,7 @@ Vue.component('marquee-text', MarqueeText);
privateId: null, privateId: null,
friendsId: null, friendsId: null,
groupId: null, groupId: null,
groupAccessType: null,
canRequestInvite: false, canRequestInvite: false,
strict: false strict: false
}; };
@@ -283,6 +285,8 @@ Vue.component('marquee-text', MarqueeText);
ctx.region = value; ctx.region = value;
} else if (key === 'group') { } else if (key === 'group') {
ctx.groupId = value; ctx.groupId = value;
} else if (key === 'groupAccessType') {
ctx.groupAccessType = value;
} else if (key === 'strict') { } else if (key === 'strict') {
ctx.strict = true; ctx.strict = true;
} }
@@ -312,6 +316,14 @@ Vue.component('marquee-text', MarqueeText);
// Group // Group
ctx.accessType = 'group'; ctx.accessType = 'group';
} }
ctx.accessTypeName = ctx.accessType;
if (ctx.groupAccessType !== null) {
if (ctx.groupAccessType === 'public') {
ctx.accessTypeName = 'groupPublic';
} else if (ctx.groupAccessType === 'plus') {
ctx.accessTypeName = 'groupPlus';
}
}
} else { } else {
ctx.worldId = _tag; ctx.worldId = _tag;
} }
@@ -501,7 +513,8 @@ Vue.component('marquee-text', MarqueeText);
noty.displayName noty.displayName
}</strong> is in ${this.displayLocation( }</strong> is in ${this.displayLocation(
noty.location, noty.location,
escapeTag(noty.worldName) escapeTag(noty.worldName),
escapeTag(noty.groupName)
)}`; )}`;
break; break;
case 'Online': case 'Online':
@@ -509,7 +522,8 @@ Vue.component('marquee-text', MarqueeText);
if (noty.worldName) { if (noty.worldName) {
locationName = ` to ${this.displayLocation( locationName = ` to ${this.displayLocation(
noty.location, noty.location,
escapeTag(noty.worldName) escapeTag(noty.worldName),
escapeTag(noty.groupName)
)}`; )}`;
} }
text = `<strong>${noty.displayName}</strong> has logged in${locationName}`; text = `<strong>${noty.displayName}</strong> has logged in${locationName}`;
@@ -572,7 +586,8 @@ Vue.component('marquee-text', MarqueeText);
noty.displayName noty.displayName
}</strong> has spawned a portal to ${this.displayLocation( }</strong> has spawned a portal to ${this.displayLocation(
noty.instanceId, noty.instanceId,
escapeTag(noty.worldName) escapeTag(noty.worldName),
escapeTag(noty.groupName)
)}`; )}`;
} else { } else {
text = 'User has spawned a portal'; text = 'User has spawned a portal';
@@ -654,7 +669,7 @@ Vue.component('marquee-text', MarqueeText);
return style; return style;
}; };
$app.methods.displayLocation = function (location, worldName) { $app.methods.displayLocation = function (location, worldName, groupName) {
var text = worldName; var text = worldName;
var L = this.parseLocation(location); var L = this.parseLocation(location);
if (L.isOffline) { if (L.isOffline) {
@@ -664,8 +679,10 @@ Vue.component('marquee-text', MarqueeText);
} else if (L.isTraveling) { } else if (L.isTraveling) {
text = 'Traveling'; text = 'Traveling';
} else if (L.worldId) { } else if (L.worldId) {
if (L.instanceId) { if (groupName) {
text = `${worldName} ${L.accessType}`; text = `${worldName} ${L.accessTypeName}(${groupName})`;
} else if (L.instanceId) {
text = `${worldName} ${L.accessTypeName}`;
} }
} }
return text; return text;