diff --git a/skins/base/css/molecules/MatrixToolbar.css b/skins/base/css/molecules/MatrixToolbar.css index 1e35ee27..9dc84602 100644 --- a/skins/base/css/molecules/MatrixToolbar.css +++ b/skins/base/css/molecules/MatrixToolbar.css @@ -25,4 +25,10 @@ limitations under the License. .mx_MatrixToolbar button { margin-left: 12px; +} + +.mx_MatrixToolbar_close { + float: right; + margin-top: 3px; + margin-right: 12px; } \ No newline at end of file diff --git a/skins/base/img/close-white.png b/skins/base/img/close-white.png new file mode 100644 index 00000000..d8752ed9 Binary files /dev/null and b/skins/base/img/close-white.png differ diff --git a/skins/base/views/molecules/MatrixToolbar.js b/skins/base/views/molecules/MatrixToolbar.js index c8b4c97c..f72304e1 100644 --- a/skins/base/views/molecules/MatrixToolbar.js +++ b/skins/base/views/molecules/MatrixToolbar.js @@ -24,15 +24,21 @@ var LogoutButton = ComponentBroker.get("atoms/LogoutButton"); var EnableNotificationsButton = ComponentBroker.get("atoms/EnableNotificationsButton"); var MatrixToolbarController = require("../../../../src/controllers/molecules/MatrixToolbar"); +var Notifier = ComponentBroker.get('organisms/Notifier'); module.exports = React.createClass({ displayName: 'MatrixToolbar', mixins: [MatrixToolbarController], + hideToolbar: function() { + Notifier.setToolbarHidden(true); + }, + render: function() { return (
You are not receiving desktop notifications. +
); } diff --git a/skins/base/views/pages/MatrixChat.js b/skins/base/views/pages/MatrixChat.js index 15da07f9..1b756792 100644 --- a/skins/base/views/pages/MatrixChat.js +++ b/skins/base/views/pages/MatrixChat.js @@ -75,7 +75,7 @@ module.exports = React.createClass({ break; } - if (Notifier.supportsDesktopNotifications() && !Notifier.isEnabled()) { + if (Notifier.supportsDesktopNotifications() && !Notifier.isEnabled() && !Notifier.isToolbarHidden()) { return (
diff --git a/src/controllers/organisms/Notifier.js b/src/controllers/organisms/Notifier.js index cd99d320..0d493bf3 100644 --- a/src/controllers/organisms/Notifier.js +++ b/src/controllers/organisms/Notifier.js @@ -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;