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

Fix notif bugs #90

Merged
merged 4 commits into from
Jul 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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