From ce0c2fceda4780ecfc101ad16c3437fba27db911 Mon Sep 17 00:00:00 2001 From: troyeguo <13820674+troyeguo@users.noreply.github.com> Date: Sat, 11 Jul 2026 19:01:33 +0800 Subject: [PATCH] Add option to hide sync progress bar during synchronization --- src/assets/locales/en.json | 1 + src/assets/locales/zh-CN.json | 1 + src/constants/settingList.tsx | 5 +++ src/containers/header/component.tsx | 44 +++++++++++-------- .../settings/syncSetting/component.tsx | 2 + .../settings/syncSetting/interface.tsx | 1 + src/utils/common.ts | 4 +- 7 files changed, 37 insertions(+), 21 deletions(-) diff --git a/src/assets/locales/en.json b/src/assets/locales/en.json index 75f9738c..cfc11f30 100644 --- a/src/assets/locales/en.json +++ b/src/assets/locales/en.json @@ -127,6 +127,7 @@ "Account": "Account", "Always keep local data when resolving sync conflicts": "Always keep local data when resolving sync conflicts", "If you update a piece of data that has already been deleted in the cloud before synchronization, it will cause a conflict. In this case, we will keep the cloud data by default. If you turn this option on, we will keep the local data": "If you update a piece of data that has already been deleted in the cloud before synchronization, it will cause a conflict. In this case, we will keep the cloud data by default. If you turn this option on, we will keep the local data", + "Hide sync progress bar when syncing": "Hide sync progress bar when syncing", "Encryption failed, error code": "Encryption failed, error code", "Decryption failed, error code": "Decryption failed, error code", "Delete login option": "Delete login option", diff --git a/src/assets/locales/zh-CN.json b/src/assets/locales/zh-CN.json index ebc55a78..cb3b19e8 100644 --- a/src/assets/locales/zh-CN.json +++ b/src/assets/locales/zh-CN.json @@ -649,6 +649,7 @@ "Send": "发送", "Please add data source in the setting-Sync and backup first": "请先在设置-同步和备份中添加数据源", "If you update a piece of data that has already been deleted in the cloud before synchronization, it will cause a conflict. In this case, we will keep the cloud data by default. If you turn this option on, we will keep the local data": "如果您在同步前更新了一条已经在云端删除的数据,会引发冲突。此时我们默认保留云端数据。如果您开启此选项,我们将保留本地数据", + "Hide sync progress bar when syncing": "同步时隐藏同步进度条", "Meticulously designed and built for Android and iOS": "为安卓和 iOS 平台精心设计和开发的客户端", "Official AI OCR": "官方 AI 文字识别", "After three years of design and development, the mobile version of Koodo Reader is finally out": "经过3年的设计和开发,移动版的 Koodo Reader 终于正式上线了", diff --git a/src/constants/settingList.tsx b/src/constants/settingList.tsx index 08dccc55..a709cc3f 100644 --- a/src/constants/settingList.tsx +++ b/src/constants/settingList.tsx @@ -322,6 +322,11 @@ export const syncSettingList = [ desc: "If you update a piece of data that has already been deleted in the cloud before synchronization, it will cause a conflict. In this case, we will keep the cloud data by default. If you turn this option on, we will keep the local data", propName: "isKeepLocal", }, + { + isElectron: false, + title: "Hide sync progress bar when syncing", + propName: "hideSyncProgress", + }, ]; export const readingSettingList = [ { diff --git a/src/containers/header/component.tsx b/src/containers/header/component.tsx index 65691d31..bc02b6f3 100644 --- a/src/containers/header/component.tsx +++ b/src/containers/header/component.tsx @@ -450,18 +450,20 @@ class Header extends React.Component { return false; } if (ConfigService.getReaderConfig("isEnableKoodoSync") !== "yes") { - toast.loading( - this.props.t("Start syncing") + - " (" + - this.props.t( - driveList.find( - (item) => - item.value === ConfigService.getItem("defaultSyncOption") - )?.label || "" - ) + - ")", - { id: "syncing", position: "bottom-center" } - ); + if (ConfigService.getReaderConfig("hideSyncProgress") !== "yes") { + toast.loading( + this.props.t("Start syncing") + + " (" + + this.props.t( + driveList.find( + (item) => + item.value === ConfigService.getItem("defaultSyncOption") + )?.label || "" + ) + + ")", + { id: "syncing", position: "bottom-center" } + ); + } } return true; @@ -534,9 +536,11 @@ class Header extends React.Component { this.props.handleFetchBookmarks(); this.props.handleFetchNotes(); - toast.success(this.props.t("Synchronisation successful"), { - id: "syncing", - }); + if (ConfigService.getReaderConfig("hideSyncProgress") !== "yes") { + toast.success(this.props.t("Synchronisation successful"), { + id: "syncing", + }); + } if ( ConfigService.getItem("defaultSyncOption") === "adrive" && @@ -642,10 +646,12 @@ class Header extends React.Component { ); return; } - toast.loading(this.props.t("Almost finished"), { - id: "syncing", - position: "bottom-center", - }); + if (ConfigService.getReaderConfig("hideSyncProgress") !== "yes") { + toast.loading(this.props.t("Almost finished"), { + id: "syncing", + position: "bottom-center", + }); + } await this.handleSuccess(); } catch (error) { console.error(error); diff --git a/src/containers/settings/syncSetting/component.tsx b/src/containers/settings/syncSetting/component.tsx index 694b0b49..58bfe358 100644 --- a/src/containers/settings/syncSetting/component.tsx +++ b/src/containers/settings/syncSetting/component.tsx @@ -54,6 +54,8 @@ class SyncSetting extends React.Component { ConfigService.getReaderConfig("isDisableAutoSync") === "yes", isEnableKoodoSync: ConfigService.getReaderConfig("isEnableKoodoSync") === "yes", + hideSyncProgress: + ConfigService.getReaderConfig("hideSyncProgress") === "yes", driveConfig: {}, scheduledSyncInterval: ConfigService.getReaderConfig("scheduledSyncInterval") || "", diff --git a/src/containers/settings/syncSetting/interface.tsx b/src/containers/settings/syncSetting/interface.tsx index fdafcdd3..98c3cd27 100644 --- a/src/containers/settings/syncSetting/interface.tsx +++ b/src/containers/settings/syncSetting/interface.tsx @@ -34,6 +34,7 @@ export interface SettingInfoState { isEnableKoodoSync: boolean; isDisableAutoSync: boolean; autoOffline: boolean; + hideSyncProgress: boolean; driveConfig: any; scheduledSyncInterval: string; backupDrive: string; diff --git a/src/utils/common.ts b/src/utils/common.ts index 0668fb73..4d5239ae 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -1195,7 +1195,7 @@ export const showTaskProgress = async ( let stats = await window .require("electron") .ipcRenderer.invoke("cloud-stats", config); - if (stats.total > 0) { + if (stats.total > 0 && ConfigService.getReaderConfig("hideSyncProgress") !== "yes") { toast.loading( i18n.t("Start Transferring Data") + " (" + @@ -1220,7 +1220,7 @@ export const showTaskProgress = async ( } else { let syncUtil = await SyncService.getSyncUtil(); let stats = await syncUtil.getStats(); - if (stats.total > 0) { + if (stats.total > 0 && ConfigService.getReaderConfig("hideSyncProgress") !== "yes") { toast.loading( i18n.t("Start Transferring Data") + " (" +