diff --git a/WheelWizard.Test/Features/ApplicationLifecycle/ApplicationStartupTests.cs b/WheelWizard.Test/Features/ApplicationLifecycle/ApplicationStartupTests.cs index 2edc8aaf..990e82a3 100644 --- a/WheelWizard.Test/Features/ApplicationLifecycle/ApplicationStartupTests.cs +++ b/WheelWizard.Test/Features/ApplicationLifecycle/ApplicationStartupTests.cs @@ -36,7 +36,8 @@ public async Task StartupLaunch_RespectsSavedPreferenceProtocolAndExplicitCli(bo fixture.Settings.Get(fixture.Settings.LAUNCH_RR_ON_STARTUP).Returns(saved); await fixture.Startup.RunAsync(new StartupOptions(protocol ? "wheelwizard://123" : null, cli)); - await fixture.Launch.Received(expected ? 1 : 0).LaunchAsync(false); + fixture.Launchers.Received(expected ? 1 : 0).GetActiveLauncher(); + await fixture.Launch.Received(expected ? 1 : 0).Launch(); fixture.Live.Received(1).Start(); await fixture.Requests.Received(protocol ? 1 : 0).HandleAsync(Arg.Any()); } @@ -68,7 +69,8 @@ public async Task ShutdownDuringUpdateCheck_DoesNotStartPollingOrLaunch() fixture.Live.DidNotReceive().Start(); await fixture.Badges.DidNotReceive().LoadBadgesAsync(); - await fixture.Launch.DidNotReceiveWithAnyArgs().LaunchAsync(default); + fixture.Launchers.DidNotReceive().GetActiveLauncher(); + await fixture.Launch.DidNotReceive().Launch(); } [Theory] @@ -108,7 +110,8 @@ public void ShutdownAfterRequestCompletion_DoesNotBeginTheNextStartupStep(string fixture.Updates.DidNotReceive().CheckForUpdatesAsync(); fixture.Badges.DidNotReceive().LoadBadgesAsync(); fixture.Live.DidNotReceive().Start(); - fixture.Launch.DidNotReceiveWithAnyArgs().LaunchAsync(default); + fixture.Launchers.DidNotReceive().GetActiveLauncher(); + fixture.Launch.DidNotReceive().Launch(); } private sealed class QueuedContext : SynchronizationContext @@ -146,7 +149,8 @@ private sealed class Fixture public IWhWzDataSingletonService Badges { get; } = Substitute.For(); public IApplicationLiveUpdates Live { get; } = Substitute.For(); public ISettingsManager Settings { get; } = Substitute.For(); - public IRetroRewindLaunchService Launch { get; } = Substitute.For(); + public ILauncherProvider Launchers { get; } = Substitute.For(); + public ILauncher Launch { get; } = Substitute.For(); public ApplicationStartup Startup { get; } public Fixture() @@ -154,7 +158,8 @@ public Fixture() Mods.ReloadAsync().Returns(Ok()); Requests.HandleAsync(Arg.Any()).Returns(Ok()); Badges.LoadBadgesAsync().Returns(Ok()); - Launch.LaunchAsync(Arg.Any()).Returns(Ok()); + Launchers.GetActiveLauncher().Returns(Launch); + Launch.Launch().Returns(Ok()); Startup = new ApplicationStartup( Mods, Requests, @@ -162,7 +167,7 @@ public Fixture() Badges, Live, Settings, - Launch, + Launchers, NullLogger.Instance ); } diff --git a/WheelWizard/Features/ApplicationLifecycle/ApplicationStartup.cs b/WheelWizard/Features/ApplicationLifecycle/ApplicationStartup.cs index 8fb555a7..ad2881f6 100644 --- a/WheelWizard/Features/ApplicationLifecycle/ApplicationStartup.cs +++ b/WheelWizard/Features/ApplicationLifecycle/ApplicationStartup.cs @@ -20,7 +20,7 @@ public sealed class ApplicationStartup( IWhWzDataSingletonService badges, IApplicationLiveUpdates liveUpdates, ISettingsManager settings, - IRetroRewindLaunchService launch, + ILauncherProvider launchers, ILogger logger ) : IApplicationStartup { @@ -54,8 +54,7 @@ public async Task RunAsync(StartupOptions options, CancellationToken cancellatio if (options.LaunchRetroRewind || (!openedProtocol && settings.Get(settings.LAUNCH_RR_ON_STARTUP))) { - // #todo: (#484) use the active launcher for startup too, and test both dolphin and recomp. - var result = await launch.LaunchAsync().WaitAsync(cancellationToken); + var result = await launchers.GetActiveLauncher().Launch().WaitAsync(cancellationToken); if (result.IsFailure) logger.LogError(result.Error.Exception, "Failed to launch Retro Rewind on startup: {Message}", result.Error.Message); } diff --git a/WheelWizard/Features/Launching/LauncherProvider.cs b/WheelWizard/Features/Launching/LauncherProvider.cs index 0f351e92..26535497 100644 --- a/WheelWizard/Features/Launching/LauncherProvider.cs +++ b/WheelWizard/Features/Launching/LauncherProvider.cs @@ -4,7 +4,7 @@ namespace WheelWizard.Launching; /// -/// Resolves the launcher the Home page should drive. The recomp is a beta (Windows and Linux) that, when +/// Resolves the launcher used by the Home page and startup. The recomp is a beta (Windows and Linux) that, when /// opted into, replaces the Dolphin/Retro Rewind frontend entirely; which launcher that decision /// selects lives here, so no view has to re-derive it. ///