Compare commits

...

32 Commits

Author SHA1 Message Date
akashnimare
297b307726 update electron-builder to v13.0.0 2017-02-07 14:20:43 +05:30
akashnimare
deed66973f update electron-builder to v13.0.0 2017-02-07 14:20:17 +05:30
akashnimare
03486e438d remove release name+notes details from autoupdater 2017-02-07 14:17:04 +05:30
Akash Nimare
e113f59aad Bump electron-builder to 12.3.1 2017-02-06 02:30:35 +05:30
Akash Nimare
29ece4824a Merge pull request #105 from zulip/nsis
🎉 switched to NSIS + autoupdates
2017-02-06 01:23:55 +05:30
akashnimare
66c62c55e2 fixed logger undefined error 2017-02-06 01:09:03 +05:30
akashnimare
40852942d2 fixed releaseName undefined error 2017-02-02 16:41:52 +05:30
akashnimare
15c8591691 windows installer >> install per all users 2017-02-02 16:16:32 +05:30
akashnimare
e21902a5e3 🆙 electron-updater to 1.4.1 2017-02-02 15:37:10 +05:30
akashnimare
a5d42e8ccd log whats happening in auto-updater 2017-02-02 12:06:13 +05:30
akashnimare
0923df7250 import autoupdater 2017-02-02 11:52:27 +05:30
akashnimare
37f5258210 updated to electron-builder's latest version 2017-02-02 11:07:31 +05:30
akashnimare
19819f7d48 squirrel startup is not needed for NSIS 2017-01-28 21:21:52 +05:30
akashnimare
40f74cdac2 removed auto updater feed 2017-01-28 13:44:07 +05:30
akashnimare
e4ba3b9721 Added electron-updater dependency autoupdates 2017-01-28 13:21:41 +05:30
akashnimare
9a221585b9 set target to NSIS 2017-01-27 11:23:13 +05:30
Akash Nimare
069a0ff306 Added iconUrl to win.build 2017-01-26 02:10:17 +05:30
akashnimare
3153fb91da 🚀 Added back/forward navigation 2017-01-26 01:30:21 +05:30
Akash Nimare
92d4d27fa8 Added app icon >> windows installer 2017-01-26 00:50:50 +05:30
Akash Nimare
209fc4a65c Added squirrel-windows dependency 2017-01-26 00:47:55 +05:30
Akash Nimare
5e9ecedecd Updated electron-builder to v11.5.1 2017-01-25 23:48:30 +05:30
Akash Nimare
613df32bf1 Updated Prerequisites 2017-01-25 23:03:35 +05:30
Akash Nimare
7606f37695 Merge pull request #102 from zulip/dev
update spellchecker to v1.0.0
2017-01-25 22:55:36 +05:30
akashnimare
a2f758a46b spellchecker v1.0.0 2017-01-24 13:03:05 +05:30
akashnimare
2a477abe5f Added log-out shortcut 2017-01-14 23:43:09 +05:30
akashnimare
5f027820f4 ✏️ small typos fixed 2017-01-14 22:42:28 +05:30
Akash Nimare
9e75861546 Fixing travis test (linux) 2017-01-07 17:50:56 +05:30
akashnimare
4060596474 🎨 fixed linting errors 2017-01-07 17:27:54 +05:30
Akash Nimare
2e5888c8af Merge pull request #96 from jajodiaraghav/add_clear_cache_option
Added Clear-cache option in menu
2017-01-07 17:07:09 +05:30
Raghav Jajodia
03d1188e14 Added clear cache option 2017-01-07 17:00:03 +05:30
Raghav Jajodia
c91b0c209a Added clear cache option 2017-01-07 15:58:19 +05:30
Raghav Jajodia
f9f70f001b Added clear cache option 2017-01-02 13:50:19 +05:30
11 changed files with 148 additions and 37 deletions

View File

@@ -14,10 +14,10 @@ multi-account, auto-updates etc.
## Prerequisites ## Prerequisites
* node >= v6.3.1 * node >= v6.3.1
* npm >= 3.10.3 * npm >= 3.10.3
* If you're on Debian or Ubuntu, you'll also need to install * python (v2.7.x recommended)
`nodejs-legacy`: * If you're on Debian or Ubuntu, you'll need to install following packages:
```sh ```sh
$ sudo apt-get install nodejs-legacy $ sudo apt-get install nodejs-legacy build-essential libxext-dev libxtst-dev libxkbfile-dev
``` ```
## Installation ## Installation

View File

