diff --git a/browser/main/index.electron.html b/browser/main/index.electron.html index 951b8166..0d9c5205 100644 --- a/browser/main/index.electron.html +++ b/browser/main/index.electron.html @@ -1,7 +1,7 @@ - CodeXen + CodeXen v0.2.0 diff --git a/browser/styles/mixins/ui.styl b/browser/styles/mixins/util.styl similarity index 61% rename from browser/styles/mixins/ui.styl rename to browser/styles/mixins/util.styl index c99d24d6..c6913cf1 100644 --- a/browser/styles/mixins/ui.styl +++ b/browser/styles/mixins/util.styl @@ -1,3 +1,7 @@ +borderBox() + box-sizing border-box + noSelect() -webkit-user-select none -webkit-app-region drag + diff --git a/main.js b/main.js index 4d00f612..852225c8 100644 --- a/main.js +++ b/main.js @@ -1,6 +1,7 @@ var app = require('app') var BrowserWindow = require('browser-window') var Menu = require('menu') +var MenuItem = require('menu-item') var Tray = require('tray') require('crash-reporter').start() @@ -10,11 +11,54 @@ var appIcon = null var menu = null var popUpWindow = null +var update = null + // app.on('window-all-closed', function () { // if (process.platform !== 'darwin') app.quit() // }) +var version = '0.2.0' +var nn = require('node-notifier') +var autoUpdater = require('auto-updater') + +autoUpdater + .on('error', function (err, message) { + nn.notify({ + title: 'Boost Update Center Ver. ' + version, + message: message + }) + }) + .on('checking-for-update', function () { + nn.notify({ + title: 'Boost Update Center Ver. ' + version, + message: 'Hello from Main processor, Mr. User!' + }) + }) + .on('update-available', function () { + nn.notify({ + title: 'Boost Update Center Ver. ' + version, + message: 'Update is available. Starting download latest build...' + }) + }) + .on('update-not-available', function () { + nn.notify({ + title: 'Boost Update Center Ver. ' + version, + message: 'Latest Build :D' + }) + }) + .on('update-downloaded', function (event, releaseNotes, releaseName, releaseDate, updateUrl, quitAndUpdate) { + nn.notify({ + title: 'Boost Update Center Ver. ' + version, + message: 'Ready to Update: ' + releaseName + }) + update = quitAndUpdate + }) + + app.on('ready', function () { + console.log('Version ' + version) + autoUpdater.setFeedUrl('http://localhost:8000/testcat/test/latest?version=' + version) + autoUpdater.checkForUpdates() // menu start var template = require('./modules/menu-template') @@ -24,12 +68,32 @@ app.on('ready', function () { // menu end appIcon = new Tray(__dirname + '/tray-icon.png') appIcon.setToolTip('Codexen') - appIcon.on('clicked', function () { - if (mainWindow == null) { - makeNewMainWindow() + + var trayMenu = new Menu() + trayMenu.append(new MenuItem({ + label: 'Open main window', + click: function () { + if (mainWindow == null) { + makeNewMainWindow() + } + mainWindow.show() } - mainWindow.show() - }) + })) + trayMenu.append(new MenuItem({ + label: 'Update App', + click: function () { + if (update != null) { + update() + } + } + })) + trayMenu.append(new MenuItem({ + label: 'Quit', + click: function () { + app.quit() + } + })) + appIcon.setContextMenu(trayMenu) makeNewMainWindow() diff --git a/package.json b/package.json index 915bb8ce..74ba6db6 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "description": "CodeXen App", "main": "main.js", "scripts": { - "start": "npm run serve | npm run dev", + "start": "electron ./main.js", + "web": "npm run serve | npm run dev", "serve": "./node_modules/.bin/http-server ./browser -p 8080", "dev": "webpack-dev-server --progress --colors --port 8090" }, @@ -39,6 +40,7 @@ "moment": "^2.10.3", "nib": "^1.1.0", "node-jsx": "^0.13.3", + "node-notifier": "^4.2.3", "react": "^0.13.3", "react-router": "^0.13.3", "react-select": "^0.5.4", @@ -58,6 +60,9 @@ "standard": { "ignore": [ "/browser/ace/" + ], + "global": [ + "localStorage" ] } } diff --git a/readme.md b/readme.md index cfe6a27b..f08d4273 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -# CodeXen app +# CodeXen app 0.2.0 ![CodeXen](app-logo.png) Short code(Snippet/Templatefile/Command) storage + boosting service