mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 06:56:04 +02:00
Fix favorite sorting when adding new favorites
This commit is contained in:
+31
-7
@@ -2973,7 +2973,8 @@ speechSynthesis.getVoices();
|
|||||||
json,
|
json,
|
||||||
params: {
|
params: {
|
||||||
favoriteId: json.id
|
favoriteId: json.id
|
||||||
}
|
},
|
||||||
|
sortTop: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -2983,7 +2984,8 @@ speechSynthesis.getVoices();
|
|||||||
json: args.json,
|
json: args.json,
|
||||||
params: {
|
params: {
|
||||||
favoriteId: args.json.id
|
favoriteId: args.json.id
|
||||||
}
|
},
|
||||||
|
sortTop: true
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -3131,9 +3133,15 @@ speechSynthesis.getVoices();
|
|||||||
};
|
};
|
||||||
|
|
||||||
API.expireFavorites = function () {
|
API.expireFavorites = function () {
|
||||||
for (var ref of this.cachedFavorites.values()) {
|
this.cachedFavorites.clear();
|
||||||
ref.$isExpired = true;
|
this.cachedFavoritesByObjectId.clear();
|
||||||
}
|
$app.favoriteObjects.clear();
|
||||||
|
$app.favoriteFriends_ = [];
|
||||||
|
$app.favoriteFriendsSorted = [];
|
||||||
|
$app.favoriteWorlds_ = [];
|
||||||
|
$app.favoriteWorldsSorted = [];
|
||||||
|
$app.favoriteAvatars_ = [];
|
||||||
|
$app.favoriteAvatarsSorted = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
API.deleteExpiredFavorites = function () {
|
API.deleteExpiredFavorites = function () {
|
||||||
@@ -10296,7 +10304,7 @@ speechSynthesis.getVoices();
|
|||||||
});
|
});
|
||||||
|
|
||||||
API.$on('FAVORITE', function (args) {
|
API.$on('FAVORITE', function (args) {
|
||||||
$app.applyFavorite(args.ref.type, args.ref.favoriteId);
|
$app.applyFavorite(args.ref.type, args.ref.favoriteId, args.sortTop);
|
||||||
});
|
});
|
||||||
|
|
||||||
API.$on('FAVORITE:@DELETE', function (args) {
|
API.$on('FAVORITE:@DELETE', function (args) {
|
||||||
@@ -10315,7 +10323,7 @@ speechSynthesis.getVoices();
|
|||||||
$app.applyFavorite('avatar', args.ref.id);
|
$app.applyFavorite('avatar', args.ref.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
$app.methods.applyFavorite = function (type, objectId) {
|
$app.methods.applyFavorite = function (type, objectId, sortTop) {
|
||||||
var favorite = API.cachedFavoritesByObjectId.get(objectId);
|
var favorite = API.cachedFavoritesByObjectId.get(objectId);
|
||||||
var ctx = this.favoriteObjects.get(objectId);
|
var ctx = this.favoriteObjects.get(objectId);
|
||||||
if (typeof favorite !== 'undefined') {
|
if (typeof favorite !== 'undefined') {
|
||||||
@@ -10405,6 +10413,21 @@ speechSynthesis.getVoices();
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isTypeChanged) {
|
if (isTypeChanged) {
|
||||||
|
if (sortTop) {
|
||||||
|
if (type === 'friend') {
|
||||||
|
this.favoriteFriends_.unshift(ctx);
|
||||||
|
this.favoriteFriendsSorted.push(ctx);
|
||||||
|
this.sortFavoriteFriends = true;
|
||||||
|
} else if (type === 'world') {
|
||||||
|
this.favoriteWorlds_.unshift(ctx);
|
||||||
|
this.favoriteWorldsSorted.push(ctx);
|
||||||
|
this.sortFavoriteWorlds = true;
|
||||||
|
} else if (type === 'avatar') {
|
||||||
|
this.favoriteAvatars_.unshift(ctx);
|
||||||
|
this.favoriteAvatarsSorted.push(ctx);
|
||||||
|
this.sortFavoriteAvatars = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (type === 'friend') {
|
if (type === 'friend') {
|
||||||
this.favoriteFriends_.push(ctx);
|
this.favoriteFriends_.push(ctx);
|
||||||
this.favoriteFriendsSorted.push(ctx);
|
this.favoriteFriendsSorted.push(ctx);
|
||||||
@@ -10419,6 +10442,7 @@ speechSynthesis.getVoices();
|
|||||||
this.sortFavoriteAvatars = true;
|
this.sortFavoriteAvatars = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (typeof ctx !== 'undefined') {
|
} else if (typeof ctx !== 'undefined') {
|
||||||
this.favoriteObjects.delete(objectId);
|
this.favoriteObjects.delete(objectId);
|
||||||
if (type === 'friend') {
|
if (type === 'friend') {
|
||||||
|
|||||||
Reference in New Issue
Block a user