Showing with 16 additions and 11 deletions.
  1. +14 −9 src/index.js
  2. +2 −2 src/quake.js
  3. BIN src/resources/IconWindows.ico
@@ -4,6 +4,14 @@ var osenv = require('osenv');
var fs = require('fs-extra');
var open = require('open');

require('crash-reporter').start();
var BrowserWindow = require('browser-window');
var app = require('app');
var Menu = require('menu');
var Tray = require('tray');
var ipc = require('ipc');
var electronReady = false;

var logger = require('./logger.js');

/*
@@ -30,11 +38,6 @@ if (!fs.existsSync(settingsPath)) {
// Import Modules
*/

require('crash-reporter').start();
var app = require('app');
var Menu = require('menu');
var Tray = require('tray');

var electron = require('./electron.js');
var notifier = require('./notifier.js');
var trigger = require('./trigger.js');
@@ -90,15 +93,18 @@ socket.on('disconnect', function(){
if (process.platform == 'darwin') app.dock.hide();

app.on('ready', function() {
electron.electronReady = true;
electronReady = true;

if (settings.first_run) {
electron.newSettings();
notifier.debug('First run, opening settings window...');
}

var appIcon = new Tray(path.join(__dirname, 'resources', 'IconTemplate.png'));
appIcon.setPressedImage(path.join(__dirname, 'resources', 'IconPressed.png'));
var appIcon, contextMenu;
if (process.platform == 'darwin') {
appIcon = new Tray(path.join(__dirname, 'resources', 'IconTemplate.png'));
appIcon.setPressedImage(path.join(__dirname, 'resources', 'IconPressed.png'));
} else appIcon = new Tray(path.join(__dirname, 'resources', 'IconWindows.ico'));

var nodev_template = [
{label: locale[lang].contribute,click: function(){open('https://github.com/lumios/eew');}},
@@ -122,7 +128,6 @@ app.on('ready', function() {
{label: locale[lang].quit,click: function(){notifier.debug('Closing Program due to User Request');process.exit(0);}}
];

var contextMenu;
if (settings.dev_mode) contextMenu = Menu.buildFromTemplate(dev_template);
else contextMenu = Menu.buildFromTemplate(nodev_template);

@@ -36,6 +36,7 @@ exports.parse = function(input) {
var message = template[1];

if (data.drill) logger.debug('Developer Quake Triggered, Parsing Fake Quake...');
if (!date.getHours() >= '07') logger.debug('Night Mode Enabled, Muting Notification...');
logger.info(data.earthquake_time + ' - ' + data.epicenter_en);
logger.info(locale.en.units.update + ' ' + situation_string + ', ' + locale.en.units.magnitude + ': ' + data.magnitude + ', ' + locale.en.units.seismic + ': ' + data.seismic_en);

@@ -44,11 +45,10 @@ exports.parse = function(input) {
notifier.notify(locale[lang].title, subtitle, message, sound_string);
// Night Notification
} else {
logger.debug('Night Mode Enabled, Muting Notification...');
notifier.notify(locale[lang].title, subtitle, message, false);
}

if (data.revision == 1 && electron.electronReady === true) {
if (data.revision == 1) {
var webContent = alertWindow.webContents;
webContent.on('did-finish-load', function() {
webContent.send('data', [data, template, locale]);
Binary file not shown.