mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
fix: testing API level being ignored (#1472)
Co-authored-by: goat <16760685+goaaats@users.noreply.github.com>
This commit is contained in:
parent
1f0b616e2c
commit
c228c92979
6 changed files with 39 additions and 11 deletions
|
|
@ -2099,7 +2099,8 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
var useTesting = pluginManager.UseTesting(manifest);
|
var useTesting = pluginManager.UseTesting(manifest);
|
||||||
var wasSeen = this.WasPluginSeen(manifest.InternalName);
|
var wasSeen = this.WasPluginSeen(manifest.InternalName);
|
||||||
|
|
||||||
var isOutdated = manifest.DalamudApiLevel < PluginManager.DalamudApiLevel;
|
var effectiveApiLevel = useTesting && manifest.TestingDalamudApiLevel != null ? manifest.TestingDalamudApiLevel.Value : manifest.DalamudApiLevel;
|
||||||
|
var isOutdated = effectiveApiLevel < PluginManager.DalamudApiLevel;
|
||||||
|
|
||||||
// Check for valid versions
|
// Check for valid versions
|
||||||
if ((useTesting && manifest.TestingAssemblyVersion == null) || manifest.AssemblyVersion == null)
|
if ((useTesting && manifest.TestingAssemblyVersion == null) || manifest.AssemblyVersion == null)
|
||||||
|
|
@ -2421,7 +2422,8 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
var canFeedback = !isThirdParty &&
|
var canFeedback = !isThirdParty &&
|
||||||
!plugin.IsDev &&
|
!plugin.IsDev &&
|
||||||
!plugin.IsOrphaned &&
|
!plugin.IsOrphaned &&
|
||||||
plugin.Manifest.DalamudApiLevel == PluginManager.DalamudApiLevel &&
|
(plugin.Manifest.DalamudApiLevel == PluginManager.DalamudApiLevel
|
||||||
|
|| plugin.Manifest.TestingDalamudApiLevel == PluginManager.DalamudApiLevel) &&
|
||||||
acceptsFeedback &&
|
acceptsFeedback &&
|
||||||
availablePluginUpdate == default;
|
availablePluginUpdate == default;
|
||||||
|
|
||||||
|
|
@ -3323,7 +3325,9 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
var searchString = this.searchText.ToLowerInvariant();
|
var searchString = this.searchText.ToLowerInvariant();
|
||||||
var matcher = new FuzzyMatcher(searchString, MatchMode.FuzzyParts);
|
var matcher = new FuzzyMatcher(searchString, MatchMode.FuzzyParts);
|
||||||
var hasSearchString = !string.IsNullOrWhiteSpace(this.searchText);
|
var hasSearchString = !string.IsNullOrWhiteSpace(this.searchText);
|
||||||
var oldApi = manifest.DalamudApiLevel < PluginManager.DalamudApiLevel;
|
var oldApi = (manifest.TestingDalamudApiLevel == null
|
||||||
|
|| manifest.TestingDalamudApiLevel < PluginManager.DalamudApiLevel)
|
||||||
|
&& manifest.DalamudApiLevel < PluginManager.DalamudApiLevel;
|
||||||
var installed = this.IsManifestInstalled(manifest).IsInstalled;
|
var installed = this.IsManifestInstalled(manifest).IsInstalled;
|
||||||
|
|
||||||
if (oldApi && !hasSearchString && !installed)
|
if (oldApi && !hasSearchString && !installed)
|
||||||
|
|
|
||||||
|
|
@ -1178,7 +1178,8 @@ internal class PluginManager : IInternalDisposableService
|
||||||
}
|
}
|
||||||
|
|
||||||
// API level - we keep the API before this in the installer to show as "outdated"
|
// API level - we keep the API before this in the installer to show as "outdated"
|
||||||
if (manifest.DalamudApiLevel < DalamudApiLevel - 1 && !this.LoadAllApiLevels)
|
var effectiveApiLevel = this.UseTesting(manifest) && manifest.TestingDalamudApiLevel != null ? manifest.TestingDalamudApiLevel.Value : manifest.DalamudApiLevel;
|
||||||
|
if (effectiveApiLevel < DalamudApiLevel - 1 && !this.LoadAllApiLevels)
|
||||||
{
|
{
|
||||||
Log.Verbose($"API Level: {manifest.InternalName} - {manifest.AssemblyVersion} - {manifest.TestingAssemblyVersion}");
|
Log.Verbose($"API Level: {manifest.InternalName} - {manifest.AssemblyVersion} - {manifest.TestingAssemblyVersion}");
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1698,7 +1699,7 @@ internal class PluginManager : IInternalDisposableService
|
||||||
|
|
||||||
if (plugin == null)
|
if (plugin == null)
|
||||||
throw new Exception("Plugin was null when adding to list");
|
throw new Exception("Plugin was null when adding to list");
|
||||||
|
|
||||||
lock (this.pluginListLock)
|
lock (this.pluginListLock)
|
||||||
{
|
{
|
||||||
this.installedPluginsList.Add(plugin);
|
this.installedPluginsList.Add(plugin);
|
||||||
|
|
@ -1728,7 +1729,15 @@ internal class PluginManager : IInternalDisposableService
|
||||||
var updates = this.AvailablePlugins
|
var updates = this.AvailablePlugins
|
||||||
.Where(remoteManifest => plugin.Manifest.InternalName == remoteManifest.InternalName)
|
.Where(remoteManifest => plugin.Manifest.InternalName == remoteManifest.InternalName)
|
||||||
.Where(remoteManifest => plugin.Manifest.InstalledFromUrl == remoteManifest.SourceRepo.PluginMasterUrl || !remoteManifest.SourceRepo.IsThirdParty)
|
.Where(remoteManifest => plugin.Manifest.InstalledFromUrl == remoteManifest.SourceRepo.PluginMasterUrl || !remoteManifest.SourceRepo.IsThirdParty)
|
||||||
.Where(remoteManifest => remoteManifest.DalamudApiLevel == DalamudApiLevel)
|
.Where(remoteManifest =>
|
||||||
|
{
|
||||||
|
var useTesting = this.UseTesting(remoteManifest);
|
||||||
|
var candidateApiLevel = useTesting && remoteManifest.TestingDalamudApiLevel != null
|
||||||
|
? remoteManifest.TestingDalamudApiLevel.Value
|
||||||
|
: remoteManifest.DalamudApiLevel;
|
||||||
|
|
||||||
|
return candidateApiLevel == DalamudApiLevel;
|
||||||
|
})
|
||||||
.Select(remoteManifest =>
|
.Select(remoteManifest =>
|
||||||
{
|
{
|
||||||
var useTesting = this.UseTesting(remoteManifest);
|
var useTesting = this.UseTesting(remoteManifest);
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,7 @@ internal class LocalPlugin : IDisposable
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether this plugin's API level is out of date.
|
/// Gets a value indicating whether this plugin's API level is out of date.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsOutdated => this.manifest.DalamudApiLevel < PluginManager.DalamudApiLevel;
|
public bool IsOutdated => this.manifest.EffectiveApiLevel < PluginManager.DalamudApiLevel;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether the plugin is for testing use only.
|
/// Gets a value indicating whether the plugin is for testing use only.
|
||||||
|
|
@ -318,8 +318,8 @@ internal class LocalPlugin : IDisposable
|
||||||
if (this.manifest.ApplicableVersion < dalamud.StartInfo.GameVersion)
|
if (this.manifest.ApplicableVersion < dalamud.StartInfo.GameVersion)
|
||||||
throw new PluginPreconditionFailedException($"Unable to load {this.Name}, game is newer than applicable version {this.manifest.ApplicableVersion}");
|
throw new PluginPreconditionFailedException($"Unable to load {this.Name}, game is newer than applicable version {this.manifest.ApplicableVersion}");
|
||||||
|
|
||||||
if (this.manifest.DalamudApiLevel < PluginManager.DalamudApiLevel && !pluginManager.LoadAllApiLevels)
|
if (this.manifest.EffectiveApiLevel < PluginManager.DalamudApiLevel && !pluginManager.LoadAllApiLevels)
|
||||||
throw new PluginPreconditionFailedException($"Unable to load {this.Name}, incompatible API level {this.manifest.DalamudApiLevel}");
|
throw new PluginPreconditionFailedException($"Unable to load {this.Name}, incompatible API level {this.manifest.EffectiveApiLevel}");
|
||||||
|
|
||||||
// We might want to throw here?
|
// We might want to throw here?
|
||||||
if (!this.IsWantedByAnyProfile)
|
if (!this.IsWantedByAnyProfile)
|
||||||
|
|
|
||||||
|
|
@ -63,11 +63,17 @@ public interface IPluginManifest
|
||||||
public List<string>? Tags { get; }
|
public List<string>? Tags { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the API level of this plugin. For the current API level, please see <see cref="PluginManager.DalamudApiLevel"/>
|
/// Gets the API level of this plugin.
|
||||||
/// for the currently used API level.
|
/// For the current API level, please see <see cref="PluginManager.DalamudApiLevel"/> for the currently used API level.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int DalamudApiLevel { get; }
|
public int DalamudApiLevel { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the API level of the plugin's testing variant.
|
||||||
|
/// For the current API level, please see <see cref="PluginManager.DalamudApiLevel"/> for the currently used API level.
|
||||||
|
/// </summary>
|
||||||
|
public int? TestingDalamudApiLevel { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the number of downloads this plugin has.
|
/// Gets the number of downloads this plugin has.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,11 @@ internal record LocalPluginManifest : PluginManifest, ILocalPluginManifest
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Version EffectiveVersion => this.Testing && this.TestingAssemblyVersion != null ? this.TestingAssemblyVersion : this.AssemblyVersion;
|
public Version EffectiveVersion => this.Testing && this.TestingAssemblyVersion != null ? this.TestingAssemblyVersion : this.AssemblyVersion;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the effective API level of this plugin.
|
||||||
|
/// </summary>
|
||||||
|
public int EffectiveApiLevel => this.Testing && this.TestingDalamudApiLevel != null ? this.TestingDalamudApiLevel.Value : this.DalamudApiLevel;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Save a plugin manifest to file.
|
/// Save a plugin manifest to file.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,10 @@ internal record PluginManifest : IPluginManifest
|
||||||
[JsonProperty]
|
[JsonProperty]
|
||||||
public int DalamudApiLevel { get; init; } = PluginManager.DalamudApiLevel;
|
public int DalamudApiLevel { get; init; } = PluginManager.DalamudApiLevel;
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
[JsonProperty]
|
||||||
|
public int? TestingDalamudApiLevel { get; init; }
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
[JsonProperty]
|
[JsonProperty]
|
||||||
public long DownloadCount { get; init; }
|
public long DownloadCount { get; init; }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue