Fix install workflow
This commit is contained in:
parent
66679ace2f
commit
742310b8d6
@ -6,7 +6,7 @@
|
|||||||
<TrimMode>copyused</TrimMode>
|
<TrimMode>copyused</TrimMode>
|
||||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||||
<IsPublishable>true</IsPublishable>
|
<IsPublishable>true</IsPublishable>
|
||||||
|
<AssemblyName>Hangover</AssemblyName>
|
||||||
<PublishReadyToRun>true</PublishReadyToRun>
|
<PublishReadyToRun>true</PublishReadyToRun>
|
||||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||||
|
|||||||
@ -10,7 +10,8 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
|||||||
<PublishProtocol>FileSystem</PublishProtocol>
|
<PublishProtocol>FileSystem</PublishProtocol>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
|
||||||
<SelfContained>false</SelfContained>
|
<SelfContained>true</SelfContained>
|
||||||
<PublishSingleFile>false</PublishSingleFile>
|
<PublishSingleFile>false</PublishSingleFile>
|
||||||
|
<PublishTrimmed>false</PublishTrimmed>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@ -10,7 +10,8 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
|||||||
<PublishProtocol>FileSystem</PublishProtocol>
|
<PublishProtocol>FileSystem</PublishProtocol>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<RuntimeIdentifier>osx-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>osx-x64</RuntimeIdentifier>
|
||||||
<SelfContained>false</SelfContained>
|
<SelfContained>true</SelfContained>
|
||||||
<PublishSingleFile>false</PublishSingleFile>
|
<PublishSingleFile>false</PublishSingleFile>
|
||||||
|
<PublishTrimmed>false</PublishTrimmed>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@ -72,7 +72,6 @@ namespace LibationAvalonia
|
|||||||
var SEGOEUI = new Typeface(new FontFamily(new Uri("avares://Libation/Assets/WINGDING.TTF"), "SEGOEUI_Local"));
|
var SEGOEUI = new Typeface(new FontFamily(new Uri("avares://Libation/Assets/WINGDING.TTF"), "SEGOEUI_Local"));
|
||||||
var gtf = FontManager.Current.GetOrAddGlyphTypeface(SEGOEUI);
|
var gtf = FontManager.Current.GetOrAddGlyphTypeface(SEGOEUI);
|
||||||
|
|
||||||
|
|
||||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||||
{
|
{
|
||||||
if (SetupRequired)
|
if (SetupRequired)
|
||||||
@ -115,28 +114,21 @@ namespace LibationAvalonia
|
|||||||
// all returns should be preceded by either:
|
// all returns should be preceded by either:
|
||||||
// - if config.LibationSettingsAreValid
|
// - if config.LibationSettingsAreValid
|
||||||
// - error message, Exit()
|
// - error message, Exit()
|
||||||
|
if (setupDialog.IsNewUser)
|
||||||
if ((!setupDialog.IsNewUser
|
{
|
||||||
&& !setupDialog.IsReturningUser) ||
|
setupDialog.Config.SetLibationFiles(Configuration.UserProfile);
|
||||||
!await RunInstall(setupDialog))
|
ShowSettingsWindow(desktop, setupDialog.Config, OnSettingsCompleted);
|
||||||
|
}
|
||||||
|
else if (setupDialog.IsReturningUser)
|
||||||
|
{
|
||||||
|
ShowLibationFilesDialog(desktop, setupDialog.Config, OnLibationFilesCompleted);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
await CancelInstallation();
|
await CancelInstallation();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// most migrations go in here
|
|
||||||
AppScaffolding.LibationScaffolding.RunPostConfigMigrations(setupDialog.Config);
|
|
||||||
|
|
||||||
await MessageBox.VerboseLoggingWarning_ShowIfTrue();
|
|
||||||
|
|
||||||
#if !DEBUG
|
|
||||||
//AutoUpdater.NET only works for WinForms or WPF application projects.
|
|
||||||
//checkForUpdate();
|
|
||||||
#endif
|
|
||||||
// logging is init'd here
|
|
||||||
AppScaffolding.LibationScaffolding.RunPostMigrationScaffolding(setupDialog.Config);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -152,32 +144,83 @@ namespace LibationAvalonia
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task RunMigrationsAsync(Configuration config)
|
||||||
|
{
|
||||||
|
// most migrations go in here
|
||||||
|
AppScaffolding.LibationScaffolding.RunPostConfigMigrations(config);
|
||||||
|
|
||||||
|
await MessageBox.VerboseLoggingWarning_ShowIfTrue();
|
||||||
|
|
||||||
|
// logging is init'd here
|
||||||
|
AppScaffolding.LibationScaffolding.RunPostMigrationScaffolding(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowSettingsWindow(IClassicDesktopStyleApplicationLifetime desktop, Configuration config, Action<IClassicDesktopStyleApplicationLifetime, SettingsDialog, Configuration> OnClose)
|
||||||
|
{
|
||||||
|
config.Books ??= Path.Combine(Configuration.UserProfile, "Books");
|
||||||
|
|
||||||
|
AppScaffolding.LibationScaffolding.PopulateMissingConfigValues(config);
|
||||||
|
|
||||||
|
var settingsDialog = new SettingsDialog();
|
||||||
|
desktop.MainWindow = settingsDialog;
|
||||||
|
settingsDialog.RestoreSizeAndLocation(Configuration.Instance);
|
||||||
|
settingsDialog.Show();
|
||||||
|
|
||||||
|
void WindowClosing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||||
|
{
|
||||||
|
settingsDialog.Closing -= WindowClosing;
|
||||||
|
e.Cancel = true;
|
||||||
|
OnClose?.Invoke(desktop, settingsDialog, config);
|
||||||
|
}
|
||||||
|
settingsDialog.Closing += WindowClosing;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnSettingsCompleted(IClassicDesktopStyleApplicationLifetime desktop, SettingsDialog settingsDialog, Configuration config)
|
||||||
|
{
|
||||||
|
if (config.LibationSettingsAreValid)
|
||||||
|
{
|
||||||
|
await RunMigrationsAsync(config);
|
||||||
|
LibraryTask = Task.Run(() => DbContexts.GetLibrary_Flat_NoTracking(includeParents: true));
|
||||||
|
AudibleUtilities.AudibleApiStorage.EnsureAccountsSettingsFileExists();
|
||||||
|
ShowMainWindow(desktop);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
await CancelInstallation();
|
||||||
|
|
||||||
|
settingsDialog.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void ShowLibationFilesDialog(IClassicDesktopStyleApplicationLifetime desktop, Configuration config, Action<IClassicDesktopStyleApplicationLifetime, LibationFilesDialog, Configuration> OnClose)
|
||||||
|
{
|
||||||
|
var libationFilesDialog = new LibationFilesDialog();
|
||||||
|
desktop.MainWindow = libationFilesDialog;
|
||||||
|
libationFilesDialog.Show();
|
||||||
|
|
||||||
|
void WindowClosing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||||
|
{
|
||||||
|
libationFilesDialog.Closing -= WindowClosing;
|
||||||
|
e.Cancel = true;
|
||||||
|
OnClose?.Invoke(desktop, libationFilesDialog, config);
|
||||||
|
}
|
||||||
|
libationFilesDialog.Closing += WindowClosing;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnLibationFilesCompleted(IClassicDesktopStyleApplicationLifetime desktop, LibationFilesDialog libationFilesDialog, Configuration config)
|
||||||
|
{
|
||||||
|
config.SetLibationFiles(libationFilesDialog.SelectedDirectory);
|
||||||
|
if (config.LibationSettingsAreValid)
|
||||||
|
{
|
||||||
|
await RunMigrationsAsync(config);
|
||||||
|
|
||||||
LibraryTask = Task.Run(() => DbContexts.GetLibrary_Flat_NoTracking(includeParents: true));
|
LibraryTask = Task.Run(() => DbContexts.GetLibrary_Flat_NoTracking(includeParents: true));
|
||||||
AudibleUtilities.AudibleApiStorage.EnsureAccountsSettingsFileExists();
|
AudibleUtilities.AudibleApiStorage.EnsureAccountsSettingsFileExists();
|
||||||
ShowMainWindow(desktop);
|
ShowMainWindow(desktop);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
private static async Task<bool> RunInstall(SetupDialog setupDialog)
|
|
||||||
{
|
{
|
||||||
var config = setupDialog.Config;
|
|
||||||
|
|
||||||
if (setupDialog.IsNewUser)
|
|
||||||
{
|
|
||||||
config.SetLibationFiles(Configuration.UserProfile);
|
|
||||||
}
|
|
||||||
else if (setupDialog.IsReturningUser)
|
|
||||||
{
|
|
||||||
|
|
||||||
var libationFilesDialog = new LibationFilesDialog();
|
|
||||||
|
|
||||||
if (await libationFilesDialog.ShowDialog<DialogResult>(setupDialog) != DialogResult.OK)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
config.SetLibationFiles(libationFilesDialog.SelectedDirectory);
|
|
||||||
if (config.LibationSettingsAreValid)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// path did not result in valid settings
|
// path did not result in valid settings
|
||||||
var continueResult = await MessageBox.Show(
|
var continueResult = await MessageBox.Show(
|
||||||
$"No valid settings were found at this location.\r\nWould you like to create a new install settings in this folder?\r\n\r\n{libationFilesDialog.SelectedDirectory}",
|
$"No valid settings were found at this location.\r\nWould you like to create a new install settings in this folder?\r\n\r\n{libationFilesDialog.SelectedDirectory}",
|
||||||
@ -185,17 +228,13 @@ namespace LibationAvalonia
|
|||||||
MessageBoxButtons.YesNo,
|
MessageBoxButtons.YesNo,
|
||||||
MessageBoxIcon.Question);
|
MessageBoxIcon.Question);
|
||||||
|
|
||||||
if (continueResult != DialogResult.Yes)
|
if (continueResult == DialogResult.Yes)
|
||||||
return false;
|
ShowSettingsWindow(desktop, config, OnSettingsCompleted);
|
||||||
|
else
|
||||||
|
await CancelInstallation();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
libationFilesDialog.Close();
|
||||||
// INIT DEFAULT SETTINGS
|
|
||||||
// if 'new user' was clicked, or if 'returning user' chose new install: show basic settings dialog
|
|
||||||
config.Books ??= Path.Combine(Configuration.UserProfile, "Books");
|
|
||||||
|
|
||||||
AppScaffolding.LibationScaffolding.PopulateMissingConfigValues(config);
|
|
||||||
return await new SettingsDialog().ShowDialog<DialogResult>(setupDialog) == DialogResult.OK
|
|
||||||
&& config.LibationSettingsAreValid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static async Task CancelInstallation()
|
static async Task CancelInstallation()
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
MinWidth="800" MaxWidth="800"
|
MinWidth="800" MaxWidth="800"
|
||||||
x:Class="LibationAvalonia.Dialogs.LibationFilesDialog"
|
x:Class="LibationAvalonia.Dialogs.LibationFilesDialog"
|
||||||
xmlns:controls="clr-namespace:LibationAvalonia.Controls"
|
xmlns:controls="clr-namespace:LibationAvalonia.Controls"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
Title="Book Details"
|
Title="Book Details"
|
||||||
Icon="/Assets/libation.ico">
|
Icon="/Assets/libation.ico">
|
||||||
|
|
||||||
|
|||||||
@ -23,6 +23,7 @@ namespace LibationAvalonia.Dialogs
|
|||||||
}
|
}
|
||||||
private DirSelectOptions dirSelectOptions;
|
private DirSelectOptions dirSelectOptions;
|
||||||
public string SelectedDirectory => dirSelectOptions.Directory;
|
public string SelectedDirectory => dirSelectOptions.Directory;
|
||||||
|
public DialogResult DialogResult { get; private set; }
|
||||||
public LibationFilesDialog()
|
public LibationFilesDialog()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@ -44,7 +45,8 @@ namespace LibationAvalonia.Dialogs
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Close(DialogResult.OK);
|
DialogResult = DialogResult.OK;
|
||||||
|
Close(DialogResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
|
|||||||
@ -10,7 +10,8 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
|||||||
<PublishProtocol>FileSystem</PublishProtocol>
|
<PublishProtocol>FileSystem</PublishProtocol>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
|
||||||
<SelfContained>false</SelfContained>
|
<SelfContained>true</SelfContained>
|
||||||
<PublishSingleFile>false</PublishSingleFile>
|
<PublishSingleFile>false</PublishSingleFile>
|
||||||
|
<PublishTrimmed>false</PublishTrimmed>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@ -10,7 +10,8 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
|||||||
<PublishProtocol>FileSystem</PublishProtocol>
|
<PublishProtocol>FileSystem</PublishProtocol>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<RuntimeIdentifier>osx-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>osx-x64</RuntimeIdentifier>
|
||||||
<SelfContained>false</SelfContained>
|
<SelfContained>true</SelfContained>
|
||||||
<PublishSingleFile>false</PublishSingleFile>
|
<PublishSingleFile>false</PublishSingleFile>
|
||||||
|
<PublishTrimmed>false</PublishTrimmed>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@ -70,7 +70,7 @@ namespace LibationAvalonia.Views
|
|||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
//This is temporaty until we have a solution for linux/mac so that
|
//This is temporaty until we have a solution for linux/mac so that
|
||||||
//Libation doesn't download a zip every time it runs.
|
//Libation doesn't download a zip every time it runs.
|
||||||
if (!App.IsWindows)
|
if (!LibationScaffolding.IsWindows)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -85,15 +85,15 @@ namespace LibationAvalonia.Views
|
|||||||
if (result != DialogResult.Yes)
|
if (result != DialogResult.Yes)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (App.IsWindows)
|
if (LibationScaffolding.IsWindows)
|
||||||
{
|
{
|
||||||
runWindowsUpgrader(zipFile);
|
runWindowsUpgrader(zipFile);
|
||||||
}
|
}
|
||||||
else if (App.IsLinux)
|
else if (LibationScaffolding.IsLinux)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (App.IsMacOs)
|
else if (LibationScaffolding.IsMacOs)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,8 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
|||||||
<PublishProtocol>FileSystem</PublishProtocol>
|
<PublishProtocol>FileSystem</PublishProtocol>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
|
||||||
<SelfContained>false</SelfContained>
|
<SelfContained>true</SelfContained>
|
||||||
<PublishSingleFile>false</PublishSingleFile>
|
<PublishSingleFile>false</PublishSingleFile>
|
||||||
|
<PublishTrimmed>false</PublishTrimmed>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@ -10,7 +10,8 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
|||||||
<PublishProtocol>FileSystem</PublishProtocol>
|
<PublishProtocol>FileSystem</PublishProtocol>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<RuntimeIdentifier>osx-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>osx-x64</RuntimeIdentifier>
|
||||||
<SelfContained>false</SelfContained>
|
<SelfContained>true</SelfContained>
|
||||||
<PublishSingleFile>false</PublishSingleFile>
|
<PublishSingleFile>false</PublishSingleFile>
|
||||||
|
<PublishTrimmed>false</PublishTrimmed>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
Loading…
x
Reference in New Issue
Block a user