@@ -12,7 +12,7 @@ import { IWindowList } from '#/types/enum'
1212import util from 'util'
1313import { IPicGo } from 'picgo'
1414import { showNotification , calcDurationRange } from '~/main/utils/common'
15- import { TALKING_DATA_EVENT } from '~/universal/events/constants'
15+ import { RENAME_FILE_NAME , TALKING_DATA_EVENT } from '~/universal/events/constants'
1616import logger from '@core/picgo/logger'
1717
1818const waitForShow = ( webcontent : WebContents ) => {
@@ -26,13 +26,13 @@ const waitForShow = (webcontent: WebContents) => {
2626const waitForRename = ( window : BrowserWindow , id : number ) : Promise < string | null > => {
2727 return new Promise ( ( resolve ) => {
2828 const windowId = window . id
29- ipcMain . once ( `rename ${ id } ` , ( evt : Event , newName : string ) => {
29+ ipcMain . once ( `${ RENAME_FILE_NAME } ${ id } ` , ( evt : Event , newName : string ) => {
3030 resolve ( newName )
3131 window . close ( )
3232 } )
3333 window . on ( 'close' , ( ) => {
3434 resolve ( null )
35- ipcMain . removeAllListeners ( `rename ${ id } ` )
35+ ipcMain . removeAllListeners ( `${ RENAME_FILE_NAME } ${ id } ` )
3636 windowManager . deleteById ( windowId )
3737 } )
3838 } )
@@ -93,7 +93,7 @@ class Uploader {
9393 if ( rename ) {
9494 const window = windowManager . create ( IWindowList . RENAME_WINDOW ) !
9595 await waitForShow ( window . webContents )
96- window . webContents . send ( 'rename' , fileName , window . webContents . id )
96+ window . webContents . send ( RENAME_FILE_NAME , fileName , item . fileName , window . webContents . id )
9797 name = await waitForRename ( window , window . webContents . id )
9898 }
9999 item . fileName = name || fileName
0 commit comments