[Fix new release detection] [IPC names to constants] [Refactoring]

This commit is contained in:
Scott E. Graves
2018-10-01 11:19:50 -05:00
parent cf6b5b68d7
commit f2a7d1c188
4 changed files with 295 additions and 201 deletions

View File

@@ -3,6 +3,7 @@ import styles from './Configuration.css';
import Box from '../../components/UI/Box/Box';
import Button from '../../components/UI/Button/Button';
import ConfigurationItem from '../../components/ConfigurationItem/ConfigurationItem';
import * as Constants from '../../constants';
import CSSModules from 'react-css-modules';
import Modal from '../../components/UI/Modal/Modal';
@@ -15,11 +16,11 @@ class Configuration extends Component {
constructor(props) {
super(props);
if (ipcRenderer) {
ipcRenderer.on('get_config_template_reply', this.onGetConfigTemplateReply);
ipcRenderer.on('get_config_reply', this.onGetConfigReply);
ipcRenderer.on('set_config_values_reply', this.onSetConfigValuesReply);
ipcRenderer.on(Constants.IPC_Get_Config_Template_Reply, this.onGetConfigTemplateReply);
ipcRenderer.on(Constants.IPC_Get_Config_Reply, this.onGetConfigReply);
ipcRenderer.on(Constants.IPC_Set_Config_Values_Reply, this.onSetConfigValuesReply);
ipcRenderer.send('get_config_template', {
ipcRenderer.send(Constants.IPC_Get_Config_Template, {
Directory: this.props.directory,
StorageType: this.props.storageType,
Version: this.props.version,
@@ -78,9 +79,9 @@ class Configuration extends Component {
componentWillUnmount = () => {
if (ipcRenderer) {
ipcRenderer.removeListener('get_config_reply', this.onGetConfigReply);
ipcRenderer.removeListener('get_config_template_reply', this.onGetConfigTemplateReply);
ipcRenderer.removeListener('set_config_values', this.onSetConfigValuesReply);
ipcRenderer.removeListener(Constants.IPC_Get_Config_Reply, this.onGetConfigReply);
ipcRenderer.removeListener(Constants.IPC_Get_Config_Template_Reply, this.onGetConfigTemplateReply);
ipcRenderer.removeListener(Constants.IPC_Set_Config_Values_Reply, this.onSetConfigValuesReply);
}
};
@@ -161,7 +162,7 @@ class Configuration extends Component {
this.setState({
Template: arg.data.Template,
});
ipcRenderer.send('get_config', {
ipcRenderer.send(Constants.IPC_Get_Config, {
Directory: this.props.directory,
StorageType: this.props.storageType,
Version: this.props.version,
@@ -198,7 +199,7 @@ class Configuration extends Component {
}
}
ipcRenderer.send('set_config_values', {
ipcRenderer.send(Constants.IPC_Set_Config_Values, {
Directory: this.props.directory,
Items: changedItems,
StorageType: this.props.storageType,