chore: 添加弹窗提示

This commit is contained in:
uye
2024-07-18 13:56:14 +08:00
parent 3dc2a186ca
commit 90afff247e
9 changed files with 100 additions and 10 deletions

View File

@@ -176,6 +176,7 @@ namespace MaaWpfGui.Constants
public const string UpdateAutoCheck = "VersionUpdate.ScheduledUpdateCheck";
public const string ResourceApi = "VersionUpdate.ResourceApi";
public const string AllowNightlyUpdates = "VersionUpdate.AllowNightlyUpdates";
public const string HasAcknowledgedNightlyWarning = "VersionUpdate.HasAcknowledgedNightlyWarning";
// 这个已经废弃了,还要留着吗?
// ReSharper disable once UnusedMember.Global

View File

@@ -203,6 +203,16 @@
<system:String x:Key="UpdateCheckStable">Stable Release</system:String>
<system:String x:Key="UpdateCheckBeta">Beta Release</system:String>
<system:String x:Key="UpdateCheckNightly">Nightly Release</system:String>
<system:String x:Key="NightlyWarning" xml:space="preserve">You have enabled nightly updates. Thank you for supporting and testing MAA.
Please note:
1. This is a nightly build and may contain unstable features.
2. If you encounter any issues, please check GitHub to see if a related issue already exists. If not, submit a new issue and attach the log file. This will help us address the problem more efficiently.
3. Please do not discuss nightly build issues in other places, such as user groups or comment sections. This occupies public resources and prevents timely feedback and resolution.
4. Do not share the method to enable nightly updates with non-developer users to avoid unnecessary confusion and risk.
You can cancel this popup by clicking the Settings - About Us - Issue Reporting link. Thank you for your understanding and cooperation!</system:String>
<system:String x:Key="UpdateCheck">Update Version</system:String>
<system:String x:Key="DownloadWithAria2">Download via aria2</system:String>
<system:String x:Key="UpdateCheckNow">Check update</system:String>

View File

@@ -1,4 +1,7 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:system="clr-namespace:System;assembly=mscorlib">
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<!-- 設定 -->
<system:String x:Key="Settings">設定</system:String>
<system:String x:Key="GeneralSettings">一般設定</system:String>
@@ -17,7 +20,7 @@
<system:String x:Key="UiTheme">UI主題</system:String>
<system:String x:Key="HotKeySettings">ホットキー設定</system:String>
<system:String x:Key="UpdateSettings">アップデート設定</system:String>
<system:String x:Key="AboutUs">About</system:String>
<system:String x:Key="AboutUs">About us</system:String>
<system:String x:Key="CoreVersion">Core バージョン</system:String>
<system:String x:Key="UiVersion">UI バージョン</system:String>
<system:String x:Key="ResourceVersion">リソースバーション</system:String>
@@ -203,6 +206,16 @@
<system:String x:Key="UpdateCheckStable">安定版</system:String>
<system:String x:Key="UpdateCheckBeta">ベータ版</system:String>
<system:String x:Key="UpdateCheckNightly">内部テスト版</system:String>
<system:String x:Key="NightlyWarning" xml:space="preserve">内部テスト版の更新を有効にしました。MAA のサポートとテストに感謝します。
ご注意ください:
1. これは内部テスト版であり、不安定な機能が含まれている可能性があります。
2. 問題が発生した場合は、GitHub で関連する issue が既に存在するかどうかを確認してください。存在しない場合は、新しい issue を提出し、ログファイルを添付してください。これにより、問題をより効率的に対処できます。
3. 内部テスト版の問題をユーザーグループやコメントセクションなどの他の場所で議論しないでください。これにより公共のリソースが占有され、迅速なフィードバックと解決が妨げられます。
4. 内部テスト版の更新方法を非開発ユーザーに共有しないでください。不要な混乱とリスクを避けるためです。
設定 - About us - フィードバックのリンクをクリックして、このポップアップをキャンセルできます。ご理解とご協力をお願いいたします!</system:String>
<system:String x:Key="UpdateCheck">Update version</system:String>
<system:String x:Key="DownloadWithAria2">aria2を使う</system:String>
<system:String x:Key="UpdateCheckNow">アップデートを確認する</system:String>
@@ -726,7 +739,7 @@
<system:String x:Key="UnsupportedLevel">サポートされていないステージです。ステージ名を確認するか、設定に移動してソフトウェア更新をチェックし、リソースバージョンを更新してみてください!</system:String>
<system:String x:Key="RecruitTagsDetected" xml:space="preserve">認識結果: </system:String>
<system:String x:Key="ConnectFailed">接続失敗</system:String>
<system:String x:Key="TryToReconnectByAdb">再接続を試みています </system:String>
<system:String x:Key="TryToReconnectByAdb">再接続を試みています</system:String>
<system:String x:Key="TryToStartEmulator">エミュレータを起動しようとしています</system:String>
<system:String x:Key="RestartAdb">ADBサーバーの再起動を試みています</system:String>
<system:String x:Key="HardRestartAdb">ADBプロセスの再起動を試みています</system:String>

