forked from matrix/element-web
provide a way to hide the notification nag toolbar
This commit is contained in:
parent
2ffa450e31
commit
566c0437c0
|
@ -26,3 +26,9 @@ limitations under the License.
|
||||||
.mx_MatrixToolbar button {
|
.mx_MatrixToolbar button {
|
||||||
margin-left: 12px;
|
margin-left: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mx_MatrixToolbar_close {
|
||||||
|
float: right;
|
||||||
|
margin-top: 3px;
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
|
@ -24,15 +24,21 @@ var LogoutButton = ComponentBroker.get("atoms/LogoutButton");
|
||||||
var EnableNotificationsButton = ComponentBroker.get("atoms/EnableNotificationsButton");
|
var EnableNotificationsButton = ComponentBroker.get("atoms/EnableNotificationsButton");
|
||||||
|
|
||||||
var MatrixToolbarController = require("../../../../src/controllers/molecules/MatrixToolbar");
|
var MatrixToolbarController = require("../../../../src/controllers/molecules/MatrixToolbar");
|
||||||
|
var Notifier = ComponentBroker.get('organisms/Notifier');
|
||||||
|
|
||||||
module.exports = React.createClass({
|
module.exports = React.createClass({
|
||||||
displayName: 'MatrixToolbar',
|
displayName: 'MatrixToolbar',
|
||||||
mixins: [MatrixToolbarController],
|
mixins: [MatrixToolbarController],
|
||||||
|
|
||||||
|
hideToolbar: function() {
|
||||||
|
Notifier.setToolbarHidden(true);
|
||||||
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
return (
|
return (
|
||||||
<div className="mx_MatrixToolbar">
|
<div className="mx_MatrixToolbar">
|
||||||
You are not receiving desktop notifications. <EnableNotificationsButton />
|
You are not receiving desktop notifications. <EnableNotificationsButton />
|
||||||
|
<div className="mx_MatrixToolbar_close"><img src="img/close-white.png" width="16" height="16" onClick={ this.hideToolbar } /></div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ module.exports = React.createClass({
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Notifier.supportsDesktopNotifications() && !Notifier.isEnabled()) {
|
if (Notifier.supportsDesktopNotifications() && !Notifier.isEnabled() && !Notifier.isToolbarHidden()) {
|
||||||
return (
|
return (
|
||||||
<div className="mx_MatrixChat_wrapper">
|
<div className="mx_MatrixChat_wrapper">
|
||||||
<MatrixToolbar />
|
<MatrixToolbar />
|
||||||
|
|
|
@ -27,10 +27,14 @@ var dis = require("../../dispatcher");
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// XXX: This isn't an organism surely in the atomic sense of the word
|
||||||
|
// what on earth is it doing here?!
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
start: function() {
|
start: function() {
|
||||||
this.boundOnRoomTimeline = this.onRoomTimeline.bind(this);
|
this.boundOnRoomTimeline = this.onRoomTimeline.bind(this);
|
||||||
MatrixClientPeg.get().on('Room.timeline', this.boundOnRoomTimeline);
|
MatrixClientPeg.get().on('Room.timeline', this.boundOnRoomTimeline);
|
||||||
|
this.state = { 'toolbarHidden' : false };
|
||||||
},
|
},
|
||||||
|
|
||||||
stop: function() {
|
stop: function() {
|
||||||
|
@ -82,6 +86,8 @@ module.exports = {
|
||||||
value: false
|
value: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.setToolbarHidden(false);
|
||||||
},
|
},
|
||||||
|
|
||||||
isEnabled: function() {
|
isEnabled: function() {
|
||||||
|
@ -94,6 +100,18 @@ module.exports = {
|
||||||
return enabled === 'true';
|
return enabled === 'true';
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setToolbarHidden: function(hidden) {
|
||||||
|
this.state.toolbarHidden = hidden;
|
||||||
|
dis.dispatch({
|
||||||
|
action: "notifier_enabled",
|
||||||
|
value: this.isEnabled()
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
isToolbarHidden: function() {
|
||||||
|
return this.state.toolbarHidden;
|
||||||
|
},
|
||||||
|
|
||||||
onRoomTimeline: function(ev, room, toStartOfTimeline) {
|
onRoomTimeline: function(ev, room, toStartOfTimeline) {
|
||||||
if (toStartOfTimeline) return;
|
if (toStartOfTimeline) return;
|
||||||
if (ev.sender && ev.sender.userId == MatrixClientPeg.get().credentials.userId) return;
|
if (ev.sender && ev.sender.userId == MatrixClientPeg.get().credentials.userId) return;
|
||||||
|
|
Loading…
Reference in New Issue