Skip to content

Commit

Permalink
Don't install DevHomeGitHubExtension on first run (#3975)
Browse files Browse the repository at this point in the history
  • Loading branch information
krschau authored Nov 13, 2024
1 parent 0f16c44 commit ca6e908
Showing 1 changed file with 1 addition and 44 deletions.
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();
}
}

0 comments on commit ca6e908

Please sign in to comment.