Rename toolbar Notifier methods to prompt

This commit is contained in:
Michael Telatynski 2020-09-15 13:58:29 +01:00
parent 493d3ae288
commit 6b5426bddd
3 changed files with 7 additions and 7 deletions

View file

@ -259,7 +259,7 @@ export const Notifier = {
} }
// set the notifications_hidden flag, as the user has knowingly interacted // set the notifications_hidden flag, as the user has knowingly interacted
// with the setting we shouldn't nag them any further // with the setting we shouldn't nag them any further
this.setToolbarHidden(true); this.setPromptHidden(true);
}, },
isEnabled: function() { isEnabled: function() {
@ -284,7 +284,7 @@ export const Notifier = {
return SettingsStore.getValue("audioNotificationsEnabled"); return SettingsStore.getValue("audioNotificationsEnabled");
}, },
setToolbarHidden: function(hidden: boolean, persistent = true) { setPromptHidden: function(hidden: boolean, persistent = true) {
this.toolbarHidden = hidden; this.toolbarHidden = hidden;
Analytics.trackEvent('Notifier', 'Set Toolbar Hidden', hidden); Analytics.trackEvent('Notifier', 'Set Toolbar Hidden', hidden);
@ -297,17 +297,17 @@ export const Notifier = {
} }
}, },
shouldShowToolbar: function() { shouldShowPrompt: function() {
const client = MatrixClientPeg.get(); const client = MatrixClientPeg.get();
if (!client) { if (!client) {
return false; return false;
} }
const isGuest = client.isGuest(); const isGuest = client.isGuest();
return !isGuest && this.supportsDesktopNotifications() && !isPushNotifyDisabled() && return !isGuest && this.supportsDesktopNotifications() && !isPushNotifyDisabled() &&
!this.isEnabled() && !this._isToolbarHidden(); !this.isEnabled() && !this._isPromptHidden();
}, },
_isToolbarHidden: function() { _isPromptHidden: function() {
// Check localStorage for any such meta data // Check localStorage for any such meta data
if (global.localStorage) { if (global.localStorage) {
return global.localStorage.getItem("notifications_hidden") === "true"; return global.localStorage.getItem("notifications_hidden") === "true";

View file

@ -1344,7 +1344,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
this.firstSyncComplete = true; this.firstSyncComplete = true;
this.firstSyncPromise.resolve(); this.firstSyncPromise.resolve();
if (Notifier.shouldShowToolbar()) { if (Notifier.shouldShowPrompt()) {
showNotificationsToast(); showNotificationsToast();
} }

View file

@ -24,7 +24,7 @@ const onAccept = () => {
}; };
const onReject = () => { const onReject = () => {
Notifier.setToolbarHidden(true); Notifier.setPromptHidden(true);
}; };
const TOAST_KEY = "desktopnotifications"; const TOAST_KEY = "desktopnotifications";