From 9ef392c5750d70d2b1de83a5d53583962ddb6aec Mon Sep 17 00:00:00 2001 From: Jiiks Date: Tue, 5 Mar 2019 23:46:42 +0200 Subject: [PATCH] test updater --- client/src/modules/updater.js | 18 +++++++++++++++++- core/src/main.js | 4 ++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/client/src/modules/updater.js b/client/src/modules/updater.js index ed862c9c..27e09195 100644 --- a/client/src/modules/updater.js +++ b/client/src/modules/updater.js @@ -8,10 +8,26 @@ * LICENSE file in the root directory of this source tree. */ -export default new class { +import Events from './events'; +import Module from './imodule'; + +export default new class extends Module { + + get updates() { return this.state.updates } + get bdUpdates() { return this.state.updates.bd } constructor() { + super({ + updatesAvailable: false, + error: null, + updates: { bd: [] } + }); + } + events(ipc) { + ipc.on('updater-checkForUpdates', () => { + Events.emit('update-check-start'); + }); } } diff --git a/core/src/main.js b/core/src/main.js index ee43a82b..3aca11a4 100644 --- a/core/src/main.js +++ b/core/src/main.js @@ -39,6 +39,7 @@ const TEST_ARGS = () => { } } const TEST_EDITOR = TESTS && true; +const TEST_UPDATER = TESTS && true; import path from 'path'; import sass from 'node-sass'; @@ -237,8 +238,6 @@ export class BetterDiscord { await this.waitForWindowUtils(); await this.ensureDirectories(); - await this.updater.checkForUpdates(); - this.windowUtils.on('did-finish-load', () => this.injectScripts(true)); this.windowUtils.on('did-navigate-in-page', (event, url, isMainFrame) => { @@ -342,6 +341,7 @@ export class BetterDiscord { */ async injectScripts(reload = false) { console.log(`[BetterDiscord] injecting ${this.config.getPath('client_script')}. Reload: ${reload}`); + if (TEST_UPDATER) setTimeout(this.updater.checkForUpdates, 5000); return this.windowUtils.injectScript(this.config.getPath('client_script')); }