From 6481be3abeda7022d5a13d0f07704985e8cd901f Mon Sep 17 00:00:00 2001 From: ShadyThGod Date: Mon, 17 Dec 2018 22:06:48 +0530 Subject: [PATCH] Added fix for "WhatsApp Works For Chrome 36+" issue i.e. Issue #7 --- src/js/whatsapp.init.js | 23 ++++++++++++++++++++++- src/windows/mainWindow.html | 2 +- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/js/whatsapp.init.js b/src/js/whatsapp.init.js index ed155818..f6e16f3b 100644 --- a/src/js/whatsapp.init.js +++ b/src/js/whatsapp.init.js @@ -1,4 +1,7 @@ -const { ipcRenderer } = require('electron'); +const { + ipcRenderer, + remote +} = require('electron'); const Mousetrap = require('mousetrap'); window.onclick = function(e) { if (e.target.tagName == "A") { @@ -6,6 +9,24 @@ window.onclick = function(e) { } } +var ses = remote.session.defaultSession; + +ses.flushStorageData(); +ses.clearStorageData({ + storages: ['appcache', 'serviceworkers', 'cachestorage', 'websql', 'indexdb'], +}); + +window.navigator.serviceWorker.getRegistrations().then(registrations => { + for (let registration of registrations) { + registration.unregister(); + } +}); + +const titleEl = document.querySelector('.window-title'); +if (titleEl && titleEl.innerHTML.includes('Google Chrome 36+')) { + window.location.reload(); +} + /* Mac Copy/Paste Fix */ Mousetrap.bind(['command+c', 'ctrl+c'], function(e) { document.execCommand('copy'); diff --git a/src/windows/mainWindow.html b/src/windows/mainWindow.html index 89b618b3..ce94eb3d 100644 --- a/src/windows/mainWindow.html +++ b/src/windows/mainWindow.html @@ -26,7 +26,7 @@ - +