View File

@@ -1,4 +1,7 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:system="clr-namespace:System;assembly=mscorlib">
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<!-- 설정 -->
<system:String x:Key="Settings">설정</system:String>
<system:String x:Key="GeneralSettings">일반 설정</system:String>
@@ -203,6 +206,16 @@
<system:String x:Key="UpdateCheckStable">안정 버전</system:String>
<system:String x:Key="UpdateCheckBeta">베타 버전</system:String>
<system:String x:Key="UpdateCheckNightly">개발 버전</system:String>
<system:String x:Key="NightlyWarning" xml:space="preserve">개발 버전 업데이트를 활성화했습니다. MAA에 대한 지원과 테스트에 감사드립니다.
주의사항:
1. 이것은 개발 버전이며, 불안정한 기능이 포함될 수 있습니다.
2. 문제가 발생하면 GitHub에서 관련 이슈가 이미 존재하는지 확인하세요. 존재하지 않는 경우, 새로운 이슈를 제출하고 로그 파일을 첨부하십시오. 이렇게 하면 문제를 보다 효율적으로 처리할 수 있습니다.
3. 사용자 그룹이나 댓글 섹션 등 다른 곳에서 개발 버전 문제를 논의하지 마십시오. 이는 공공 자원을 차지하고 신속한 피드백과 해결을 방해합니다.
4. 비개발자 사용자에게 개발 버전 업데이트 방법을 공유하지 마십시오. 불필요한 혼란과 위험을 피하기 위해서입니다.
설정 - 정보 - 이슈 제보 링크를 클릭하여 이 팝업을 취소할 수 있습니다. 이해와 협조에 감사드립니다!</system:String>
<system:String x:Key="UpdateCheck">업데이트할 버전</system:String>
<system:String x:Key="DownloadWithAria2">aria2로 다운로드</system:String>
<system:String x:Key="UpdateCheckNow">지금 업데이트</system:String>

View File

@@ -1,4 +1,7 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:system="clr-namespace:System;assembly=mscorlib">
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<!-- 设置 -->
<system:String x:Key="Settings">设置</system:String>
<system:String x:Key="GeneralSettings">常规设置</system:String>
@@ -203,6 +206,16 @@
<system:String x:Key="UpdateCheckStable">稳定版</system:String>
<system:String x:Key="UpdateCheckBeta">公测版</system:String>
<system:String x:Key="UpdateCheckNightly">内测版</system:String>
<system:String x:Key="NightlyWarning" xml:space="preserve">您已启用内测版更新。感谢您对 MAA 的支持与测试。
请注意:
1. 这是内测版,可能包含不稳定的功能。
2. 如果遇到问题,请务必在 GitHub 上检查是否已有相关 issue若无则提交 issue并附上日志文件。这样我们可以更高效地处理问题。
3. 请不要在其他地方讨论内测版问题,例如用户群、评论区等。这会占用公共资源且无法及时反馈和解决问题。
4. 请勿将更新内测版的方法告知其他非开发用户,以避免对他们造成不必要的困扰和风险。
您可通过点击 设置-关于我们-问题反馈 链接来取消该弹窗,感谢您的理解与配合!</system:String>
<system:String x:Key="UpdateCheck">更新版本</system:String>
<system:String x:Key="DownloadWithAria2">使用 aria2 进行下载</system:String>
<system:String x:Key="UpdateCheckNow">检查更新</system:String>

View File

