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
|
||||
RELOAD_APP: Reload App
|
||||
UPLOAD_SUCCEED: Upload Succeed
|
||||
MULTI_UPLOAD_SUCCEED: ${n} Images Uploaded Succeed
|
||||
UPLOAD_FAILED: Upload Failed
|
||||
UPLOAD_PROGRESS: Upload Progress
|
||||
UPLOADING: Uploading
|
||||
|
||||
@@ -6,6 +6,7 @@ HIDE_MINI_WINDOW: 隐藏mini窗口
|
||||
CHOOSE_DEFAULT_PICBED: 选择默认图床
|
||||
RELOAD_APP: 重启应用
|
||||
UPLOAD_SUCCEED: 上传成功
|
||||
MULTI_UPLOAD_SUCCEED: ${n} 张图片上传成功
|
||||
UPLOAD_FAILED: 上传失败
|
||||
UPLOAD_PROGRESS: 上传进度
|
||||
UPLOADING: 正在上传
|
||||
|
||||
@@ -6,6 +6,7 @@ HIDE_MINI_WINDOW: 隱藏mini視窗
|
||||
CHOOSE_DEFAULT_PICBED: 選擇預設圖床
|
||||
RELOAD_APP: 重啟程式
|
||||
UPLOAD_SUCCEED: 上傳成功
|
||||
MULTI_UPLOAD_SUCCEED: ${n} 張圖片上傳成功
|
||||
UPLOAD_FAILED: 上傳失敗
|
||||
UPLOAD_PROGRESS: 上傳進度
|
||||
UPLOADING: 正在上傳
|
||||
|
||||
@@ -118,7 +118,8 @@ export const uploadChoosedFiles = async (
|
||||
const pasteStyle = db.get(configPaths.settings.pasteStyle) || IPasteStyle.MARKDOWN
|
||||
const deleteLocalFile = db.get(configPaths.settings.deleteLocalFile) || false
|
||||
const pasteText: string[] = []
|
||||
for (let i = 0; i < imgs.length; i++) {
|
||||
const imgLength = imgs.length
|
||||
for (let i = 0; i < imgLength; i++) {
|
||||
if (deleteLocalFile) {
|
||||
fs.remove(rawInput[i])
|
||||
.then(() => {
|
||||
@@ -140,6 +141,7 @@ export const uploadChoosedFiles = async (
|
||||
? true
|
||||
: !!db.get(configPaths.settings.uploadResultNotification)
|
||||
if (isShowResultNotification) {
|
||||
if (imgLength <= 3) {
|
||||
const notification = new Notification({
|
||||
title: $t('UPLOAD_SUCCEED'),
|
||||
body: shortUrl || imgs[i].imgUrl!
|
||||
@@ -148,6 +150,15 @@ export const uploadChoosedFiles = async (
|
||||
setTimeout(() => {
|
||||
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])
|
||||
result.push({
|
||||
|
||||
@@ -7,6 +7,7 @@ export interface ILocales {
|
||||
CHOOSE_DEFAULT_PICBED: string
|
||||
RELOAD_APP: string
|
||||
UPLOAD_SUCCEED: string
|
||||
MULTI_UPLOAD_SUCCEED: string
|
||||
UPLOAD_FAILED: string
|
||||
UPLOAD_PROGRESS: string
|
||||
UPLOADING: string
|
||||
|
||||
Reference in New Issue
Block a user