@@ -14,6 +14,7 @@ const {
1414 setLoadingDescription
1515} = require ( './window-creators/change-loading-win-visibility-state' )
1616const wins = require ( './window-creators/windows' )
17+ const WINDOW_NAMES = require ( './window-creators/window.names' )
1718const isMainWinAvailable = require ( './helpers/is-main-win-available' )
1819const {
1920 DEFAULT_ARCHIVE_DB_FILE_NAME ,
@@ -39,8 +40,8 @@ module.exports = ({
3940 const secretKeyPath = path . join ( pathToUserData , SECRET_KEY_FILE_NAME )
4041
4142 return async ( ) => {
42- const win = isMainWinAvailable ( wins . mainWindow )
43- ? wins . mainWindow
43+ const win = isMainWinAvailable ( wins [ WINDOW_NAMES . MAIN_WINDOW ] )
44+ ? wins [ WINDOW_NAMES . MAIN_WINDOW ]
4445 : BrowserWindow . getFocusedWindow ( )
4546
4647 try {
@@ -69,6 +70,7 @@ module.exports = ({
6970 }
7071
7172 await showLoadingWindow ( {
73+ windowName : WINDOW_NAMES . LOADING_WINDOW ,
7274 description : i18next
7375 . t ( 'exportDB.loadingWindow.description' )
7476 } )
@@ -90,7 +92,11 @@ module.exports = ({
9092 : ''
9193 const description = `${ _description } ${ archived } `
9294
93- await setLoadingDescription ( { progress, description } )
95+ await setLoadingDescription ( {
96+ windowName : WINDOW_NAMES . LOADING_WINDOW ,
97+ progress,
98+ description
99+ } )
94100 }
95101
96102 await zip ( filePath , [
@@ -99,7 +105,9 @@ module.exports = ({
99105 dbWalPath ,
100106 secretKeyPath
101107 ] , { progressHandler } )
102- await hideLoadingWindow ( )
108+ await hideLoadingWindow ( {
109+ windowName : WINDOW_NAMES . LOADING_WINDOW
110+ } )
103111
104112 await showMessageModalDialog ( win , {
105113 buttons : [
@@ -111,7 +119,9 @@ module.exports = ({
111119 } )
112120 } catch ( err ) {
113121 try {
114- await hideLoadingWindow ( )
122+ await hideLoadingWindow ( {
123+ windowName : WINDOW_NAMES . LOADING_WINDOW
124+ } )
115125 await showErrorModalDialog (
116126 win ,
117127 i18next . t ( 'exportDB.modalDialog.title' ) ,
0 commit comments