diff --git a/Directory.Packages.props b/Directory.Packages.props index a62db82c3e..41ca84f166 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -105,7 +105,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + all @@ -128,7 +128,7 @@ - + diff --git a/src/Abstractions/NexusMods.Abstractions.Collections/Json/ModSourceType.cs b/src/Abstractions/NexusMods.Abstractions.Collections/Json/ModSourceType.cs index e0fb7ef82d..d951f8b1ae 100644 --- a/src/Abstractions/NexusMods.Abstractions.Collections/Json/ModSourceType.cs +++ b/src/Abstractions/NexusMods.Abstractions.Collections/Json/ModSourceType.cs @@ -24,12 +24,12 @@ public enum ModSourceType /// /// Downloaded externally via an URL. /// - [JsonStringEnumMemberName("Browse")] + [JsonStringEnumMemberName("browse")] Browse, /// /// Downloaded externally via an URL. /// - [JsonStringEnumMemberName("Direct")] + [JsonStringEnumMemberName("direct")] Direct, } diff --git a/src/Networking/NexusMods.Networking.NexusWebApi/LoginManager.cs b/src/Networking/NexusMods.Networking.NexusWebApi/LoginManager.cs index 408b4b91f3..be2e59b099 100644 --- a/src/Networking/NexusMods.Networking.NexusWebApi/LoginManager.cs +++ b/src/Networking/NexusMods.Networking.NexusWebApi/LoginManager.cs @@ -32,7 +32,7 @@ public sealed class LoginManager : IDisposable, ILoginManager public Observable UserInfoObservable => _userInfo; /// - public UserInfo? UserInfo { get; private set; } + public UserInfo? UserInfo => _cachedUserInfo.Get(); private readonly IDisposable _observeDatomDisposable; @@ -61,18 +61,16 @@ public LoginManager( .DistinctUntilChanged() .SubscribeAwait(async (hasValue, cancellationToken) => { - _cachedUserInfo.Evict(); - if (!hasValue) { + _cachedUserInfo.Evict(); _userInfo.OnNext(value: null); - UserInfo = null; } else { var userInfo = await Verify(cancellationToken); + _cachedUserInfo.Store(userInfo); _userInfo.OnNext(userInfo); - UserInfo = userInfo; } }, awaitOperation: AwaitOperation.Sequential, configureAwait: false); } diff --git a/tests/NexusMods.Collections.Tests/CollectionInstallTests.cs b/tests/NexusMods.Collections.Tests/CollectionInstallTests.cs index 25d3f9d85d..4b4b5dd878 100644 --- a/tests/NexusMods.Collections.Tests/CollectionInstallTests.cs +++ b/tests/NexusMods.Collections.Tests/CollectionInstallTests.cs @@ -32,6 +32,7 @@ public async Task CanInstallCollections(string slug, int revisionNumber) var loginManager = ServiceProvider.GetRequiredService(); _ = await loginManager.GetUserInfoAsync(); + loginManager.UserInfo.Should().NotBeNull(because: "this test requires a logged in user"); loginManager.IsPremium.Should().BeTrue(because: "this test requires premium to automatically download mods"); await using var destination = TemporaryFileManager.CreateFile(); diff --git a/tests/NexusMods.StandardGameLocators.TestHelpers/Services.cs b/tests/NexusMods.StandardGameLocators.TestHelpers/Services.cs index 5b970ad346..2c7c9f42a7 100644 --- a/tests/NexusMods.StandardGameLocators.TestHelpers/Services.cs +++ b/tests/NexusMods.StandardGameLocators.TestHelpers/Services.cs @@ -42,7 +42,7 @@ public static IServiceCollection AddStubbedGameLocators(this IServiceCollection coll.AddSingleton>(s => new StubbedGameLocator(s.GetRequiredService(), - tfm => new GOGGame(GOGGameId.From(42), "Stubbed Game", tfm.CreateFolder("gog_game").Path), + tfm => new GOGGame(GOGGameId.From(42), "Stubbed Game", tfm.CreateFolder("gog_game").Path, "4242"), game => game.Id)); coll.AddSingleton>(s =>