Skip to content
This repository was archived by the owner on Nov 10, 2020. It is now read-only.

Commit

Permalink
Merge pull request #90 from tahnik/fix_notif_bugs
Browse files Browse the repository at this point in the history
Fix notif bugs
  • Loading branch information
tahnik authored Jul 21, 2017
2 parents 414dae7 + a1d1d3c commit d265d3e
Show file tree
Hide file tree
Showing 5 changed files with 648 additions and 4,485 deletions.
20 changes: 18 additions & 2 deletions app/src/main/app.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
const electron = require('electron');

const { app, BrowserWindow, Menu, Tray } = electron;
const { app, BrowserWindow, Menu, Tray, ipcMain } = electron;

const https = require('https');
const os = require('os');
const path = require('path');
const url = require('url');
const { ipcMain } = require('electron');
const { autoUpdater } = require('electron-updater');

const notify = require(path.join(__dirname, '/modules/notify.js'));
Expand Down Expand Up @@ -74,6 +73,23 @@ function initTray() {
function createWindow() {
notify.init();

// Some shortcuts to make development easier.
if (process.env.NODE_ENV === 'development') {
const { globalShortcut } = electron;

const showNotifGlobal = globalShortcut.register('CommandOrControl+Alt+N', () => {
notify.show({
body: 'This is a test notification.',
content: { comment_id: 728393, created_time: 1500665102, rant_id: 538347, read: 0, type: 'comment_mention', uid: 719925 },
id: 538347,
});
});

if (!showNotifGlobal) {
console.warn('registration failed :(');
}
}

// Send usage data to firebase
if (process.env.NODE_ENV !== 'development') {
let plat = '';
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/modules/notification.html
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ <h4 id="header">USER</h4>
}

function calcPos() {
main.ui().setSize(460, document.getElementById('app').scrollHeight - 13);
main.ui().setSize(444, document.getElementById('app').scrollHeight - 13);
setTimeout(()=>{
var np = screen.getDisplayNearestPoint(screen.getCursorScreenPoint());
var ap = screen.getCursorScreenPoint();
Expand All @@ -261,7 +261,7 @@ <h4 id="header">USER</h4>
np.workArea.y + 12
)
}
}, 65)
}, 100)
}

window.onbeforeunload = (e) => {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/modules/notify.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function notifyLinux(opt) {
let w;
function initUI() {
w = new BrowserWindow({
width: 460,
width: 444,
height: 172,
frame: false,
show: false,
Expand Down
Loading

0 comments on commit d265d3e

Please sign in to comment.