fix: populate available plugins in SetPluginReposFromConfigAsync

This commit is contained in:
Raymond 2021-09-12 18:09:58 -04:00
parent 936708861f
commit e7b7da7cca

View file

@ -159,14 +159,7 @@ namespace Dalamud.Plugin.Internal
.Select(repo => new PluginRepository(repo.Url, repo.IsEnabled))); .Select(repo => new PluginRepository(repo.Url, repo.IsEnabled)));
this.Repos = repos; this.Repos = repos;
await this.ReloadPluginMastersAsync(notify);
if (notify)
this.NotifyAvailablePluginsChanged();
foreach (var repo in repos)
{
await repo.ReloadPluginMasterAsync();
}
} }
/// <summary> /// <summary>
@ -306,21 +299,20 @@ namespace Dalamud.Plugin.Internal
/// <summary> /// <summary>
/// Reload the PluginMaster for each repo, filter, and event that the list has updated. /// Reload the PluginMaster for each repo, filter, and event that the list has updated.
/// </summary> /// </summary>
/// <param name="notify">Whether to notify that available plugins have changed afterwards.</param>
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
public async Task ReloadPluginMastersAsync() public async Task ReloadPluginMastersAsync(bool notify = true)
{ {
foreach (var repo in this.Repos) await Task.WhenAll(this.Repos.Select(repo => repo.ReloadPluginMasterAsync()));
{
await repo.ReloadPluginMasterAsync();
}
this.RefilterPluginMasters(); this.RefilterPluginMasters(notify);
} }
/// <summary> /// <summary>
/// Apply visibility and eligibility filters to the available plugins, then event that the list has updated. /// Apply visibility and eligibility filters to the available plugins, then event that the list has updated.
/// </summary> /// </summary>
public void RefilterPluginMasters() /// <param name="notify">Whether to notify that available plugins have changed afterwards.</param>
public void RefilterPluginMasters(bool notify = true)
{ {
this.availablePlugins = this.Repos this.availablePlugins = this.Repos
.SelectMany(repo => repo.PluginMaster) .SelectMany(repo => repo.PluginMaster)
@ -328,7 +320,10 @@ namespace Dalamud.Plugin.Internal
.Where(this.IsManifestVisible) .Where(this.IsManifestVisible)
.ToList(); .ToList();
this.NotifyAvailablePluginsChanged(); if (notify)
{
this.NotifyAvailablePluginsChanged();
}
} }
/// <summary> /// <summary>