Skip to content

Commit

Permalink
chore: Update main.js and index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
truemiller committed May 14, 2024
1 parent 2be7802 commit 68ebac9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
3 changes: 3 additions & 0 deletions electron/loading/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
// document.getElementById("text").innerText = arg;
// });
ipcRenderer.send("check", "Starting check...");
ipcRenderer.on("response", (event, arg) => {
console.log(arg);
});
</script>

</html>
37 changes: 22 additions & 15 deletions electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,12 @@ async function beforeQuit() {
const createTray = () => {
const trayPath =
isWindows || isMac ? TRAY_ICONS.LOGGED_OUT : TRAY_ICONS_PATHS.LOGGED_OUT;
const trayIcon = trayPath.resize({ width: 16 });
trayIcon.setTemplateImage(true);
const tray = new Tray(trayIcon);

if (trayPath.resize) {
trayPath.resize({ width: 16 });
trayPath.setTemplateImage(true);
}
const tray = new Tray(trayPath);

const contextMenu = Menu.buildFromTemplate([
{
Expand Down Expand Up @@ -169,7 +172,7 @@ const createMainWindow = () => {
title: 'Olas Operate',
resizable: false,
draggable: true,
frame: true,
frame: false,
transparent: true,
fullscreenable: false,
maximizable: false,
Expand Down Expand Up @@ -325,19 +328,23 @@ async function launchNextAppDev() {
ipcMain.on('check', async function (event, _argument) {
// Update
try {
event.sender.send('response', 'Checking for updates');
// await macUpdater.checkForUpdates().then((res) => {
// if (res) {
// console.log(res);
// res.downloadPromise.then(() => {
// event.sender.send('response', 'Update downloaded');
// macUpdater.quitAndInstall();
// });
// }
// });
macUpdater.checkForUpdates().then((res) => {
if (res) {
new Notification({
title: 'Update Available',
body: 'Downloading update...',
}).show();
}
res.downloadPromise.then(() => {
new Notification({
title: 'Update Downloaded',
body: 'Restarting application...',
}).show();
macUpdater.quitAndInstall();
});
});
} catch (e) {
console.error(e);
event.sender.send('response', e);
}

// Setup
Expand Down

0 comments on commit 68ebac9

Please sign in to comment.