Download and install updates without the help of electron-updater

This commit is contained in:
Scott Nonnenberg 2019-03-28 10:09:26 -07:00
parent 82dc723432
commit c8ea2e9463
32 changed files with 75974 additions and 518 deletions

30
main.js
View file

@ -61,7 +61,7 @@ const development = config.environment === 'development';
// data directory has been set.
const attachments = require('./app/attachments');
const attachmentChannel = require('./app/attachment_channel');
const autoUpdate = require('./app/auto_update');
const updater = require('./ts/updater/index');
const createTrayIcon = require('./app/tray_icon');
const ephemeralConfig = require('./app/ephemeral_config');
const logging = require('./app/logging');
@ -383,12 +383,29 @@ function createWindow() {
// when you should delete the corresponding element.
mainWindow = null;
});
ipc.on('show-window', () => {
showWindow();
});
}
ipc.on('show-window', () => {
showWindow();
});
let updatesStarted = false;
ipc.on('ready-for-updates', async () => {
if (updatesStarted) {
return;
}
updatesStarted = true;
try {
await updater.start(getMainWindow, locale.messages, logger);
} catch (error) {
logger.error(
'Error starting update checks:',
error && error.stack ? error.stack : error
);
}
});
function openReleaseNotes() {
shell.openExternal(
`https://github.com/signalapp/Signal-Desktop/releases/tag/v${app.getVersion()}`
@ -636,6 +653,7 @@ app.on('ready', async () => {
await logging.initialize();
logger = logging.getLogger();
logger.info('app ready');
logger.info(`starting version ${packageJson.version}`);
if (!locale) {
const appLocale = process.env.NODE_ENV === 'test' ? 'en' : app.getLocale();
@ -696,8 +714,6 @@ app.on('ready', async () => {
ready = true;
autoUpdate.initialize(getMainWindow, locale.messages);
createWindow();
if (usingTrayIcon) {