From 8a98f06910ba55c31f1c42cc2c02be2df5544262 Mon Sep 17 00:00:00 2001 From: MistEO Date: Sat, 15 Mar 2025 23:58:28 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B0=83=E6=95=B4=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E6=9D=A5=E6=BA=90=E6=8F=90=E7=A4=BA=20(#12156)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 调整下载来源提示 * chore: 调整一下toast文本 --- src/MaaWpfGui/Res/Localizations/en-us.xaml | 4 +- src/MaaWpfGui/Res/Localizations/ja-jp.xaml | 4 +- src/MaaWpfGui/Res/Localizations/ko-kr.xaml | 4 +- src/MaaWpfGui/Res/Localizations/zh-cn.xaml | 4 +- src/MaaWpfGui/Res/Localizations/zh-tw.xaml | 4 +- .../ViewModels/UI/VersionUpdateViewModel.cs | 37 ++++++++++++++++--- 6 files changed, 47 insertions(+), 10 deletions(-) diff --git a/src/MaaWpfGui/Res/Localizations/en-us.xaml b/src/MaaWpfGui/Res/Localizations/en-us.xaml index e70b186098..27937b2b4a 100644 --- a/src/MaaWpfGui/Res/Localizations/en-us.xaml +++ b/src/MaaWpfGui/Res/Localizations/en-us.xaml @@ -253,9 +253,11 @@ You can cancel this popup by clicking the Settings - About Us - Issue Reporting MirrorChyan Fill after switching source MirrorChyan has detected a software update. Please go to 「Settings - Software Update」 to configure CDK or using the Global source. + MirrorChyan does not support nightly updates for now, and will use Global Source to check... MirrorChyan has detected a resource update {0}. Please go to 「Settings - Software Update」 to configure CDK, or using the Global source click 「Resource Update」 to update manually. New Version Found - Downloading in the background…… + Downloading from 「Global Source」... + Downloading from 「MirrorChyan」... Version: Info: Go to the website diff --git a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml index 9216c0e691..1a508779d4 100644 --- a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml +++ b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml @@ -253,9 +253,11 @@ MirrorChyan 更新ソース切替後入力 MirrorChyan はソフトウェアの更新を検出しました。CDK を構成するか、グローバル ソースを使用するには、「設定-アップデート設定」に移動してください。 + MirrorChyan は現時点では夜間更新をサポートしておらず、グローバル ソースを使用してチェックします... MirrorChyan はリソースの更新を検出しました{0}。「設定-ソフトウェア更新」に移動して CDK を構成するか、「リソース更新」をクリックして手動で更新してください。 新しいバージョンが見つかりました - バックグラウンドでダウンロードを行います…… + 「Global Source」からダウンロード中... + 「MirrorChyan」からダウンロード中... バージョン: 内容: Webサイトで確認 diff --git a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml index 8eafd9bb3a..f4eee78674 100644 --- a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml +++ b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml @@ -253,9 +253,11 @@ MirrorChyan 소스 전환 후 입력 MirrorChyan이 소프트웨어 업데이트를 감지했습니다.「설정 - 소프트웨어 업데이트」로 이동하여 CDK를 구성하거나 글로벌 소스를 사용하세요. + MirrorChyan은 현재 야간 업데이트를 지원하지 않으며, 글로벌 소스를 사용하여 확인합니다. MirrorChyan이 리소스 업데이트를 감지했습니다{0}.「설정 - 소프트웨어 업데이트」로 이동하여 CDK를 구성하거나「리소스 업데이트」를 클릭하여 수동으로 업데이트하세요. 새로운 버전 확인 - 백그라운드에서 다운로드 중…… + 「Global Source」에서 다운로드 중... + 「MirrorChyan」에서 다운로드 중... 버전: 정보: 웹사이트로 가기 diff --git a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml index 2f54476897..74a5d33627 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml @@ -253,9 +253,11 @@ Mirror酱 切换更新源后填写 Mirror酱检测到软件更新。请前往「设置-更新设置」配置 CDK 或使用海外源。 + Mirror酱暂不支持内测版更新,即将使用海外源检查…… Mirror酱检测到资源更新{0}。可前往「设置-更新设置」配置 CDK,或使用海外源点击「资源更新」进行手动更新。 检测到新版本 - 正在后台下载…… + 正在使用「海外源」下载…… + 正在使用「Mirror酱」下载…… 版本号: 更新信息: 前往页面查看 diff --git a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml index 009cdf2973..df0c3ab1ca 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml @@ -253,9 +253,11 @@ Mirror醬 切換更新源後填寫 Mirror醬偵測到軟體更新。請前往「設定-更新設定」設定 CDK 或使用全域來源。 + Mirror醬暫不支援內測版更新,即將使用全域來源檢查… Mirror醬偵測到資源更新{0}。請前往「設定-更新設定」設定 CDK,或使用全域來源點選「資源更新」進行手動更新。 檢測到新版本 - 正在後臺下載…… + 正在使用「全域來源」下載… + 正在使用「Mirror醬」下載… 版本號: 更新資訊: 前往頁面查看 diff --git a/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs b/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs index 650ddcf30c..02a84f27e8 100644 --- a/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs @@ -553,7 +553,7 @@ public class VersionUpdateViewModel : Screen bool otaFound = _assetsObject != null; bool goDownload = otaFound && SettingsViewModel.VersionUpdateSettings.AutoDownloadUpdatePackage; - ShowUpdateInfo(otaFound, LocalizationHelper.GetString("NewVersionFoundButtonGoWebpage")); + ShowUpdateInfo(otaFound, LocalizationHelper.GetString("NewVersionFoundButtonGoWebpage"), true); UpdatePackageName = _assetsObject?["name"]?.ToString() ?? string.Empty; @@ -679,7 +679,7 @@ public class VersionUpdateViewModel : Screen } } - private void ShowUpdateInfo(bool otaFound, string? text) + private void ShowUpdateInfo(bool otaFound, string? text, bool globalSource) { bool goDownload = otaFound && SettingsViewModel.VersionUpdateSettings.AutoDownloadUpdatePackage; @@ -687,7 +687,14 @@ public class VersionUpdateViewModel : Screen if (goDownload) { OutputDownloadProgress(downloading: false, output: LocalizationHelper.GetString("NewVersionDownloadPreparing")); - toast.AppendContentText(LocalizationHelper.GetString("NewVersionFoundDescDownloading")); + if (globalSource) + { + toast.AppendContentText(LocalizationHelper.GetString("NewVersionFoundDescDownloadingWithGlobalSource")); + } + else + { + toast.AppendContentText(LocalizationHelper.GetString("NewVersionFoundDescDownloadingWithMirrorChyan")); + } } if (!otaFound) @@ -735,6 +742,8 @@ public class VersionUpdateViewModel : Screen return CheckUpdateRetT.NoNeedToUpdate; } + ShowUpdateInfo(true, null, false); + UpdatePackageName = "MirrorChyanApp" + _mirrorcVersionName + ".zip"; var downloaded = await DownloadFromMirrorChyan(_mirrorcDownloadUrl, UpdatePackageName); @@ -793,6 +802,13 @@ public class VersionUpdateViewModel : Screen return (CheckUpdateRetT.NoNeedToUpdateDebugVersion, null); } + if (SettingsViewModel.VersionUpdateSettings.VersionType == + VersionUpdateSettingsUserControlModel.UpdateVersionType.Nightly + && SettingsViewModel.VersionUpdateSettings.UpdateSource == "MirrorChyan") + { + ToastNotification.ShowDirect(LocalizationHelper.GetString("MirrorChyanNotSupportNightly")); + } + // mirrorChyan 暂时没有支持 nightly,之后加一加 if ((SettingsViewModel.VersionUpdateSettings.VersionType is VersionUpdateSettingsUserControlModel.UpdateVersionType.Beta or @@ -1087,14 +1103,25 @@ public class VersionUpdateViewModel : Screen OutputDownloadProgress(progress + $" {speedDisplay}"); } - private static void OutputDownloadProgress(string output, bool downloading = true) + private static void OutputDownloadProgress(string output, bool downloading = true, bool globalSource = true) { if (_logItemViewModels == null) { return; } - var log = new LogItemViewModel(downloading ? LocalizationHelper.GetString("NewVersionFoundDescDownloading") + "\n" + output : output, UiLogColor.Download); + string fullText = string.Empty; + if (downloading) + { + string key = globalSource ? "NewVersionFoundDescDownloadingWithGlobalSource" : "NewVersionFoundDescDownloadingWithMirrorChyan"; + fullText = LocalizationHelper.GetString(key) + "\n" + output; + } + else + { + fullText = output; + } + + var log = new LogItemViewModel(fullText, UiLogColor.Download); Execute.OnUIThread(() => {