Skip to content

Commit

Permalink
Merge branch 'master' into prepare-0.0.16
Browse files Browse the repository at this point in the history
Conflicts:
	package.json
  • Loading branch information
Emmanouil Konstantinidis committed Aug 30, 2015
2 parents 3cf6aa5 + c12102d commit 1867f18
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 3 deletions.
55 changes: 53 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
var app = require('app');
var path = require('path');
var ipc = require('ipc');
var ghReleases = require('electron-gh-releases');

require('crash-reporter').start();

var Menu = require('menu');
var Tray = require('tray');
var BrowserWindow = require('browser-window');
var AutoLaunch = require('auto-launch');
var BrowserWindow = require('browser-window');
var dialog = require('dialog');

var iconIdle = path.join(__dirname, 'images', 'tray-idleTemplate.png');
var iconActive = path.join(__dirname, 'images', 'tray-active.png');
Expand Down Expand Up @@ -45,6 +47,7 @@ app.on('ready', function(){
appIcon.window.setVisibleOnAllWorkspaces(true);

initMenu();
checkAutoUpdate();
}

function showWindow (bounds) {
Expand Down Expand Up @@ -89,6 +92,55 @@ app.on('ready', function(){
appIcon.window.hide();
}

function checkAutoUpdate() {

var autoUpdateOptions = {
repo: 'ekonstantinidis/gitify',
currentVersion: app.getVersion()
};

var update = new ghReleases(autoUpdateOptions, function (autoUpdater) {
autoUpdater
.on('error', function(event, message) {
console.log('ERRORED.');
console.log('Event: ' + JSON.stringify(event) + '. MESSAGE: ' + message);
})
.on('update-downloaded', function (event, releaseNotes, releaseName,
releaseDate, updateUrl, quitAndUpdate) {
console.log('Update downloaded');
confirmAutoUpdate(quitAndUpdate);
});
});

// Check for updates
update.check(function (err, status) {
if (err || !status) {
app.dock.hide();
}

if (!err && status) {
update.download();
}
});
}

function confirmAutoUpdate(quitAndUpdate) {
dialog.showMessageBox({
type: 'question',
buttons: ['Update & Restart', 'Cancel'],
title: 'Update Available',
cancelId: 99,
message: 'There is an update available. Would you like to update Gitify now?'
}, function (response) {
console.log('Exit: ' + response);
app.dock.hide();
if (response === 0) {
quitAndUpdate();
}
}
);
}

ipc.on('reopen-window', function() {
appIcon.window.show();
});
Expand All @@ -113,6 +165,5 @@ app.on('ready', function(){
app.quit();
});

app.dock.hide();
appIcon.setToolTip('GitHub Notifications on your menu bar.');
});
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"watch-js": "watchify -t babelify src/js/app.js -o build/js/app.js -v",
"watch": "npm run build && grunt build && npm run watch-js & grunt watch",
"start": "electron .",
"dist": "electron-packager . Gitify --overwrite --platform=darwin --arch=x64 --version=0.31.0 --asar=true --icon=images/app-icon.icns --prune --ignore='src' --ignore='coverage'",
"dist": "electron-packager . Gitify --overwrite --platform=darwin --arch=x64 --version=0.31.0 --asar=true --icon=images/app-icon.icns --prune --ignore='src' --ignore='coverage' && bash scripts/codesign.bash",
"lint": "eslint 'src/js/' 'src/js/app.js' 'main.js'",
"test": "npm run lint && jest"
},
Expand Down Expand Up @@ -78,6 +78,7 @@
"babelify": "=6.1.3",
"bootstrap": "=3.3.5",
"browserify": "=11.0.1",
"electron-gh-releases": "=1.0.1",
"font-awesome": "=4.4.0",
"octicons": "=2.4.1",
"react": "=0.13.3",
Expand Down
1 change: 1 addition & 0 deletions scripts/codesign.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
codesign --verbose --deep --force --sign "Developer ID Application: Emmanouil KONSTANTINIDIS" Gitify-darwin-x64/Gitify.app

0 comments on commit 1867f18

Please sign in to comment.