@@ -1,4 +1,7 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:system="clr-namespace:System;assembly=mscorlib">
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<!-- 設定 -->
<system:String x:Key="Settings">設定</system:String>
<system:String x:Key="GeneralSettings">常規設定</system:String>
@@ -199,6 +202,16 @@
<system:String x:Key="UpdateCheckStable">穩定版</system:String>
<system:String x:Key="UpdateCheckBeta">公測版</system:String>
<system:String x:Key="UpdateCheckNightly">內測版</system:String>
<system:String x:Key="NightlyWarning" xml:space="preserve">您已啟用內測版更新。感謝您對 MAA 的支持與測試。
請注意:
1. 這是內測版,可能包含不穩定的功能。
2. 如果遇到問題,請務必在 GitHub 上檢查是否已有相關 issue若無則提交 issue並附上日誌文件。這樣我們可以更高效地處理問題。
3. 請不要在其他地方討論內測版問題,例如用戶群、評論區等。這會佔用公共資源且無法及時反饋和解決問題。
4. 請勿將更新內測版的方法告知其他非開發用戶,以避免對他們造成不必要的困擾和風險。
您可通過點擊 設置-關於我們-問題反饋 鏈接來取消該彈窗,感謝您的理解與配合!</system:String>
<system:String x:Key="UpdateCheck">更新版本</system:String>
<system:String x:Key="DownloadWithAria2">使用 aria2 進行下載</system:String>
<system:String x:Key="UpdateCheckNow">檢查更新</system:String>

View File

@@ -39,6 +39,11 @@ namespace MaaWpfGui.ViewModels.UI
InitViewModels();
InitProxy();
if (Instances.SettingsViewModel.AllowNightlyUpdates && Instances.SettingsViewModel.UpdateNightly && !Instances.SettingsViewModel.HasAcknowledgedNightlyWarning)
{
MessageBoxHelper.Show(LocalizationHelper.GetString("NightlyWarning"));
}
Task.Run(async () =>
{
await Instances.AnnouncementViewModel.CheckAndDownloadAnnouncement();
@@ -54,6 +59,7 @@ namespace MaaWpfGui.ViewModels.UI
_ = Execute.OnUIThreadAsync(() => Instances.WindowManager.ShowWindow(Instances.AnnouncementViewModel));
});
Instances.VersionUpdateViewModel.ShowUpdateOrDownload();
}

View File

@@ -221,7 +221,7 @@ namespace MaaWpfGui.ViewModels.UI
private void InitVersionUpdate()
{
if (VersionType == UpdateVersionType.Nightly && !_allowNightlyUpdates)
if (VersionType == UpdateVersionType.Nightly && !AllowNightlyUpdates)
{
VersionType = UpdateVersionType.Beta;
}
@@ -3371,10 +3371,23 @@ namespace MaaWpfGui.ViewModels.UI
public List<GenericCombinedData<UpdateVersionType>> VersionTypeList
{
get => AllVersionTypeList.Where(v => _allowNightlyUpdates || v.Value != UpdateVersionType.Nightly).ToList();
get => AllVersionTypeList.Where(v => AllowNightlyUpdates || v.Value != UpdateVersionType.Nightly).ToList();
}
private readonly bool _allowNightlyUpdates = Convert.ToBoolean(ConfigurationHelper.GetGlobalValue(ConfigurationKeys.AllowNightlyUpdates, bool.FalseString));
public bool AllowNightlyUpdates { get; set; } = Convert.ToBoolean(ConfigurationHelper.GetGlobalValue(ConfigurationKeys.AllowNightlyUpdates, bool.FalseString));
private bool _hasAcknowledgedNightlyWarning = Convert.ToBoolean(ConfigurationHelper.GetGlobalValue(ConfigurationKeys.HasAcknowledgedNightlyWarning, bool.FalseString));
public bool HasAcknowledgedNightlyWarning
{
get => _hasAcknowledgedNightlyWarning;
set
{
SetAndNotify(ref _hasAcknowledgedNightlyWarning, value);
ConfigurationHelper.SetGlobalValue(ConfigurationKeys.HasAcknowledgedNightlyWarning, value.ToString());
}
}
/// <summary>
/// Gets a value indicating whether to update nightly.
@@ -4868,6 +4881,13 @@ namespace MaaWpfGui.ViewModels.UI
_ = Execute.OnUIThreadAsync(() => Instances.WindowManager.ShowWindow(Instances.AnnouncementViewModel));
}
// UI 绑定的方法
// ReSharper disable once UnusedMember.Global
public void SetAcknowledgedNightlyWarning()
{
HasAcknowledgedNightlyWarning = true;
}
public void SetupSleepManagement()
{
if (!BlockSleep)

View File

@@ -115,7 +115,8 @@
<Hyperlink
Cursor="Hand"
NavigateUri="{Binding Source={x:Static constants:MaaUrls.GitHubIssues}}"
TextDecorations="None">
TextDecorations="None"
Command="{s:Action SetAcknowledgedNightlyWarning}">
<TextBlock Text="{DynamicResource Issue}" />
</Hyperlink>
</controls:TextBlock>