Merge remote-tracking branch 'origin/develop' into develop
commit
3428c1c3d3
|
@ -80,10 +80,15 @@ const Notifier = {
|
||||||
if (ev.getContent().body) msg = ev.getContent().body;
|
if (ev.getContent().body) msg = ev.getContent().body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.isBodyEnabled()) {
|
||||||
|
msg = '';
|
||||||
|
}
|
||||||
|
|
||||||
const avatarUrl = ev.sender ? Avatar.avatarUrlForMember(
|
const avatarUrl = ev.sender ? Avatar.avatarUrlForMember(
|
||||||
ev.sender, 40, 40, 'crop',
|
ev.sender, 40, 40, 'crop',
|
||||||
) : null;
|
) : null;
|
||||||
|
|
||||||
|
const avatarUrl = ev.sender ? Avatar.avatarUrlForMember(ev.sender, 40, 40, 'crop') : null;
|
||||||
const notif = plaf.displayNotification(title, msg, avatarUrl, room);
|
const notif = plaf.displayNotification(title, msg, avatarUrl, room);
|
||||||
|
|
||||||
// if displayNotification returns non-null, the platform supports
|
// if displayNotification returns non-null, the platform supports
|
||||||
|
@ -195,6 +200,19 @@ const Notifier = {
|
||||||
return enabled === 'true';
|
return enabled === 'true';
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setBodyEnabled: function(enable) {
|
||||||
|
if (!global.localStorage) return;
|
||||||
|
global.localStorage.setItem('notifications_body_enabled', enable ? 'true' : 'false');
|
||||||
|
},
|
||||||
|
|
||||||
|
isBodyEnabled: function() {
|
||||||
|
if (!global.localStorage) return true;
|
||||||
|
const enabled = global.localStorage.getItem('notifications_body_enabled');
|
||||||
|
// default to true if the popups are enabled
|
||||||
|
if (enabled === null) return this.isEnabled();
|
||||||
|
return enabled === 'true';
|
||||||
|
},
|
||||||
|
|
||||||
setAudioEnabled: function(enable) {
|
setAudioEnabled: function(enable) {
|
||||||
if (!global.localStorage) return;
|
if (!global.localStorage) return;
|
||||||
global.localStorage.setItem('audio_notifications_enabled',
|
global.localStorage.setItem('audio_notifications_enabled',
|
||||||
|
|
|
@ -98,6 +98,17 @@ export default {
|
||||||
Notifier.setEnabled(enable);
|
Notifier.setEnabled(enable);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getEnableNotificationBody: function() {
|
||||||
|
return Notifier.isBodyEnabled();
|
||||||
|
},
|
||||||
|
|
||||||
|
setEnableNotificationBody: function(enable) {
|
||||||
|
if (!Notifier.supportsDesktopNotifications()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Notifier.setBodyEnabled(enable);
|
||||||
|
},
|
||||||
|
|
||||||
getEnableAudioNotifications: function() {
|
getEnableAudioNotifications: function() {
|
||||||
return Notifier.isAudioEnabled();
|
return Notifier.isAudioEnabled();
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue