Skip to content

Commit

Permalink
Merge #4008 Remove duplicate dev build prompts
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Jan 24, 2024
2 parents 0bd6f6c + 2668b44 commit 5d0b6cd
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 19 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ All notable changes to this project will be documented in this file.

### Features

- [Updater] Support dev builds for auto updater (#3997 by: HebaruSan)
- [Updater] Support dev builds for auto updater (#3997, #4008 by: HebaruSan)
- [GUI] Sort mods satisfying the same recommendation by download count (#4007 by: HebaruSan)

### Bugfixes

- [GUI] Suppress admin user check for URL handler registration (#3996 by: HebaruSan)
- [Netkan] Fix null reference exception in swinfo transformer (#3999 by: HebaruSan)
- [GUI] Refactor Contents tab refreshing (#4001 by: HebaruSan)
- [Core] Fix crash with DLC disabled by Steam (#4002 by: HebaruSan)
- [Multiple] Fixes for installing .ckan files and DarkKAN mods (#4006 by: HebaruSan)

### Internal

- [Policy] Fix #3518 rewrite de-indexing policy (#3993 by: JonnyOThan; reviewed: HebaruSan)
- [Netkan] Fix null reference exception in swinfo transformer (#3999 by: HebaruSan)

## v1.34.4 (Niven)

Expand Down
8 changes: 4 additions & 4 deletions Cmdline/Action/Upgrade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ public int RunCommand(CKAN.GameInstance instance, object raw_options)
}
var config = ServiceLocator.Container.Resolve<IConfiguration>();
var devBuild = options.dev_build
|| (!options.stable_release && config.DevBuilds);
|| (!options.stable_release && (config.DevBuilds ?? false));
if (devBuild != config.DevBuilds)
{
config.DevBuilds = devBuild;
user.RaiseMessage(
config.DevBuilds
config.DevBuilds ?? false
? Properties.Resources.UpgradeSwitchingToDevBuilds
: Properties.Resources.UpgradeSwitchingToStableReleases);
}
Expand All @@ -77,7 +77,7 @@ public int RunCommand(CKAN.GameInstance instance, object raw_options)
try
{
var upd = new AutoUpdate();
var update = upd.GetUpdate(config.DevBuilds);
var update = upd.GetUpdate(config.DevBuilds ?? false);
var latestVersion = update.Version;
var currentVersion = new ModuleVersion(Meta.GetVersion());

Expand All @@ -92,7 +92,7 @@ public int RunCommand(CKAN.GameInstance instance, object raw_options)
if (user.RaiseYesNoDialog(Properties.Resources.UpgradeProceed))
{
user.RaiseMessage(Properties.Resources.UpgradePleaseWait);
upd.StartUpdateProcess(false, config.DevBuilds, user);
upd.StartUpdateProcess(false, config.DevBuilds ?? false, user);
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion Core/Configuration/IConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ public interface IConfiguration
/// <summary>
/// true if user wants to use nightly builds from S3, false to use releases from GitHub
/// </summary>
bool DevBuilds { get; set; }
bool? DevBuilds { get; set; }
}
}
4 changes: 2 additions & 2 deletions Core/Configuration/JsonConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private class Config
public IDictionary<string, string> AuthTokens { get; set; } = new Dictionary<string, string>();
public string[] GlobalInstallFilters { get; set; } = Array.Empty<string>();
public string[] PreferredHosts { get; set; } = Array.Empty<string>();
public bool DevBuilds { get; set; }
public bool? DevBuilds { get; set; }
}

public class ConfigConverter : JsonPropertyNamesChangedConverter
Expand Down Expand Up @@ -324,7 +324,7 @@ public string[] PreferredHosts
}
}

public bool DevBuilds
public bool? DevBuilds
{
get
{
Expand Down
2 changes: 1 addition & 1 deletion Core/Configuration/Win32RegistryConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public void SetAuthToken(string host, string token)
/// <summary>
/// Not implemented because the Windows registry is deprecated
/// </summary>
public bool DevBuilds { get; set; }
public bool? DevBuilds { get; set; }

public static bool DoesRegistryConfigurationExist()
{
Expand Down
4 changes: 2 additions & 2 deletions GUI/Dialogs/SettingsDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void UpdateDialog()
UpdateAutoUpdate();

CheckUpdateOnLaunchCheckbox.Checked = guiConfig.CheckForUpdatesOnLaunch;
DevBuildsCheckbox.Checked = coreConfig.DevBuilds;
DevBuildsCheckbox.Checked = coreConfig.DevBuilds ?? false;
RefreshOnStartupCheckbox.Checked = guiConfig.RefreshOnStartup;
HideEpochsCheckbox.Checked = guiConfig.HideEpochs;
HideVCheckbox.Checked = guiConfig.HideV;
Expand All @@ -84,7 +84,7 @@ private void UpdateAutoUpdate()
LocalVersionLabel.Text = Meta.GetVersion();
try
{
var latestVersion = updater.GetUpdate(coreConfig.DevBuilds)
var latestVersion = updater.GetUpdate(coreConfig.DevBuilds ?? false)
.Version;
LatestVersionLabel.Text = latestVersion.ToString();
// Allow downgrading in case they want to stop using dev builds
Expand Down
9 changes: 4 additions & 5 deletions GUI/Main/MainAutoUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ private void AutoUpdatePrompts(IConfiguration coreConfig,
guiConfig.CheckForUpdatesOnLaunchNoNag = true;
}

if (!guiConfig.DevBuildsNoNag && guiConfig.CheckForUpdatesOnLaunch)
if (!coreConfig.DevBuilds.HasValue && guiConfig.CheckForUpdatesOnLaunch)
{
coreConfig.DevBuilds = !YesNoDialog(Properties.Resources.MainReleasesOrDevBuildsPrompt,
Properties.Resources.MainReleasesOrDevBuildsYes,
Properties.Resources.MainReleasesOrDevBuildsNo);
guiConfig.DevBuildsNoNag = true;
}
}

Expand All @@ -51,7 +50,7 @@ private bool CheckForCKANUpdate()
{
log.Info("Making auto-update call");
var mainConfig = ServiceLocator.Container.Resolve<IConfiguration>();
var update = updater.GetUpdate(mainConfig.DevBuilds);
var update = updater.GetUpdate(mainConfig.DevBuilds ?? false);
var latestVersion = update.Version;
var currentVersion = new ModuleVersion(Meta.GetVersion());

Expand Down Expand Up @@ -87,12 +86,12 @@ public void UpdateCKAN()
DisableMainWindow();
tabController.RenameTab("WaitTabPage", Properties.Resources.MainUpgradingWaitTitle);
var mainConfig = ServiceLocator.Container.Resolve<IConfiguration>();
var update = updater.GetUpdate(mainConfig.DevBuilds);
var update = updater.GetUpdate(mainConfig.DevBuilds ?? false);
Wait.SetDescription(string.Format(Properties.Resources.MainUpgradingTo,
update.Version));

log.Info("Start ckan update");
Wait.StartWaiting((sender, args) => updater.StartUpdateProcess(true, mainConfig.DevBuilds, currentUser),
Wait.StartWaiting((sender, args) => updater.StartUpdateProcess(true, mainConfig.DevBuilds ?? false, currentUser),
UpdateReady,
false,
null);
Expand Down
1 change: 0 additions & 1 deletion GUI/Model/GUIConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public class GUIConfiguration

public bool CheckForUpdatesOnLaunch = false;
public bool CheckForUpdatesOnLaunchNoNag = false;
public bool DevBuildsNoNag = false;

public bool EnableTrayIcon = false;
public bool MinimizeToTray = false;
Expand Down
2 changes: 1 addition & 1 deletion Tests/Core/Configuration/FakeConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public string Language

public string[] PreferredHosts { get; set; } = Array.Empty<string>();

public bool DevBuilds { get; set; }
public bool? DevBuilds { get; set; }

public void Dispose()
{
Expand Down

0 comments on commit 5d0b6cd

Please sign in to comment.