Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
nblthree committed Oct 14, 2019
1 parent 3f178d7 commit c43489c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
15 changes: 10 additions & 5 deletions main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { join } = require('path');
const { BrowserWindow, app, Tray, dialog } = require('electron');
const isDev = require('electron-is-dev');
const prepareNext = require('electron-next');
// Const { autoUpdater } = require('electron-updater');
const { autoUpdater } = require('electron-updater');

const prepareIpc = require('./ipc');
const getContextMenu = require('./context-menu');
Expand Down Expand Up @@ -40,10 +40,6 @@ process.on('unhandledRejection', error => {

// Prepare the renderer once the app is ready
app.on('ready', async () => {
/* If (!isDev) {
autoUpdater.checkForUpdatesAndNotify();
} */

await prepareNext('./renderer');

const mainWindow = new BrowserWindow({
Expand Down Expand Up @@ -114,6 +110,15 @@ app.on('ready', async () => {

if (isDev) {
mainWindow.webContents.openDevTools();
} else {
autoUpdater.checkForUpdatesAndNotify();
autoUpdater.on('update-available', () => {
mainWindow.webContents.send('update_available');
});
autoUpdater.on('update-downloaded', () => {
mainWindow.webContents.send('update_downloaded');
autoUpdater.quitAndInstall();
});
}

const url = isDev
Expand Down
13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@
"productName": "AniTV",
"description": "Download and watch your preferred seasonal anime and get notified whenever a new episode is available",
"version": "1.0.5",
"repository": "MarchWorks/anitv",
"repository": {
"type" : "git",
"url" : "https://github.com/MarchWorks/anitv.git"
},
"main": "main/index.js",
"scripts": {
"dev": "electron .",
"build": "yarn build-renderer && yarn build-app",
"deploy": "yarn build-renderer && yarn deploy-app",
"build-app": "electron-builder",
"deploy-app": "electron-builder build --publish always",
"build-renderer": "cross-env NODE_ENV=production next build renderer && next export renderer",
"test": "yarn test-lint",
"test-lint": "xo",
Expand All @@ -23,9 +28,9 @@
],
"win": {
"icon": "main/static/icons/icon.png",
"publish": [
"github"
]
"publish": {
"provider": "github"
}
},
"mac": {
"icon": "main/static/icons/icon.png",
Expand Down

0 comments on commit c43489c

Please sign in to comment.