Skip to content

armgit / Filee

Public Imported from GitHub
0

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

Setup: "Launch Filee" after an update opens the main window with the slides

KnifeLemon79bc2491936b
diff --git a/src/Filee.Setup/Installation/Installer.cs b/src/Filee.Setup/Installation/Installer.cs
index ea5aaf73..5eceb860 100644
--- a/src/Filee.Setup/Installation/Installer.cs
+++ b/src/Filee.Setup/Installation/Installer.cs
@@ -169,11 +169,12 @@ public sealed class Installer(SetupContext context, SetupPayload payload)
}
/// <summary>
- /// The arguments Filee starts with: the choices of a fresh install, or "back to the tray" after an update, with the
- /// new version's "What's new" slides.
+ /// The arguments Filee starts with: the choices of a fresh install, or after an update the new version's "What's new"
+ /// slides, back in the tray (/SILENT, the app's own updater) or over the main window (<paramref name="shown"/>: the
+ /// user clicked "Launch Filee").
/// </summary>
- public static string LaunchArguments(InstallChoices choices, bool update) => update
- ? "--background --whats-new"
+ public static string LaunchArguments(InstallChoices choices, bool update, bool shown = false) => update
+ ? shown ? "--whats-new" : "--background --whats-new"
: $"--install-engines={string.Join(',', choices.Engines)} " +
$"--start-with-windows={OnOff(choices.Tasks.Startup)} --context-menu={OnOff(choices.Tasks.ContextMenu)}" +
(choices.LanguagePicked ? $" --language={choices.Language}" : "");
diff --git a/src/Filee.Setup/ViewModels/SetupViewModel.cs b/src/Filee.Setup/ViewModels/SetupViewModel.cs
index a37fee67..01ebc028 100644
--- a/src/Filee.Setup/ViewModels/SetupViewModel.cs
+++ b/src/Filee.Setup/ViewModels/SetupViewModel.cs
@@ -314,11 +314,13 @@ public sealed partial class SetupViewModel : ObservableObject
[RelayCommand]
private Task Uninstall() => UninstallAsync();
- /// <summary>"Launch Filee" on the Done card.</summary>
+ /// <summary>"Launch Filee" on the Done card: after an update the main window, not the tray, so the slides show over it.</summary>
[RelayCommand]
private void LaunchAndClose()
{
- Launch = _result?.Launch;
+ Launch = IsUpdate && _result?.Launch is { } launch
+ ? launch with { Arguments = Installer.LaunchArguments(_initial, update: true, shown: true) }
+ : _result?.Launch;
CloseRequested?.Invoke(this, EventArgs.Empty);
}
diff --git a/tests/Filee.Setup.Tests/InstallerTests.cs b/tests/Filee.Setup.Tests/InstallerTests.cs
index bab81aee..4baa61da 100644
--- a/tests/Filee.Setup.Tests/InstallerTests.cs
+++ b/tests/Filee.Setup.Tests/InstallerTests.cs
@@ -320,6 +320,9 @@ public class InstallerTests
var updated = CommandLine.Parse(Installer.LaunchArguments(fresh, update: true).Split(' '));
Assert.True(updated.Background);
Assert.True(updated.WhatsNew);
+ var shown = CommandLine.Parse(Installer.LaunchArguments(fresh, update: true, shown: true).Split(' '));
+ Assert.False(shown.Background);
+ Assert.True(shown.WhatsNew);
Assert.False(CommandLine.Parse(Installer.LaunchArguments(fresh, update: false).Split(' ')).WhatsNew);
}
}
diff --git a/tests/Filee.Setup.Tests/SetupWindowTests.cs b/tests/Filee.Setup.Tests/SetupWindowTests.cs
index 02323caf..1bd01a8e 100644
--- a/tests/Filee.Setup.Tests/SetupWindowTests.cs
+++ b/tests/Filee.Setup.Tests/SetupWindowTests.cs
@@ -2,6 +2,8 @@
// errors and text that doesn't fit, and leaves screenshots in bin/.../screenshots for review. Animations are off
// (static logo, a still from each clip) except in the test that runs them.
+extern alias app;
+
using System.Runtime.CompilerServices;
using Avalonia;
using Avalonia.Controls;
@@ -19,6 +21,7 @@ using Filee.Setup.Installation;
using Filee.Setup.Payload;
using Filee.Setup.ViewModels;
using Filee.Setup.Views;
+using CommandLine = app::Filee.App.Services.CommandLine;
namespace Filee.Setup.Tests;
@@ -328,6 +331,20 @@ public class SetupWindowTests
window.Close();
}
+ [AvaloniaFact]
+ public async Task Launch_after_an_update_opens_the_main_window_with_the_slides()
+ {
+ var (model, _, _) = Model("en", update: true);
+ var window = Show(model);
+ await model.InstallAsync();
+ Pump();
+ model.LaunchAndCloseCommand.Execute(null);
+ var options = CommandLine.Parse(model.Launch!.Arguments.Split(' '));
+ Assert.False(options.Background);
+ Assert.True(options.WhatsNew);
+ window.Close();
+ }
+
[AvaloniaFact]
public void Closing_the_window_before_installing_cancels()
{