Skip to content

Commit

Permalink
Incorporating PR review feedback - Part 1
Browse files Browse the repository at this point in the history
  • Loading branch information
Madhusudhan-MSFT committed Feb 15, 2024
1 parent 416b716 commit 3391065
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Commands/RepairCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace AppInstaller::CLI
{
struct RepairCommand final : public Command
{
RepairCommand(std::string_view parent) : Command("repair", {"repair"}, parent) {}
RepairCommand(std::string_view parent) : Command("repair", parent) {}

std::vector<Argument> GetArguments() const override;

Expand Down
13 changes: 12 additions & 1 deletion src/AppInstallerCLICore/Workflows/RepairFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ namespace AppInstaller::CLI::Workflow

// Default to silent unless it is not present or interactivity is requested
auto uninstallCommandItr = packageMetadata.find(PackageVersionMetadata::SilentUninstallCommand);
if (uninstallCommandItr == packageMetadata.end() || context.Args.Contains(Execution::Args::Type::Interactive))

if ((!context.Args.Contains(Execution::Args::Type::Silent) && uninstallCommandItr == packageMetadata.end())
|| context.Args.Contains(Execution::Args::Type::Interactive))
{
auto interactiveItr = packageMetadata.find(PackageVersionMetadata::StandardUninstallCommand);
if (interactiveItr != packageMetadata.end())
Expand Down Expand Up @@ -90,6 +92,10 @@ namespace AppInstaller::CLI::Workflow
context.Add<Execution::Data::PackageFamilyNames>(packageFamilyNames);
}

/// <summary>
/// The function performs a preliminary check on the installed package by reading its ARP registry flags for NoModify and NoRepair to confirm if the repair operation is applicable.
/// </summary>
/// <param name="context">Execution context object</param>
void ApplicabilityCheckForInstalledPackage(Execution::Context& context)
{
// Installed Package repair applicability check
Expand Down Expand Up @@ -119,6 +125,11 @@ namespace AppInstaller::CLI::Workflow
}
}


/// <summary>
/// This function performs a preliminary check on the available matching package by reading its manifest entries for repair behavior to determine the type of repair operation and repair switch are applicable
/// </summary>
/// <param name="context">Execution context object</param>
void ApplicabilityCheckForAvailablePackage(Execution::Context& context)
{
// Selected Installer repair applicability check
Expand Down
6 changes: 3 additions & 3 deletions src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw
Original file line number Diff line number Diff line change
Expand Up @@ -2764,7 +2764,7 @@ Please specify one of them using the --source option to proceed.</value>
<value>Repairs the selected package</value>
</data>
<data name="NoRepairInfoFound" xml:space="preserve">
<value>winget cannot locate the Repair command for this package. Please reach out to the package publisher for support.</value>
<value>The Repair command for this package cannot be found. Please reach out to the package publisher for support.</value>
<comment>{Locked="winget"}</comment>
</data>
<data name="RepairDifferentInstallTechnology" xml:space="preserve">
Expand All @@ -2783,10 +2783,10 @@ Please specify one of them using the --source option to proceed.</value>
<value>Repair operation completed successfully.</value>
</data>
<data name="RepairAbandoned" xml:space="preserve">
<value>Repair Abandoned</value>
<value>Repair abandoned</value>
</data>
<data name="RepairFlowStartingPackageRepair" xml:space="preserve">
<value>Starting Package Repair...</value>
<value>Starting package repair...</value>
</data>
<data name="MSStoreRepairFailed" xml:space="preserve">
<value>Failed to repair Microsoft Store package. Error code: {0}</value>
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCommonCore/AppInstallerTelemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ namespace AppInstaller::Logging
AICLI_TraceLoggingStringView(type, "Type"),
TraceLoggingUInt32(errorCode, "ErrorCode"),
TelemetryPrivacyDataTag(PDT_ProductAndServicePerformance),
TraceLoggingKeyword(MICROSOFT_KEYWORD_CRITICAL_DATA));
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES));

if (m_useSummary)
{
Expand Down
13 changes: 10 additions & 3 deletions src/AppInstallerSharedLib/AppInstallerStrings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -875,9 +875,16 @@ namespace AppInstaller::Utility
return false;
}

DWORD dwordValue = std::stoul(value);
try
{
DWORD dwordValue = std::stoul(value);

// If the value is 0, then it is not set.
return dwordValue != 0;
// If the value is 0, then it is not set.
return dwordValue != 0;
}
catch (...)
{
return false;
}
}
}

0 comments on commit 3391065

Please sign in to comment.