bugfixes and cleanup code

This commit is contained in:
pypy
2020-01-12 08:29:23 +09:00
parent 794c8e0b93
commit f72adb9d90
+56 -129
View File
@@ -477,7 +477,6 @@ if (window.CefSharp) {
method: 'GET' method: 'GET'
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json json
}; };
this.$emit('CONFIG', args); this.$emit('CONFIG', args);
@@ -705,7 +704,6 @@ if (window.CefSharp) {
if (Array.isArray(args.json)) { if (Array.isArray(args.json)) {
for (var json of args.json) { for (var json of args.json) {
this.$emit('USER', { this.$emit('USER', {
ref: null,
json, json,
params: { params: {
userId: json.id userId: json.id
@@ -737,7 +735,6 @@ if (window.CefSharp) {
} }
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params, params,
origin: true origin: true
@@ -762,7 +759,6 @@ if (window.CefSharp) {
params params
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params, params,
origin: true origin: true
@@ -787,7 +783,6 @@ if (window.CefSharp) {
params params
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -807,7 +802,6 @@ if (window.CefSharp) {
params params
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -821,7 +815,6 @@ if (window.CefSharp) {
method: 'GET' method: 'GET'
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
origin: true origin: true
}; };
@@ -893,7 +886,6 @@ if (window.CefSharp) {
method: 'GET' method: 'GET'
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -1083,7 +1075,6 @@ if (window.CefSharp) {
params params
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -1104,7 +1095,6 @@ if (window.CefSharp) {
params params
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -1125,7 +1115,6 @@ if (window.CefSharp) {
if (Array.isArray(args.json)) { if (Array.isArray(args.json)) {
for (var json of args.json) { for (var json of args.json) {
this.$emit('WORLD', { this.$emit('WORLD', {
ref: null,
json, json,
params: { params: {
worldId: json.id worldId: json.id
@@ -1145,7 +1134,6 @@ if (window.CefSharp) {
method: 'GET' method: 'GET'
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -1247,7 +1235,6 @@ if (window.CefSharp) {
params params
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -1272,7 +1259,6 @@ if (window.CefSharp) {
if (Array.isArray(args.json)) { if (Array.isArray(args.json)) {
for (var json of args.json) { for (var json of args.json) {
this.$emit('USER', { this.$emit('USER', {
ref: null,
json, json,
params: { params: {
userId: json.id userId: json.id
@@ -1363,7 +1349,6 @@ if (window.CefSharp) {
params params
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -1382,7 +1367,6 @@ if (window.CefSharp) {
method: 'POST' method: 'POST'
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -1401,7 +1385,6 @@ if (window.CefSharp) {
method: 'DELETE' method: 'DELETE'
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -1420,7 +1403,6 @@ if (window.CefSharp) {
method: 'DELETE' method: 'DELETE'
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -1439,7 +1421,6 @@ if (window.CefSharp) {
method: 'GET' method: 'GET'
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -1460,7 +1441,6 @@ if (window.CefSharp) {
if (Array.isArray(args.json)) { if (Array.isArray(args.json)) {
for (var json of args.json) { for (var json of args.json) {
this.$emit('AVATAR', { this.$emit('AVATAR', {
ref: null,
json, json,
params: { params: {
avatarId: json.id avatarId: json.id
@@ -1484,7 +1464,6 @@ if (window.CefSharp) {
method: 'GET' method: 'GET'
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -1562,7 +1541,6 @@ if (window.CefSharp) {
params params
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -1582,7 +1560,6 @@ if (window.CefSharp) {
params params
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -1609,7 +1586,6 @@ if (window.CefSharp) {
if (Array.isArray(args.json)) { if (Array.isArray(args.json)) {
for (var json of args.json) { for (var json of args.json) {
this.$emit('NOTIFICATION', { this.$emit('NOTIFICATION', {
ref: null,
json, json,
params: { params: {
notificationId: json.id notificationId: json.id
@@ -1634,7 +1610,6 @@ if (window.CefSharp) {
} }
}); });
this.$emit('FRIEND:ADD', { this.$emit('FRIEND:ADD', {
ref: null,
params: { params: {
userId: ref.senderUserId userId: ref.senderUserId
} }
@@ -1756,7 +1731,6 @@ if (window.CefSharp) {
params params
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -1770,7 +1744,6 @@ if (window.CefSharp) {
method: 'PUT' method: 'PUT'
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json json
}; };
// FIXME: NOTIFICATION:CLEAR 핸들링 // FIXME: NOTIFICATION:CLEAR 핸들링
@@ -1794,7 +1767,6 @@ if (window.CefSharp) {
params params
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -1813,7 +1785,6 @@ if (window.CefSharp) {
method: 'PUT' method: 'PUT'
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -1832,7 +1803,6 @@ if (window.CefSharp) {
method: 'PUT' method: 'PUT'
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -1870,7 +1840,6 @@ if (window.CefSharp) {
if (Array.isArray(args.json)) { if (Array.isArray(args.json)) {
for (var json of args.json) { for (var json of args.json) {
this.$emit('PLAYER-MODERATION', { this.$emit('PLAYER-MODERATION', {
ref: null,
json, json,
params: { params: {
playerModerationId: json.id playerModerationId: json.id
@@ -1882,7 +1851,6 @@ if (window.CefSharp) {
API.$on('PLAYER-MODERATION:SEND', function (args) { API.$on('PLAYER-MODERATION:SEND', function (args) {
this.$emit('PLAYER-MODERATION', { this.$emit('PLAYER-MODERATION', {
ref: null,
json: args.json, json: args.json,
params: { params: {
playerModerationId: args.json.id playerModerationId: args.json.id
@@ -1977,7 +1945,6 @@ if (window.CefSharp) {
method: 'GET' method: 'GET'
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json json
}; };
this.$emit('PLAYER-MODERATION:LIST', args); this.$emit('PLAYER-MODERATION:LIST', args);
@@ -1990,7 +1957,6 @@ if (window.CefSharp) {
method: 'GET' method: 'GET'
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json json
}; };
this.$emit('PLAYER-MODERATION:LIST', args); this.$emit('PLAYER-MODERATION:LIST', args);
@@ -2011,7 +1977,6 @@ if (window.CefSharp) {
params params
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -2033,7 +1998,6 @@ if (window.CefSharp) {
params params
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -2085,7 +2049,6 @@ if (window.CefSharp) {
if (Array.isArray(args.json)) { if (Array.isArray(args.json)) {
for (var json of args.json) { for (var json of args.json) {
this.$emit('FAVORITE', { this.$emit('FAVORITE', {
ref: null,
json, json,
params: { params: {
favoriteId: json.id favoriteId: json.id
@@ -2097,7 +2060,6 @@ if (window.CefSharp) {
API.$on('FAVORITE:ADD', function (args) { API.$on('FAVORITE:ADD', function (args) {
this.$emit('FAVORITE', { this.$emit('FAVORITE', {
ref: null,
json: args.json, json: args.json,
params: { params: {
favoriteId: args.json.id favoriteId: args.json.id
@@ -2135,7 +2097,6 @@ if (window.CefSharp) {
if (Array.isArray(args.json)) { if (Array.isArray(args.json)) {
for (var json of args.json) { for (var json of args.json) {
this.$emit('FAVORITE:GROUP', { this.$emit('FAVORITE:GROUP', {
ref: null,
json, json,
params: { params: {
favoriteGroupId: json.id favoriteGroupId: json.id
@@ -2147,7 +2108,6 @@ if (window.CefSharp) {
API.$on('FAVORITE:GROUP:SAVE', function (args) { API.$on('FAVORITE:GROUP:SAVE', function (args) {
this.$emit('FAVORITE:GROUP', { this.$emit('FAVORITE:GROUP', {
ref: null,
json: args.json, json: args.json,
params: { params: {
favoriteGroupId: args.json.id favoriteGroupId: args.json.id
@@ -2176,7 +2136,6 @@ if (window.CefSharp) {
if (Array.isArray(args.json)) { if (Array.isArray(args.json)) {
for (var json of args.json) { for (var json of args.json) {
this.$emit('USER', { this.$emit('USER', {
ref: null,
json, json,
params: { params: {
userId: json.id userId: json.id
@@ -2196,7 +2155,6 @@ if (window.CefSharp) {
continue; continue;
} }
this.$emit('WORLD', { this.$emit('WORLD', {
ref: null,
json, json,
params: { params: {
worldId: json.id worldId: json.id
@@ -2214,7 +2172,6 @@ if (window.CefSharp) {
continue; continue;
} }
this.$emit('AVATAR', { this.$emit('AVATAR', {
ref: null,
json, json,
params: { params: {
avatarId: json.id avatarId: json.id
@@ -2540,7 +2497,6 @@ if (window.CefSharp) {
params params
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -2562,7 +2518,6 @@ if (window.CefSharp) {
params params
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -2581,7 +2536,6 @@ if (window.CefSharp) {
method: 'DELETE' method: 'DELETE'
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -2630,7 +2584,6 @@ if (window.CefSharp) {
params params
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -2653,7 +2606,6 @@ if (window.CefSharp) {
params params
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -2674,7 +2626,6 @@ if (window.CefSharp) {
params params
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -2695,7 +2646,6 @@ if (window.CefSharp) {
params params
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -2716,7 +2666,6 @@ if (window.CefSharp) {
params params
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -2737,7 +2686,6 @@ if (window.CefSharp) {
params params
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json, json,
params params
}; };
@@ -2771,7 +2719,6 @@ if (window.CefSharp) {
switch (type) { switch (type) {
case 'notification': case 'notification':
this.$emit('NOTIFICATION', { this.$emit('NOTIFICATION', {
ref: null,
json: content, json: content,
params: { params: {
notificationId: content.id notificationId: content.id
@@ -2781,14 +2728,12 @@ if (window.CefSharp) {
case 'friend-add': case 'friend-add':
this.$emit('USER', { this.$emit('USER', {
ref: null,
json: content.user, json: content.user,
params: { params: {
userId: content.userId userId: content.userId
} }
}); });
this.$emit('FRIEND:ADD', { this.$emit('FRIEND:ADD', {
ref: null,
params: { params: {
userId: content.userId userId: content.userId
} }
@@ -2797,7 +2742,6 @@ if (window.CefSharp) {
case 'friend-delete': case 'friend-delete':
this.$emit('FRIEND:DELETE', { this.$emit('FRIEND:DELETE', {
ref: null,
params: { params: {
userId: content.userId userId: content.userId
} }
@@ -2806,7 +2750,6 @@ if (window.CefSharp) {
case 'friend-online': case 'friend-online':
this.$emit('USER', { this.$emit('USER', {
ref: null,
json: { json: {
location: content.location, location: content.location,
...content.user ...content.user
@@ -2816,7 +2759,6 @@ if (window.CefSharp) {
} }
}); });
this.$emit('FRIEND:STATE', { this.$emit('FRIEND:STATE', {
ref: null,
json: { json: {
state: 'online' state: 'online'
}, },
@@ -2828,14 +2770,12 @@ if (window.CefSharp) {
case 'friend-active': case 'friend-active':
this.$emit('USER', { this.$emit('USER', {
ref: null,
json: content.user, json: content.user,
params: { params: {
userId: content.userId userId: content.userId
} }
}); });
this.$emit('FRIEND:STATE', { this.$emit('FRIEND:STATE', {
ref: null,
json: { json: {
state: 'active' state: 'active'
}, },
@@ -2847,7 +2787,6 @@ if (window.CefSharp) {
case 'friend-offline': case 'friend-offline':
this.$emit('FRIEND:STATE', { this.$emit('FRIEND:STATE', {
ref: null,
json: { json: {
state: 'offline' state: 'offline'
}, },
@@ -2859,7 +2798,6 @@ if (window.CefSharp) {
case 'friend-update': case 'friend-update':
this.$emit('USER', { this.$emit('USER', {
ref: null,
json: content.user, json: content.user,
params: { params: {
userId: content.userId userId: content.userId
@@ -2870,7 +2808,6 @@ if (window.CefSharp) {
case 'friend-location': case 'friend-location':
if (content.world) { if (content.world) {
this.$emit('WORLD', { this.$emit('WORLD', {
ref: null,
json: content.world, json: content.world,
params: { params: {
worldId: content.world.id worldId: content.world.id
@@ -2879,7 +2816,6 @@ if (window.CefSharp) {
} }
if (content.userId === this.currentUser.id) { if (content.userId === this.currentUser.id) {
this.$emit('USER', { this.$emit('USER', {
ref: null,
json: content.user, json: content.user,
params: { params: {
userId: content.userId userId: content.userId
@@ -2887,7 +2823,6 @@ if (window.CefSharp) {
}); });
} else { } else {
this.$emit('USER', { this.$emit('USER', {
ref: null,
json: { json: {
location: content.location, location: content.location,
...content.user ...content.user
@@ -2901,7 +2836,6 @@ if (window.CefSharp) {
case 'user-update': case 'user-update':
this.$emit('USER:CURRENT', { this.$emit('USER:CURRENT', {
ref: null,
json: content.user, json: content.user,
params: { params: {
userId: content.userId userId: content.userId
@@ -2912,7 +2846,6 @@ if (window.CefSharp) {
case 'user-location': case 'user-location':
if (isObject(content.world)) { if (isObject(content.world)) {
this.$emit('WORLD', { this.$emit('WORLD', {
ref: null,
json: content.world, json: content.world,
params: { params: {
worldId: content.world.id worldId: content.world.id
@@ -2920,7 +2853,6 @@ if (window.CefSharp) {
}); });
} }
this.$emit('USER', { this.$emit('USER', {
ref: null,
json: { json: {
id: content.userId, id: content.userId,
location: content.location location: content.location
@@ -2941,7 +2873,6 @@ if (window.CefSharp) {
method: 'GET' method: 'GET'
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json json
}; };
this.$emit('AUTH', args); this.$emit('AUTH', args);
@@ -2969,7 +2900,6 @@ if (window.CefSharp) {
json.content = JSON.parse(json.content); json.content = JSON.parse(json.content);
} }
this.$emit('PIPELINE', { this.$emit('PIPELINE', {
ref: null,
json json
}); });
} catch (err) { } catch (err) {
@@ -2998,7 +2928,6 @@ if (window.CefSharp) {
method: 'GET' method: 'GET'
}).then((json) => { }).then((json) => {
var args = { var args = {
ref: null,
json json
}; };
this.$emit('VISITS', args); this.$emit('VISITS', args);
@@ -3224,27 +3153,26 @@ if (window.CefSharp) {
if (i <= 0) { if (i <= 0) {
break; break;
} }
var ref = this.gameLogTable.data[--i]; var ctx = this.gameLogTable.data[--i];
// Location, OnPlayerJoined, OnPlayerLeft // Location, OnPlayerJoined, OnPlayerLeft
if (ref.type) { if (ctx.type) {
// FIXME: 이거 존나 느릴거 같은데 // FIXME: 이거 존나 느릴거 같은데
var isFriend = false; var isFriend = false;
var isFavorite = false; var isFavorite = false;
for (var key in API.user) { for (var ref of API.cachedUsers.values()) {
var ref = API.cachedUsers.get(key); if (ref.displayName === ctx.data) {
if (ref.displayName === ref.data) { isFriend = this.friends.has(ref.id);
isFriend = Boolean(this.friend[ref.id]);
isFavorite = API.cachedFavoritesByObjectId.has(ref.id); isFavorite = API.cachedFavoritesByObjectId.has(ref.id);
break; break;
} }
} }
arr.push({ arr.push({
...ref, ...ctx,
isFriend, isFriend,
isFavorite isFavorite
}); });
} else { } else {
arr.push(ref); arr.push(ctx);
} }
++j; ++j;
} }
@@ -3254,13 +3182,13 @@ if (window.CefSharp) {
if (i <= 0) { if (i <= 0) {
break; break;
} }
var ref = this.feedTable.data[--i]; var ctx = this.feedTable.data[--i];
// GPS, Online, Offline, Status, Avatar // GPS, Online, Offline, Status, Avatar
if (ref.type !== 'Avatar') { if (ctx.type !== 'Avatar') {
arr.push({ arr.push({
...ref, ...ctx,
isFriend: Boolean(this.friend[ref.userId]), isFriend: this.friends.has(ctx.userId),
isFavorite: API.cachedFavoritesByObjectId.has(ref.userId) isFavorite: API.cachedFavoritesByObjectId.has(ctx.userId)
}); });
++j; ++j;
} }
@@ -3281,8 +3209,9 @@ if (window.CefSharp) {
}; };
$app.methods.notifyMenu = function (index) { $app.methods.notifyMenu = function (index) {
if (this.$refs.menu.activeIndex !== index) { var { menu } = this.$refs;
var item = this.$refs.menu.items[index]; if (menu.activeIndex !== index) {
var item = menu.items[index];
if (item) { if (item) {
item.$el.classList.add('notify'); item.$el.classList.add('notify');
} }
@@ -3460,7 +3389,7 @@ if (window.CefSharp) {
} else { } else {
VRCXStorage.Remove(key); VRCXStorage.Remove(key);
} }
var ref = this.friend[id]; var ref = this.friends.get(id);
if (ref) { if (ref) {
ref.memo = String(memo || ''); ref.memo = String(memo || '');
} }
@@ -3468,8 +3397,8 @@ if (window.CefSharp) {
// App: Friends // App: Friends
$app.data.friend = {}; $app.data.friends = new Map();
$app.data.friendNo = 0; $app.data.friendsNo = 0;
$app.data.isFriendGroup0 = true; $app.data.isFriendGroup0 = true;
$app.data.isFriendGroup1 = true; $app.data.isFriendGroup1 = true;
$app.data.isFriendGroup2 = true; $app.data.isFriendGroup2 = true;
@@ -3502,8 +3431,8 @@ if (window.CefSharp) {
$app.watch.orderFriendGroup3 = saveOrderFriendGroup; $app.watch.orderFriendGroup3 = saveOrderFriendGroup;
API.$on('LOGIN', function () { API.$on('LOGIN', function () {
$app.friend = {}; $app.friends.clear();
$app.friendNo = 0; $app.friendsNo = 0;
$app.isFriendGroup0 = true; $app.isFriendGroup0 = true;
$app.isFriendGroup1 = true; $app.isFriendGroup1 = true;
$app.isFriendGroup2 = true; $app.isFriendGroup2 = true;
@@ -3566,16 +3495,16 @@ if (window.CefSharp) {
ref.onlineFriends.forEach((id) => { ref.onlineFriends.forEach((id) => {
map[id] = 'online'; map[id] = 'online';
}); });
for (var key in map) { for (var id in map) {
if (this.friend[key]) { if (this.friends.has(id)) {
this.updateFriend(key, map[key], origin); this.updateFriend(id, map[id], origin);
} else { } else {
this.addFriend(key, map[key]); this.addFriend(id, map[id]);
} }
} }
for (var key in this.friend) { for (var id of this.friends.keys()) {
if (!map[key]) { if (map[id] === undefined) {
this.removeFriend(key); this.removeFriend(id);
} }
} }
if (origin) { if (origin) {
@@ -3584,7 +3513,7 @@ if (window.CefSharp) {
}; };
$app.methods.addFriend = function (id, state) { $app.methods.addFriend = function (id, state) {
if (this.friend[id]) { if (this.friends.has(id)) {
return; return;
} }
var ref = API.cachedUsers.get(id); var ref = API.cachedUsers.get(id);
@@ -3594,7 +3523,7 @@ if (window.CefSharp) {
ref, ref,
vip: API.cachedFavoritesByObjectId.has(id), vip: API.cachedFavoritesByObjectId.has(id),
name: '', name: '',
no: ++this.friendNo, no: ++this.friendsNo,
memo: this.loadMemo(id) memo: this.loadMemo(id)
}; };
if (ref) { if (ref) {
@@ -3606,7 +3535,7 @@ if (window.CefSharp) {
ctx.name = ref.displayName; ctx.name = ref.displayName;
} }
} }
Vue.set(this.friend, id, ctx); this.friends.set(id, ctx);
if (ctx.state === 'online') { if (ctx.state === 'online') {
if (ctx.vip) { if (ctx.vip) {
this.sortFriendGroup0 = true; this.sortFriendGroup0 = true;
@@ -3629,7 +3558,7 @@ if (window.CefSharp) {
}; };
$app.methods.removeFriend = function (id) { $app.methods.removeFriend = function (id) {
var ctx = this.friend[id]; var ctx = this.friends.get(id);
if (ctx) { if (ctx) {
Vue.delete(this.friend, id); Vue.delete(this.friend, id);
if (ctx.state === 'online') { if (ctx.state === 'online') {
@@ -3651,7 +3580,7 @@ if (window.CefSharp) {
}; };
$app.methods.updateFriend = function (id, state, origin) { $app.methods.updateFriend = function (id, state, origin) {
var ctx = this.friend[id]; var ctx = this.friends.get(id);
if (ctx) { if (ctx) {
var ref = API.cachedUsers.get(id); var ref = API.cachedUsers.get(id);
var vip = API.cachedFavoritesByObjectId.has(id); var vip = API.cachedFavoritesByObjectId.has(id);
@@ -3868,8 +3797,7 @@ if (window.CefSharp) {
this.quickSearchItems = []; this.quickSearchItems = [];
if (query) { if (query) {
var QUERY = query.toUpperCase(); var QUERY = query.toUpperCase();
for (var key in this.friend) { for (var ctx in this.friends.values()) {
var ctx = this.friend[key];
if (ctx.ref) { if (ctx.ref) {
var NAME = ctx.name.toUpperCase(); var NAME = ctx.name.toUpperCase();
var match = NAME.includes(QUERY); var match = NAME.includes(QUERY);
@@ -3989,7 +3917,7 @@ if (window.CefSharp) {
API.$on('USER:UPDATE', function (args) { API.$on('USER:UPDATE', function (args) {
var { ref, props } = args; var { ref, props } = args;
if ($app.friend[ref.id]) { if ($app.friends.get(ref.id)) {
if (props.location) { if (props.location) {
if (props.location[0] === 'offline') { if (props.location[0] === 'offline') {
$app.addFeed('Offline', ref, { $app.addFeed('Offline', ref, {
@@ -4041,14 +3969,15 @@ if (window.CefSharp) {
} }
}); });
var saveFeedTimer = false; var saveFeedTimer = null;
$app.methods.saveFeed = function () { $app.methods.saveFeed = function () {
if (saveFeedTimer === false) { if (saveFeedTimer !== null) {
saveFeedTimer = setTimeout(() => { return;
saveFeedTimer = false;
VRCXStorage.SetArray(`${API.currentUser.id}_feedTable`, this.feedTable.data);
}, 1);
} }
saveFeedTimer = setTimeout(() => {
saveFeedTimer = null;
VRCXStorage.SetArray(`${API.currentUser.id}_feedTable`, this.feedTable.data);
}, 1);
}; };
$app.methods.addFeed = function (type, ref, extra) { $app.methods.addFeed = function (type, ref, extra) {
@@ -4248,10 +4177,9 @@ if (window.CefSharp) {
}; };
$app.methods.lookupUser = function (name) { $app.methods.lookupUser = function (name) {
for (var key in API.user) { for (var ref of API.cachedUsers.values()) {
var ctx = API.cachedUsers.get(key); if (ref.displayName === name) {
if (ctx.displayName === name) { this.showUserDialog(ref.id);
this.showUserDialog(ctx.id);
return; return;
} }
} }
@@ -4781,16 +4709,17 @@ if (window.CefSharp) {
} }
}); });
var saveFriendLogTimer = false; var saveFriendLogTimer = null;
$app.methods.saveFriendLog = function () { $app.methods.saveFriendLog = function () {
if (saveFriendLogTimer === false) { if (saveFriendLogTimer !== null) {
saveFriendLogTimer = setTimeout(() => { return;
saveFriendLogTimer = false;
VRCXStorage.SetObject(`${API.currentUser.id}_friendLog`, this.friendLog);
VRCXStorage.SetArray(`${API.currentUser.id}_friendLogTable`, this.friendLogTable.data);
VRCXStorage.Set(`${API.currentUser.id}_friendLogUpdatedAt`, new Date().toJSON());
}, 1);
} }
saveFriendLogTimer = setTimeout(() => {
saveFriendLogTimer = null;
VRCXStorage.SetObject(`${API.currentUser.id}_friendLog`, this.friendLog);
VRCXStorage.SetArray(`${API.currentUser.id}_friendLogTable`, this.friendLogTable.data);
VRCXStorage.Set(`${API.currentUser.id}_friendLogUpdatedAt`, new Date().toJSON());
}, 1);
}; };
$app.methods.initFriendship = function (ref) { $app.methods.initFriendship = function (ref) {
@@ -5482,7 +5411,7 @@ if (window.CefSharp) {
if (args.ref.id === D.id) { if (args.ref.id === D.id) {
D.loading = false; D.loading = false;
D.ref = args.ref; D.ref = args.ref;
D.friend = this.friend[D.id]; D.friend = this.friends.get(D.id);
D.isFriend = Boolean(D.friend); D.isFriend = Boolean(D.friend);
D.incomingRequest = false; D.incomingRequest = false;
D.outgoingRequest = false; D.outgoingRequest = false;
@@ -5550,8 +5479,7 @@ if (window.CefSharp) {
} }
D.users = []; D.users = [];
if (!L.isOffline) { if (!L.isOffline) {
for (var key in this.friend) { for (var { ref } of this.friends.values()) {
var ref = API.cachedUsers.get(key);
if (ref && if (ref &&
ref.location === D.ref.location) { ref.location === D.ref.location) {
D.users.push(ref); D.users.push(ref);
@@ -5958,8 +5886,7 @@ if (window.CefSharp) {
users: [] users: []
}; };
} }
for (var key in this.friend) { for (var { ref } of this.friends.values()) {
var ref = API.cachedUsers.get(key);
if (ref && if (ref &&
ref.$location.worldId === D.id) { ref.$location.worldId === D.id) {
({ instanceId } = ref.$location); ({ instanceId } = ref.$location);