Skip to content

Commit

Permalink
Create a task
Browse files Browse the repository at this point in the history
  • Loading branch information
AmelBawa-msft committed Oct 14, 2024
1 parent caa13c2 commit 0ac0ab4
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 8 deletions.
2 changes: 0 additions & 2 deletions src/AppInstallerCLICore/Commands/ConfigureCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "ConfigureValidateCommand.h"
#include "ConfigureExportCommand.h"
#include "Workflows/ConfigurationFlow.h"
#include "Workflows/SmartScreenFlow.h"
#include "Workflows/MSStoreInstallerHandler.h"
#include "ConfigurationCommon.h"

Expand Down Expand Up @@ -78,7 +77,6 @@ namespace AppInstaller::CLI
context <<
VerifyIsFullPackage <<
VerifyFileOrUri(Execution::Args::Type::ConfigurationFile) <<
EvaluateUri <<
CreateConfigurationProcessor <<
OpenConfigurationSet <<
ShowConfigurationSet <<
Expand Down
2 changes: 0 additions & 2 deletions src/AppInstallerCLICore/Commands/DownloadCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "Workflows/DownloadFlow.h"
#include "Workflows/InstallFlow.h"
#include "Workflows/PromptFlow.h"
#include "Workflows/SmartScreenFlow.h"
#include "Resources.h"
#include <AppInstallerRuntime.h>
#include <winget/ManifestCommon.h>
Expand Down Expand Up @@ -105,7 +104,6 @@ namespace AppInstaller::CLI
Workflow::ReportIdentityAndInstallationDisclaimer <<
Workflow::ShowPromptsForSinglePackage(/* ensureAcceptance */ true) <<
Workflow::DownloadPackageDependencies <<
Workflow::EvaluateUri <<
Workflow::DownloadInstaller;
}
}
2 changes: 2 additions & 0 deletions src/AppInstallerCLICore/Workflows/ConfigurationFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.
#include "pch.h"
#include "ConfigurationFlow.h"
#include "SmartScreenFlow.h"
#include "PromptFlow.h"
#include "TableOutput.h"
#include "Public/ConfigurationSetProcessorFactoryRemoting.h"
Expand Down Expand Up @@ -1300,6 +1301,7 @@ namespace AppInstaller::CLI::Workflow

void CreateConfigurationProcessor(Context& context)
{
context << ExecuteSmartScreen(true);
auto progressScope = context.Reporter.BeginAsyncProgress(true);
progressScope->Callback().SetProgressMessage(Resource::String::ConfigurationInitializing());

Expand Down
2 changes: 2 additions & 0 deletions src/AppInstallerCLICore/Workflows/DownloadFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.
#include "pch.h"
#include "DownloadFlow.h"
#include "SmartScreenFlow.h"
#include "MSStoreInstallerHandler.h"
#include <winget/Filesystem.h>
#include <AppInstallerDeployment.h>
Expand Down Expand Up @@ -208,6 +209,7 @@ namespace AppInstaller::CLI::Workflow
}

bool installerDownloadOnly = WI_IsFlagSet(context.GetFlags(), Execution::ContextFlag::InstallerDownloadOnly);
context << ExecuteSmartScreen(false);

// CheckForExistingInstaller will set the InstallerPath if found
if (!context.Contains(Execution::Data::InstallerPath))
Expand Down
5 changes: 2 additions & 3 deletions src/AppInstallerCLICore/Workflows/SmartScreenFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,9 @@ namespace AppInstaller::CLI::Workflow
return S_OK;
}

void EvaluateUri(Execution::Context& context)
void ExecuteSmartScreen::operator()(Execution::Context& context) const
{
// DSC
if (context.Args.Contains(Execution::Args::Type::ConfigurationFile))
if (m_isConfigurationFlow)
{
auto uriValidation = EvaluateConfigurationUri(context);
if(FAILED(uriValidation))
Expand Down
15 changes: 14 additions & 1 deletion src/AppInstallerCLICore/Workflows/SmartScreenFlow.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@

namespace AppInstaller::CLI::Workflow
{
void EvaluateUri(Execution::Context& context);
// Composite flow that chooses what to do based on whether or not the
// configuration flow is being run.
// Required Args: None
// Inputs: IsConfigurationFlow
// Outputs: None
struct ExecuteSmartScreen : public WorkflowTask
{
ExecuteSmartScreen(bool isConfigurationFlow) : WorkflowTask("ExecuteSmartScreen"), m_isConfigurationFlow(isConfigurationFlow) {}

void operator()(Execution::Context& context) const override;

private:
bool m_isConfigurationFlow;
};
}

1 change: 1 addition & 0 deletions src/Internal/UriValidation/UriValidation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ namespace AppInstaller::UriValidation
UriValidationResult ValidateUri(const std::string& uri)
{
#ifndef AICLI_DISABLE_TEST_HOOKS
// For testing purposes, block all URIs that end with "/block"
if (EndsWith(uri, "/block"))
{
return UriValidationResult(UriValidationDecision::Block, std::string());
Expand Down

0 comments on commit 0ac0ab4

Please sign in to comment.