Merge pull request #1645 from DGP-Studio/fix/jumplist

This commit is contained in:
DismissedLight
2024-05-28 16:02:13 +08:00
committed by GitHub
3 changed files with 32 additions and 0 deletions

View File

@@ -69,6 +69,7 @@ internal sealed partial class AppActivation : IAppActivation, IAppActivationActi
using (activateSemaphore.Enter())
{
// TODO: Introduced in 1.10.2, remove in later version
serviceProvider.GetRequiredService<IJumpListInterop>().ClearAsync().SafeForget();
serviceProvider.GetRequiredService<IScheduleTaskInterop>().UnregisterAllTasks();
if (UnsafeLocalSetting.Get(SettingKeys.Major1Minor10Revision0GuideState, GuideState.Language) < GuideState.Completed)

View File

@@ -0,0 +1,9 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
namespace Snap.Hutao.Core.Shell;
internal interface IJumpListInterop
{
ValueTask ClearAsync();
}

View File

@@ -0,0 +1,22 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Windows.UI.StartScreen;
namespace Snap.Hutao.Core.Shell;
[Injection(InjectAs.Transient, typeof(IJumpListInterop))]
internal sealed class JumpListInterop : IJumpListInterop
{
public async ValueTask ClearAsync()
{
if (JumpList.IsSupported())
{
JumpList list = await JumpList.LoadCurrentAsync();
list.Items.Clear();
await list.SaveAsync();
}
}
}