feat: suppress pop-up changelog and announcements

[skip changelog]
This commit is contained in:
uye
2024-06-22 01:52:44 +08:00
parent 5003df7cf8
commit e295c1a830
4 changed files with 41 additions and 1 deletions

View File

@@ -241,6 +241,7 @@ namespace MaaWpfGui.Constants
public const string VersionUpdateBody = "VersionUpdate.body";
public const string VersionUpdateIsFirstBoot = "VersionUpdate.isfirstboot";
public const string VersionUpdatePackage = "VersionUpdate.package";
public const string VersionUpdateDoNotShowUpdate = "VersionUpdate.doNotShowUpdate";
public const string OperBoxData = "OperBox.Data";
@@ -254,5 +255,6 @@ namespace MaaWpfGui.Constants
public const string AnnouncementInfo = "Announcement.AnnouncementInfo";
public const string DoNotRemindThisAnnouncementAgain = "Announcement.DoNotRemindThisAnnouncementAgain";
public const string DoNotShowAnnouncement = "Announcement.DoNotShowAnnouncement";
}
}

View File

@@ -54,6 +54,21 @@ namespace MaaWpfGui.ViewModels.UI
}
}
private bool _doNotShowAnnouncement = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.DoNotShowAnnouncement, bool.FalseString));
/// <summary>
/// Gets or sets a value indicating whether to show the update.
/// </summary>
public bool DoNotShowAnnouncement
{
get => _doNotShowAnnouncement;
set
{
SetAndNotify(ref _doNotShowAnnouncement, value);
ConfigurationHelper.SetValue(ConfigurationKeys.DoNotShowAnnouncement, value.ToString());
}
}
/// <summary>
/// 检查更新
/// </summary>

View File

@@ -47,6 +47,11 @@ namespace MaaWpfGui.ViewModels.UI
return;
}
if (Instances.AnnouncementViewModel.DoNotShowAnnouncement)
{
return;
}
_ = Execute.OnUIThreadAsync(() => Instances.WindowManager.ShowWindow(Instances.AnnouncementViewModel));
});
Instances.VersionUpdateViewModel.ShowUpdateOrDownload();

View File

@@ -404,6 +404,21 @@ namespace MaaWpfGui.ViewModels.UI
Native,
}
private bool _doNotShowUpdate = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.VersionUpdateDoNotShowUpdate, bool.FalseString));
/// <summary>
/// Gets or sets a value indicating whether to show the update.
/// </summary>
public bool DoNotShowUpdate
{
get => _doNotShowUpdate;
set
{
SetAndNotify(ref _doNotShowUpdate, value);
ConfigurationHelper.SetValue(ConfigurationKeys.VersionUpdateDoNotShowUpdate, value.ToString());
}
}
/// <summary>
/// 如果是在更新后第一次启动显示ReleaseNote弹窗否则检查更新并下载更新包。
/// </summary>
@@ -412,7 +427,10 @@ namespace MaaWpfGui.ViewModels.UI
if (IsFirstBootAfterUpdate)
{
IsFirstBootAfterUpdate = false;
Instances.WindowManager.ShowWindow(this);
if (!DoNotShowUpdate)
{
Instances.WindowManager.ShowWindow(this);
}
}
else
{