mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Use state entry for WebView2 runtime prompt
This commit is contained in:
parent
2795ccf92e
commit
cd411e33ff
@ -36,8 +36,6 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
private readonly IAppData AppData;
|
private readonly IAppData AppData;
|
||||||
|
|
||||||
private bool FreshInstall => !File.Exists(AppData.ExecutablePath) || String.IsNullOrEmpty(AppData.State.VersionGuid);
|
|
||||||
|
|
||||||
private string _launchCommandLine = App.LaunchSettings.RobloxLaunchArgs;
|
private string _launchCommandLine = App.LaunchSettings.RobloxLaunchArgs;
|
||||||
private LaunchMode _launchMode = App.LaunchSettings.RobloxLaunchMode;
|
private LaunchMode _launchMode = App.LaunchSettings.RobloxLaunchMode;
|
||||||
private string _latestVersionGuid = null!;
|
private string _latestVersionGuid = null!;
|
||||||
@ -47,7 +45,7 @@ namespace Bloxstrap
|
|||||||
private double _progressIncrement;
|
private double _progressIncrement;
|
||||||
private long _totalDownloadedBytes = 0;
|
private long _totalDownloadedBytes = 0;
|
||||||
|
|
||||||
private bool _mustUpgrade => File.Exists(AppData.LockFilePath) || !File.Exists(AppData.ExecutablePath);
|
private bool _mustUpgrade => String.IsNullOrEmpty(AppData.State.VersionGuid) || File.Exists(AppData.LockFilePath) || !File.Exists(AppData.ExecutablePath);
|
||||||
private bool _noConnection = false;
|
private bool _noConnection = false;
|
||||||
|
|
||||||
public IBootstrapperDialog? Dialog = null;
|
public IBootstrapperDialog? Dialog = null;
|
||||||
@ -164,12 +162,16 @@ namespace Bloxstrap
|
|||||||
// TODO: handle exception and update skip
|
// TODO: handle exception and update skip
|
||||||
await GetLatestVersionInfo();
|
await GetLatestVersionInfo();
|
||||||
|
|
||||||
// install/update roblox if we're running for the first time, needs updating, or the player location doesn't exist
|
if (!_noConnection)
|
||||||
if (!_noConnection && (AppData.State.VersionGuid != _latestVersionGuid || _mustUpgrade))
|
{
|
||||||
|
if (AppData.State.VersionGuid != _latestVersionGuid || _mustUpgrade)
|
||||||
await UpgradeRoblox();
|
await UpgradeRoblox();
|
||||||
|
|
||||||
if (!_noConnection)
|
// we require deployment details for applying modifications for a worst case scenario,
|
||||||
|
// where we'd need to restore files from a package that isn't present on disk and needs to be redownloaded
|
||||||
await ApplyModifications();
|
await ApplyModifications();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// check if launch uri is set to our bootstrapper
|
// check if launch uri is set to our bootstrapper
|
||||||
// this doesn't go under register, so we check every launch
|
// this doesn't go under register, so we check every launch
|
||||||
@ -523,7 +525,10 @@ namespace Bloxstrap
|
|||||||
{
|
{
|
||||||
const string LOG_IDENT = "Bootstrapper::UpgradeRoblox";
|
const string LOG_IDENT = "Bootstrapper::UpgradeRoblox";
|
||||||
|
|
||||||
SetStatus(FreshInstall ? Strings.Bootstrapper_Status_Installing : Strings.Bootstrapper_Status_Upgrading);
|
if (String.IsNullOrEmpty(AppData.State.VersionGuid))
|
||||||
|
SetStatus(Strings.Bootstrapper_Status_Installing);
|
||||||
|
else
|
||||||
|
SetStatus(Strings.Bootstrapper_Status_Upgrading);
|
||||||
|
|
||||||
Directory.CreateDirectory(Paths.Base);
|
Directory.CreateDirectory(Paths.Base);
|
||||||
Directory.CreateDirectory(Paths.Downloads);
|
Directory.CreateDirectory(Paths.Downloads);
|
||||||
@ -628,18 +633,25 @@ namespace Bloxstrap
|
|||||||
if (_cancelTokenSource.IsCancellationRequested)
|
if (_cancelTokenSource.IsCancellationRequested)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// only prompt on fresh install, since we don't want to be prompting them for every single launch
|
if (App.State.Prop.PromptWebView2Install)
|
||||||
// TODO: state entry?
|
|
||||||
if (FreshInstall)
|
|
||||||
{
|
{
|
||||||
using var hklmKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\WOW6432Node\\Microsoft\\EdgeUpdate\\Clients\\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}");
|
using var hklmKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\WOW6432Node\\Microsoft\\EdgeUpdate\\Clients\\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}");
|
||||||
using var hkcuKey = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\EdgeUpdate\\Clients\\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}");
|
using var hkcuKey = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\EdgeUpdate\\Clients\\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}");
|
||||||
|
|
||||||
if (hklmKey is null && hkcuKey is null)
|
if (hklmKey is not null || hkcuKey is not null)
|
||||||
|
{
|
||||||
|
// reset prompt state if the user has it installed
|
||||||
|
App.State.Prop.PromptWebView2Install = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
var result = Frontend.ShowMessageBox(Strings.Bootstrapper_WebView2NotFound, MessageBoxImage.Warning, MessageBoxButton.YesNo, MessageBoxResult.Yes);
|
var result = Frontend.ShowMessageBox(Strings.Bootstrapper_WebView2NotFound, MessageBoxImage.Warning, MessageBoxButton.YesNo, MessageBoxResult.Yes);
|
||||||
|
|
||||||
if (result == MessageBoxResult.Yes)
|
if (result != MessageBoxResult.Yes)
|
||||||
|
{
|
||||||
|
App.State.Prop.PromptWebView2Install = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
App.Logger.WriteLine(LOG_IDENT, "Installing WebView2 runtime...");
|
App.Logger.WriteLine(LOG_IDENT, "Installing WebView2 runtime...");
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
{
|
{
|
||||||
public bool ShowFFlagEditorWarning { get; set; } = true;
|
public bool ShowFFlagEditorWarning { get; set; } = true;
|
||||||
|
|
||||||
|
public bool PromptWebView2Install { get; set; } = true;
|
||||||
|
|
||||||
public AppState Player { get; set; } = new();
|
public AppState Player { get; set; } = new();
|
||||||
|
|
||||||
public AppState Studio { get; set; } = new();
|
public AppState Studio { get; set; } = new();
|
||||||
|
Loading…
Reference in New Issue
Block a user