provide a way to hide the notification nag toolbar

This commit is contained in:
Matthew Hodgson 2015-08-12 00:42:04 +01:00
parent 2ffa450e31
commit 566c0437c0
5 changed files with 31 additions and 1 deletions

View file

@ -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 = {
start: function() {
this.boundOnRoomTimeline = this.onRoomTimeline.bind(this);
MatrixClientPeg.get().on('Room.timeline', this.boundOnRoomTimeline);
this.state = { 'toolbarHidden' : false };
},
stop: function() {
@ -82,6 +86,8 @@ module.exports = {
value: false
});
}
this.setToolbarHidden(false);
},
isEnabled: function() {
@ -94,6 +100,18 @@ module.exports = {
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) {
if (toStartOfTimeline) return;
if (ev.sender && ev.sender.userId == MatrixClientPeg.get().credentials.userId) return;