Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't install DevHomeGitHubExtension on first run #3975

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 1 addition & 44 deletions src/ViewModels/InitializationViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,13 @@ public class InitializationViewModel : ObservableObject

private readonly IThemeSelectorService _themeSelector;
private readonly IWidgetServiceService _widgetServiceService;
private readonly IMicrosoftStoreService _msStoreService;
private readonly IPackageDeploymentService _packageDeploymentService;

#if CANARY_BUILD
private const string GitHubExtensionStorePackageId = "9N806ZKPW85R";
private const string GitHubExtensionPackageFamilyName = "Microsoft.Windows.DevHomeGitHubExtension.Canary_8wekyb3d8bbwe";
#elif STABLE_BUILD
private const string GitHubExtensionStorePackageId = "9NZCC27PR6N6";
private const string GitHubExtensionPackageFamilyName = "Microsoft.Windows.DevHomeGitHubExtension_8wekyb3d8bbwe";
#else
private const string GitHubExtensionStorePackageId = "";
private const string GitHubExtensionPackageFamilyName = "";
#endif

public InitializationViewModel(
IThemeSelectorService themeSelector,
IWidgetServiceService widgetServiceService,
IMicrosoftStoreService msStoreService,
IPackageDeploymentService packageDeploymentService)
IWidgetServiceService widgetServiceService)
{
_themeSelector = themeSelector;
_widgetServiceService = widgetServiceService;
_msStoreService = msStoreService;
_packageDeploymentService = packageDeploymentService;
}

public async void OnPageLoaded()
Expand Down Expand Up @@ -74,37 +57,11 @@ public async void OnPageLoaded()
_log.Information(ex, "Installing WidgetService failed: ");
}

// Install the DevHomeGitHubExtension, unless it's already installed or a dev build is running.
if (string.IsNullOrEmpty(GitHubExtensionStorePackageId) || HasDevHomeGitHubExtensionInstalled())
{
_log.Information("Skipping installing DevHomeGitHubExtension.");
}
else
{
try
{
_log.Information("Installing DevHomeGitHubExtension...");
await _msStoreService.TryInstallPackageAsync(GitHubExtensionStorePackageId);
}
catch (Exception ex)
{
_log.Information(ex, "Installing DevHomeGitHubExtension failed: ");
}
}

App.MainWindow.Content = Application.Current.GetService<ShellPage>();

_themeSelector.SetRequestedTheme();

TelemetryFactory.Get<ITelemetry>().Log("DevHome_Initialization_Ended_Event", LogLevel.Critical, new DevHomeInitializationEndedEvent());
_log.Information("Dev Home Initialization ended.");
}

private bool HasDevHomeGitHubExtensionInstalled()
{
var packages = _packageDeploymentService.FindPackagesForCurrentUser(GitHubExtensionPackageFamilyName);

// Don't check here if the package is ok, we'll do that later on the Dashboard.
return packages.Any();
}
}
Loading