Skip to content

Commit

Permalink
Add backward compatible fix to handle new call end button HTML
Browse files Browse the repository at this point in the history
  • Loading branch information
vivek-nexus committed Aug 5, 2024
1 parent 6e6329d commit 45ae8b9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Improve workplace communication by connecting Google Meet with Slack!

**Google Meet ⇔ Slack automatically (Glack) updates your slack status in real time, when you join and exit meetings, even for unscheduled meetings or overflowing meetings.**

Extension status: 🟢 OPERATIONAL (v2.0.3 — degraded functionality for users who recieved new meet UI; fix in progress)
Extension status: 🟢 OPERATIONAL (v2.1.0)



Expand Down
35 changes: 23 additions & 12 deletions extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,14 @@ checkExtensionStatus().then(() => {
joinKeyBoardShortcutListener();
exitKeyBoardShortcutListener();

// 1. Meet UI prior to July/Aug 2024
checkElement(".google-material-icons", "call_end").then(() => {
console.log("Meeting started, setting Slack status")
chrome.runtime.sendMessage({ message: "Set status" }, function (response) {
console.log(response);
});

contains(".google-material-icons", "call_end")[0].parentElement.addEventListener("click", () => {
console.log("Meeting ended, clearing Slack status")
chrome.runtime.sendMessage({ message: "Clear status" }, function (response) {
console.log(response);
});
})
meetingRoutines(".google-material-icons", "call_end")
})

// 2. Meet UI post July/Aug 2024
checkElement(".google-symbols", "call_end").then(() => {
meetingRoutines(".google-symbols", "call_end")
})
}
else {
Expand All @@ -67,6 +63,21 @@ chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
}
});

function meetingRoutines(selector, text) {
console.log("Meeting started, setting Slack status")
chrome.runtime.sendMessage({ message: "Set status" }, function (response) {
console.log(response);
});

// Event bubbling ensures this works for both cases 1 and 2. The node in case 2 is nested one level deeper than case 1.
contains(selector, text)[0].parentElement.parentElement.addEventListener("click", () => {
console.log("Meeting ended, clearing Slack status")
chrome.runtime.sendMessage({ message: "Clear status" }, function (response) {
console.log(response);
});
})
}

function joinKeyBoardShortcutListener() {
document.addEventListener("keydown", function (event) {
if ((event.ctrlKey || event.metaKey) && !(event.shiftKey) && (event.key.toLowerCase() === "v")) {
Expand All @@ -84,7 +95,7 @@ function exitKeyBoardShortcutListener() {
document.addEventListener("keydown", function (event) {
if ((event.ctrlKey || event.metaKey) && (event.shiftKey) && (event.key.toLowerCase() === "v")) {
if (contains("i", "call_end")[0])
contains("i", "call_end")[0].parentElement.click();
contains("i", "call_end")[0].click();
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion extension/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Google Meet ⇔ Slack integration (Glack)",
"version": "2.0.3",
"version": "2.1.0",
"manifest_version": 3,
"description": "Real-time Google Meet status on Slack, just like Slack huddles.",
"action": {
Expand Down

0 comments on commit 45ae8b9

Please sign in to comment.