Merge remote-tracking branch 'origin/develop' into develop

pull/4797/head
Weblate 2017-06-23 08:47:57 +00:00
commit 2a72c2e19b
4 changed files with 23 additions and 0 deletions

View File

@ -242,6 +242,9 @@ electron.app.on('activate', () => {
electron.app.on('before-quit', () => { electron.app.on('before-quit', () => {
global.appQuitting = true; global.appQuitting = true;
if (mainWindow) {
mainWindow.webContents.send('before-quit');
}
}); });
// Set the App User Model ID to match what the squirrel // Set the App User Model ID to match what the squirrel

View File

@ -45,6 +45,12 @@ rageshake.init().then(() => {
console.error("Failed to initialise rageshake: " + err); console.error("Failed to initialise rageshake: " + err);
}); });
window.addEventListener('beforeunload', (e) => {
console.log('riot-web closing');
// try to flush the logs to indexeddb
rageshake.flush();
});
// add React and ReactPerf to the global namespace, to make them easier to // add React and ReactPerf to the global namespace, to make them easier to
// access via the console // access via the console

View File

@ -22,9 +22,16 @@ import dis from 'matrix-react-sdk/lib/dispatcher';
import { _t } from 'matrix-react-sdk/lib/languageHandler'; import { _t } from 'matrix-react-sdk/lib/languageHandler';
import q from 'q'; import q from 'q';
import {remote, ipcRenderer} from 'electron'; import {remote, ipcRenderer} from 'electron';
import rageshake from '../rageshake';
remote.autoUpdater.on('update-downloaded', onUpdateDownloaded); remote.autoUpdater.on('update-downloaded', onUpdateDownloaded);
// try to flush the rageshake logs to indexeddb before quit.
ipcRenderer.on('before-quit', function () {
console.log('riot-desktop closing');
rageshake.flush();
});
function onUpdateDownloaded(ev: Event, releaseNotes: string, ver: string, date: Date, updateURL: string) { function onUpdateDownloaded(ev: Event, releaseNotes: string, ver: string, date: Date, updateURL: string) {
dis.dispatch({ dis.dispatch({
action: 'new_version', action: 'new_version',

View File

@ -427,6 +427,13 @@ module.exports = {
return initPromise; return initPromise;
}, },
flush: function() {
if (!store) {
return;
}
store.flush();
},
/** /**
* Clean up old logs. * Clean up old logs.
* @return Promise Resolves if cleaned logs. * @return Promise Resolves if cleaned logs.