diff options
Diffstat (limited to 'src/stores/ServicesStore.js')
-rw-r--r-- | src/stores/ServicesStore.js | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index 269cd1526..82da9c5f1 100644 --- a/src/stores/ServicesStore.js +++ b/src/stores/ServicesStore.js | |||
@@ -37,6 +37,7 @@ export default class ServicesStore extends Store { | |||
37 | this.actions.service.toggleService.listen(this._toggleService.bind(this)); | 37 | this.actions.service.toggleService.listen(this._toggleService.bind(this)); |
38 | this.actions.service.handleIPCMessage.listen(this._handleIPCMessage.bind(this)); | 38 | this.actions.service.handleIPCMessage.listen(this._handleIPCMessage.bind(this)); |
39 | this.actions.service.sendIPCMessage.listen(this._sendIPCMessage.bind(this)); | 39 | this.actions.service.sendIPCMessage.listen(this._sendIPCMessage.bind(this)); |
40 | this.actions.service.sendIPCMessageToAllServices.listen(this._sendIPCMessageToAllServices.bind(this)); | ||
40 | this.actions.service.setUnreadMessageCount.listen(this._setUnreadMessageCount.bind(this)); | 41 | this.actions.service.setUnreadMessageCount.listen(this._setUnreadMessageCount.bind(this)); |
41 | this.actions.service.openWindow.listen(this._openWindow.bind(this)); | 42 | this.actions.service.openWindow.listen(this._openWindow.bind(this)); |
42 | this.actions.service.filter.listen(this._filter.bind(this)); | 43 | this.actions.service.filter.listen(this._filter.bind(this)); |
@@ -58,6 +59,7 @@ export default class ServicesStore extends Store { | |||
58 | this._mapActiveServiceToServiceModelReaction.bind(this), | 59 | this._mapActiveServiceToServiceModelReaction.bind(this), |
59 | this._saveActiveService.bind(this), | 60 | this._saveActiveService.bind(this), |
60 | this._logoutReaction.bind(this), | 61 | this._logoutReaction.bind(this), |
62 | this._shareSettingsWithServiceProcess.bind(this), | ||
61 | ]); | 63 | ]); |
62 | 64 | ||
63 | // Just bind this | 65 | // Just bind this |
@@ -330,7 +332,17 @@ export default class ServicesStore extends Store { | |||
330 | @action _sendIPCMessage({ serviceId, channel, args }) { | 332 | @action _sendIPCMessage({ serviceId, channel, args }) { |
331 | const service = this.one(serviceId); | 333 | const service = this.one(serviceId); |
332 | 334 | ||
333 | service.webview.send(channel, args); | 335 | if (service.webview) { |
336 | service.webview.send(channel, args); | ||
337 | } | ||
338 | } | ||
339 | |||
340 | @action _sendIPCMessageToAllServices({ channel, args }) { | ||
341 | this.all.forEach(s => this.actions.service.sendIPCMessage({ | ||
342 | serviceId: s.id, | ||
343 | channel, | ||
344 | args, | ||
345 | })); | ||
334 | } | 346 | } |
335 | 347 | ||
336 | @action _openWindow({ event }) { | 348 | @action _openWindow({ event }) { |
@@ -495,6 +507,13 @@ export default class ServicesStore extends Store { | |||
495 | } | 507 | } |
496 | } | 508 | } |
497 | 509 | ||
510 | _shareSettingsWithServiceProcess() { | ||
511 | this.actions.service.sendIPCMessageToAllServices({ | ||
512 | channel: 'settings-update', | ||
513 | args: this.stores.settings.all, | ||
514 | }); | ||
515 | } | ||
516 | |||
498 | _cleanUpTeamIdAndCustomUrl(recipeId, data) { | 517 | _cleanUpTeamIdAndCustomUrl(recipeId, data) { |
499 | const serviceData = data; | 518 | const serviceData = data; |
500 | const recipe = this.stores.recipes.one(recipeId); | 519 | const recipe = this.stores.recipes.one(recipeId); |