Skip to content

Commit

Permalink
✨ Feature: add gui-api for remove event
Browse files Browse the repository at this point in the history
ISSUES CLOSED: #201
  • Loading branch information
Molunerfinn committed Apr 14, 2019
1 parent 6db86ec commit 407b821
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
18 changes: 10 additions & 8 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -540,15 +540,17 @@ app.on('ready', () => {
globalShortcut.register(db.read().get('settings.shortKey.upload').value(), () => {
uploadClipboardFiles()
})
let files = getUploadFiles()
if (files.length > 0) { // 如果有文件列表作为参数,说明是命令行启动
let win
if (miniWindow && miniWindow.isVisible()) {
win = miniWindow
} else {
win = settingWindow || window || createSettingWindow()
if (process.env.NODE_ENV !== 'development') {
let files = getUploadFiles()
if (files.length > 0) { // 如果有文件列表作为参数,说明是命令行启动
let win
if (miniWindow && miniWindow.isVisible()) {
win = miniWindow
} else {
win = settingWindow || window || createSettingWindow()
}
uploadChoosedFiles(win.webContents, files)
}
uploadChoosedFiles(win.webContents, files)
}
})

Expand Down
4 changes: 3 additions & 1 deletion src/main/utils/picgoCoreIPC.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ const handleRemoveFiles = (ipcMain, CONFIG_PATH) => {
ipcMain.on('removeFiles', (event, files) => {
const picgo = new PicGo(CONFIG_PATH)
const guiApi = new GuiApi(ipcMain, event.sender, picgo)
picgo.emit('remove', files, guiApi)
setTimeout(() => {
picgo.emit('remove', files, guiApi)
}, 500)
})
}

Expand Down

0 comments on commit 407b821

Please sign in to comment.