diff --git a/index.html b/index.html
index 204e784..25c9e54 100644
--- a/index.html
+++ b/index.html
@@ -45,6 +45,28 @@
const notification = document.getElementById("notification");
const message = document.getElementById("message");
const restartButton = document.getElementById("restart-button");
+ ipcRenderer.on("checking-for-update", () => {
+ ipcRenderer.removeAllListeners("checking-for-update");
+ message.innerText = "Checking for updates...";
+ notification.classList.remove("hidden");
+ });
+ ipcRenderer.on("update-not-available", () => {
+ ipcRenderer.removeAllListeners("update-not-available");
+ message.innerText = "No updates available";
+ notification.classList.remove("hidden");
+ setTimeout(() => {
+ notification.classList.add("hidden");
+ }, 2000);
+
+ });
+ ipcRenderer.on("download-progress", (e, text) => {
+ message.innerText = "Downloading: " + text;
+ notification.classList.remove("hidden"); //tnrtodo comment this out
+ });
+ ipcRenderer.on("error", (e, text) => {
+ ipcRenderer.removeAllListeners("error");
+ message.innerText = "Error updating: " + text;
+ });
ipcRenderer.on("update_available", () => {
ipcRenderer.removeAllListeners("update_available");
message.innerText = "A new update is available. Downloading now...";
@@ -57,6 +79,7 @@
restartButton.classList.remove("hidden");
notification.classList.remove("hidden");
});
+
function closeNotification() {
notification.classList.add("hidden");
}
diff --git a/main.js b/main.js
index f94b3d3..d4f0232 100644
--- a/main.js
+++ b/main.js
@@ -56,6 +56,7 @@ async function createWindow(windowVars) {
await waitTillAppReady();
//if no windowVars are passed then we should
// Create the browser window.
+
let mainWindowState = windowStateKeeper({
defaultWidth: 1000,
defaultHeight: 800
@@ -198,19 +199,43 @@ app.on("activate", function() {
}
});
-autoUpdater.on("update-available", () => {
+function sendStatusToWindow(type, message) {
let browserWindows = BrowserWindow.getAllWindows();
- browserWindows && browserWindows.forEach(win => win.webContents.send("update_available"));
+ browserWindows &&
+ browserWindows.forEach(win => win.webContents.send(type, message));
+}
+autoUpdater.on("update-available", () => {
+ sendStatusToWindow("update_available");
});
autoUpdater.on("update-downloaded", () => {
- let browserWindows = BrowserWindow.getAllWindows();
- browserWindows && browserWindows.forEach(win => win.webContents.send("update_downloaded"));
+ sendStatusToWindow("update-downloaded");
+});
+autoUpdater.on("checking-for-update", () => {
+ sendStatusToWindow("checking-for-update");
+});
+autoUpdater.on("update-not-available", info => {
+ sendStatusToWindow("update-not-available");
+});
+autoUpdater.on("error", err => {
+ sendStatusToWindow("error", err);
+});
+autoUpdater.on("download-progress", progressObj => {
+ let log_message = "Download speed: " + progressObj.bytesPerSecond;
+ log_message = log_message + " - Downloaded " + progressObj.percent + "%";
+ log_message =
+ log_message +
+ " (" +
+ progressObj.transferred +
+ "/" +
+ progressObj.total +
+ ")";
+ sendStatusToWindow("download-progress", log_message);
});
-ipcMain.on('restart_app', () => {
+ipcMain.on("restart_app", () => {
setImmediate(() => {
autoUpdater.quitAndInstall();
- })
+ });
});
// 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 require them here.
diff --git a/package.json b/package.json
index 1262c43..874f7c1 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
- "name": "ove-electron",
- "version": "0.0.6",
+ "name": "ove",
+ "version": "0.0.7",
"description": "An open source vector/plasmid editor",
"main": "main.js",
"scripts": {
@@ -24,8 +24,8 @@
"mac": {
"hardenedRuntime": true,
"gatekeeperAssess": false,
- "/entitlements": "src/misc/entitlements.mac.plist",
- "/entitlementsInherit": "src/misc/entitlements.mac.plist"
+ "entitlements": "src/misc/entitlements.mac.plist",
+ "entitlementsInherit": "src/misc/entitlements.mac.plist"
},
"appId": "com.teselagen.openVectorEditor",
"fileAssociations": [
diff --git a/src/misc/notarize.js b/src/misc/notarize.js
index fb53c27..039b48c 100644
--- a/src/misc/notarize.js
+++ b/src/misc/notarize.js
@@ -9,7 +9,7 @@ exports.default = async function notarizing(context) {
const appName = context.packager.appInfo.productFilename;
return await notarize({
- appBundleId: 'com.teselagen.yourAppId',
+ appBundleId: 'com.teselagen.openVectorEditor',
appPath: `${appOutDir}/${appName}.app`,
appleId: process.env.APPLEID,
appleIdPassword: process.env.APPLEIDPASS,
diff --git a/src/utils/menu.js b/src/utils/menu.js
index 1234fbc..7be98c0 100644
--- a/src/utils/menu.js
+++ b/src/utils/menu.js
@@ -36,7 +36,7 @@ module.exports = function createMenu({ createWindow, getSeqJsonFromPath }) {
accelerator: "CmdOrCtrl+N",
click: () => {
createWindow({
- initialSeqJson: {}
+ initialSeqJson: undefined
});
}
},
diff --git a/yarn.lock b/yarn.lock
index 1a89349..ca269b9 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -998,6 +998,14 @@ electron-download@^4.1.0:
semver "^5.4.1"
sumchecker "^2.0.2"
+electron-notarize@^0.1.1:
+ version "0.1.1"
+ resolved "https://registry.yarnpkg.com/electron-notarize/-/electron-notarize-0.1.1.tgz#c3563d70c5e7b3315f44e8495b30050a8c408b91"
+ integrity sha512-TpKfJcz4LXl5jiGvZTs5fbEx+wUFXV5u8voeG5WCHWfY/cdgdD8lDZIZRqLVOtR3VO+drgJ9aiSHIO9TYn/fKg==
+ dependencies:
+ debug "^4.1.1"
+ fs-extra "^8.0.1"
+
electron-publish@21.2.0:
version "21.2.0"
resolved "https://registry.yarnpkg.com/electron-publish/-/electron-publish-21.2.0.tgz#cc225cb46aa62e74b899f2f7299b396c9802387d"
@@ -1524,7 +1532,7 @@ fs-extra@^4.0.1:
jsonfile "^4.0.0"
universalify "^0.1.0"
-fs-extra@^8.1.0:
+fs-extra@^8.0.1, fs-extra@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0"
integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==