Skip to content

Commit

Permalink
Merge branch 'development' of https://github.com/thomsbg/nativefier i…
Browse files Browse the repository at this point in the history
…nto thomsbg-development

# Conflicts:
#	app/src/main.js
  • Loading branch information
jiahaog committed Oct 9, 2016
2 parents f63f2e9 + f329350 commit b85bde4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 23 deletions.
30 changes: 15 additions & 15 deletions app/src/components/mainWindow/mainWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,20 +136,24 @@ function createMainWindow(options, onAppQuit, setDockBadge) {
});

if (options.counter) {
mainWindow.on('page-title-updated', () => {
if (mainWindow.isFocused()) {
return;
mainWindow.on('page-title-updated', (e, title) => {
const itemCountRegex = /[\(\[{](\d*?)[}\]\)]/;
const match = itemCountRegex.exec(title);
if (match) {
setDockBadge(match[1]);
} else {
setDockBadge('');
}

if (options.counter) {
const itemCountRegex = /[\(\[{](\d*?)[}\]\)]/;
const match = itemCountRegex.exec(mainWindow.getTitle());
if (match) {
setDockBadge(match[1]);
}
});
} else {
ipcMain.on('notification', () => {
if (!isOSX() || mainWindow.isFocused()) {
return;
}
setDockBadge('●');
setDockBadge('•');
});
mainWindow.on('focus', () => {
setDockBadge('');
});
}

Expand All @@ -168,10 +172,6 @@ function createMainWindow(options, onAppQuit, setDockBadge) {

mainWindow.loadURL(options.targetUrl);

mainWindow.on('focus', () => {
setDockBadge('');
});

mainWindow.on('close', event => {
if (mainWindow.isFullScreen()) {
mainWindow.setFullScreen(false);
Expand Down
9 changes: 1 addition & 8 deletions app/src/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'source-map-support/register';
import fs from 'fs';
import path from 'path';
import {app, ipcMain, crashReporter} from 'electron';
import {app, crashReporter} from 'electron';
import createLoginWindow from './components/login/loginWindow';
import createMainWindow from './components/mainWindow/mainWindow';
import helpers from './helpers/helpers';
Expand Down Expand Up @@ -81,10 +81,3 @@ app.on('login', (event, webContents, request, authInfo, callback) => {
event.preventDefault();
createLoginWindow(callback);
});

ipcMain.on('notification', () => {
if (!isOSX() || mainWindow.isFocused()) {
return;
}
setDockBadge('●');
});

0 comments on commit b85bde4

Please sign in to comment.