Refactor IPC

This commit is contained in:
Natsumi
2023-03-07 01:09:01 +13:00
parent 18aa24fa60
commit bb8c3dcfa9
8 changed files with 151 additions and 38 deletions

View File

@@ -2583,7 +2583,15 @@ speechSynthesis.getVoices();
};
this.cachedAvatars.set(ref.id, ref);
} else {
var {unityPackages} = ref;
Object.assign(ref, json);
if (
json.unityPackages.length > 0 &&
unityPackages.length > 0 &&
!json.unityPackages.assetUrl
) {
ref.unityPackages = unityPackages;
}
}
ref.name = $app.replaceBioSymbols(ref.name);
ref.description = $app.replaceBioSymbols(ref.description);
@@ -10774,10 +10782,24 @@ speechSynthesis.getVoices();
}
if (block === row.block && mute === row.mute) {
// no change
type = '';
if (type) {
this.addEntryPhotonEvent({
photonId,
text: `Moderation ${text}`,
type: 'Moderation',
color: 'yellow',
created_at: gameLogDate
});
}
return;
}
}
if (text) {
this.moderationAgainstTable.forEach((item) => {
if (item.userId === ref.id && item.type === type) {
removeFromArray(this.moderationAgainstTable, item);
}
});
if (type) {
this.addEntryPhotonEvent({
photonId,
text: `Moderation ${text}`,
@@ -10785,8 +10807,6 @@ speechSynthesis.getVoices();
color: 'yellow',
created_at: gameLogDate
});
}
if (type) {
var noty = {
created_at: new Date().toJSON(),
userId: ref.id,
@@ -10800,12 +10820,9 @@ speechSynthesis.getVoices();
displayName: ref.displayName,
type
};
this.moderationAgainstTable.forEach((item) => {
if (item.userId === ref.id && item.type === type) {
removeFromArray(this.moderationAgainstTable, item);
}
});
this.moderationAgainstTable.push(entry);
}
if (block || mute || block !== row.block || mute !== row.mute) {
this.updateSharedFeed(true);
}
if (block || mute) {
@@ -10816,7 +10833,7 @@ speechSynthesis.getVoices();
block,
mute
});
} else {
} else if (row.block || row.mute) {
database.deleteModeration(ref.id);
}
});
@@ -14875,6 +14892,9 @@ speechSynthesis.getVoices();
}
);
}
if (this.ipcEnabled) {
AppApi.SendIpc('ShowUserDialog', userId);
}
API.getCachedUser({
userId
})
@@ -21617,6 +21637,8 @@ speechSynthesis.getVoices();
this.ipcEnabled = true;
this.ipcTimeout = 60; // 30secs
break;
case 'MsgPing':
break;
case 'LaunchCommand':
AppApi.FocusWindow();
this.eventLaunchCommand(data.command);
@@ -21644,10 +21666,22 @@ speechSynthesis.getVoices();
$app.data.customUserTags = new Map();
$app.methods.addCustomTag = function (data) {
this.customUserTags.set(data.UserId, {
tag: data.Tag,
if (data.Tag) {
this.customUserTags.set(data.UserId, {
tag: data.Tag,
colour: data.TagColour
});
} else {
this.customUserTags.delete(data.UserId);
}
var feedUpdate = {
userId: data.UserId,
colour: data.TagColour
});
};
AppApi.ExecuteVrOverlayFunction(
'updateHudFeedTag',
JSON.stringify(feedUpdate)
);
var ref = API.cachedUsers.get(data.UserId);
if (typeof ref !== 'undefined') {
ref.$customTag = data.Tag;

View File

@@ -726,6 +726,15 @@ Vue.component('marquee-text', MarqueeText);
this.cleanHudFeed();
};
$app.methods.updateHudFeedTag = function (json) {
var ref = JSON.parse(json);
this.hudFeed.forEach((item) => {
if (item.userId === ref.userId) {
item.colour = ref.colour;
}
});
};
$app.data.hudTimeout = [];
$app.methods.updateHudTimeout = function (json) {