Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

Commit

Permalink
added dialog for other platforms than win32
Browse files Browse the repository at this point in the history
  • Loading branch information
juaneth committed May 9, 2022
1 parent 2384914 commit c74a344
Showing 1 changed file with 29 additions and 20 deletions.
49 changes: 29 additions & 20 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,7 @@
const { app, BrowserWindow, Tray, Menu, autoUpdater } = require("electron");
const { app, BrowserWindow, Tray, Menu, autoUpdater, dialog } = require("electron");
const nativeImage = require('electron').nativeImage
const path = require("path");

// Auto Updates
const server = 'https://update.electronjs.org'
const feed = `${server}/juaneth/omnipetal/${process.platform}-${process.arch}/${app.getVersion()}`

if (!process.argv.includes("dev")) {
autoUpdater.setFeedURL(feed)

autoUpdater.checkForUpdates()

setInterval(() => {
autoUpdater.checkForUpdates()
}, 300000)
}

// Handle creating/removing shortcuts on Windows when installing/uninstalling.
if (require("electron-squirrel-startup")) {
// eslint-disable-line global-require
Expand Down Expand Up @@ -55,6 +41,32 @@ const createWindow = () => {
// Setup the tray icon
let tray = null
app.whenReady().then(() => {
// Auto Updates

if (!process.argv.includes("dev")) {
if (process.platform === "win32") {
const server = 'https://update.electronjs.org'
const feed = `${server}/juaneth/omnipetal/${process.platform}-${process.arch}/${app.getVersion()}`

autoUpdater.setFeedURL(feed)

autoUpdater.checkForUpdates()

setInterval(() => {
autoUpdater.checkForUpdates()
}, 300000)
} else {
setTimeout(() => {
dialog.showMessageBox({
type: "warning",
title: "Omnipetal",
message: "❤️ Omnipetal is not supported for your platform, some features may not work, Windows is our recommended platform ❤️.",
});
}, 2000);
}
}


const image = nativeImage.createFromPath(
path.join(__dirname, "icon.png")
);
Expand Down Expand Up @@ -120,7 +132,7 @@ const createWindow = () => {
mainWindow.webContents.openDevTools()
}
}
},
}
])
tray.setToolTip('Omnipetal')
tray.setContextMenu(contextMenu)
Expand Down Expand Up @@ -152,7 +164,4 @@ app.on("activate", () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});

// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and import them here.
});

0 comments on commit c74a344

Please sign in to comment.