Skip to content

Commit

Permalink
Release 1.1.22
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmuslos authored May 25, 2021
2 parents 5101acc + b069e3c commit 9e7e019
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"[email protected]"
],
"productName": "Homeworker",
"version": "1.1.21",
"version": "1.1.22",
"description": "Desktop app for Windows and MacOS",
"main": "src/main.js",
"scripts": {
Expand Down
17 changes: 1 addition & 16 deletions src/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,16 @@ const { ipcRenderer } = require("electron")
const os = require("os")
const { getDisplayMedia } = require("./util/screenPicker")

// Got notification from websocket
document.addEventListener('websocketMessage|type:fcm-message', (event) => {
if(Notification.permission === "granted") {
const { notification, data } = event.message.payload

if(data.link && window.location.href === data.link) return

const notificationObject = new Notification(notification.title, data)
notificationObject.addEventListener("click", () => {
if(data.link) window.location = data.link
notificationObject.close()
})
}
})

window.addEventListener("load", () => {
window.desktop = {
call: true,
darwin: os.type().toLocaleLowerCase() === "darwin",
offerUnread: (unreadNotifications, unreadChatMessages) => ipcRenderer.invoke("unread_notifications", {unreadNotifications, unreadChatMessages}),
}
window.navigator.mediaDevices.getDisplayMedia = getDisplayMedia

// Sadly it is impossible to do that with an DomObserver witch leeds ti this mess
setInterval(() => document.querySelectorAll("iframe").forEach(iframe => iframe.contentWindow.navigator.mediaDevices.getDisplayMedia = getDisplayMedia), 500)
window.navigator.mediaDevices.getDisplayMedia = getDisplayMedia
})

console.log("Registered preload script")

0 comments on commit 9e7e019

Please sign in to comment.