Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public async Task StartupLaunch_RespectsSavedPreferenceProtocolAndExplicitCli(bo
fixture.Settings.Get<bool>(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<string>());
}
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -146,23 +149,25 @@ private sealed class Fixture
public IWhWzDataSingletonService Badges { get; } = Substitute.For<IWhWzDataSingletonService>();
public IApplicationLiveUpdates Live { get; } = Substitute.For<IApplicationLiveUpdates>();
public ISettingsManager Settings { get; } = Substitute.For<ISettingsManager>();
public IRetroRewindLaunchService Launch { get; } = Substitute.For<IRetroRewindLaunchService>();
public ILauncherProvider Launchers { get; } = Substitute.For<ILauncherProvider>();
public ILauncher Launch { get; } = Substitute.For<ILauncher>();
public ApplicationStartup Startup { get; }

public Fixture()
{
Mods.ReloadAsync().Returns(Ok());
Requests.HandleAsync(Arg.Any<string>()).Returns(Ok());
Badges.LoadBadgesAsync().Returns(Ok());
Launch.LaunchAsync(Arg.Any<bool>()).Returns(Ok());
Launchers.GetActiveLauncher().Returns(Launch);
Launch.Launch().Returns(Ok());
Startup = new ApplicationStartup(
Mods,
Requests,
Updates,
Badges,
Live,
Settings,
Launch,
Launchers,
NullLogger<ApplicationStartup>.Instance
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public sealed class ApplicationStartup(
IWhWzDataSingletonService badges,
IApplicationLiveUpdates liveUpdates,
ISettingsManager settings,
IRetroRewindLaunchService launch,
ILauncherProvider launchers,
ILogger<ApplicationStartup> logger
) : IApplicationStartup
{
Expand Down Expand Up @@ -54,8 +54,7 @@ public async Task RunAsync(StartupOptions options, CancellationToken cancellatio

if (options.LaunchRetroRewind || (!openedProtocol && settings.Get<bool>(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);
}
Expand Down
2 changes: 1 addition & 1 deletion WheelWizard/Features/Launching/LauncherProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace WheelWizard.Launching;

/// <summary>
/// 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.
/// </summary>
Expand Down
Loading