mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-31 10:49:47 +08:00
✨ Feature: add a new config item to close upload result notification
ISSUES CLOSED: #74
This commit is contained in:
@@ -392,14 +392,17 @@ export function createTray () {
|
||||
await fs.remove(rawInput[i])
|
||||
}
|
||||
pasteText.push(await (pasteTemplate(pasteStyle, imgs[i], db.get('settings.customLink'))))
|
||||
const notification = new Notification({
|
||||
title: T('UPLOAD_SUCCEED'),
|
||||
body: imgs[i].imgUrl!
|
||||
// icon: files[i]
|
||||
})
|
||||
setTimeout(() => {
|
||||
notification.show()
|
||||
}, i * 100)
|
||||
const isShowResultNotification = db.get('settings.uploadResultNotification') === undefined ? true : !!db.get('settings.uploadResultNotification')
|
||||
if (isShowResultNotification) {
|
||||
const notification = new Notification({
|
||||
title: T('UPLOAD_SUCCEED'),
|
||||
body: imgs[i].imgUrl!
|
||||
// icon: files[i]
|
||||
})
|
||||
setTimeout(() => {
|
||||
notification.show()
|
||||
}, i * 100)
|
||||
}
|
||||
await GalleryDB.getInstance().insert(imgs[i])
|
||||
}
|
||||
handleCopyUrl(pasteText.join('\n'))
|
||||
|
||||
@@ -32,14 +32,17 @@ export const uploadClipboardFiles = async (): Promise<IStringKeyMap> => {
|
||||
const trayWindow = windowManager.get(IWindowList.TRAY_WINDOW)
|
||||
const pasteStyle = db.get('settings.pasteStyle') || 'markdown'
|
||||
handleCopyUrl(await (pasteTemplate(pasteStyle, img[0], db.get('settings.customLink'))))
|
||||
const notification = new Notification({
|
||||
title: T('UPLOAD_SUCCEED'),
|
||||
body: img[0].imgUrl!
|
||||
// icon: img[0].imgUrl
|
||||
})
|
||||
setTimeout(() => {
|
||||
notification.show()
|
||||
}, 100)
|
||||
const isShowResultNotification = db.get('settings.uploadResultNotification') === undefined ? true : !!db.get('settings.uploadResultNotification')
|
||||
if (isShowResultNotification) {
|
||||
const notification = new Notification({
|
||||
title: T('UPLOAD_SUCCEED'),
|
||||
body: img[0].imgUrl!
|
||||
// icon: img[0].imgUrl
|
||||
})
|
||||
setTimeout(() => {
|
||||
notification.show()
|
||||
}, 100)
|
||||
}
|
||||
await GalleryDB.getInstance().insert(img[0])
|
||||
// trayWindow just be created in mac/windows, not in linux
|
||||
trayWindow?.webContents?.send('clipboardFiles', [])
|
||||
@@ -88,14 +91,17 @@ export const uploadChoosedFiles = async (webContents: WebContents, files: IFileW
|
||||
})
|
||||
}
|
||||
pasteText.push(await (pasteTemplate(pasteStyle, imgs[i], db.get('settings.customLink'))))
|
||||
const notification = new Notification({
|
||||
title: T('UPLOAD_SUCCEED'),
|
||||
body: imgs[i].imgUrl!
|
||||
// icon: files[i].path
|
||||
})
|
||||
setTimeout(() => {
|
||||
notification.show()
|
||||
}, i * 100)
|
||||
const isShowResultNotification = db.get('settings.uploadResultNotification') === undefined ? true : !!db.get('settings.uploadResultNotification')
|
||||
if (isShowResultNotification) {
|
||||
const notification = new Notification({
|
||||
title: T('UPLOAD_SUCCEED'),
|
||||
body: imgs[i].imgUrl!
|
||||
// icon: files[i].path
|
||||
})
|
||||
setTimeout(() => {
|
||||
notification.show()
|
||||
}, i * 100)
|
||||
}
|
||||
await GalleryDB.getInstance().insert(imgs[i])
|
||||
result.push({
|
||||
url: handleUrlEncodeWithSetting(imgs[i].imgUrl!),
|
||||
|
||||
@@ -89,14 +89,17 @@ class GuiApi implements IGuiApi {
|
||||
await fs.remove(rawInput[i])
|
||||
}
|
||||
pasteText.push(await (pasteTemplate(pasteStyle, imgs[i], db.get('settings.customLink'))))
|
||||
const notification = new Notification({
|
||||
title: T('UPLOAD_SUCCEED'),
|
||||
body: imgs[i].imgUrl as string
|
||||
// icon: imgs[i].imgUrl
|
||||
})
|
||||
setTimeout(() => {
|
||||
notification.show()
|
||||
}, i * 100)
|
||||
const isShowResultNotification = db.get('settings.uploadResultNotification') === undefined ? true : !!db.get('settings.uploadResultNotification')
|
||||
if (isShowResultNotification) {
|
||||
const notification = new Notification({
|
||||
title: T('UPLOAD_SUCCEED'),
|
||||
body: imgs[i].imgUrl as string
|
||||
// icon: imgs[i].imgUrl
|
||||
})
|
||||
setTimeout(() => {
|
||||
notification.show()
|
||||
}, i * 100)
|
||||
}
|
||||
await GalleryDB.getInstance().insert(imgs[i])
|
||||
}
|
||||
handleCopyUrl(pasteText.join('\n'))
|
||||
|
||||
@@ -58,13 +58,16 @@ export default {
|
||||
if (img !== false) {
|
||||
const pasteStyle = db.get('settings.pasteStyle') || 'markdown'
|
||||
handleCopyUrl(await (pasteTemplate(pasteStyle, img[0], db.get('settings.customLink'))))
|
||||
const notification = new Notification({
|
||||
title: T('UPLOAD_SUCCEED'),
|
||||
body: img[0].imgUrl!
|
||||
// icon: file[0]
|
||||
// icon: img[0].imgUrl
|
||||
})
|
||||
notification.show()
|
||||
const isShowResultNotification = db.get('settings.uploadResultNotification') === undefined ? true : !!db.get('settings.uploadResultNotification')
|
||||
if (isShowResultNotification) {
|
||||
const notification = new Notification({
|
||||
title: T('UPLOAD_SUCCEED'),
|
||||
body: img[0].imgUrl!
|
||||
// icon: file[0]
|
||||
// icon: img[0].imgUrl
|
||||
})
|
||||
notification.show()
|
||||
}
|
||||
await GalleryDB.getInstance().insert(img[0])
|
||||
trayWindow.webContents.send('clipboardFiles', [])
|
||||
if (windowManager.has(IWindowList.SETTING_WINDOW)) {
|
||||
|
||||
@@ -287,6 +287,16 @@
|
||||
@change="handleUploadNotification"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:label="$T('SETTINGS_OPEN_UPLOAD_RESULT_TIPS')"
|
||||
>
|
||||
<el-switch
|
||||
v-model="form.uploadResultNotification"
|
||||
:active-text="$T('SETTINGS_OPEN')"
|
||||
:inactive-text="$T('SETTINGS_CLOSE')"
|
||||
@change="handleUploadResultNotification"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:label="$T('SETTINGS_COMPRESS_AND_WATERMARK')"
|
||||
>
|
||||
@@ -1527,6 +1537,7 @@ const form = reactive<ISettingForm>({
|
||||
rename: false,
|
||||
autoRename: false,
|
||||
uploadNotification: false,
|
||||
uploadResultNotification: true,
|
||||
miniWindowOntop: false,
|
||||
logLevel: ['all'],
|
||||
autoCopyUrl: true,
|
||||
@@ -1680,6 +1691,7 @@ async function initData () {
|
||||
form.rename = settings.rename || false
|
||||
form.autoRename = settings.autoRename || false
|
||||
form.uploadNotification = settings.uploadNotification || false
|
||||
form.uploadResultNotification = settings.uploadResultNotification === undefined ? true : settings.uploadResultNotification
|
||||
form.miniWindowOntop = settings.miniWindowOntop || false
|
||||
form.logLevel = initLogLevel(settings.logLevel || [])
|
||||
form.autoCopyUrl = settings.autoCopy === undefined ? true : settings.autoCopy
|
||||
@@ -1952,6 +1964,12 @@ function handleUploadNotification (val: ICheckBoxValueType) {
|
||||
})
|
||||
}
|
||||
|
||||
function handleUploadResultNotification (val: ICheckBoxValueType) {
|
||||
saveConfig({
|
||||
'settings.uploadResultNotification': val
|
||||
})
|
||||
}
|
||||
|
||||
async function cancelWindowSize () {
|
||||
mainWindowSizeVisible.value = false
|
||||
mainWindowWidth.value = await getConfig<number>('settings.mainWindowWidth') || 1200
|
||||
|
||||
1
src/universal/types/i18n.d.ts
vendored
1
src/universal/types/i18n.d.ts
vendored
@@ -167,6 +167,7 @@ interface ILocales {
|
||||
SETTINGS_ADVANCED_RENAME_ENABLE: string
|
||||
SETTINGS_ADVANCED_RENAME_FORMAT: string
|
||||
SETTINGS_OPEN_UPLOAD_TIPS: string
|
||||
SETTINGS_OPEN_UPLOAD_RESULT_TIPS: string
|
||||
SETTINGS_MINI_WINDOW_ON_TOP: string
|
||||
SETTINGS_AUTO_COPY_URL_AFTER_UPLOAD: string
|
||||
SETTINGS_TIPS_PLACEHOLDER_URL: string
|
||||
|
||||
1
src/universal/types/view.d.ts
vendored
1
src/universal/types/view.d.ts
vendored
@@ -5,6 +5,7 @@ interface ISettingForm {
|
||||
rename: boolean
|
||||
autoRename: boolean
|
||||
uploadNotification: boolean
|
||||
uploadResultNotification: boolean
|
||||
miniWindowOntop: boolean
|
||||
logLevel: string[]
|
||||
autoCopyUrl: boolean
|
||||
|
||||
Reference in New Issue
Block a user