[Updater > App] Rewrite to simplify imports
This commit is contained in:
parent
63562ea219
commit
8b2ef7cfd5
1 changed files with 13 additions and 15 deletions
|
@ -1,35 +1,33 @@
|
|||
const { init: moduleInit } = require('./moduleUpdater');
|
||||
const moduleUpdater = require('./moduleUpdater');
|
||||
const updater = require('./updater');
|
||||
|
||||
const settings = require('../appSettings').getSettings();
|
||||
const buildInfo = require('../utils/buildInfo');
|
||||
const { UPDATE_ENDPOINT, NEW_UPDATE_ENDPOINT } = require('../Constants');
|
||||
const Constants = require('../Constants');
|
||||
|
||||
const { fatal, handled } = require('../errorHandler');
|
||||
const { performFirstRunTasks } = require('../firstRun');
|
||||
const { update: autostartUpdate } = require('../autoStart');
|
||||
const { initSplash, focusWindow, APP_SHOULD_LAUNCH, APP_SHOULD_SHOW, events: splashEvents } = require('../splash');
|
||||
const firstRun = require('../firstRun');
|
||||
const autoStart = require('../autoStart');
|
||||
const splash = require('../splash');
|
||||
|
||||
|
||||
exports.update = (startMin, done, show) => {
|
||||
if (updater.tryInitUpdater(buildInfo, NEW_UPDATE_ENDPOINT)) {
|
||||
if (updater.tryInitUpdater(buildInfo, Constants.NEW_UPDATE_ENDPOINT)) {
|
||||
const inst = updater.getUpdater();
|
||||
|
||||
inst.on('host-updated', () => {
|
||||
autostartUpdate(() => {});
|
||||
});
|
||||
inst.on('host-updated', () => autoStart.update(() => {}));
|
||||
inst.on('unhandled-exception', fatal);
|
||||
inst.on(updater.INCONSISTENT_INSTALLER_STATE_ERROR, fatal);
|
||||
inst.on('update-error', handled);
|
||||
|
||||
performFirstRunTasks(inst);
|
||||
firstRun.performFirstRunTasks(inst);
|
||||
} else {
|
||||
moduleInit(UPDATE_ENDPOINT, settings, buildInfo);
|
||||
moduleUpdater.init(Constants.UPDATE_ENDPOINT, settings, buildInfo);
|
||||
}
|
||||
|
||||
initSplash(startMin);
|
||||
splashEvents.once(APP_SHOULD_LAUNCH, done);
|
||||
splashEvents.once(APP_SHOULD_SHOW, show);
|
||||
splash.initSplash(startMin);
|
||||
splash.events.once(splash.APP_SHOULD_LAUNCH, done);
|
||||
splash.events.once(splash.APP_SHOULD_SHOW, show);
|
||||
};
|
||||
|
||||
exports.focusSplash = () => focusWindow();
|
||||
exports.focusSplash = () => splash.focusWindow();
|
Loading…
Reference in a new issue