@@ -1,40 +1,46 @@
'use strict'; 'use strict';
const os = require('os'); // const os = require('os');
const {app, autoUpdater, dialog} = require('electron'); const {app, dialog} = require('electron');
const {autoUpdater} = require('electron-updater');
const version = app.getVersion(); // We don't need to call all of these since it's automatically handled by electron-updater
const platform = os.platform() + '_' + os.arch(); // usually returns darwin_64 // const version = app.getVersion();
// const platform = os.platform() + '_' + os.arch(); // usually returns darwin_64
const updaterFeedURL = 'http://zulipdesktop.herokuapp.com/update/' + platform + '/' + version; // const updaterFeedURL = 'http://zulipdesktop.herokuapp.com/update/' + platform + '/' + version;
function appUpdater() { function appUpdater() {
autoUpdater.setFeedURL(updaterFeedURL); // autoUpdater.setFeedURL(updaterFeedURL);
// Log whats happening // Log whats happening
const log = require('electron-log');
log.transports.file.level = 'info';
autoUpdater.logger = log;
// TODO send autoUpdater events to renderer so that we could // TODO send autoUpdater events to renderer so that we could
// it could console log in developer tools // it could console log in developer tools
/*
autoUpdater.on('error', err => console.log(err)); autoUpdater.on('error', err => console.log(err));
autoUpdater.on('checking-for-update', () => console.log('checking-for-update')); autoUpdater.on('checking-for-update', () => console.log('checking-for-update'));
autoUpdater.on('update-available', () => console.log('update-available')); autoUpdater.on('update-available', () => console.log('update-available'));
autoUpdater.on('update-not-available', () => console.log('update-not-available')); autoUpdater.on('update-not-available', () => console.log('update-not-available'));
*/
// Ask the user if update is available // Ask the user if update is available
autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => { autoUpdater.on('update-downloaded', (event, info) => {
let message = app.getName() + ' ' + releaseName + ' is now available. It will be installed the next time you restart the application.'; // let message = app.getName() + ' ' + info.releaseName + ' is now available. It will be installed the next time you restart the application.';
if (releaseNotes) { // if (info.releaseNotes) {
const splitNotes = releaseNotes.split(/[^\r]\n/); // const splitNotes = info.releaseNotes.split(/[^\r]\n/);
message += '\n\nRelease notes:\n'; // message += '\n\nRelease notes:\n';
splitNotes.forEach(notes => { // splitNotes.forEach(notes => {
message += notes + '\n\n'; // message += notes + '\n\n';
}); // });
} // }
// Ask user to update the app // Ask user to update the app
dialog.showMessageBox({ dialog.showMessageBox({
type: 'question', type: 'question',
buttons: ['Install and Relaunch', 'Later'], buttons: ['Install and Relaunch', 'Later'],
defaultId: 0, defaultId: 0,
message: 'A new version of ' + app.getName() + ' has been downloaded', message: 'A new version of ' + app.getName() + ' has been downloaded',
detail: message detail: 'It will be installed the next time you restart the application'
}, response => { }, response => {
if (response === 0) { if (response === 0) {
setTimeout(() => autoUpdater.quitAndInstall(), 1); setTimeout(() => autoUpdater.quitAndInstall(), 1);

View File

@@ -29,7 +29,7 @@ window.addDomain = function () {
ipcRenderer.send('new-domain', domain); ipcRenderer.send('new-domain', domain);
} else { } else {
document.getElementById('main').innerHTML = 'Connect'; document.getElementById('main').innerHTML = 'Connect';
document.getElementById('server-status').innerHTML = 'Not a vaild Zulip Server.'; document.getElementById('server-status').innerHTML = 'Not a valid Zulip Server.';
} }
}); });
}; };

View File

@@ -16,10 +16,11 @@ const {appUpdater} = require('./autoupdater');
const db = new JsonDB(app.getPath('userData') + '/domain.json', true, true); const db = new JsonDB(app.getPath('userData') + '/domain.json', true, true);
const data = db.getData('/'); const data = db.getData('/');
// Handling squirrel.windows events on windows /* Handling squirrel.windows events on windows
Update - Not needed for NSIS
if (require('electron-squirrel-startup')) { if (require('electron-squirrel-startup')) {
app.quit(); app.quit();
} } */
// adds debug features like hotkeys for triggering dev tools and reload // adds debug features like hotkeys for triggering dev tools and reload
require('electron-debug')(); require('electron-debug')();

View File

@@ -0,0 +1,69 @@
// Adopted from
// https://github.com/wozaki/twitter-js-apps/blob/9bc00eafd575fd180dc7a450e1b1daf425e67b80/redux/src/main/renderer/registries/electron/swipeNavigatorImpl.js
'use strict'
const {remote} = require('electron');
const THRESHOLD_DELTA_X = 70;
const THRESHOLD_LIMIT_DELTA_Y = 50;
const THRESHOLD_TIME = 50;
// TODO avoid module global state
let tracking = false;
let deltaX = 0;
let deltaY = 0;
let startTime = 0;
let time = 0;
module.exports.register = function register() {
remote.getCurrentWindow()
.on('scroll-touch-begin', onScrollBegin)
.on('scroll-touch-end', onScrollEnd)
.on('swipe', onSwipe)
window.addEventListener('wheel', onMouseWheel, {passive: true});
window.addEventListener('beforeunload', remove);
}
const remove = module.exports.remove = function remove() {
remote.getCurrentWindow()
.removeListener('scroll-touch-begin', onScrollBegin)
.removeListener('scroll-touch-end', onScrollEnd)
.removeListener('swipe', onSwipe)
window.removeEventListener('mousewheel', onMouseWheel);
window.removeEventListener('beforeunload', remove);
}
function onSwipe(e, direction) {
if (direction === 'left')
remote.getCurrentWebContents().goBack()
else if (direction === 'right')
remote.getCurrentWebContents().goForward()
}
function onMouseWheel(e) {
if (tracking) {
deltaX = deltaX + e.deltaX
deltaY = deltaY + e.deltaY
time = (new Date()).getTime() - startTime
}
}
function onScrollBegin() {
tracking = true
startTime = (new Date()).getTime()
}
function onScrollEnd() {
if (time > THRESHOLD_TIME && tracking && Math.abs(deltaY) < THRESHOLD_LIMIT_DELTA_Y)
if (deltaX > THRESHOLD_DELTA_X)
remote.getCurrentWebContents().goForward()
else if (deltaX < -THRESHOLD_DELTA_X)
remote.getCurrentWebContents().goBack()
tracking = false
deltaX = 0
deltaY = 0
startTime = 0
}

View File

@@ -2,6 +2,8 @@
const os = require('os'); const os = require('os');
const electron = require('electron'); const electron = require('electron');
const {dialog} = require('electron');
const app = electron.app; const app = electron.app;
const BrowserWindow = electron.BrowserWindow; const BrowserWindow = electron.BrowserWindow;
const shell = electron.shell; const shell = electron.shell;
@@ -19,6 +21,14 @@ function sendAction(action) {
win.webContents.send(action); win.webContents.send(action);
} }
function clearCache() {
const win = BrowserWindow.getAllWindows()[0];
const ses = win.webContents.session;
ses.clearCache(() => {
dialog.showMessageBox({type: 'info', buttons: [], message: 'Cache cleared!'});
});
}
const viewSubmenu = [ const viewSubmenu = [
{ {
label: 'Reload', label: 'Reload',
@@ -134,8 +144,15 @@ const darwinTpl = [
{ {
type: 'separator' type: 'separator'
}, },
{
label: 'Clear Cache',
click() {
clearCache();
}
},
{ {
label: 'Log Out', label: 'Log Out',
accelerator: 'Cmd+L',
click(item, focusedWindow) { click(item, focusedWindow) {
if (focusedWindow) { if (focusedWindow) {
sendAction('log-out'); sendAction('log-out');
@@ -263,8 +280,15 @@ const otherTpl = [
{ {
type: 'separator' type: 'separator'
}, },
{
label: 'Clear Cache',
click() {
clearCache();
}
},
{ {
label: 'Log Out', label: 'Log Out',
accelerator: 'Ctrl+L',
click(item, focusedWindow) { click(item, focusedWindow) {
if (focusedWindow) { if (focusedWindow) {
sendAction('log-out'); sendAction('log-out');
@@ -312,7 +336,6 @@ const otherTpl = [
{ {
role: 'selectall' role: 'selectall'
} }
] ]
}, },
{ {

View File

@@ -3,6 +3,10 @@ const ipcRenderer = require('electron').ipcRenderer;
const {webFrame} = require('electron'); const {webFrame} = require('electron');
const {spellChecker} = require('./spellchecker'); const {spellChecker} = require('./spellchecker');
// enable swipe back/forward navigation on macOS
require('./macos-swipe-navigation.js').register();
// eslint-disable-next-line import/no-unassigned-import
require('./domain'); require('./domain');
// handle zooming functionality // handle zooming functionality

View File

@@ -1,7 +1,7 @@
{ {
"name": "zulip", "name": "zulip",
"productName": "Zulip", "productName": "Zulip",
"version": "0.5.4", "version": "0.5.6",
"description": "Zulip Desktop App", "description": "Zulip Desktop App",
"license": "Apache-2.0", "license": "Apache-2.0",
"email":"<svnitakash@gmail.com>", "email":"<svnitakash@gmail.com>",
@@ -28,14 +28,15 @@
], ],
"dependencies": { "dependencies": {
"electron-is-dev": "0.1.2", "electron-is-dev": "0.1.2",
"electron-squirrel-startup": "1.0.0", "electron-updater": "1.4.1",
"electron-log": "1.3.0",
"configstore": "2.1.0", "configstore": "2.1.0",
"dialogs": "1.1.14", "dialogs": "1.1.14",
"electron-debug": "1.1.0", "electron-debug": "1.1.0",
"electron-localshortcut": "0.6.1", "electron-localshortcut": "0.6.1",
"node-json-db": "0.7.3", "node-json-db": "0.7.3",
"request": "2.79.0", "request": "2.79.0",
"electron-spellchecker": "0.7.0", "electron-spellchecker": "1.0.0",
"wurl": "2.1.0" "wurl": "2.1.0"
} }
} }

View File

@@ -42,7 +42,7 @@ function addDomain() {
} else { } else {
document.getElementById('pic').style.display = 'none'; document.getElementById('pic').style.display = 'none';
document.getElementById('main').innerHTML = 'Switch'; document.getElementById('main').innerHTML = 'Switch';
document.getElementById('urladded').innerHTML = 'Not a vaild Zulip Server.'; document.getElementById('urladded').innerHTML = 'Not a valid Zulip Server.';
} }
}); });
} }

View File

@@ -1,7 +1,7 @@
{ {
"name": "zulip", "name": "zulip",
"productName": "Zulip", "productName": "Zulip",
"version": "0.5.4", "version": "0.5.6",
"description": "Zulip Desktop App", "description": "Zulip Desktop App",
"license": "Apache-2.0", "license": "Apache-2.0",
"email":"<svnitakash@gmail.com>", "email":"<svnitakash@gmail.com>",
@@ -43,7 +43,7 @@
"packageCategory": "GNOME;GTK;Network;InstantMessaging", "packageCategory": "GNOME;GTK;Network;InstantMessaging",
"description": "Zulip Desktop Client for Linux", "description": "Zulip Desktop Client for Linux",
"target" : ["deb", "AppImage"], "target" : ["deb", "AppImage"],
"version" : "0.5.4", "version" : "0.5.6",
"title" : "Zulip", "title" : "Zulip",
"license": "Apache-2.0", "license": "Apache-2.0",
"maintainer": "Akash Nimare <svnitakash@gmail.com>" "maintainer": "Akash Nimare <svnitakash@gmail.com>"
@@ -67,8 +67,13 @@
] ]
}, },
"win": { "win": {
"target": "squirrel", "target": "nsis",
"icon": "build/icon.ico" "icon": "build/icon.ico",
"iconUrl": "https://raw.githubusercontent.com/zulip/zulip-electron/master/build/icon.ico"
},
"nsis": {
"perMachine": true,
"oneClick": false
} }
}, },
"keywords": [ "keywords": [
@@ -82,7 +87,7 @@
"devDependencies": { "devDependencies": {
"assert": "^1.4.1", "assert": "^1.4.1",
"devtron": "^1.1.0", "devtron": "^1.1.0",
"electron-builder": "10.15.1", "electron-builder": "13.0.0",
"electron": "1.4.7", "electron": "1.4.7",
"electron-connect": "^0.4.6", "electron-connect": "^0.4.6",
"gulp": "^3.9.1", "gulp": "^3.9.1",
@@ -98,7 +103,7 @@
"rules": { "rules": {
"max-lines": [ "max-lines": [
"warn", "warn",
350 500
], ],
"no-warning-comments": 0, "no-warning-comments": 0,
"no-else-return": 0, "no-else-return": 0,
@@ -108,7 +113,8 @@
} }
], ],
"ignore": [ "ignore": [
"tests/*.js" "tests/*.js",
"app/main/macos-swipe-navigation.js"
], ],
"envs": [ "envs": [
"node", "node",
@@ -116,4 +122,4 @@
"mocha" "mocha"
] ]
} }
} }

View File

@@ -1,7 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
export DISPLAY=:99.0 export {no_proxy,NO_PROXY}="127.0.0.1,localhost"
export DISPLAY=:99.0
sh -e /etc/init.d/xvfb start sh -e /etc/init.d/xvfb start
sleep 3 sleep 3
fi fi