Skip to content

Commit

Permalink
v3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sidneys committed Jan 19, 2017
1 parent f81621a commit dd43d21
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 85 deletions.
5 changes: 0 additions & 5 deletions app/html/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@
</div>
</div>

<div id="titlebar"
class="draggable">
</div>

<webview id="webview"
class="draggable"

src="https://pushbullet.com"
preload="../scripts/renderer/inject.js"
Expand Down
118 changes: 78 additions & 40 deletions app/scripts/renderer/inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,42 @@ const pbPush = require(path.join(appRootPath, 'app', 'scripts', 'renderer', 'pus
* @global
* @default
*/
let defaultPollingInterval = 1000;
let defaultInterval = 1000;


/**
* Remove setup menu item
* User Interface tweaks
*/
let registerInterfaceOptimizations = () => {
let applyInterfaceOptimizations = () => {
logger.debug('inject', 'applyInterfaceOptimizations()');

let pollingInterval = setTimeout(() => {
// Header: remove shadow
let header = document.getElementById('mobile-header') || document.getElementById('header');
header.style.boxShadow = 'none';

// Sink: transparent background
let sink = document.getElementById('sink');
sink.style.backgroundColor = 'transparent';

// Dark areas: transparent background
document.querySelectorAll('div').forEach((el) => {
if (el.style.backgroundColor === 'rgb(149, 165, 166)') {
el.style.backgroundColor = 'transparent';
}
});

clearInterval(pollingInterval);
}, defaultInterval, this);

};

/**
* Navigation tweaks
*/
let registerNavigationOptimizations = () => {
logger.debug('inject', 'registerNavigationOptimizations()');

let pollingInterval = setInterval(() => {
if (!window.pb) { return; }

Expand All @@ -64,34 +93,36 @@ let registerInterfaceOptimizations = () => {
// Set initial view
window.onecup['goto']('/#people');

// Optimize header layout
let header = document.getElementById('mobile-header') || document.getElementById('header');
header.style.boxShadow = 'none';
applyInterfaceOptimizations();

clearInterval(pollingInterval);
}, defaultPollingInterval, this);
}, defaultInterval, this);
};

/**
* Proxy pb.ws
*/
let registerErrorProxyobject = () => {
let pollingInterval = setInterval(function() {
logger.debug('inject', 'registerErrorProxyobject()');

let pollingInterval = setInterval(() => {
if (!window.pb) { return; }
window.pb.error = new Proxy(window.pb.error, {
set: function(target, name, value) {
target[name] = value;
}
});
clearInterval(pollingInterval);
}, defaultPollingInterval, this);
}, defaultInterval, this);
};

/**
* Proxy pb.api.pushes.objs
*/
let registerPushProxyobject = () => {
let pollingInterval = setInterval(function() {
logger.debug('inject', 'registerPushProxyobject()');

let pollingInterval = setInterval(() => {
if (!window.pb) { return; }

window.pb.api.pushes.objs = new Proxy(window.pb.api.pushes.objs, {
Expand All @@ -117,20 +148,21 @@ let registerPushProxyobject = () => {

pushesObj[iden] = newPush;

// DEBUG
logger.debug('inject', 'proxy', 'iden', iden, 'appIsTarget', appIsTarget, 'pushExists', pushExists);
}
});

clearInterval(pollingInterval);
}, defaultPollingInterval, this);
}, defaultInterval, this);
};

/**
* Listen for Pushbullet Stream
*/
let registerWebsocketListeners = () => {
let pollingInterval = setInterval(function() {
logger.debug('inject', 'registerWebsocketListeners()');

let pollingInterval = setInterval(() => {
if (!window.pb) { return; }

/**
Expand Down Expand Up @@ -166,35 +198,18 @@ let registerWebsocketListeners = () => {
});

clearInterval(pollingInterval);
}, defaultPollingInterval, this);
}, defaultInterval, this);
};


/**
* Add native context menus
* @listens window:PointerEvent#contextmenu
*/
window.addEventListener('contextmenu', (ev) => {
if (!ev.target['closest']('textarea, input, [contenteditable="true"]')) { return; }

let menu = editorContextMenu();

let menuTimeout = setTimeout(function() {
menu.popup(remote.getCurrentWindow());
return clearTimeout(menuTimeout);
}, 60);
});


/**
* Initialize
*/
let initialize = () => {
/**
* @listens connectivityService#online
*/
/** @listens connectivityService#on */
connectivityService.once('online', () => {
registerInterfaceOptimizations();
logger.debug('inject', 'connectivityService#on');

registerNavigationOptimizations();
registerErrorProxyobject();
registerPushProxyobject();
registerWebsocketListeners();
Expand All @@ -211,15 +226,38 @@ let initialize = () => {
location.reload();
}

// DEBUG
logger.debug('window:load', 'reachable', connectivityService.online);

});
};


/**
* @listens window:Event#load
*/
/** @listens window#resize */
window.addEventListener('resize', () => {
logger.debug('inject', 'window#resize');

applyInterfaceOptimizations();
});

/** @listens window#contextmenu */
window.addEventListener('contextmenu', (ev) => {
logger.debug('inject', 'window#contextmenu');

if (!ev.target['closest']('textarea, input, [contenteditable="true"]')) {
return;
}

let menu = editorContextMenu();

let menuTimeout = setTimeout(() => {
menu.popup(remote.getCurrentWindow());
return clearTimeout(menuTimeout);
}, 60);
});

/** @listens window#on */
window.addEventListener('load', () => {
logger.debug('inject', 'window#load');

initialize();
});

4 changes: 2 additions & 2 deletions app/scripts/services/connectivity-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ const isOnline = require('is-online');
* @constant
*/
const defaultHostnameList = ['www.google.com'];
const defaultTimeout = 3000;
const defaultInterval = 20000;
const defaultTimeout = 2000;
const defaultInterval = 10000;


/**
Expand Down
3 changes: 2 additions & 1 deletion app/scripts/services/updater-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const semverCompare = require('semver-compare');
*/
const packageJson = require(path.join(appRootPath, 'package.json'));
const platformHelper = require(path.join(appRootPath, 'lib', 'platform-helper'));
const isDebug = require(path.join(appRootPath, 'lib', 'is-debug'));
const logger = require(path.join(appRootPath, 'lib', 'logger'))({ writeToFile: true });
const messengerService = require(path.join(appRootPath, 'app', 'scripts', 'services', 'messenger-service'));

Expand Down Expand Up @@ -162,7 +163,7 @@ let bumpInternalVersion = () => {
app.on('ready', () => {
logger.debug('updater-service', 'App:ready');

//if (isDebug) { return; }
if (isDebug) { return; }

try {
updateManager = new UpdateManager();
Expand Down
10 changes: 6 additions & 4 deletions app/scripts/windows/main-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,19 @@ class MainWindow extends BrowserWindow {
constructor() {
super({
acceptFirstMouse: true,
autoHideMenuBar: true,
backgroundColor: '#4AB367',
frame: !platformHelper.isMacOS,
autoHideMenuBar: false,
backgroundColor: platformHelper.isMacOS ? '#0095A5A6' : '#95A5A6',
frame: true,
fullscreenable: true,
icon: appIcon,
minHeight: 512,
minWidth: 256,
show: false,
thickFrame: true,
title: appProductName,
titleBarStyle: platformHelper.isMacOS ? 'hidden-inset' : 'default',
titleBarStyle: 'default',
transparent: false,
vibrancy: 'dark',
webPreferences: {
nodeIntegration: true,
allowDisplayingInsecureContent: true,
Expand Down
32 changes: 1 addition & 31 deletions app/styles/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ html {
overflow: hidden;
}


/* body
========================================================================== */

Expand All @@ -30,7 +29,6 @@ body {
overflow: hidden;
}


/* ==========================================================================
STATES
========================================================================== */
Expand All @@ -42,7 +40,6 @@ body {
-webkit-app-region: drag;
}


/* ==========================================================================
WEBVIEW
========================================================================== */
Expand All @@ -57,28 +54,6 @@ webview {
justify-content: space-between;
}


/* ==========================================================================
TITLE BAR
========================================================================== */

/* #titlebar-background
========================================================================== */

#titlebar {
display: block;
}

html:not('.darwin') #titlebar {
display: none;
}

html.darwin #titlebar {
display: block;
height: 20px;
}


/* ==========================================================================
SPINNER
========================================================================== */
Expand Down Expand Up @@ -232,7 +207,6 @@ html.darwin #titlebar {
pointer-events: auto;
}


/* spinner__statustext
========================================================================== */

Expand All @@ -243,8 +217,7 @@ html.darwin #titlebar {
color: white;
text-align: center;
font-size: 1.25rem;
}

}

/* ==========================================================================
ANIMATIONS
Expand Down Expand Up @@ -300,8 +273,6 @@ html.darwin #titlebar {
}
}



/* ==========================================================================
CONTROLS
========================================================================== */
Expand Down Expand Up @@ -335,7 +306,6 @@ html.darwin #titlebar {
background-color: rgba(255, 255, 255, 1.0);
}


/* controls__button
========================================================================== */

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "pb-for-desktop",
"productName": "PB for Desktop",
"version": "3.1.0",
"version": "3.2.0",
"description": "PushBullet desktop application for macOS, Windows and Linux",
"license": "MIT",
"homepage": "https://sidneys.github.io/pb-for-desktop",
Expand Down Expand Up @@ -70,7 +70,7 @@
},
"devDependencies": {
"electron": "^1.4.14",
"electron-builder": "^11.3.0",
"electron-builder": "^11.4.4",
"electron-builder-squirrel-windows": "^11.4.0",
"fkill": "^4.1.0",
"glob": "^7.1.1",
Expand Down

0 comments on commit dd43d21

Please sign in to comment.