From 566c0437c0a677d6ea40567600d8868ba538e119 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Wed, 12 Aug 2015 00:42:04 +0100 Subject: [PATCH] provide a way to hide the notification nag toolbar --- skins/base/css/molecules/MatrixToolbar.css | 6 ++++++ skins/base/img/close-white.png | Bin 0 -> 1305 bytes skins/base/views/molecules/MatrixToolbar.js | 6 ++++++ skins/base/views/pages/MatrixChat.js | 2 +- src/controllers/organisms/Notifier.js | 18 ++++++++++++++++++ 5 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 skins/base/img/close-white.png diff --git a/skins/base/css/molecules/MatrixToolbar.css b/skins/base/css/molecules/MatrixToolbar.css index 1e35ee270f..9dc846026f 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 0000000000000000000000000000000000000000..d8752ed9fe1036498acf69cd9d5beb2287086b18 GIT binary patch literal 1305 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|I14-?iy0WW zg+Z8+Vb&Z81_tI8nIRD+5xzcF$@#f@i7EL>sd^Q;1whpd3^o;3KxS@gNuokUZcbjY zRfVk*ScMgk4HDK@QUEI{$+lIB@C{IK&M!(;Fx4~BGf=YQQczH^DN0GR3UYCSY6tRc zl`=|73as??%gf94%8m8%i_-NCEiEne4UF`SjC6r2bc-wVN)jt{^NN)rhQQ2mNi9w; z$}A|!%+FH*nVXoDUs__Tqy(}E4xsMLEr45;R}A$P(0}?Bi3R$GdItK~G?iqgA)JSz z3nYV6TWUon4s9SAh&FIwK-_2p3{flJ{FKbJN|(fvR68RBLsMM?3tdCQ5FxocyBTg2d!hP6<>}%WVj*~R z;$A^1k}+RFb^cqaFS2`#&6^$e zB+O_Ei!YhRZhJwz@Ywr~y^{*pF>U9W=Y6X;>!bQg#XSea@2u4Hy*%fq*tQK#@+ You are not receiving desktop notifications. +
); } diff --git a/skins/base/views/pages/MatrixChat.js b/skins/base/views/pages/MatrixChat.js index 15da07f9d3..1b75679272 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 cd99d32076..0d493bf340 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;