Install downloaded updates while in tray

This commit is contained in:
Fedor Indutny 2023-12-12 03:15:36 +01:00 committed by GitHub
parent c4521a063c
commit 12a2ec8dd4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 87 additions and 24 deletions

View file

@ -2,26 +2,20 @@
// SPDX-License-Identifier: AGPL-3.0-only
import config from 'config';
import type { BrowserWindow } from 'electron';
import type { Updater } from './common';
import type { Updater, UpdaterOptionsType } from './common';
import { MacOSUpdater } from './macos';
import { WindowsUpdater } from './windows';
import { isLinuxVersionSupported } from './linux';
import type { LoggerType } from '../types/Logging';
import { DialogType } from '../types/Dialogs';
import type { SettingsChannel } from '../main/settingsChannel';
let initialized = false;
let updater: Updater | undefined;
export async function start(
settingsChannel: SettingsChannel,
logger: LoggerType,
getMainWindow: () => BrowserWindow | undefined
): Promise<void> {
export async function start(options: UpdaterOptionsType): Promise<void> {
const { platform } = process;
const { logger, getMainWindow } = options;
if (initialized) {
throw new Error('updater/start: Updates have already been initialized!');
@ -50,9 +44,9 @@ export async function start(
}
if (platform === 'win32') {
updater = new WindowsUpdater(logger, settingsChannel, getMainWindow);
updater = new WindowsUpdater(options);
} else if (platform === 'darwin') {
updater = new MacOSUpdater(logger, settingsChannel, getMainWindow);
updater = new MacOSUpdater(options);
} else {
throw new Error('updater/start: Unsupported platform');
}