Skip to content
Snippets Groups Projects
Commit 510518f2 authored by mathias.chouet's avatar mathias.chouet
Browse files

Fix #462 (partially)

parent c3c10673
No related branches found
No related tags found
No related merge requests found
Pipeline #138420 passed
../src/assets/icons/android-chrome-512x512.png
\ No newline at end of file
const { app, dialog, shell, net, BrowserWindow, Notification } = require('electron');
const { app, dialog, shell, net, BrowserWindow, Notification, nativeImage } = require('electron');
let win;
......@@ -23,7 +23,6 @@ function createWindow () {
// Ask confirmation before closing the app.
win.on('close', (e) => {
e.preventDefault();
// @WARNING renders ugly on Linux
const choice = dialog.showMessageBoxSync(
{
type: "question",
......@@ -68,6 +67,14 @@ function semverCompare(a, b) {
return 0;
}
// debug
function alert(text) {
dialog.showMessageBox(null, {
message: text,
buttons: ['Cancel']
});
}
/**
* Calls the Cassiopee update server to check for available updates;
* if so, displays a desktop notification which, if clicked, will
......@@ -121,11 +128,15 @@ const lookForUpdates = function() {
const latestVersionURL = URL + data[data.latest][platform];
// show notification on desktop
if (Notification.isSupported()) {
// @see https://stackoverflow.com/questions/41823184/how-to-get-icon-path-image-in-electron-builder
let iconPath = "assets/icons/electron/icon.png";
if (! app.isPackaged) {
iconPath = "dist/" + iconPath; // marche pas !? Comment obtenir le chemin de l'icône dans app.asar ?
}
let notif = new Notification({
title: `Cassiopee version ${data.latest} is available`,
body: `Click to download update installer`,
icon: "electron/icon.png"
icon: nativeImage.createFromPath(iconPath) // @see https://github.com/electron/electron/issues/24221
});
notif.addListener("click", () => {
// ask system to open URL with default browser
......
......@@ -2412,12 +2412,12 @@
},
"dependencies": {
"debug": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz",
"integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==",
"dev": true,
"requires": {
"ms": "^2.1.1"
"ms": "2.1.2"
}
},
"env-paths": {
......@@ -8094,9 +8094,9 @@
},
"dependencies": {
"@types/node": {
"version": "12.12.61",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.61.tgz",
"integrity": "sha512-+/KPk6uV9qGfVX0y2uUj3y8O0Z6KZWUy3XTS0uQGYYF+iXGtepm9GPETdcRq+hGmErkLOr5QJDX8vuymkwu4sA==",
"version": "12.12.62",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.62.tgz",
"integrity": "sha512-qAfo81CsD7yQIM9mVyh6B/U47li5g7cfpVQEDMfQeF8pSZVwzbhwU3crc0qG4DmpsebpJPR49AKOExQyJ05Cpg==",
"dev": true
}
}
......@@ -18322,12 +18322,12 @@
},
"dependencies": {
"debug": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz",
"integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==",
"dev": true,
"requires": {
"ms": "^2.1.1"
"ms": "2.1.2"
}
},
"ms": {
......
../android-chrome-512x512.png
\ No newline at end of file
  • David Dorchies :zany_face: @david.dorchies

    mentioned in issue #435 (closed)

    By Mathias Chouet on 2020-09-30T09:09:26 (imported from GitLab)

    ·

    mentioned in issue #435 (closed)

    By Mathias Chouet on 2020-09-30T09:09:26 (imported from GitLab)

    Toggle commit list
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment