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
// 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";

View file

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

View file

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