diff --git a/src/Artemis.UI/Screens/Settings/Tabs/GeneralTabViewModel.cs b/src/Artemis.UI/Screens/Settings/Tabs/GeneralTabViewModel.cs index b4db42619..5121af0f5 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/GeneralTabViewModel.cs +++ b/src/Artemis.UI/Screens/Settings/Tabs/GeneralTabViewModel.cs @@ -147,7 +147,7 @@ public class GeneralTabViewModel : ActivatableViewModelBase public PluginSetting UIAutoRunDelay => _settingsService.GetSetting("UI.AutoRunDelay", 15); public PluginSetting UIShowOnStartup => _settingsService.GetSetting("UI.ShowOnStartup", true); public PluginSetting UICheckForUpdates => _settingsService.GetSetting("UI.Updating.AutoCheck", true); - public PluginSetting UIAutoUpdate => _settingsService.GetSetting("UI.Updating.AutoInstall", false); + public PluginSetting UIAutoUpdate => _settingsService.GetSetting("UI.Updating.AutoInstall", true); public PluginSetting ProfileEditorShowDataModelValues => _settingsService.GetSetting("ProfileEditor.ShowDataModelValues", false); public PluginSetting CoreLoggingLevel => _settingsService.GetSetting("Core.LoggingLevel", LogEventLevel.Information); public PluginSetting CorePreferredGraphicsContext => _settingsService.GetSetting("Core.PreferredGraphicsContext", "Software"); diff --git a/src/Artemis.UI/Screens/StartupWizard/StartupWizardViewModel.cs b/src/Artemis.UI/Screens/StartupWizard/StartupWizardViewModel.cs index 4ef72e32f..99d0eb719 100644 --- a/src/Artemis.UI/Screens/StartupWizard/StartupWizardViewModel.cs +++ b/src/Artemis.UI/Screens/StartupWizard/StartupWizardViewModel.cs @@ -87,7 +87,7 @@ public class StartupWizardViewModel : DialogViewModelBase public PluginSetting UIAutoRunDelay => _settingsService.GetSetting("UI.AutoRunDelay", 15); public PluginSetting UIShowOnStartup => _settingsService.GetSetting("UI.ShowOnStartup", true); public PluginSetting UICheckForUpdates => _settingsService.GetSetting("UI.Updating.AutoCheck", true); - public PluginSetting UIAutoUpdate => _settingsService.GetSetting("UI.Updating.AutoInstall", false); + public PluginSetting UIAutoUpdate => _settingsService.GetSetting("UI.Updating.AutoInstall", true); public int CurrentStep { diff --git a/src/Artemis.UI/Services/Updating/UpdateService.cs b/src/Artemis.UI/Services/Updating/UpdateService.cs index b417a49c8..79bb98ebd 100644 --- a/src/Artemis.UI/Services/Updating/UpdateService.cs +++ b/src/Artemis.UI/Services/Updating/UpdateService.cs @@ -24,6 +24,7 @@ public class UpdateService : IUpdateService private readonly Func _getReleaseInstaller; private readonly ILogger _logger; + private readonly IMainWindowService _mainWindowService; private readonly IReleaseRepository _releaseRepository; private readonly Lazy _updateNotificationProvider; private readonly Platform _updatePlatform; @@ -40,6 +41,7 @@ public class UpdateService : IUpdateService Func getReleaseInstaller) { _logger = logger; + _mainWindowService = mainWindowService; _updatingClient = updatingClient; _releaseRepository = releaseRepository; _updateNotificationProvider = updateNotificationProvider; @@ -55,7 +57,7 @@ public class UpdateService : IUpdateService throw new PlatformNotSupportedException("Cannot auto update on the current platform"); _autoCheck = settingsService.GetSetting("UI.Updating.AutoCheck", true); - _autoInstall = settingsService.GetSetting("UI.Updating.AutoInstall", false); + _autoInstall = settingsService.GetSetting("UI.Updating.AutoInstall", true); _autoCheck.SettingChanged += HandleAutoUpdateEvent; mainWindowService.MainWindowOpened += HandleAutoUpdateEvent; Timer timer = new(UPDATE_CHECK_INTERVAL); @@ -102,7 +104,7 @@ public class UpdateService : IUpdateService { ReleaseInstaller installer = _getReleaseInstaller(release.Id); await installer.InstallAsync(CancellationToken.None); - Utilities.ApplyUpdate(true); + RestartForUpdate(true); } private async void HandleAutoUpdateEvent(object? sender, EventArgs e) @@ -156,11 +158,12 @@ public class UpdateService : IUpdateService if (CachedLatestRelease == null) return false; - // Only offer it once per session - _suspendAutoCheck = true; + // Unless auto install is enabled, only offer it once per session + if (!_autoInstall.Value) + _suspendAutoCheck = true; // If the window is open show the changelog, don't auto-update while the user is busy - if (!_autoInstall.Value) + if (_mainWindowService.IsMainWindowOpen || !_autoInstall.Value) ShowUpdateNotification(CachedLatestRelease); else await AutoInstallUpdate(CachedLatestRelease);