Skip to content

Commit

Permalink
Only prompt channel change once during enrollment
Browse files Browse the repository at this point in the history
  • Loading branch information
pizzaboxer committed Jul 16, 2023
1 parent 8a4adae commit 7caa59e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions Bloxstrap/Models/State.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{
public class State
{
public string LastEnrolledChannel { get; set; } = "";
public string VersionGuid { get; set; } = "";
public List<string> ModManifest { get; set; } = new();
}
Expand Down
16 changes: 13 additions & 3 deletions Bloxstrap/ProtocolHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static string ParseUri(string protocol)
if (key == "channel" && !String.IsNullOrEmpty(val))
{
channelArgPresent = true;
ChangeChannel(val);
EnrollChannel(val);

// we'll set the arg when launching
continue;
Expand All @@ -65,7 +65,7 @@ public static string ParseUri(string protocol)
}

if (!channelArgPresent)
ChangeChannel(RobloxDeployment.DefaultChannel);
EnrollChannel(RobloxDeployment.DefaultChannel);

return commandLine.ToString();
}
Expand All @@ -80,9 +80,12 @@ public static void ChangeChannel(string channel)

if (App.Settings.Prop.ChannelChangeMode != ChannelChangeMode.Automatic)
{
if (channel == App.State.Prop.LastEnrolledChannel)
return;

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" +
$"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,
MessageBoxButton.YesNo
);
Expand All @@ -95,6 +98,13 @@ public static void ChangeChannel(string 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)
{
string handlerArgs = $"\"{handler}\" %1";
Expand Down

0 comments on commit 7caa59e

Please sign in to comment.