mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-06 20:42:57 +08:00
✨ Feature(custom): optimize result notification for multi-upload
ISSUES CLOSED: #404
This commit is contained in:
@@ -6,6 +6,7 @@ HIDE_MINI_WINDOW: Hide Mini Window
|
|||||||
CHOOSE_DEFAULT_PICBED: Choose Default Picbed
|
CHOOSE_DEFAULT_PICBED: Choose Default Picbed
|
||||||
RELOAD_APP: Reload App
|
RELOAD_APP: Reload App
|
||||||
UPLOAD_SUCCEED: Upload Succeed
|
UPLOAD_SUCCEED: Upload Succeed
|
||||||
|
MULTI_UPLOAD_SUCCEED: ${n} Images Uploaded Succeed
|
||||||
UPLOAD_FAILED: Upload Failed
|
UPLOAD_FAILED: Upload Failed
|
||||||
UPLOAD_PROGRESS: Upload Progress
|
UPLOAD_PROGRESS: Upload Progress
|
||||||
UPLOADING: Uploading
|
UPLOADING: Uploading
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ HIDE_MINI_WINDOW: 隐藏mini窗口
|
|||||||
CHOOSE_DEFAULT_PICBED: 选择默认图床
|
CHOOSE_DEFAULT_PICBED: 选择默认图床
|
||||||
RELOAD_APP: 重启应用
|
RELOAD_APP: 重启应用
|
||||||
UPLOAD_SUCCEED: 上传成功
|
UPLOAD_SUCCEED: 上传成功
|
||||||
|
MULTI_UPLOAD_SUCCEED: ${n} 张图片上传成功
|
||||||
UPLOAD_FAILED: 上传失败
|
UPLOAD_FAILED: 上传失败
|
||||||
UPLOAD_PROGRESS: 上传进度
|
UPLOAD_PROGRESS: 上传进度
|
||||||
UPLOADING: 正在上传
|
UPLOADING: 正在上传
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ HIDE_MINI_WINDOW: 隱藏mini視窗
|
|||||||
CHOOSE_DEFAULT_PICBED: 選擇預設圖床
|
CHOOSE_DEFAULT_PICBED: 選擇預設圖床
|
||||||
RELOAD_APP: 重啟程式
|
RELOAD_APP: 重啟程式
|
||||||
UPLOAD_SUCCEED: 上傳成功
|
UPLOAD_SUCCEED: 上傳成功
|
||||||
|
MULTI_UPLOAD_SUCCEED: ${n} 張圖片上傳成功
|
||||||
UPLOAD_FAILED: 上傳失敗
|
UPLOAD_FAILED: 上傳失敗
|
||||||
UPLOAD_PROGRESS: 上傳進度
|
UPLOAD_PROGRESS: 上傳進度
|
||||||
UPLOADING: 正在上傳
|
UPLOADING: 正在上傳
|
||||||
|
|||||||
@@ -118,7 +118,8 @@ export const uploadChoosedFiles = async (
|
|||||||
const pasteStyle = db.get(configPaths.settings.pasteStyle) || IPasteStyle.MARKDOWN
|
const pasteStyle = db.get(configPaths.settings.pasteStyle) || IPasteStyle.MARKDOWN
|
||||||
const deleteLocalFile = db.get(configPaths.settings.deleteLocalFile) || false
|
const deleteLocalFile = db.get(configPaths.settings.deleteLocalFile) || false
|
||||||
const pasteText: string[] = []
|
const pasteText: string[] = []
|
||||||
for (let i = 0; i < imgs.length; i++) {
|
const imgLength = imgs.length
|
||||||
|
for (let i = 0; i < imgLength; i++) {
|
||||||
if (deleteLocalFile) {
|
if (deleteLocalFile) {
|
||||||
fs.remove(rawInput[i])
|
fs.remove(rawInput[i])
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@@ -140,14 +141,24 @@ export const uploadChoosedFiles = async (
|
|||||||
? true
|
? true
|
||||||
: !!db.get(configPaths.settings.uploadResultNotification)
|
: !!db.get(configPaths.settings.uploadResultNotification)
|
||||||
if (isShowResultNotification) {
|
if (isShowResultNotification) {
|
||||||
const notification = new Notification({
|
if (imgLength <= 3) {
|
||||||
title: $t('UPLOAD_SUCCEED'),
|
const notification = new Notification({
|
||||||
body: shortUrl || imgs[i].imgUrl!
|
title: $t('UPLOAD_SUCCEED'),
|
||||||
// icon: files[i].path
|
body: shortUrl || imgs[i].imgUrl!
|
||||||
})
|
// icon: files[i].path
|
||||||
setTimeout(() => {
|
})
|
||||||
notification.show()
|
setTimeout(() => {
|
||||||
}, i * 100)
|
notification.show()
|
||||||
|
}, i * 100)
|
||||||
|
} else if (i === imgLength - 1) {
|
||||||
|
const notification = new Notification({
|
||||||
|
title: $t('MULTI_UPLOAD_SUCCEED', { n: imgLength }),
|
||||||
|
body: ''
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
notification.show()
|
||||||
|
}, i * 100)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const inserted = await GalleryDB.getInstance().insert(imgs[i])
|
const inserted = await GalleryDB.getInstance().insert(imgs[i])
|
||||||
result.push({
|
result.push({
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ export interface ILocales {
|
|||||||
CHOOSE_DEFAULT_PICBED: string
|
CHOOSE_DEFAULT_PICBED: string
|
||||||
RELOAD_APP: string
|
RELOAD_APP: string
|
||||||
UPLOAD_SUCCEED: string
|
UPLOAD_SUCCEED: string
|
||||||
|
MULTI_UPLOAD_SUCCEED: string
|
||||||
UPLOAD_FAILED: string
|
UPLOAD_FAILED: string
|
||||||
UPLOAD_PROGRESS: string
|
UPLOAD_PROGRESS: string
|
||||||
UPLOADING: string
|
UPLOADING: string
|
||||||
|
|||||||
Reference in New Issue
Block a user