From 6b5426bddd7f882a818bbab5db46f70491ae8e5a Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 15 Sep 2020 13:58:29 +0100 Subject: [PATCH] Rename toolbar Notifier methods to prompt --- src/Notifier.ts | 10 +++++----- src/components/structures/MatrixChat.tsx | 2 +- src/toasts/DesktopNotificationsToast.ts | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Notifier.ts b/src/Notifier.ts index 03f037be98..2643de1abc 100644 --- a/src/Notifier.ts +++ b/src/Notifier.ts @@ -259,7 +259,7 @@ export const Notifier = { } // set the notifications_hidden flag, as the user has knowingly interacted // with the setting we shouldn't nag them any further - this.setToolbarHidden(true); + this.setPromptHidden(true); }, isEnabled: function() { @@ -284,7 +284,7 @@ export const Notifier = { return SettingsStore.getValue("audioNotificationsEnabled"); }, - setToolbarHidden: function(hidden: boolean, persistent = true) { + setPromptHidden: function(hidden: boolean, persistent = true) { this.toolbarHidden = hidden; Analytics.trackEvent('Notifier', 'Set Toolbar Hidden', hidden); @@ -297,17 +297,17 @@ export const Notifier = { } }, - shouldShowToolbar: function() { + shouldShowPrompt: function() { const client = MatrixClientPeg.get(); if (!client) { return false; } const isGuest = client.isGuest(); return !isGuest && this.supportsDesktopNotifications() && !isPushNotifyDisabled() && - !this.isEnabled() && !this._isToolbarHidden(); + !this.isEnabled() && !this._isPromptHidden(); }, - _isToolbarHidden: function() { + _isPromptHidden: function() { // Check localStorage for any such meta data if (global.localStorage) { return global.localStorage.getItem("notifications_hidden") === "true"; diff --git a/src/components/structures/MatrixChat.tsx b/src/components/structures/MatrixChat.tsx index d3d5835dae..4cdb58014e 100644 --- a/src/components/structures/MatrixChat.tsx +++ b/src/components/structures/MatrixChat.tsx @@ -1344,7 +1344,7 @@ export default class MatrixChat extends React.PureComponent { this.firstSyncComplete = true; this.firstSyncPromise.resolve(); - if (Notifier.shouldShowToolbar()) { + if (Notifier.shouldShowPrompt()) { showNotificationsToast(); } diff --git a/src/toasts/DesktopNotificationsToast.ts b/src/toasts/DesktopNotificationsToast.ts index 413e82e20b..d8aa7647a3 100644 --- a/src/toasts/DesktopNotificationsToast.ts +++ b/src/toasts/DesktopNotificationsToast.ts @@ -24,7 +24,7 @@ const onAccept = () => { }; const onReject = () => { - Notifier.setToolbarHidden(true); + Notifier.setPromptHidden(true); }; const TOAST_KEY = "desktopnotifications";