Only prompt channel change once during enrollment

This commit is contained in:
pizzaboxer 2023-07-16 16:28:16 +01:00
parent 8a4adaec3a
commit 7caa59ead3
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8
2 changed files with 14 additions and 3 deletions

View File

@ -2,6 +2,7 @@
{ {
public class State public class State
{ {
public string LastEnrolledChannel { get; set; } = "";
public string VersionGuid { get; set; } = ""; public string VersionGuid { get; set; } = "";
public List<string> ModManifest { get; set; } = new(); public List<string> ModManifest { get; set; } = new();
} }

View File

@ -55,7 +55,7 @@ namespace Bloxstrap
if (key == "channel" && !String.IsNullOrEmpty(val)) if (key == "channel" && !String.IsNullOrEmpty(val))
{ {
channelArgPresent = true; channelArgPresent = true;
ChangeChannel(val); EnrollChannel(val);
// we'll set the arg when launching // we'll set the arg when launching
continue; continue;
@ -65,7 +65,7 @@ namespace Bloxstrap
} }
if (!channelArgPresent) if (!channelArgPresent)
ChangeChannel(RobloxDeployment.DefaultChannel); EnrollChannel(RobloxDeployment.DefaultChannel);
return commandLine.ToString(); return commandLine.ToString();
} }
@ -80,9 +80,12 @@ namespace Bloxstrap
if (App.Settings.Prop.ChannelChangeMode != ChannelChangeMode.Automatic) if (App.Settings.Prop.ChannelChangeMode != ChannelChangeMode.Automatic)
{ {
if (channel == App.State.Prop.LastEnrolledChannel)
return;
MessageBoxResult result = Controls.ShowMessageBox( MessageBoxResult result = Controls.ShowMessageBox(
$"Roblox is attempting to set your channel to {channel}, however your current preferred channel is {App.Settings.Prop.Channel}.\n\n" + $"Roblox is attempting to set your channel to {channel}, however your current preferred channel is {App.Settings.Prop.Channel}.\n\n" +
$"Would you like to switch channels from {App.Settings.Prop.Channel} to {channel}?", $"Would you like to switch your preferred channel to {channel}?",
MessageBoxImage.Question, MessageBoxImage.Question,
MessageBoxButton.YesNo MessageBoxButton.YesNo
); );
@ -95,6 +98,13 @@ namespace Bloxstrap
App.Settings.Prop.Channel = channel; App.Settings.Prop.Channel = channel;
} }
public static void EnrollChannel(string channel)
{
ChangeChannel(channel);
App.State.Prop.LastEnrolledChannel = channel;
App.State.Save();
}
public static void Register(string key, string name, string handler) public static void Register(string key, string name, string handler)
{ {
string handlerArgs = $"\"{handler}\" %1"; string handlerArgs = $"\"{handler}\" %1";