From 2530ec841947dacbc40db1ead96fe05041fc1219 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 28 May 2020 19:03:42 +0100 Subject: [PATCH] Try and fix the Notifier race Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/Notifier.js | 7 +------ src/components/structures/MatrixChat.tsx | 5 +++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Notifier.js b/src/Notifier.js index cc804904e2..fac6f4e854 100644 --- a/src/Notifier.js +++ b/src/Notifier.js @@ -27,8 +27,7 @@ import { _t } from './languageHandler'; import Modal from './Modal'; import SettingsStore, {SettingLevel} from "./settings/SettingsStore"; import { - showToast as showNotificationsToast, - hideToast as hideNotificationsToast, + hideToast as hideNotificationsToast, showToast as showNotificationsToast, } from "./toasts/DesktopNotificationsToast"; /* @@ -188,10 +187,6 @@ const Notifier = { MatrixClientPeg.get().on("sync", this.boundOnSyncStateChange); this.toolbarHidden = false; this.isSyncing = false; - - if (this.shouldShowToolbar()) { - showNotificationsToast(); - } }, stop: function() { diff --git a/src/components/structures/MatrixChat.tsx b/src/components/structures/MatrixChat.tsx index fe50b80140..b70d6ed3eb 100644 --- a/src/components/structures/MatrixChat.tsx +++ b/src/components/structures/MatrixChat.tsx @@ -71,6 +71,7 @@ import { showToast as showAnalyticsToast, hideToast as hideAnalyticsToast } from "../../toasts/AnalyticsToast"; +import {showToast as showNotificationsToast} from "../../toasts/DesktopNotificationsToast"; /** constants for MatrixChat.state.view */ export enum Views { @@ -1364,6 +1365,10 @@ export default class MatrixChat extends React.PureComponent { this.firstSyncComplete = true; this.firstSyncPromise.resolve(); + if (Notifier.shouldShowToolbar()) { + showNotificationsToast(); + } + dis.dispatch({action: 'focus_composer'}); this.setState({ ready: true,