Refactoring

This commit is contained in:
2020-02-22 19:17:11 -06:00
parent 12ad878618
commit acb8e59660
13 changed files with 64 additions and 36 deletions

View File

@@ -1,6 +1,6 @@
const Constants = require('../../constants');
const addListeners = (ipcMain, closeApplication, setWindowVisibility) => {
const addListeners = (ipcMain, {closeApplication, setWindowVisibility}) => {
ipcMain.on(Constants.IPC_Shutdown, () => {
closeApplication();
});
@@ -17,4 +17,4 @@ const addListeners = (ipcMain, closeApplication, setWindowVisibility) => {
module.exports = {
addListeners
};
};

View File

@@ -1,7 +1,7 @@
const Constants = require('../../constants');
const helpers = require('../../helpers');
const addListeners = (ipcMain, standardIPCReply) => {
const addListeners = (ipcMain, {standardIPCReply}) => {
ipcMain.on(Constants.IPC_Get_Config, (event, data) => {
helpers
.getConfig(data.Version, data.Provider, data.Remote)
@@ -53,4 +53,4 @@ const addListeners = (ipcMain, standardIPCReply) => {
module.exports = {
addListeners
};
};

View File

@@ -1,7 +1,7 @@
const Constants = require('../../constants');
const helpers = require('../../helpers');
const addListeners = (ipcMain, standardIPCReply) => {
const addListeners = (ipcMain, {standardIPCReply}) => {
ipcMain.on(Constants.IPC_Check_Daemon_Version, (event, data) => {
helpers
.checkDaemonVersion(data.Version, data.Provider)
@@ -44,4 +44,4 @@ const addListeners = (ipcMain, standardIPCReply) => {
module.exports = {
addListeners
};
};

View File

@@ -2,7 +2,7 @@ const Constants = require('../../constants');
const fs = require('fs');
const helpers = require('../../helpers');
const addListeners = (ipcMain, standardIPCReply) => {
const addListeners = (ipcMain, {standardIPCReply}) => {
ipcMain.on(Constants.IPC_Check_Dependency_Installed, (event, data) => {
try {
const exists = fs.lstatSync(data.File).isFile();

View File

@@ -2,7 +2,7 @@ const Constants = require('../../constants');
const helpers = require('../../helpers');
const path = require('path');
const addListeners = (ipcMain, standardIPCReply) => {
const addListeners = (ipcMain, {standardIPCReply}) => {
ipcMain.on(Constants.IPC_Download_File, (event, data) => {
const destination = path.join(helpers.getDataDirectory(), data.Filename);
helpers.downloadFile(data.URL, destination, (progress) => {
@@ -22,4 +22,4 @@ const addListeners = (ipcMain, standardIPCReply) => {
module.exports = {
addListeners
};
};

View File

@@ -1,7 +1,7 @@
const Constants = require('../../constants');
const fs = require('fs');
const addListeners = (ipcMain, getMainWindow, dialog) => {
const addListeners = (ipcMain, {getMainWindow, dialog}) => {
ipcMain.on(Constants.IPC_Browse_Directory + '_sync', (event, data) => {
dialog.showOpenDialog(getMainWindow(), {
defaultPath: data.Location,
@@ -28,4 +28,4 @@ const addListeners = (ipcMain, getMainWindow, dialog) => {
module.exports = {
addListeners
};
};

View File

@@ -62,7 +62,7 @@ const unmountAllDrives = () => {
mountedData = {};
};
const addListeners = (ipcMain, setTrayImage, standardIPCReply) => {
const addListeners = (ipcMain, {setTrayImage, standardIPCReply}) => {
ipcMain.on(Constants.IPC_Check_Mount_Location + '_sync', (event, data) => {
let response = {
Success: true,

View File

@@ -14,7 +14,7 @@ const setPlatformOverride = platformOverride => {
_platformOverride = platformOverride;
};
const addListeners = (ipcMain, detectScript, saveUiSettings) => {
const addListeners = (ipcMain, {detectScript, saveUiSettings}) => {
ipcMain.on(Constants.IPC_Get_Platform, (event) => {
const sendResponse = (appPlatform, platform) => {
event.sender.send(Constants.IPC_Get_Platform_Reply, {
@@ -76,4 +76,4 @@ module.exports = {
getPlatformOverride,
setPlatformOverride,
addListeners
};
};

View File

@@ -5,7 +5,7 @@ const os = require('os');
const path = require('path');
const unzip = require('unzipper');
const addListeners = (ipcMain, getCleanupReleases, standardIPCReply) => {
const addListeners = (ipcMain, {getCleanupReleases, standardIPCReply}) => {
ipcMain.on(Constants.IPC_Check_Installed, (event, data) => {
const destination = path.join(helpers.getDataDirectory(), data.Version);
helpers

View File

@@ -2,7 +2,7 @@ const Constants = require('../../constants');
const os = require('os');
const helpers = require('../../helpers');
const addListeners = (ipcMain, closeApplication) => {
const addListeners = (ipcMain, {closeApplication}) => {
ipcMain.on(Constants.IPC_Reboot_System, () => {
if (os.platform() === 'win32') {
helpers.executeAsync('shutdown.exe', ['/r', '/t', '30']);
@@ -13,4 +13,4 @@ const addListeners = (ipcMain, closeApplication) => {
module.exports = {
addListeners
};
};

View File

@@ -3,7 +3,7 @@ const fs = require('fs');
const helpers = require('../../helpers');
const os = require('os');
const addListeners = (ipcMain, setIsInstalling, unmountAllDrives, standardIPCReply) => {
const addListeners = (ipcMain, {setIsInstalling, unmountAllDrives, standardIPCReply}) => {
ipcMain.on(Constants.IPC_Install_Upgrade, (event, data) => {
let allowSkipVerification = true;
@@ -113,4 +113,4 @@ const addListeners = (ipcMain, setIsInstalling, unmountAllDrives, standardIPCRep
module.exports = {
addListeners
};
};