diff options
-rw-r--r-- | src/actions/service.js | 4 | ||||
-rw-r--r-- | src/stores/ServicesStore.js | 21 | ||||
-rw-r--r-- | src/webview/plugin.js | 4 |
3 files changed, 28 insertions, 1 deletions
diff --git a/src/actions/service.js b/src/actions/service.js index 1b918251b..e3100e986 100644 --- a/src/actions/service.js +++ b/src/actions/service.js | |||
@@ -50,6 +50,10 @@ export default { | |||
50 | channel: PropTypes.string.isRequired, | 50 | channel: PropTypes.string.isRequired, |
51 | args: PropTypes.object.isRequired, | 51 | args: PropTypes.object.isRequired, |
52 | }, | 52 | }, |
53 | sendIPCMessageToAllServices: { | ||
54 | channel: PropTypes.string.isRequired, | ||
55 | args: PropTypes.object.isRequired, | ||
56 | }, | ||
53 | openWindow: { | 57 | openWindow: { |
54 | event: PropTypes.object.isRequired, | 58 | event: PropTypes.object.isRequired, |
55 | }, | 59 | }, |
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); |
diff --git a/src/webview/plugin.js b/src/webview/plugin.js index 569fa9493..fec353f34 100644 --- a/src/webview/plugin.js +++ b/src/webview/plugin.js | |||
@@ -19,6 +19,10 @@ ipcRenderer.on('initializeRecipe', (e, data) => { | |||
19 | } | 19 | } |
20 | }); | 20 | }); |
21 | 21 | ||
22 | ipcRenderer.on('settings-update', (e, data) => { | ||
23 | console.log(data); | ||
24 | }); | ||
25 | |||
22 | document.addEventListener('DOMContentLoaded', () => { | 26 | document.addEventListener('DOMContentLoaded', () => { |
23 | ipcRenderer.sendToHost('hello'); | 27 | ipcRenderer.sendToHost('hello'); |
24 | }, false); | 28 | }, false); |