mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 07:47:30 +02:00
Notification organization.
This commit is contained in:
parent
8882468f3e
commit
8db5772a37
1 changed files with 16 additions and 29 deletions
|
@ -102,33 +102,20 @@
|
||||||
const currentTimestamp = _getTimestamp();
|
const currentTimestamp = _getTimestamp();
|
||||||
const timeArray = _formatTimestamp(currentTimestamp);
|
const timeArray = _formatTimestamp(currentTimestamp);
|
||||||
|
|
||||||
if (!message.channel) message.channel = "domain"; // We don't know where to put this message. Assume it is a domain wide message.
|
if (!message.channel) message.channel = "domain"; // We don't know where to put this message. Assume it is a domain wide message.
|
||||||
|
message.channel = message.channel.toLowerCase(); // Only recognize channel names as lower case.
|
||||||
message.channel = message.channel.toLowerCase();
|
|
||||||
|
if (!channels.includes(message.channel)) return; // Check the channel. If the channel is not one we have, do nothing.
|
||||||
// Check the channel. If the channel is not one we have, do nothing.
|
if (message.channel == "local" && isTooFar(message.position)) return; // If message is local, and if player is too far away from location, do nothing.
|
||||||
if (!channels.includes(message.channel)) return;
|
|
||||||
|
|
||||||
// If message is local, and if player is too far away from location, do nothing.
|
|
||||||
if (message.channel == "local" && isTooFar(message.position)) return;
|
|
||||||
|
|
||||||
// Format the timestamp
|
// Format the timestamp
|
||||||
message.timeString = timeArray[0];
|
message.timeString = timeArray[0];
|
||||||
message.dateString = timeArray[1];
|
message.dateString = timeArray[1];
|
||||||
|
|
||||||
|
_emitEvent({ type: "show_message", ...message }); // Update qml view of to new message.
|
||||||
|
_notificationCoreMessage(message.displayName, message.message) // Show a new message on screen.
|
||||||
|
|
||||||
// Update qml view of to new message
|
// Create a new variable based on the message that will be saved.
|
||||||
_emitEvent({ type: "show_message", ...message });
|
|
||||||
|
|
||||||
// Show new message on screen
|
|
||||||
Messages.sendLocalMessage(
|
|
||||||
"Floof-Notif",
|
|
||||||
JSON.stringify({
|
|
||||||
sender: message.displayName,
|
|
||||||
text: message.message,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
// Save message to history
|
|
||||||
let savedMessage = message;
|
let savedMessage = message;
|
||||||
|
|
||||||
// Remove unnecessary data.
|
// Remove unnecessary data.
|
||||||
|
@ -239,13 +226,7 @@
|
||||||
|
|
||||||
// Show new message on screen
|
// Show new message on screen
|
||||||
if (settings.join_notification){
|
if (settings.join_notification){
|
||||||
Messages.sendLocalMessage(
|
_notificationCoreMessage(displayName, type)
|
||||||
"Floof-Notif",
|
|
||||||
JSON.stringify({
|
|
||||||
sender: displayName,
|
|
||||||
text: type,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_emitEvent({ type: "notification", ...message });
|
_emitEvent({ type: "notification", ...message });
|
||||||
|
@ -289,6 +270,12 @@
|
||||||
|
|
||||||
return timeArray;
|
return timeArray;
|
||||||
}
|
}
|
||||||
|
function _notificationCoreMessage(displayName, message){
|
||||||
|
Messages.sendLocalMessage(
|
||||||
|
"Floof-Notif",
|
||||||
|
JSON.stringify({ sender: displayName, text: message })
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emit a packet to the HTML front end. Easy communication!
|
* Emit a packet to the HTML front end. Easy communication!
|
||||||
|
|
Loading…
Reference in a new issue