Skip to content

Commit

Permalink
bumping
Browse files Browse the repository at this point in the history
  • Loading branch information
tnrich committed Sep 23, 2019
1 parent f9f0b6d commit 3576a79
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 13 deletions.
23 changes: 23 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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...";
Expand All @@ -57,6 +79,7 @@
restartButton.classList.remove("hidden");
notification.classList.remove("hidden");
});

function closeNotification() {
notification.classList.add("hidden");
}
Expand Down
37 changes: 31 additions & 6 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand All @@ -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": [
Expand Down
2 changes: 1 addition & 1 deletion src/misc/notarize.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module.exports = function createMenu({ createWindow, getSeqJsonFromPath }) {
accelerator: "CmdOrCtrl+N",
click: () => {
createWindow({
initialSeqJson: {}
initialSeqJson: undefined
});
}
},
Expand Down
10 changes: 9 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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==
Expand Down

0 comments on commit 3576a79

Please sign in to comment.