Re-add channel version check on startup

This commit is contained in:
pizzaboxer 2023-07-28 11:17:56 +01:00
parent 2d55e913a2
commit cb4c813b8a
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8
3 changed files with 34 additions and 11 deletions

View File

@ -191,6 +191,30 @@ namespace Bloxstrap
ClientVersion clientVersion = await RobloxDeployment.GetInfo(App.Settings.Prop.Channel);
if (clientVersion.IsBehindDefaultChannel)
{
MessageBoxResult action = App.Settings.Prop.ChannelChangeMode switch
{
ChannelChangeMode.Prompt => Controls.ShowMessageBox(
$"The channel you're currently on ({App.Settings.Prop.Channel}) is out of date, and appears to no longer be receiving updates.\n" +
$"Would you like to switch to the default channel ({RobloxDeployment.DefaultChannel})?",
MessageBoxImage.Warning,
MessageBoxButton.YesNo
),
ChannelChangeMode.Automatic => MessageBoxResult.Yes,
ChannelChangeMode.Ignore => MessageBoxResult.No,
_ => MessageBoxResult.None
};
if (action == MessageBoxResult.Yes)
{
App.Logger.WriteLine("Bootstrapper::CheckLatestVersion", $"Changed Roblox channel from {App.Settings.Prop.Channel} to {RobloxDeployment.DefaultChannel}");
App.Settings.Prop.Channel = RobloxDeployment.DefaultChannel;
clientVersion = await RobloxDeployment.GetInfo(App.Settings.Prop.Channel);
}
}
_latestVersionGuid = clientVersion.VersionGuid;
_versionFolder = Path.Combine(Paths.Versions, _latestVersionGuid);
_versionPackageManifest = await PackageManifest.Get(_latestVersionGuid);

View File

@ -94,7 +94,7 @@ namespace Bloxstrap
return;
}
App.Logger.WriteLine("Protocol::ParseUri", $"Changed Roblox build channel from {App.Settings.Prop.Channel} to {channel}");
App.Logger.WriteLine("Protocol::ParseUri", $"Changed Roblox channel from {App.Settings.Prop.Channel} to {channel}");
App.Settings.Prop.Channel = channel;
}

View File

@ -121,6 +121,14 @@ namespace Bloxstrap
clientVersion = JsonSerializer.Deserialize<ClientVersion>(rawResponse)!;
}
// check if channel is behind LIVE
if (channel != DefaultChannel)
{
var defaultClientVersion = await GetInfo(DefaultChannel);
if (Utilities.CompareVersions(clientVersion.Version, defaultClientVersion.Version) == -1)
clientVersion.IsBehindDefaultChannel = true;
}
// for preferences
if (extraInformation && clientVersion.Timestamp is null)
@ -138,15 +146,6 @@ namespace Bloxstrap
App.Logger.WriteLine(LOG_IDENT, $"{manifestUrl} - Last-Modified: {lastModified}");
clientVersion.Timestamp = DateTime.Parse(lastModified).ToLocalTime();
}
// check if channel is behind LIVE
if (channel != DefaultChannel)
{
var defaultClientVersion = await GetInfo(DefaultChannel);
if (Utilities.CompareVersions(clientVersion.Version, defaultClientVersion.Version) == -1)
clientVersion.IsBehindDefaultChannel = true;
}
}
ClientVersionCache[channel] = clientVersion;