Skip to content

Commit

Permalink
Merge branch 'develop' into anoa/jitsi_ptt
Browse files Browse the repository at this point in the history
* develop: (30 commits)
  [matrix] -> Matrix
  Nudge karma to 3.1.2
  set chrome path for travis CI explicitly
  Updated install spinner referenced in element-hq#8913
  Add support for localConfig at $appData/config.json. Move electron-config to $appData/electron-config.json
  Translated using Weblate (Hungarian)
  Update to electron 4.0.6
  Translated using Weblate (Spanish)
  Translated using Weblate (Norwegian Bokmål)
  Translated using Weblate (Hungarian)
  Translated using Weblate (Hindi)
  Translated using Weblate (Greek)
  Translated using Weblate (German)
  Translated using Weblate (Finnish)
  Translated using Weblate (Arabic)
  Translated using Weblate (Portuguese (Brazil))
  Translated using Weblate (Czech)
  Translated using Weblate (Swedish)
  Translated using Weblate (Swedish)
  Allow disabling update mechanism
  ...
  • Loading branch information
anoadragon453 committed Mar 3, 2019
2 parents d7b0e15 + 48015aa commit fa72152
Show file tree
Hide file tree
Showing 22 changed files with 341 additions and 97 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ install:
# commit.
- npm install && scripts/fetch-develop.deps.sh --depth 1
script:
- npm run test
- CHROME_BIN='/usr/bin/google-chrome-stable' npm run test
- npm run lint
Binary file modified electron_app/build/install-spinner.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions electron_app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"author": "New Vector Ltd.",
"dependencies": {
"auto-launch": "^5.0.1",
"electron-store": "^2.0.0",
"electron-window-state": "^4.1.0",
"iohook": "^0.3.1",
"minimist": "^1.2.0",
Expand Down
27 changes: 24 additions & 3 deletions electron_app/src/electron-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const updater = require('./updater');
const { migrateFromOldOrigin } = require('./originMigrator');

const windowStateKeeper = require('electron-window-state');
const Store = require('electron-store');

// boolean flag set whilst we are doing one-time origin migration
// We only serve the origin migration script while we're actually
Expand All @@ -56,8 +57,19 @@ try {
// Continue with the defaults (ie. an empty config)
}

try {
// Load local config and use it to override values from the one baked with the build
const localConfig = require(path.join(app.getPath('userData'), 'config.json'));
vectorConfig = Object.assign(vectorConfig, localConfig);
} catch (e) {
// Could not load local config, this is expected in most cases.
}

const store = new Store({ name: "electron-config" });

let mainWindow = null;
global.appQuitting = false;
global.minimizeToTray = store.get('minimizeToTray', true);


// handle uncaught errors otherwise it displays
Expand Down Expand Up @@ -137,6 +149,12 @@ ipcMain.on('ipcCall', async function(ev, payload) {
launcher.disable();
}
break;
case 'getMinimizeToTrayEnabled':
ret = global.minimizeToTray;
break;
case 'setMinimizeToTrayEnabled':
store.set('minimizeToTray', global.minimizeToTray = args[0]);
break;
case 'getAppVersion':
ret = app.getVersion();
break;
Expand All @@ -148,6 +166,7 @@ ipcMain.on('ipcCall', async function(ev, payload) {
} else {
mainWindow.focus();
}
break;
case 'origin_migrate':
migratingOrigin = true;
await migrateFromOldOrigin();
Expand Down Expand Up @@ -263,10 +282,12 @@ app.on('ready', () => {
path: absTarget,
});
}, (error) => {
if (error) console.error('Failed to register protocol')
if (error) console.error('Failed to register protocol');
});

if (vectorConfig['update_base_url']) {
if (argv['no-update']) {
console.log('Auto update disabled via command line flag "--no-update"');
} else if (vectorConfig['update_base_url']) {
console.log(`Starting auto update with base URL: ${vectorConfig['update_base_url']}`);
updater.start(vectorConfig['update_base_url']);
} else {
Expand Down Expand Up @@ -332,7 +353,7 @@ app.on('ready', () => {
mainWindow = global.mainWindow = null;
});
mainWindow.on('close', (e) => {
if (!global.appQuitting && (tray.hasTray() || process.platform === 'darwin')) {
if (global.minimizeToTray && !global.appQuitting && (tray.hasTray() || process.platform === 'darwin')) {
// On Mac, closing the window just hides it
// (this is generally how single-window Mac apps
// behave, eg. Mail.app)
Expand Down
Loading

0 comments on commit fa72152

Please sign in to comment.