From e9c8a31e1f07031e1b315020d48bb97434f40f41 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 31 Oct 2019 13:28:00 -0600 Subject: [PATCH] Start and stop Mjolnir with the lifecycle --- src/Lifecycle.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Lifecycle.js b/src/Lifecycle.js index 13f3abccb1..f2b50d7f2d 100644 --- a/src/Lifecycle.js +++ b/src/Lifecycle.js @@ -36,6 +36,7 @@ import * as StorageManager from './utils/StorageManager'; import SettingsStore from "./settings/SettingsStore"; import TypingStore from "./stores/TypingStore"; import {IntegrationManagers} from "./integrations/IntegrationManagers"; +import {Mjolnir} from "./mjolnir/Mjolnir"; /** * Called at startup, to attempt to build a logged-in Matrix session. It tries @@ -585,6 +586,11 @@ async function startMatrixClient(startSyncing=true) { IntegrationManagers.sharedInstance().startWatching(); ActiveWidgetStore.start(); + // Start Mjolnir even though we haven't checked the feature flag yet. Starting + // the thing just wastes CPU cycles, but should result in no actual functionality + // being exposed to the user. + Mjolnir.sharedInstance().start(); + if (startSyncing) { await MatrixClientPeg.start(); } else { @@ -645,6 +651,7 @@ export function stopMatrixClient(unsetClient=true) { Presence.stop(); ActiveWidgetStore.stop(); IntegrationManagers.sharedInstance().stopWatching(); + Mjolnir.sharedInstance().stop(); if (DMRoomMap.shared()) DMRoomMap.shared().stop(); const cli = MatrixClientPeg.get(); if (cli) {