Add desktop notifications, overridable in the same way as other components (although it's not a react component). Also extend the flux dispatcher a little to be less dumb about dispatching while something else is already dispatching.
This commit is contained in:
parent
947f389e51
commit
fd20e82123
9 changed files with 288 additions and 3 deletions
|
@ -23,10 +23,14 @@ var MatrixClientPeg = require("../../MatrixClientPeg");
|
|||
|
||||
var dis = require("../../dispatcher");
|
||||
|
||||
var ComponentBroker = require('../../ComponentBroker');
|
||||
|
||||
var Notifier = ComponentBroker.get('organisms/Notifier');
|
||||
|
||||
module.exports = {
|
||||
getInitialState: function() {
|
||||
return {
|
||||
logged_in: !!(MatrixClientPeg.get() && mxCliPeg.get().credentials),
|
||||
logged_in: !!(MatrixClientPeg.get() && MatrixClientPeg.get().credentials),
|
||||
ready: false
|
||||
};
|
||||
},
|
||||
|
@ -61,14 +65,15 @@ module.exports = {
|
|||
logged_in: false,
|
||||
ready: false
|
||||
});
|
||||
Notifier.stop();
|
||||
MatrixClientPeg.get().removeAllListeners();
|
||||
MatrixClientPeg.replace(null);
|
||||
break;
|
||||
case 'view_room':
|
||||
this.focusComposer = true;
|
||||
this.setState({
|
||||
currentRoom: payload.room_id
|
||||
});
|
||||
this.focusComposer = true;
|
||||
break;
|
||||
case 'view_prev_room':
|
||||
roomIndexDelta = -1;
|
||||
|
@ -105,6 +110,7 @@ module.exports = {
|
|||
that.setState({ready: true, currentRoom: firstRoom});
|
||||
dis.dispatch({action: 'focus_composer'});
|
||||
});
|
||||
Notifier.start();
|
||||
cli.startClient();
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue