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 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
|
||||
if ((useTesting && manifest.TestingAssemblyVersion == null) || manifest.AssemblyVersion == null)
|
||||
|
|
@ -2421,7 +2422,8 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
var canFeedback = !isThirdParty &&
|
||||
!plugin.IsDev &&
|
||||
!plugin.IsOrphaned &&
|
||||
plugin.Manifest.DalamudApiLevel == PluginManager.DalamudApiLevel &&
|
||||
(plugin.Manifest.DalamudApiLevel == PluginManager.DalamudApiLevel
|
||||
|| plugin.Manifest.TestingDalamudApiLevel == PluginManager.DalamudApiLevel) &&
|
||||
acceptsFeedback &&
|
||||
availablePluginUpdate == default;
|
||||
|
||||
|
|
@ -3323,7 +3325,9 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
var searchString = this.searchText.ToLowerInvariant();
|
||||
var matcher = new FuzzyMatcher(searchString, MatchMode.FuzzyParts);
|
||||
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;
|
||||
|
||||
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"
|
||||
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}");
|
||||
return false;
|
||||
|
|
@ -1728,7 +1729,15 @@ internal class PluginManager : IInternalDisposableService
|
|||
var updates = this.AvailablePlugins
|
||||
.Where(remoteManifest => plugin.Manifest.InternalName == remoteManifest.InternalName)
|
||||
.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 =>
|
||||
{
|
||||
var useTesting = this.UseTesting(remoteManifest);
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ internal class LocalPlugin : IDisposable
|
|||
/// <summary>
|
||||
/// Gets a value indicating whether this plugin's API level is out of date.
|
||||
/// </summary>
|
||||
public bool IsOutdated => this.manifest.DalamudApiLevel < PluginManager.DalamudApiLevel;
|
||||
public bool IsOutdated => this.manifest.EffectiveApiLevel < PluginManager.DalamudApiLevel;
|
||||
|
||||
/// <summary>
|
||||
/// 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)
|
||||
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)
|
||||
throw new PluginPreconditionFailedException($"Unable to load {this.Name}, incompatible API level {this.manifest.DalamudApiLevel}");
|
||||
if (this.manifest.EffectiveApiLevel < PluginManager.DalamudApiLevel && !pluginManager.LoadAllApiLevels)
|
||||
throw new PluginPreconditionFailedException($"Unable to load {this.Name}, incompatible API level {this.manifest.EffectiveApiLevel}");
|
||||
|
||||
// We might want to throw here?
|
||||
if (!this.IsWantedByAnyProfile)
|
||||
|
|
|
|||
|
|
@ -63,11 +63,17 @@ public interface IPluginManifest
|
|||
public List<string>? Tags { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the API level of this plugin. For the current API level, please see <see cref="PluginManager.DalamudApiLevel"/>
|
||||
/// for the currently used API level.
|
||||
/// Gets the API level of this plugin.
|
||||
/// For the current API level, please see <see cref="PluginManager.DalamudApiLevel"/> for the currently used API level.
|
||||
/// </summary>
|
||||
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>
|
||||
/// Gets the number of downloads this plugin has.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -45,6 +45,11 @@ internal record LocalPluginManifest : PluginManifest, ILocalPluginManifest
|
|||
/// </summary>
|
||||
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>
|
||||
/// Save a plugin manifest to file.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -79,6 +79,10 @@ internal record PluginManifest : IPluginManifest
|
|||
[JsonProperty]
|
||||
public int DalamudApiLevel { get; init; } = PluginManager.DalamudApiLevel;
|
||||
|
||||
/// <inheritdoc/>
|
||||
[JsonProperty]
|
||||
public int? TestingDalamudApiLevel { get; init; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
[JsonProperty]
|
||||
public long DownloadCount { get; init; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue