diff --git a/packages/neuron-ui/src/widgets/AlertDialog/index.tsx b/packages/neuron-ui/src/widgets/AlertDialog/index.tsx index 9d54be38c6..eaab451223 100644 --- a/packages/neuron-ui/src/widgets/AlertDialog/index.tsx +++ b/packages/neuron-ui/src/widgets/AlertDialog/index.tsx @@ -15,7 +15,6 @@ const AlertDialog = ({ title, message, type, - onClose, onOk, onCancel, action, @@ -24,14 +23,13 @@ const AlertDialog = ({ title?: string message?: string type: AlertType - onClose?: () => void onOk?: () => void onCancel?: () => void action?: Action }) => { const [t] = useTranslation() const dialogRef = useRef(null) - useDialog({ show, dialogRef, onClose: onClose || (() => {}) }) + useDialog({ show, dialogRef, onClose: onCancel || (() => {}) }) const actions = useMemo<('cancel' | 'ok')[]>(() => { if (action) { return action === 'all' ? ['cancel', 'ok'] : [action] diff --git a/packages/neuron-wallet/src/controllers/update.ts b/packages/neuron-wallet/src/controllers/update.ts index 2be6ea3c71..2df1b40ff7 100644 --- a/packages/neuron-wallet/src/controllers/update.ts +++ b/packages/neuron-wallet/src/controllers/update.ts @@ -1,4 +1,5 @@ import { autoUpdater, UpdateInfo, CancellationToken, ProgressInfo } from 'electron-updater' +import { t } from 'i18next' import AppUpdaterSubject, { AppUpdater } from '../models/subjects/app-updater' import logger from '../utils/logger' @@ -64,11 +65,16 @@ export default class UpdateController { autoUpdater.on('error', error => { UpdateController.isChecking = false + let errorMsg = error == null ? 'unknown' : (error.stack || error).toString() + logger.error('Update Controller:\t autoUpdater fail:', errorMsg) + if (errorMsg.includes('net::ERR_INTERNET_DISCONNECTED') || errorMsg.includes('net::ERR_TIMED_OUT')) { + errorMsg = t('messages.could-not-connect-service') + } this.notify({ version: '', releaseDate: '', releaseNotes: '', - errorMsg: error == null ? 'unknown' : (error.stack || error).toString(), + errorMsg, }) }) diff --git a/packages/neuron-wallet/src/locales/en.ts b/packages/neuron-wallet/src/locales/en.ts index 2b919a62b2..5afd76c2f0 100644 --- a/packages/neuron-wallet/src/locales/en.ts +++ b/packages/neuron-wallet/src/locales/en.ts @@ -137,6 +137,7 @@ export default { 'no-exist-ckb-node-data': '{{path}} has no CKB Node config and storage, press confirm to synchronize from scratch', 'light-client-sudt-acp-error': "Light client mode doesn't support sending assets to other's asset account", + 'could-not-connect-service': 'Could not connect to the service, please try again later.', }, messageBox: { button: { diff --git a/packages/neuron-wallet/src/locales/zh-tw.ts b/packages/neuron-wallet/src/locales/zh-tw.ts index 1c7d1d4ff1..2a33914e52 100644 --- a/packages/neuron-wallet/src/locales/zh-tw.ts +++ b/packages/neuron-wallet/src/locales/zh-tw.ts @@ -126,6 +126,7 @@ export default { 'target-lock-error': 'CKB 資產只能轉賬到 secp256k1 或者 acp 地址', 'no-exist-ckb-node-data': '{{path}} 目錄下沒有找到 CKB Node 配置和數據, 點擊確認重新同步', 'light-client-sudt-acp-error': '輕節點模式不支持發送資產給其他用戶的資產賬戶', + 'could-not-connect-service': '無法連接到服務,請稍後再試。', }, messageBox: { button: { diff --git a/packages/neuron-wallet/src/locales/zh.ts b/packages/neuron-wallet/src/locales/zh.ts index b1a62625c2..803ac9a975 100644 --- a/packages/neuron-wallet/src/locales/zh.ts +++ b/packages/neuron-wallet/src/locales/zh.ts @@ -127,6 +127,7 @@ export default { 'target-lock-error': 'CKB 资产只能转账到 secp256k1 或者 acp 地址', 'no-exist-ckb-node-data': '{{path}} 目录下没有找到 CKB Node 配置和数据, 点击确认重新同步', 'light-client-sudt-acp-error': '轻节点模式不支持发送资产给其他用户的资产账户', + 'could-not-connect-service': '无法连接到服务,请稍后再试。', }, messageBox: { button: {