Skip to content

Commit a368051

Browse files
committed
🐛 fix: unpackaged not run
1 parent 2b4bab3 commit a368051

File tree

2 files changed

+37
-7
lines changed

2 files changed

+37
-7
lines changed

src/SwashbucklerDiary.Maui/Essentials/AppLifecycle/AppActivation.Windows.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,20 @@ private static async void Activate(object? sender, AppActivationArguments args)
3333

3434
private static ValueTask<ActivationArguments> CreateArguments(AppActivationArguments args)
3535
{
36-
return args.Kind switch
36+
if (args.Kind == ExtendedActivationKind.Protocol && args.Data is ProtocolActivatedEventArgs protocolActivatedEventArgs)
3737
{
38-
ExtendedActivationKind.Protocol => HandleScheme((ProtocolActivatedEventArgs)args.Data),
39-
ExtendedActivationKind.ShareTarget => HandleShare((ShareTargetActivatedEventArgs)args.Data),
40-
ExtendedActivationKind.Launch => HandleLaunch((LaunchActivatedEventArgs)args.Data),
41-
_ => NewAppActivationArguments()
42-
};
38+
return HandleScheme(protocolActivatedEventArgs);
39+
}
40+
else if (args.Kind == ExtendedActivationKind.ShareTarget && args.Data is ShareTargetActivatedEventArgs shareTargetActivatedEventArgs)
41+
{
42+
return HandleShare(shareTargetActivatedEventArgs);
43+
}
44+
else if (args.Kind == ExtendedActivationKind.Launch && args.Data is LaunchActivatedEventArgs launchActivatedEventArgs)
45+
{
46+
return HandleLaunch(launchActivatedEventArgs);
47+
}
48+
49+
return NewAppActivationArguments();
4350
}
4451

4552
private static ValueTask<ActivationArguments> HandleScheme(ProtocolActivatedEventArgs args)

src/SwashbucklerDiary.Maui/Services/VersionUpdataManager/VersionUpdataManager.cs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public class VersionUpdataManager : Rcl.Services.VersionUpdataManager
1111

1212
private readonly IPopupServiceHelper _popupServiceHelper;
1313

14+
private readonly IPlatformIntegration _platformIntegration;
15+
1416
public VersionUpdataManager(IDiaryService diaryService,
1517
IResourceService resourceService,
1618
ISettingService settingService,
@@ -20,11 +22,13 @@ public VersionUpdataManager(IDiaryService diaryService,
2022
IDiaryFileManager diaryFileManager,
2123
IAccessExternal accessExternal,
2224
IPopupServiceHelper popupServiceHelper,
23-
IStaticWebAssets staticWebAssets) :
25+
IStaticWebAssets staticWebAssets,
26+
IPlatformIntegration platformIntegration) :
2427
base(diaryService, resourceService, settingService, mediaResourceManager, i18n, versionTracking, diaryFileManager, staticWebAssets)
2528
{
2629
_accessExternal = accessExternal;
2730
_popupServiceHelper = popupServiceHelper;
31+
_platformIntegration = platformIntegration;
2832
}
2933

3034
protected override void InitializeVersionHandlers()
@@ -73,6 +77,25 @@ protected override async Task HandleVersionUpdate697()
7377

7478
public override async Task ToUpdate()
7579
{
80+
#if WINDOWS
81+
bool IsPackagedApp = false;
82+
try
83+
{
84+
if (Windows.ApplicationModel.Package.Current is not null)
85+
{
86+
IsPackagedApp = true;
87+
}
88+
}
89+
catch
90+
{
91+
}
92+
93+
if (!IsPackagedApp)
94+
{
95+
await _platformIntegration.OpenBrowser("https://github.com/Yu-Core/SwashbucklerDiary/releases");
96+
return;
97+
}
98+
#endif
7699
bool flag = await _accessExternal.OpenAppStoreAppDetails();
77100
if (!flag)
78101
{

0 commit comments

Comments
 (0)