Skip to content

Commit

Permalink
Show only agreement related info during install (#3999)
Browse files Browse the repository at this point in the history
This PR cleans up the install flow to make it easier for a user to see
the agreements of the package. It does this by changing the install flow
to not show fields that are unrelated to package agreements such as
- Moniker
- Description
- PackageUrl
- ReleaseNotes
- ReleaseNotesUrl
- InstallationNotes
- Documentations
- Tags

Co-authored-by: yao-msft <50888816+yao-msft@users.noreply.github.com>
  • Loading branch information
Trenly and yao-msft committed Jan 25, 2024
1 parent e2d7202 commit 995a95d
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Workflows/PromptFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ namespace AppInstaller::CLI::Workflow
return;
}

context << Workflow::ReportManifestIdentityWithVersion(Resource::String::ReportIdentityForAgreements) << Workflow::ShowPackageInfo;
context << Workflow::ReportManifestIdentityWithVersion(Resource::String::ReportIdentityForAgreements) << Workflow::ShowAgreementsInfo;
context.Reporter.EmptyLine();
}

Expand Down
72 changes: 48 additions & 24 deletions src/AppInstallerCLICore/Workflows/ShowFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,57 @@ namespace {
outputStream << " "_liv << value << std::endl;
}
}

void ShowAgreements(Execution::OutputStream outputStream, const std::vector<AppInstaller::Manifest::Agreement>& agreements) {

if (agreements.empty()) {
return;
}

outputStream << Execution::ManifestInfoEmphasis << Resource::String::ShowLabelAgreements << std::endl;
for (const auto& agreement : agreements) {

if (!agreement.Label.empty())
{
outputStream << " "_liv << Execution::ManifestInfoEmphasis << agreement.Label << ": "_liv;
}

if (!agreement.AgreementText.empty())
{
outputStream << agreement.AgreementText << std::endl;
}

if (!agreement.AgreementUrl.empty())
{
outputStream << agreement.AgreementUrl << std::endl;
}
}
}
}

namespace AppInstaller::CLI::Workflow
{
void ShowAgreementsInfo(Execution::Context& context)
{
const auto& manifest = context.Get<Execution::Data::Manifest>();
auto info = context.Reporter.Info();

ShowSingleLineField(info, Resource::String::ShowLabelVersion, manifest.Version);
ShowSingleLineField(info, Resource::String::ShowLabelPublisher, manifest.CurrentLocalization.Get<Manifest::Localization::Publisher>());
ShowSingleLineField(info, Resource::String::ShowLabelPublisherUrl, manifest.CurrentLocalization.Get<Manifest::Localization::PublisherUrl>());
ShowSingleLineField(info, Resource::String::ShowLabelPublisherSupportUrl, manifest.CurrentLocalization.Get<Manifest::Localization::PublisherSupportUrl>());
ShowSingleLineField(info, Resource::String::ShowLabelAuthor, manifest.CurrentLocalization.Get<Manifest::Localization::Author>());
ShowSingleLineField(info, Resource::String::ShowLabelPackageUrl, manifest.CurrentLocalization.Get<Manifest::Localization::PackageUrl>());
ShowSingleLineField(info, Resource::String::ShowLabelLicense, manifest.CurrentLocalization.Get<Manifest::Localization::License>());
ShowSingleLineField(info, Resource::String::ShowLabelLicenseUrl, manifest.CurrentLocalization.Get<Manifest::Localization::LicenseUrl>());
ShowSingleLineField(info, Resource::String::ShowLabelPrivacyUrl, manifest.CurrentLocalization.Get<Manifest::Localization::PrivacyUrl>());
ShowSingleLineField(info, Resource::String::ShowLabelCopyright, manifest.CurrentLocalization.Get<Manifest::Localization::Copyright>());
ShowSingleLineField(info, Resource::String::ShowLabelCopyrightUrl, manifest.CurrentLocalization.Get<Manifest::Localization::CopyrightUrl>());
ShowSingleLineField(info, Resource::String::ShowLabelPurchaseUrl, manifest.CurrentLocalization.Get<Manifest::Localization::PurchaseUrl>());
ShowAgreements(info, manifest.CurrentLocalization.Get<Manifest::Localization::Agreements>());

}

void ShowManifestInfo(Execution::Context& context)
{
context << ShowPackageInfo << ShowInstallerInfo;
Expand Down Expand Up @@ -118,30 +165,7 @@ namespace AppInstaller::CLI::Workflow
}
}
ShowMultiValueField(info, Resource::String::ShowLabelTags, manifest.CurrentLocalization.Get<Manifest::Localization::Tags>());
const auto& agreements = manifest.CurrentLocalization.Get<Manifest::Localization::Agreements>();
if (!agreements.empty())
{
context.Reporter.Info() << Execution::ManifestInfoEmphasis << Resource::String::ShowLabelAgreements << std::endl;
for (const auto& agreement : agreements)
{
if (!agreement.Label.empty())
{
info << Execution::ManifestInfoEmphasis << agreement.Label << ": "_liv;
}

if (!agreement.AgreementText.empty())
{
info << agreement.AgreementText << std::endl;
}

if (!agreement.AgreementUrl.empty())
{
info << agreement.AgreementUrl << std::endl;
}
}

info << std::endl;
}
ShowAgreements(info, manifest.CurrentLocalization.Get<Manifest::Localization::Agreements>());
}

void ShowInstallerInfo(Execution::Context& context)
Expand Down
6 changes: 6 additions & 0 deletions src/AppInstallerCLICore/Workflows/ShowFlow.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@

namespace AppInstaller::CLI::Workflow
{
// Shows information on an application; this is only the information for package agreements
// Required Args: None
// Inputs: Manifest
// Outputs: None
void ShowAgreementsInfo(Execution::Context& context);

// Shows information on an application.
// Required Args: None
// Inputs: Manifest, Installer
Expand Down

0 comments on commit 995a95d

Please sign in to comment.