mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 06:56:04 +02:00
Custom favorite friend groups
This commit is contained in:
+90
-24
@@ -3977,6 +3977,7 @@ speechSynthesis.getVoices();
|
|||||||
};
|
};
|
||||||
|
|
||||||
API.$on('LOGIN', function () {
|
API.$on('LOGIN', function () {
|
||||||
|
$app.localFavoriteFriends.clear();
|
||||||
this.cachedFavorites.clear();
|
this.cachedFavorites.clear();
|
||||||
this.cachedFavoritesByObjectId.clear();
|
this.cachedFavoritesByObjectId.clear();
|
||||||
this.cachedFavoriteGroups.clear();
|
this.cachedFavoriteGroups.clear();
|
||||||
@@ -4044,6 +4045,8 @@ speechSynthesis.getVoices();
|
|||||||
}
|
}
|
||||||
// 애초에 $isDeleted인데 여기로 올 수 가 있나..?
|
// 애초에 $isDeleted인데 여기로 올 수 가 있나..?
|
||||||
this.cachedFavoritesByObjectId.delete(args.params.objectId);
|
this.cachedFavoritesByObjectId.delete(args.params.objectId);
|
||||||
|
$app.localFavoriteFriends.delete(args.params.objectId);
|
||||||
|
$app.updateSidebarFriendsList();
|
||||||
if (ref.$isDeleted) {
|
if (ref.$isDeleted) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -4096,6 +4099,8 @@ speechSynthesis.getVoices();
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
this.cachedFavoritesByObjectId.delete(ref.favoriteId);
|
this.cachedFavoritesByObjectId.delete(ref.favoriteId);
|
||||||
|
$app.localFavoriteFriends.delete(ref.favoriteId);
|
||||||
|
$app.updateSidebarFriendsList();
|
||||||
ref.$isDeleted = true;
|
ref.$isDeleted = true;
|
||||||
API.$emit('FAVORITE:@DELETE', {
|
API.$emit('FAVORITE:@DELETE', {
|
||||||
ref,
|
ref,
|
||||||
@@ -4156,6 +4161,14 @@ speechSynthesis.getVoices();
|
|||||||
};
|
};
|
||||||
this.cachedFavorites.set(ref.id, ref);
|
this.cachedFavorites.set(ref.id, ref);
|
||||||
this.cachedFavoritesByObjectId.set(ref.favoriteId, ref);
|
this.cachedFavoritesByObjectId.set(ref.favoriteId, ref);
|
||||||
|
if (
|
||||||
|
ref.type === 'friend' &&
|
||||||
|
($app.localFavoriteFriendsGroups.length === 0 ||
|
||||||
|
$app.localFavoriteFriendsGroups.includes(ref.groupKey))
|
||||||
|
) {
|
||||||
|
$app.localFavoriteFriends.add(ref.favoriteId);
|
||||||
|
$app.updateSidebarFriendsList();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Object.assign(ref, json);
|
Object.assign(ref, json);
|
||||||
ref.$isExpired = false;
|
ref.$isExpired = false;
|
||||||
@@ -4172,6 +4185,7 @@ speechSynthesis.getVoices();
|
|||||||
};
|
};
|
||||||
|
|
||||||
API.expireFavorites = function () {
|
API.expireFavorites = function () {
|
||||||
|
$app.localFavoriteFriends.clear();
|
||||||
this.cachedFavorites.clear();
|
this.cachedFavorites.clear();
|
||||||
this.cachedFavoritesByObjectId.clear();
|
this.cachedFavoritesByObjectId.clear();
|
||||||
$app.favoriteObjects.clear();
|
$app.favoriteObjects.clear();
|
||||||
@@ -5687,7 +5701,7 @@ speechSynthesis.getVoices();
|
|||||||
);
|
);
|
||||||
// OnPlayerJoining/Traveling
|
// OnPlayerJoining/Traveling
|
||||||
API.currentTravelers.forEach((ref) => {
|
API.currentTravelers.forEach((ref) => {
|
||||||
var isFavorite = API.cachedFavoritesByObjectId.has(ref.id);
|
var isFavorite = this.localFavoriteFriends.has(ref.id);
|
||||||
if (
|
if (
|
||||||
(this.sharedFeedFilters.wrist.OnPlayerJoining === 'Friends' ||
|
(this.sharedFeedFilters.wrist.OnPlayerJoining === 'Friends' ||
|
||||||
(this.sharedFeedFilters.wrist.OnPlayerJoining === 'VIP' &&
|
(this.sharedFeedFilters.wrist.OnPlayerJoining === 'VIP' &&
|
||||||
@@ -5864,12 +5878,12 @@ speechSynthesis.getVoices();
|
|||||||
var isFavorite = false;
|
var isFavorite = false;
|
||||||
if (ctx.userId) {
|
if (ctx.userId) {
|
||||||
isFriend = this.friends.has(ctx.userId);
|
isFriend = this.friends.has(ctx.userId);
|
||||||
isFavorite = API.cachedFavoritesByObjectId.has(ctx.userId);
|
isFavorite = this.localFavoriteFriends.has(ctx.userId);
|
||||||
} else if (ctx.displayName) {
|
} else if (ctx.displayName) {
|
||||||
for (var ref of API.cachedUsers.values()) {
|
for (var ref of API.cachedUsers.values()) {
|
||||||
if (ref.displayName === ctx.displayName) {
|
if (ref.displayName === ctx.displayName) {
|
||||||
isFriend = this.friends.has(ref.id);
|
isFriend = this.friends.has(ref.id);
|
||||||
isFavorite = API.cachedFavoritesByObjectId.has(ref.id);
|
isFavorite = this.localFavoriteFriends.has(ref.id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5987,12 +6001,12 @@ speechSynthesis.getVoices();
|
|||||||
noty.isFavorite = false;
|
noty.isFavorite = false;
|
||||||
if (noty.userId) {
|
if (noty.userId) {
|
||||||
noty.isFriend = this.friends.has(noty.userId);
|
noty.isFriend = this.friends.has(noty.userId);
|
||||||
noty.isFavorite = API.cachedFavoritesByObjectId.has(noty.userId);
|
noty.isFavorite = this.localFavoriteFriends.has(noty.userId);
|
||||||
} else if (noty.displayName) {
|
} else if (noty.displayName) {
|
||||||
for (var ref of API.cachedUsers.values()) {
|
for (var ref of API.cachedUsers.values()) {
|
||||||
if (ref.displayName === noty.displayName) {
|
if (ref.displayName === noty.displayName) {
|
||||||
noty.isFriend = this.friends.has(ref.id);
|
noty.isFriend = this.friends.has(ref.id);
|
||||||
noty.isFavorite = API.cachedFavoritesByObjectId.has(ref.id);
|
noty.isFavorite = this.localFavoriteFriends.has(ref.id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6046,7 +6060,7 @@ speechSynthesis.getVoices();
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var isFriend = this.friends.has(ctx.userId);
|
var isFriend = this.friends.has(ctx.userId);
|
||||||
var isFavorite = API.cachedFavoritesByObjectId.has(ctx.userId);
|
var isFavorite = this.localFavoriteFriends.has(ctx.userId);
|
||||||
if (
|
if (
|
||||||
w < 20 &&
|
w < 20 &&
|
||||||
wristFilter[ctx.type] &&
|
wristFilter[ctx.type] &&
|
||||||
@@ -6078,7 +6092,7 @@ speechSynthesis.getVoices();
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
noty.isFriend = this.friends.has(noty.userId);
|
noty.isFriend = this.friends.has(noty.userId);
|
||||||
noty.isFavorite = API.cachedFavoritesByObjectId.has(noty.userId);
|
noty.isFavorite = this.localFavoriteFriends.has(noty.userId);
|
||||||
var notyFilter = this.sharedFeedFilters.noty;
|
var notyFilter = this.sharedFeedFilters.noty;
|
||||||
if (
|
if (
|
||||||
notyFilter[noty.type] &&
|
notyFilter[noty.type] &&
|
||||||
@@ -6120,9 +6134,7 @@ speechSynthesis.getVoices();
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var isFriend = this.friends.has(ctx.senderUserId);
|
var isFriend = this.friends.has(ctx.senderUserId);
|
||||||
var isFavorite = API.cachedFavoritesByObjectId.has(
|
var isFavorite = this.localFavoriteFriends.has(ctx.senderUserId);
|
||||||
ctx.senderUserId
|
|
||||||
);
|
|
||||||
if (
|
if (
|
||||||
w < 20 &&
|
w < 20 &&
|
||||||
wristFilter[ctx.type] &&
|
wristFilter[ctx.type] &&
|
||||||
@@ -6144,7 +6156,7 @@ speechSynthesis.getVoices();
|
|||||||
|
|
||||||
$app.methods.queueNotificationNoty = function (noty) {
|
$app.methods.queueNotificationNoty = function (noty) {
|
||||||
noty.isFriend = this.friends.has(noty.senderUserId);
|
noty.isFriend = this.friends.has(noty.senderUserId);
|
||||||
noty.isFavorite = API.cachedFavoritesByObjectId.has(noty.senderUserId);
|
noty.isFavorite = this.localFavoriteFriends.has(noty.senderUserId);
|
||||||
var notyFilter = this.sharedFeedFilters.noty;
|
var notyFilter = this.sharedFeedFilters.noty;
|
||||||
if (
|
if (
|
||||||
notyFilter[noty.type] &&
|
notyFilter[noty.type] &&
|
||||||
@@ -6186,7 +6198,7 @@ speechSynthesis.getVoices();
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var isFriend = this.friends.has(ctx.userId);
|
var isFriend = this.friends.has(ctx.userId);
|
||||||
var isFavorite = API.cachedFavoritesByObjectId.has(ctx.userId);
|
var isFavorite = this.localFavoriteFriends.has(ctx.userId);
|
||||||
if (
|
if (
|
||||||
w < 20 &&
|
w < 20 &&
|
||||||
wristFilter[ctx.type] &&
|
wristFilter[ctx.type] &&
|
||||||
@@ -6211,7 +6223,7 @@ speechSynthesis.getVoices();
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
noty.isFriend = this.friends.has(noty.userId);
|
noty.isFriend = this.friends.has(noty.userId);
|
||||||
noty.isFavorite = API.cachedFavoritesByObjectId.has(noty.userId);
|
noty.isFavorite = this.localFavoriteFriends.has(noty.userId);
|
||||||
var notyFilter = this.sharedFeedFilters.noty;
|
var notyFilter = this.sharedFeedFilters.noty;
|
||||||
if (
|
if (
|
||||||
notyFilter[noty.type] &&
|
notyFilter[noty.type] &&
|
||||||
@@ -6252,7 +6264,7 @@ speechSynthesis.getVoices();
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
var isFriend = this.friends.has(ctx.userId);
|
var isFriend = this.friends.has(ctx.userId);
|
||||||
var isFavorite = API.cachedFavoritesByObjectId.has(ctx.userId);
|
var isFavorite = this.localFavoriteFriends.has(ctx.userId);
|
||||||
// add tag colour
|
// add tag colour
|
||||||
var tagColour = '';
|
var tagColour = '';
|
||||||
var tagRef = this.customUserTags.get(ctx.userId);
|
var tagRef = this.customUserTags.get(ctx.userId);
|
||||||
@@ -6282,7 +6294,7 @@ speechSynthesis.getVoices();
|
|||||||
noty.isFavorite = false;
|
noty.isFavorite = false;
|
||||||
if (noty.userId) {
|
if (noty.userId) {
|
||||||
noty.isFriend = this.friends.has(noty.userId);
|
noty.isFriend = this.friends.has(noty.userId);
|
||||||
noty.isFavorite = API.cachedFavoritesByObjectId.has(noty.userId);
|
noty.isFavorite = this.localFavoriteFriends.has(noty.userId);
|
||||||
}
|
}
|
||||||
var notyFilter = this.sharedFeedFilters.noty;
|
var notyFilter = this.sharedFeedFilters.noty;
|
||||||
if (notyFilter[noty.type] && notyFilter[noty.type] === 'On') {
|
if (notyFilter[noty.type] && notyFilter[noty.type] === 'On') {
|
||||||
@@ -8758,7 +8770,7 @@ speechSynthesis.getVoices();
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var ref = API.cachedUsers.get(id);
|
var ref = API.cachedUsers.get(id);
|
||||||
var isVIP = API.cachedFavoritesByObjectId.has(id);
|
var isVIP = this.localFavoriteFriends.has(id);
|
||||||
var ctx = {
|
var ctx = {
|
||||||
id,
|
id,
|
||||||
state: state || 'offline',
|
state: state || 'offline',
|
||||||
@@ -8889,7 +8901,7 @@ speechSynthesis.getVoices();
|
|||||||
ctx.pendingOffline = false;
|
ctx.pendingOffline = false;
|
||||||
}
|
}
|
||||||
var ref = API.cachedUsers.get(id);
|
var ref = API.cachedUsers.get(id);
|
||||||
var isVIP = API.cachedFavoritesByObjectId.has(id);
|
var isVIP = this.localFavoriteFriends.has(id);
|
||||||
var location = '';
|
var location = '';
|
||||||
var $location_at = '';
|
var $location_at = '';
|
||||||
if (typeof ref !== 'undefined') {
|
if (typeof ref !== 'undefined') {
|
||||||
@@ -10116,10 +10128,7 @@ speechSynthesis.getVoices();
|
|||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (
|
if (this.feedTable.vip && !this.localFavoriteFriends.has(feed.userId)) {
|
||||||
this.feedTable.vip &&
|
|
||||||
!API.cachedFavoritesByObjectId.has(feed.userId)
|
|
||||||
) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!this.feedSearch(feed)) {
|
if (!this.feedSearch(feed)) {
|
||||||
@@ -11344,7 +11353,7 @@ speechSynthesis.getVoices();
|
|||||||
userId = photonUserRef.id;
|
userId = photonUserRef.id;
|
||||||
isFriend = photonUserRef.isFriend;
|
isFriend = photonUserRef.isFriend;
|
||||||
}
|
}
|
||||||
var isFavorite = API.cachedFavoritesByObjectId.has(userId);
|
var isFavorite = this.localFavoriteFriends.has(userId);
|
||||||
var colour = '';
|
var colour = '';
|
||||||
var tagRef = this.customUserTags.get(userId);
|
var tagRef = this.customUserTags.get(userId);
|
||||||
if (typeof tagRef !== 'undefined') {
|
if (typeof tagRef !== 'undefined') {
|
||||||
@@ -27399,6 +27408,63 @@ speechSynthesis.getVoices();
|
|||||||
this.worldFavoriteSearchResults = results;
|
this.worldFavoriteSearchResults = results;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// #endregion
|
||||||
|
// #region | Local Favorite Friends
|
||||||
|
|
||||||
|
$app.data.localFavoriteFriends = new Set();
|
||||||
|
$app.data.localFavoriteFriendsGroups = JSON.parse(
|
||||||
|
await configRepository.getString(
|
||||||
|
'VRCX_localFavoriteFriendsGroups',
|
||||||
|
'[]'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$app.methods.updateLocalFavoriteFriends = function () {
|
||||||
|
this.localFavoriteFriends.clear();
|
||||||
|
for (var ref of API.cachedFavorites.values()) {
|
||||||
|
if (
|
||||||
|
ref.$isDeleted === false &&
|
||||||
|
ref.type === 'friend' &&
|
||||||
|
(this.localFavoriteFriendsGroups.length === 0 ||
|
||||||
|
this.localFavoriteFriendsGroups.includes(ref.$groupKey))
|
||||||
|
) {
|
||||||
|
this.localFavoriteFriends.add(ref.favoriteId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.updateSidebarFriendsList();
|
||||||
|
|
||||||
|
configRepository.setString(
|
||||||
|
'VRCX_localFavoriteFriendsGroups',
|
||||||
|
JSON.stringify(this.localFavoriteFriendsGroups)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
$app.methods.updateSidebarFriendsList = function () {
|
||||||
|
for (var ctx of this.friends.values()) {
|
||||||
|
var isVIP = this.localFavoriteFriends.has(ctx.id);
|
||||||
|
if (ctx.isVIP === isVIP) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ctx.isVIP = isVIP;
|
||||||
|
if (ctx.state !== 'online') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (ctx.isVIP) {
|
||||||
|
removeFromArray(this.friendsGroup1_, ctx);
|
||||||
|
removeFromArray(this.friendsGroupB_, ctx);
|
||||||
|
this.sortFriendsGroup0 = true;
|
||||||
|
this.friendsGroup0_.push(ctx);
|
||||||
|
this.friendsGroupA_.unshift(ctx);
|
||||||
|
} else {
|
||||||
|
removeFromArray(this.friendsGroup0_, ctx);
|
||||||
|
removeFromArray(this.friendsGroupA_, ctx);
|
||||||
|
this.sortFriendsGroup1 = true;
|
||||||
|
this.friendsGroup1_.push(ctx);
|
||||||
|
this.friendsGroupB_.unshift(ctx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// #endregion
|
// #endregion
|
||||||
// #region | App: pending offline timer
|
// #region | App: pending offline timer
|
||||||
|
|
||||||
@@ -29641,10 +29707,10 @@ speechSynthesis.getVoices();
|
|||||||
if (typeof row.isFavorite !== 'undefined') {
|
if (typeof row.isFavorite !== 'undefined') {
|
||||||
return row.isFavorite;
|
return row.isFavorite;
|
||||||
}
|
}
|
||||||
if (!row.userId || API.cachedFavoritesByObjectId.size === 0) {
|
if (!row.userId) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
row.isFavorite = API.cachedFavoritesByObjectId.has(row.userId);
|
row.isFavorite = this.localFavoriteFriends.has(row.userId);
|
||||||
return row.isFavorite;
|
return row.isFavorite;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -213,9 +213,13 @@
|
|||||||
"minimized": "Start as minimized state",
|
"minimized": "Start as minimized state",
|
||||||
"tray": "Close to tray"
|
"tray": "Close to tray"
|
||||||
},
|
},
|
||||||
|
"favorites": {
|
||||||
|
"header": "Favorite Friends",
|
||||||
|
"group_placeholder": "Choose Groups"
|
||||||
|
},
|
||||||
"game_log": {
|
"game_log": {
|
||||||
"header": "Game Log",
|
"header": "Game Log",
|
||||||
"resource_load": "Log Udon resource load"
|
"resource_load": "Log Udon string/image load"
|
||||||
},
|
},
|
||||||
"automation": {
|
"automation": {
|
||||||
"header": "Automation",
|
"header": "Automation",
|
||||||
|
|||||||
@@ -84,6 +84,14 @@ mixin settingsTab()
|
|||||||
+simpleSwitch("view.settings.general.application.startup", "isStartAtWindowsStartup", "saveVRCXWindowOption")
|
+simpleSwitch("view.settings.general.application.startup", "isStartAtWindowsStartup", "saveVRCXWindowOption")
|
||||||
+simpleSwitch("view.settings.general.application.minimized", "isStartAsMinimizedState", "saveVRCXWindowOption")
|
+simpleSwitch("view.settings.general.application.minimized", "isStartAsMinimizedState", "saveVRCXWindowOption")
|
||||||
+simpleSwitch("view.settings.general.application.tray", "isCloseToTray", "saveVRCXWindowOption")
|
+simpleSwitch("view.settings.general.application.tray", "isCloseToTray", "saveVRCXWindowOption")
|
||||||
|
//- General | Favorite
|
||||||
|
+simpleSettingsCategory("view.settings.general.favorites.header")
|
||||||
|
br
|
||||||
|
el-select(v-model="localFavoriteFriendsGroups" multiple clearable :placeholder="$t('view.settings.general.favorites.group_placeholder')" @change="updateLocalFavoriteFriends")
|
||||||
|
el-option-group(:label="$t('view.settings.general.favorites.group_placeholder')")
|
||||||
|
el-option.x-friend-item(v-for="group in API.favoriteFriendGroups" :key="group.key" :label="group.displayName ? group.displayName : group.name" :value="group.key")
|
||||||
|
.detail
|
||||||
|
span.name(v-text="group.displayName ? group.displayName : group.name")
|
||||||
//- General | Game Log
|
//- General | Game Log
|
||||||
+simpleSettingsCategory("view.settings.general.game_log.header")
|
+simpleSettingsCategory("view.settings.general.game_log.header")
|
||||||
+simpleSwitch("view.settings.general.game_log.resource_load", "logResourceLoad", "saveGameLogOptions")
|
+simpleSwitch("view.settings.general.game_log.resource_load", "logResourceLoad", "saveGameLogOptions")
|
||||||
|
|||||||
Reference in New Issue
Block a user