Skip to content

Commit

Permalink
make notification states immutable
Browse files Browse the repository at this point in the history
  • Loading branch information
hduelme committed Jun 29, 2024
1 parent 8d97e56 commit ecda3f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions js/ui/messageTray.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,34 +31,34 @@ var LONGER_HIDE_TIMEOUT = 0.6;
const NOTIFICATION_IMAGE_SIZE = 125;
const NOTIFICATION_IMAGE_OPACITY = 230; // 0 - 255

var State = {
const State = Object.freeze({
HIDDEN: 0,
SHOWING: 1,
SHOWN: 2,
HIDING: 3
};
});

// These reasons are useful when we destroy the notifications received through
// the notification daemon. We use EXPIRED for transient notifications that the
// user did not interact with, DISMISSED for all other notifications that were
// destroyed as a result of a user action, and SOURCE_CLOSED for the notifications
// that were requested to be destroyed by the associated source.
var NotificationDestroyedReason = {
const NotificationDestroyedReason = Object.freeze({
EXPIRED: 1,
DISMISSED: 2,
SOURCE_CLOSED: 3
};
});

// Message tray has its custom Urgency enumeration. LOW, NORMAL and CRITICAL
// urgency values map to the corresponding values for the notifications received
// through the notification daemon. HIGH urgency value is used for chats received
// through the Telepathy client.
var Urgency = {
const Urgency = Object.freeze({
LOW: 0,
NORMAL: 1,
HIGH: 2,
CRITICAL: 3
};
});

function _fixMarkup(text, allowMarkup) {
if (allowMarkup) {
Expand Down
8 changes: 4 additions & 4 deletions js/ui/notificationDaemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,18 @@ const NotificationDaemonIface =
</interface> \
</node>';

const NotificationClosedReason = {
const NotificationClosedReason = Object.freeze({
EXPIRED: 1,
DISMISSED: 2,
APP_CLOSED: 3,
UNDEFINED: 4
};
});

const Urgency = {
const Urgency = Object.freeze({
LOW: 0,
NORMAL: 1,
CRITICAL: 2
};
});

const rewriteRules = {
'XChat': [
Expand Down

0 comments on commit ecda3f0

Please sign in to comment.