Updater debug utility
This commit is contained in:
parent
e7e9021e3f
commit
759ced3417
14 changed files with 409 additions and 15 deletions
|
@ -4,6 +4,7 @@
|
|||
import { get as getFromConfig } from 'config';
|
||||
import { BrowserWindow } from 'electron';
|
||||
|
||||
import { UpdaterInterface } from './common';
|
||||
import { start as startMacOS } from './macos';
|
||||
import { start as startWindows } from './windows';
|
||||
import { LocaleType } from '../types/I18N';
|
||||
|
@ -11,6 +12,8 @@ import { LoggerType } from '../types/Logging';
|
|||
|
||||
let initialized = false;
|
||||
|
||||
let updater: UpdaterInterface | undefined;
|
||||
|
||||
export async function start(
|
||||
getMainWindow: () => BrowserWindow,
|
||||
locale?: LocaleType,
|
||||
|
@ -39,14 +42,24 @@ export async function start(
|
|||
}
|
||||
|
||||
if (platform === 'win32') {
|
||||
await startWindows(getMainWindow, locale, logger);
|
||||
updater = await startWindows(getMainWindow, locale, logger);
|
||||
} else if (platform === 'darwin') {
|
||||
await startMacOS(getMainWindow, locale, logger);
|
||||
updater = await startMacOS(getMainWindow, locale, logger);
|
||||
} else {
|
||||
throw new Error('updater/start: Unsupported platform');
|
||||
}
|
||||
}
|
||||
|
||||
export async function force(): Promise<void> {
|
||||
if (!initialized) {
|
||||
throw new Error("updater/force: Updates haven't been initialized!");
|
||||
}
|
||||
|
||||
if (updater) {
|
||||
await updater.force();
|
||||
}
|
||||
}
|
||||
|
||||
function autoUpdateDisabled() {
|
||||
return (
|
||||
process.platform === 'linux' ||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue