diff options
Diffstat (limited to 'src/stores/ServicesStore.js')
-rw-r--r-- | src/stores/ServicesStore.js | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index 269cd1526..87d31c0c5 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 |
@@ -284,6 +286,7 @@ export default class ServicesStore extends Store { | |||
284 | if (channel === 'hello') { | 286 | if (channel === 'hello') { |
285 | this._initRecipePolling(service.id); | 287 | this._initRecipePolling(service.id); |
286 | this._initializeServiceRecipeInWebview(serviceId); | 288 | this._initializeServiceRecipeInWebview(serviceId); |
289 | this._shareSettingsWithServiceProcess(); | ||
287 | } else if (channel === 'messages') { | 290 | } else if (channel === 'messages') { |
288 | this.actions.service.setUnreadMessageCount({ | 291 | this.actions.service.setUnreadMessageCount({ |
289 | serviceId, | 292 | serviceId, |
@@ -330,7 +333,17 @@ export default class ServicesStore extends Store { | |||
330 | @action _sendIPCMessage({ serviceId, channel, args }) { | 333 | @action _sendIPCMessage({ serviceId, channel, args }) { |
331 | const service = this.one(serviceId); | 334 | const service = this.one(serviceId); |
332 | 335 | ||
333 | service.webview.send(channel, args); | 336 | if (service.webview) { |
337 | service.webview.send(channel, args); | ||
338 | } | ||
339 | } | ||
340 | |||
341 | @action _sendIPCMessageToAllServices({ channel, args }) { | ||
342 | this.all.forEach(s => this.actions.service.sendIPCMessage({ | ||
343 | serviceId: s.id, | ||
344 | channel, | ||
345 | args, | ||
346 | })); | ||
334 | } | 347 | } |
335 | 348 | ||
336 | @action _openWindow({ event }) { | 349 | @action _openWindow({ event }) { |
@@ -495,6 +508,13 @@ export default class ServicesStore extends Store { | |||
495 | } | 508 | } |
496 | } | 509 | } |
497 | 510 | ||
511 | _shareSettingsWithServiceProcess() { | ||
512 | this.actions.service.sendIPCMessageToAllServices({ | ||
513 | channel: 'settings-update', | ||
514 | args: this.stores.settings.all, | ||
515 | }); | ||
516 | } | ||
517 | |||
498 | _cleanUpTeamIdAndCustomUrl(recipeId, data) { | 518 | _cleanUpTeamIdAndCustomUrl(recipeId, data) { |
499 | const serviceData = data; | 519 | const serviceData = data; |
500 | const recipe = this.stores.recipes.one(recipeId); | 520 | const recipe = this.stores.recipes.one(recipeId); |