From 7aa17de4be1bc79b4dbc7ac880293cda27b509e0 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Tue, 4 Jun 2019 15:20:34 -0500 Subject: [PATCH] Restore main window on error message --- CHANGELOG.md | 1 + public/electron.js | 9 +++++++++ src/App.js | 2 ++ src/constants.js | 2 ++ src/containers/MountItems/MountItems.js | 8 +++++++- 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dcadb8..bfb762d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ * Removed `react-css-modules` dependency * Removed Hyperspace (no active development/insufficient host network) * Added signature or SHA-256 validation to downloads +* Restore main window on error message ## 1.0.2 ## * Option to launch application hidden (notification icon only) diff --git a/public/electron.js b/public/electron.js index 6168316..7afa431 100644 --- a/public/electron.js +++ b/public/electron.js @@ -883,6 +883,15 @@ ipcMain.on(Constants.IPC_Shutdown, () => { closeApplication(); }); +ipcMain.on(Constants.IPC_Show_Window, () => { + setWindowVisibility(true); +}); + +ipcMain.on(Constants.IPC_Show_Window + '_sync', event => { + setWindowVisibility(true); + event.returnValue = true; +}); + ipcMain.on(Constants.IPC_Unmount_Drive, (event, data) => { clearManualMountDetection(data.StorageType); diff --git a/src/App.js b/src/App.js index 9d1d435..7062f38 100644 --- a/src/App.js +++ b/src/App.js @@ -544,6 +544,8 @@ class App extends IPCContainer { Error: error, ErrorAction: action, ErrorCritical: critical, + }, () => { + this.sendRequest(Constants.IPC_Show_Window); }); }; diff --git a/src/constants.js b/src/constants.js index 25f4010..2bbdedd 100644 --- a/src/constants.js +++ b/src/constants.js @@ -111,6 +111,8 @@ exports.IPC_Mount_Drive_Reply = 'mount_drive_reply'; exports.IPC_Save_State = 'save_state'; +exports.IPC_Show_Window = 'show_window'; + exports.IPC_Set_Config_Values = 'set_config_values'; exports.IPC_Set_Config_Values_Reply = 'set_config_values_reply'; diff --git a/src/containers/MountItems/MountItems.js b/src/containers/MountItems/MountItems.js index ca288fb..612feae 100644 --- a/src/containers/MountItems/MountItems.js +++ b/src/containers/MountItems/MountItems.js @@ -46,7 +46,12 @@ class MountItems extends IPCContainer { this.setState({ DisplayRetry: Object.keys(retryItems).length > 0, RetryItems: retryItems, - }, stateCallback); + }, () => { + if (this.state.DisplayRetry) { + this.sendRequest(Constants.IPC_Show_Window); + } + stateCallback(); + }); } }; @@ -224,6 +229,7 @@ class MountItems extends IPCContainer { DisplayRetry: true, RetryItems: retryItems, }, () => { + this.sendRequest(Constants.IPC_Show_Window); this.retryIntervals[storageType] = setInterval(() => { let retryItems = { ...this.state.RetryItems,