Sidebar all favorites toggle

This commit is contained in:
Natsumi
2024-06-18 22:47:19 +12:00
parent 73a9803abd
commit a1118ff43d
3 changed files with 54 additions and 18 deletions
+45 -16
View File
@@ -9049,10 +9049,12 @@ speechSynthesis.getVoices();
} }
var ref = API.cachedUsers.get(id); var ref = API.cachedUsers.get(id);
var isVIP = this.localFavoriteFriends.has(id); var isVIP = this.localFavoriteFriends.has(id);
var isFavorite = API.cachedFavoritesByObjectId.has(id);
var ctx = { var ctx = {
id, id,
state: state || 'offline', state: state || 'offline',
isVIP, isVIP,
isFavorite,
ref, ref,
name: '', name: '',
no: ++this.friendsNo, no: ++this.friendsNo,
@@ -9082,7 +9084,7 @@ speechSynthesis.getVoices();
} }
this.friends.set(id, ctx); this.friends.set(id, ctx);
if (ctx.state === 'online') { if (ctx.state === 'online') {
if (ctx.isVIP) { if ((this.sidebarAllFavorites && ctx.isFavorite) || ctx.isVIP) {
this.sortFriendsGroup0 = true; this.sortFriendsGroup0 = true;
this.friendsGroup0_.push(ctx); this.friendsGroup0_.push(ctx);
this.friendsGroupA_.unshift(ctx); this.friendsGroupA_.unshift(ctx);
@@ -9109,7 +9111,7 @@ speechSynthesis.getVoices();
} }
this.friends.delete(id); this.friends.delete(id);
if (ctx.state === 'online') { if (ctx.state === 'online') {
if (ctx.isVIP) { if ((this.sidebarAllFavorites && ctx.isFavorite) || ctx.isVIP) {
removeFromArray(this.friendsGroup0_, ctx); removeFromArray(this.friendsGroup0_, ctx);
removeFromArray(this.friendsGroupA_, ctx); removeFromArray(this.friendsGroupA_, ctx);
} else { } else {
@@ -9180,6 +9182,7 @@ speechSynthesis.getVoices();
} }
var ref = API.cachedUsers.get(id); var ref = API.cachedUsers.get(id);
var isVIP = this.localFavoriteFriends.has(id); var isVIP = this.localFavoriteFriends.has(id);
var isFavorite = API.cachedFavoritesByObjectId.has(id);
var location = ''; var location = '';
var $location_at = ''; var $location_at = '';
if (typeof ref !== 'undefined') { if (typeof ref !== 'undefined') {
@@ -9198,7 +9201,10 @@ speechSynthesis.getVoices();
userId: id userId: id
}); });
} }
if (ctx.isVIP) { if (
(this.sidebarAllFavorites && ctx.isFavorite) ||
ctx.isVIP
) {
removeFromArray(this.friendsGroupA_, ctx); removeFromArray(this.friendsGroupA_, ctx);
this.sortFriendsGroup0 = true; this.sortFriendsGroup0 = true;
this.friendsGroupA_.unshift(ctx); this.friendsGroupA_.unshift(ctx);
@@ -9215,10 +9221,14 @@ speechSynthesis.getVoices();
this.friendsGroupD_.push(ctx); this.friendsGroupD_.push(ctx);
} }
} }
if (ctx.isVIP !== isVIP) { if (ctx.isVIP !== isVIP || ctx.isFavorite !== isFavorite) {
ctx.isVIP = isVIP; ctx.isVIP = isVIP;
ctx.isFavorite = isFavorite;
if (ctx.state === 'online') { if (ctx.state === 'online') {
if (ctx.isVIP) { if (
(this.sidebarAllFavorites && ctx.isFavorite) ||
ctx.isVIP
) {
removeFromArray(this.friendsGroup1_, ctx); removeFromArray(this.friendsGroup1_, ctx);
removeFromArray(this.friendsGroupB_, ctx); removeFromArray(this.friendsGroupB_, ctx);
this.sortFriendsGroup0 = true; this.sortFriendsGroup0 = true;
@@ -9236,7 +9246,10 @@ speechSynthesis.getVoices();
if (typeof ref !== 'undefined' && ctx.name !== ref.displayName) { if (typeof ref !== 'undefined' && ctx.name !== ref.displayName) {
ctx.name = ref.displayName; ctx.name = ref.displayName;
if (ctx.state === 'online') { if (ctx.state === 'online') {
if (ctx.isVIP) { if (
(this.sidebarAllFavorites && ctx.isFavorite) ||
ctx.isVIP
) {
this.sortFriendsGroup0 = true; this.sortFriendsGroup0 = true;
} else { } else {
this.sortFriendsGroup1 = true; this.sortFriendsGroup1 = true;
@@ -9264,6 +9277,7 @@ speechSynthesis.getVoices();
) { ) {
ctx.ref = ref; ctx.ref = ref;
ctx.isVIP = isVIP; ctx.isVIP = isVIP;
ctx.isFavorite = isFavorite;
if (typeof ref !== 'undefined') { if (typeof ref !== 'undefined') {
ctx.name = ref.displayName; ctx.name = ref.displayName;
} }
@@ -9291,7 +9305,6 @@ speechSynthesis.getVoices();
id, id,
ctx, ctx,
stateInput, stateInput,
isVIP,
location, location,
$location_at $location_at
); );
@@ -9299,6 +9312,7 @@ speechSynthesis.getVoices();
} else { } else {
ctx.ref = ref; ctx.ref = ref;
ctx.isVIP = isVIP; ctx.isVIP = isVIP;
ctx.isFavorite = isFavorite;
if (typeof ref !== 'undefined') { if (typeof ref !== 'undefined') {
ctx.name = ref.displayName; ctx.name = ref.displayName;
} }
@@ -9306,7 +9320,6 @@ speechSynthesis.getVoices();
id, id,
ctx, ctx,
stateInput, stateInput,
isVIP,
location, location,
$location_at $location_at
); );
@@ -9317,11 +9330,12 @@ speechSynthesis.getVoices();
id, id,
ctx, ctx,
stateInput, stateInput,
isVIP,
location, location,
$location_at $location_at
) { ) {
var date = this.APILastOnline.get(id); var date = this.APILastOnline.get(id);
var isVIP = this.localFavoriteFriends.has(id);
var isFavorite = API.cachedFavoritesByObjectId.has(id);
if ( if (
ctx.state === 'online' && ctx.state === 'online' &&
(stateInput === 'active' || stateInput === 'offline') && (stateInput === 'active' || stateInput === 'offline') &&
@@ -9403,7 +9417,7 @@ speechSynthesis.getVoices();
} }
} }
if (ctx.state === 'online') { if (ctx.state === 'online') {
if (ctx.isVIP) { if ((this.sidebarAllFavorites && ctx.isFavorite) || ctx.isVIP) {
removeFromArray(this.friendsGroup0_, ctx); removeFromArray(this.friendsGroup0_, ctx);
removeFromArray(this.friendsGroupA_, ctx); removeFromArray(this.friendsGroupA_, ctx);
} else { } else {
@@ -9418,7 +9432,7 @@ speechSynthesis.getVoices();
removeFromArray(this.friendsGroupD_, ctx); removeFromArray(this.friendsGroupD_, ctx);
} }
if (newState === 'online') { if (newState === 'online') {
if (isVIP) { if ((this.sidebarAllFavorites && isFavorite) || isVIP) {
this.sortFriendsGroup0 = true; this.sortFriendsGroup0 = true;
this.friendsGroup0_.push(ctx); this.friendsGroup0_.push(ctx);
this.friendsGroupA_.unshift(ctx); this.friendsGroupA_.unshift(ctx);
@@ -9442,6 +9456,7 @@ speechSynthesis.getVoices();
ctx.state = newState; ctx.state = newState;
ctx.name = newRef.displayName; ctx.name = newRef.displayName;
ctx.isVIP = isVIP; ctx.isVIP = isVIP;
ctx.isFavorite = isFavorite;
}; };
$app.methods.getWorldName = async function (location) { $app.methods.getWorldName = async function (location) {
@@ -9492,7 +9507,7 @@ speechSynthesis.getVoices();
} }
var ctx = this.friends.get(userId); var ctx = this.friends.get(userId);
if (typeof ctx.ref !== 'undefined' && ctx.state === 'online') { if (typeof ctx.ref !== 'undefined' && ctx.state === 'online') {
if (ctx.isVIP) { if ((this.sidebarAllFavorites && ctx.isFavorite) || ctx.isVIP) {
removeFromArray(this.friendsGroupA_, ctx); removeFromArray(this.friendsGroupA_, ctx);
this.sortFriendsGroup1 = true; this.sortFriendsGroup1 = true;
this.friendsGroupA_.unshift(ctx); this.friendsGroupA_.unshift(ctx);
@@ -28055,6 +28070,11 @@ speechSynthesis.getVoices();
// #endregion // #endregion
// #region | Local Favorite Friends // #region | Local Favorite Friends
$app.data.sidebarAllFavorites = await configRepository.getBool(
'VRCX_sidebarAllFavorites',
false
);
$app.data.localFavoriteFriends = new Set(); $app.data.localFavoriteFriends = new Set();
$app.data.localFavoriteFriendsGroups = JSON.parse( $app.data.localFavoriteFriendsGroups = JSON.parse(
await configRepository.getString( await configRepository.getString(
@@ -28081,28 +28101,37 @@ speechSynthesis.getVoices();
'VRCX_localFavoriteFriendsGroups', 'VRCX_localFavoriteFriendsGroups',
JSON.stringify(this.localFavoriteFriendsGroups) JSON.stringify(this.localFavoriteFriendsGroups)
); );
configRepository.setBool(
'VRCX_sidebarAllFavorites',
this.sidebarAllFavorites
);
}; };
$app.methods.updateSidebarFriendsList = function () { $app.methods.updateSidebarFriendsList = function () {
for (var ctx of this.friends.values()) { for (var ctx of this.friends.values()) {
var isVIP = this.localFavoriteFriends.has(ctx.id); var isVIP = this.localFavoriteFriends.has(ctx.id);
if (ctx.isVIP === isVIP) { var isFavorite = API.cachedFavoritesByObjectId.has(ctx.id);
continue;
}
ctx.isVIP = isVIP; ctx.isVIP = isVIP;
ctx.isFavorite = isFavorite;
if (ctx.state !== 'online') { if (ctx.state !== 'online') {
continue; continue;
} }
if (ctx.isVIP) { if ((this.sidebarAllFavorites && ctx.isFavorite) || ctx.isVIP) {
removeFromArray(this.friendsGroup1_, ctx); removeFromArray(this.friendsGroup1_, ctx);
removeFromArray(this.friendsGroupB_, ctx); removeFromArray(this.friendsGroupB_, ctx);
this.sortFriendsGroup0 = true; this.sortFriendsGroup0 = true;
if (this.friendsGroup0_.includes(ctx)) {
continue;
}
this.friendsGroup0_.push(ctx); this.friendsGroup0_.push(ctx);
this.friendsGroupA_.unshift(ctx); this.friendsGroupA_.unshift(ctx);
} else { } else {
removeFromArray(this.friendsGroup0_, ctx); removeFromArray(this.friendsGroup0_, ctx);
removeFromArray(this.friendsGroupA_, ctx); removeFromArray(this.friendsGroupA_, ctx);
this.sortFriendsGroup1 = true; this.sortFriendsGroup1 = true;
if (this.friendsGroup1_.includes(ctx)) {
continue;
}
this.friendsGroup1_.push(ctx); this.friendsGroup1_.push(ctx);
this.friendsGroupB_.unshift(ctx); this.friendsGroupB_.unshift(ctx);
} }
+5 -2
View File
@@ -214,7 +214,7 @@
"tray": "Close to tray" "tray": "Close to tray"
}, },
"favorites": { "favorites": {
"header": "Favorite Friends", "header": "VRCX Favorite Friends",
"group_placeholder": "Choose Groups" "group_placeholder": "Choose Groups"
}, },
"logging": { "logging": {
@@ -236,7 +236,7 @@
"auto_invite_request_accept_tooltip": "Automatically accept invite requests from favorite friends", "auto_invite_request_accept_tooltip": "Automatically accept invite requests from favorite friends",
"auto_invite_request_accept_off": "Off", "auto_invite_request_accept_off": "Off",
"auto_invite_request_accept_favs": "All Favorites", "auto_invite_request_accept_favs": "All Favorites",
"auto_invite_request_accept_selected_favs": "Selected Favorites" "auto_invite_request_accept_selected_favs": "VRCX Favorites"
}, },
"legal_notice": { "legal_notice": {
"header": "Legal Notice", "header": "Legal Notice",
@@ -282,6 +282,9 @@
}, },
"side_panel": { "side_panel": {
"header": "Side Panel", "header": "Side Panel",
"favorites": "Favorites",
"vrcx": "VRCX",
"all": "All",
"sorting": { "sorting": {
"header": "Sorting", "header": "Sorting",
"sort_private_to_bottom": "Sort Private to bottom", "sort_private_to_bottom": "Sort Private to bottom",
+4
View File
@@ -191,6 +191,10 @@ mixin settingsTab()
div.options-container div.options-container
span.header {{ $t('view.settings.appearance.side_panel.header') }} span.header {{ $t('view.settings.appearance.side_panel.header') }}
br br
div.options-container-item
span.name {{ $t('view.settings.appearance.side_panel.favorites') }}
el-switch(v-model="sidebarAllFavorites" :inactive-text="$t('view.settings.appearance.side_panel.vrcx')" :active-text="$t('view.settings.appearance.side_panel.all')" @change="updateLocalFavoriteFriends")
br
span.sub-header {{ $t('view.settings.appearance.side_panel.sorting.header') }} span.sub-header {{ $t('view.settings.appearance.side_panel.sorting.header') }}
div.options-container-item div.options-container-item
span.name {{ $t('view.settings.appearance.side_panel.sorting.sort_private_to_bottom') }} span.name {{ $t('view.settings.appearance.side_panel.sorting.sort_private_to_bottom') }}