mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-12 03:13:50 +02:00
Dynamic favorite group sizes
This commit is contained in:
@@ -3203,6 +3203,18 @@ speechSynthesis.getVoices();
|
||||
API.favoriteAvatarGroups = [];
|
||||
API.isFavoriteLoading = false;
|
||||
API.isFavoriteGroupLoading = false;
|
||||
API.favoriteLimits = {
|
||||
maxFavoriteGroups: {
|
||||
avatar: 6,
|
||||
friend: 3,
|
||||
world: 4
|
||||
},
|
||||
maxFavoritesPerGroup: {
|
||||
avatar: 50,
|
||||
friend: 150,
|
||||
world: 100
|
||||
}
|
||||
};
|
||||
|
||||
API.$on('LOGIN', function () {
|
||||
this.cachedFavorites.clear();
|
||||
@@ -3484,11 +3496,12 @@ speechSynthesis.getVoices();
|
||||
}
|
||||
};
|
||||
|
||||
API.refreshFavorites = function () {
|
||||
API.refreshFavorites = async function () {
|
||||
if (this.isFavoriteLoading) {
|
||||
return;
|
||||
}
|
||||
this.isFavoriteLoading = true;
|
||||
await this.getFavoriteLimits();
|
||||
this.expireFavorites();
|
||||
this.bulk({
|
||||
fn: 'getFavorites',
|
||||
@@ -3538,28 +3551,28 @@ speechSynthesis.getVoices();
|
||||
API.buildFavoriteGroups = function () {
|
||||
// 450 = ['group_0', 'group_1', 'group_2'] x 150
|
||||
this.favoriteFriendGroups = [];
|
||||
for (var i = 0; i < 3; ++i) {
|
||||
for (var i = 0; i < this.favoriteLimits.maxFavoriteGroups.friend; ++i) {
|
||||
this.favoriteFriendGroups.push({
|
||||
assign: false,
|
||||
key: `friend:group_${i}`,
|
||||
type: 'friend',
|
||||
name: `group_${i}`,
|
||||
displayName: `Group ${i + 1}`,
|
||||
capacity: 150,
|
||||
capacity: this.favoriteLimits.maxFavoritesPerGroup.friend,
|
||||
count: 0,
|
||||
visibility: 'private'
|
||||
});
|
||||
}
|
||||
// 400 = ['worlds1', 'worlds2', 'worlds3', 'worlds4'] x 100
|
||||
this.favoriteWorldGroups = [];
|
||||
for (var i = 0; i < 4; ++i) {
|
||||
for (var i = 0; i < this.favoriteLimits.maxFavoriteGroups.world; ++i) {
|
||||
this.favoriteWorldGroups.push({
|
||||
assign: false,
|
||||
key: `world:worlds${i + 1}`,
|
||||
type: 'world',
|
||||
name: `worlds${i + 1}`,
|
||||
displayName: `Group ${i + 1}`,
|
||||
capacity: 100,
|
||||
capacity: this.favoriteLimits.maxFavoritesPerGroup.world,
|
||||
count: 0,
|
||||
visibility: 'private'
|
||||
});
|
||||
@@ -3568,14 +3581,14 @@ speechSynthesis.getVoices();
|
||||
// Favorite Avatars (0/50)
|
||||
// VRC+ Group 1..5 (0/50)
|
||||
this.favoriteAvatarGroups = [];
|
||||
for (var i = 0; i < 6; ++i) {
|
||||
for (var i = 0; i < this.favoriteLimits.maxFavoriteGroups.avatar; ++i) {
|
||||
this.favoriteAvatarGroups.push({
|
||||
assign: false,
|
||||
key: `avatar:avatars${i + 1}`,
|
||||
type: 'avatar',
|
||||
name: `avatars${i + 1}`,
|
||||
displayName: `Group ${i + 1}`,
|
||||
capacity: 50,
|
||||
capacity: this.favoriteLimits.maxFavoritesPerGroup.avatar,
|
||||
count: 0,
|
||||
visibility: 'private'
|
||||
});
|
||||
@@ -3674,6 +3687,25 @@ speechSynthesis.getVoices();
|
||||
}
|
||||
};
|
||||
|
||||
API.getFavoriteLimits = function () {
|
||||
return this.call('auth/user/favoritelimits', {
|
||||
method: 'GET'
|
||||
}).then((json) => {
|
||||
var args = {
|
||||
json
|
||||
};
|
||||
this.$emit('FAVORITE:LIMITS', args);
|
||||
return args;
|
||||
});
|
||||
};
|
||||
|
||||
API.$on('FAVORITE:LIMITS', function (args) {
|
||||
this.favoriteLimits = {
|
||||
...this.favoriteLimits,
|
||||
...args.json
|
||||
};
|
||||
});
|
||||
|
||||
API.refreshFavoriteGroups = function () {
|
||||
if (this.isFavoriteGroupLoading) {
|
||||
return;
|
||||
|
||||
@@ -1768,7 +1768,7 @@ html
|
||||
span(slot="label")
|
||||
span(v-text="list[0]" style="font-weight:bold;font-size:16px")
|
||||
i.x-user-status(style="margin-left:5px" :class="userFavoriteWorldsStatus(list[1])")
|
||||
span(style="color:#909399;font-size:12px;margin-left:5px") {{ list[2].length }}/100
|
||||
span(style="color:#909399;font-size:12px;margin-left:5px") {{ list[2].length }}/{{ API.favoriteLimits.maxFavoritesPerGroup.world }}
|
||||
.x-friend-list(style="margin-top:10px;margin-bottom:15px;min-height:60px")
|
||||
.x-friend-item(v-for="world in list[2]" :key="world.id" @click="showWorldDialog(world.id)" class="x-friend-item-border")
|
||||
.avatar
|
||||
|
||||
Reference in New Issue
Block a user