Skip to content

Commit 418270f

Browse files
authored
Merge pull request #3233 from Jack251970/plugins_manifest_reupdate
Fix Plugin Store Page Refresh Issue
2 parents 0893134 + 319f016 commit 418270f

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

Flow.Launcher.Core/ExternalPlugins/PluginsManifest.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Flow.Launcher.Infrastructure.Logger;
1+
using Flow.Launcher.Infrastructure.Logger;
22
using System;
33
using System.Collections.Generic;
44
using System.Threading;
@@ -21,7 +21,7 @@ public static class PluginsManifest
2121

2222
public static List<UserPlugin> UserPlugins { get; private set; }
2323

24-
public static async Task UpdateManifestAsync(CancellationToken token = default, bool usePrimaryUrlOnly = false)
24+
public static async Task<bool> UpdateManifestAsync(CancellationToken token = default, bool usePrimaryUrlOnly = false)
2525
{
2626
try
2727
{
@@ -31,8 +31,14 @@ public static async Task UpdateManifestAsync(CancellationToken token = default,
3131
{
3232
var results = await mainPluginStore.FetchAsync(token, usePrimaryUrlOnly).ConfigureAwait(false);
3333

34-
UserPlugins = results;
35-
lastFetchedAt = DateTime.Now;
34+
// If the results are empty, we shouldn't update the manifest because the results are invalid.
35+
if (results.Count != 0)
36+
{
37+
UserPlugins = results;
38+
lastFetchedAt = DateTime.Now;
39+
40+
return true;
41+
}
3642
}
3743
}
3844
catch (Exception e)
@@ -43,6 +49,8 @@ public static async Task UpdateManifestAsync(CancellationToken token = default,
4349
{
4450
manifestUpdateLock.Release();
4551
}
52+
53+
return false;
4654
}
4755
}
4856
}

Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ public partial class SettingsPanePluginStoreViewModel : BaseModel
1313
{
1414
public string FilterText { get; set; } = string.Empty;
1515

16-
public IList<PluginStoreItemViewModel> ExternalPlugins => PluginsManifest.UserPlugins
17-
.Select(p => new PluginStoreItemViewModel(p))
16+
public IList<PluginStoreItemViewModel> ExternalPlugins =>
17+
PluginsManifest.UserPlugins?.Select(p => new PluginStoreItemViewModel(p))
1818
.OrderByDescending(p => p.Category == PluginStoreItemViewModel.NewRelease)
1919
.ThenByDescending(p => p.Category == PluginStoreItemViewModel.RecentlyUpdated)
2020
.ThenByDescending(p => p.Category == PluginStoreItemViewModel.None)
@@ -24,8 +24,10 @@ public partial class SettingsPanePluginStoreViewModel : BaseModel
2424
[RelayCommand]
2525
private async Task RefreshExternalPluginsAsync()
2626
{
27-
await PluginsManifest.UpdateManifestAsync();
28-
OnPropertyChanged(nameof(ExternalPlugins));
27+
if (await PluginsManifest.UpdateManifestAsync())
28+
{
29+
OnPropertyChanged(nameof(ExternalPlugins));
30+
}
2931
}
3032

3133
public bool SatisfiesFilter(PluginStoreItemViewModel plugin)

0 commit comments

Comments
 (0)