diff --git a/src/preload.js b/src/preload.js index d7be0f49..a9da86d8 100644 --- a/src/preload.js +++ b/src/preload.js @@ -102,27 +102,13 @@ window.onload = () => { new MutationObserver((mutations) => { // Check when WhatsApp is done loading - if ( - mutations[0].removedNodes.length > 0 && - mutations[0].removedNodes[0].id === "startup" - ) { - addChatIDs(); - - // Update chat IDs when a chat is added/removed. - new MutationObserver(() => { - addChatIDs(); - }).observe( - document.querySelector('#pane-side [role="region"]', { - subtree: true, - childList: true, - }) - ); + if (mutations[0].removedNodes[0]?.innerHTML.includes("progress")) { // Remove "Update available" message if ( document.querySelector("._3z9_h").innerText.includes("Update available") ) { - document.querySelector("._3z9_h").style.display = "none"; + document.querySelector("._3z9_h").firstChild.remove() } } diff --git a/src/util/webview/addChatIDs.js b/src/util/webview/addChatIDs.js deleted file mode 100644 index 5a32a903..00000000 --- a/src/util/webview/addChatIDs.js +++ /dev/null @@ -1,16 +0,0 @@ -const addChatIDs = () => { - if (document.querySelectorAll('#pane-side [role="region"] > *').length > 0) { - document - .querySelectorAll('#pane-side [role="region"] > *') - .forEach((chat) => { - let internalInstance = - chat[ - Object.keys(chat).find((key) => key.includes("InternalInstance")) - ]; - let id = - internalInstance.memoizedProps.children.props.contact.id._serialized; - chat.id = id; - }); - } -}; -module.exports = addChatIDs;