Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArmoredChat notifications on join and leave #1203

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions scripts/communityScripts/armored-chat/armored_chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
var settings = {
external_window: false,
maximum_messages: 200,
join_notification: true
};

// Global vars
Expand Down Expand Up @@ -115,6 +116,7 @@
// Update qml view of to new message
_emitEvent({ type: "show_message", ...message });

// Show new message on screen
Messages.sendLocalMessage(
"Floof-Notif",
JSON.stringify({
Expand Down Expand Up @@ -146,18 +148,17 @@
_sendMessage(event.message, event.channel);
break;
case "setting_change":
// Set the setting value, and save the config
settings[event.setting] = event.value; // Update local settings
_saveSettings(); // Save local settings

// Extra actions to preform.
switch (event.setting) {
case "external_window":
chatOverlayWindow.presentationMode = event.value
? Desktop.PresentationMode.NATIVE
: Desktop.PresentationMode.VIRTUAL;
break;
case "maximum_messages":
// Do nothing
break;
}

break;
Expand Down Expand Up @@ -228,6 +229,17 @@
let message = {};
message.message = `${displayName} ${type}`;

// Show new message on screen
if (settings.join_notification){
Messages.sendLocalMessage(
"Floof-Notif",
JSON.stringify({
sender: displayName,
text: type,
})
);
}

_emitEvent({ type: "notification", ...message });
}, 1500);
}
Expand Down
26 changes: 26 additions & 0 deletions scripts/communityScripts/armored-chat/armored_chat.qml
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,31 @@ Rectangle {
}
}
}


// Join notification
Rectangle {
width: parent.width
height: 40
color: "transparent"

Text{
text: "Join notification"
color: "white"
font.pointSize: 12
anchors.verticalCenter: parent.verticalCenter
}

CheckBox{
id: s_join_notification
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter

onCheckedChanged: {
toScript({type: 'setting_change', setting: 'join_notification', value: checked})
}
}
}
}
}

Expand Down Expand Up @@ -561,6 +586,7 @@ Rectangle {
case "initial_settings":
if (message.settings.external_window) s_external_window.checked = true;
if (message.settings.maximum_messages) s_maximum_messages.value = message.settings.maximum_messages;
if (message.settings.join_notification) s_join_notification.checked = true;
break;
}
}
Expand Down
Loading