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

Show only agreement related info during install #3999

Merged
merged 4 commits into from
Jan 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
54 changes: 22 additions & 32 deletions src/AppInstallerCLICore/Workflows/ShowFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,28 @@ namespace {
}
}

void ShowAgreementItem(Execution::OutputStream outputStream, AppInstaller::Manifest::Agreement agreement) {
if (!agreement.Label.empty())
{
outputStream << " "_liv << Execution::ManifestInfoEmphasis << agreement.Label << ": "_liv;
void ShowAgreements(Execution::OutputStream outputStream, std::vector<AppInstaller::Manifest::Agreement> agreements) {
Trenly marked this conversation as resolved.
Show resolved Hide resolved
if (agreements.empty()) {
return;
}

if (!agreement.AgreementText.empty())
{
outputStream << agreement.AgreementText << std::endl;
}
outputStream << Execution::ManifestInfoEmphasis << Resource::String::ShowLabelAgreements << std::endl;
for (const auto& agreement : agreements) {

if (!agreement.AgreementUrl.empty())
{
outputStream << agreement.AgreementUrl << std::endl;
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;
}
}
}
}
Expand All @@ -103,17 +111,8 @@ namespace AppInstaller::CLI::Workflow
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>());

const auto& agreements = manifest.CurrentLocalization.Get<Manifest::Localization::Agreements>();
if (!agreements.empty())
{
info << Execution::ManifestInfoEmphasis << Resource::String::ShowLabelAgreements << std::endl;
for (const auto& agreement : agreements)
{
ShowAgreementItem(info, agreement);
}

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

}

void ShowManifestInfo(Execution::Context& context)
Expand Down Expand Up @@ -165,16 +164,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())
{
info << Execution::ManifestInfoEmphasis << Resource::String::ShowLabelAgreements << std::endl;
for (const auto& agreement : agreements)
{
ShowAgreementItem(info, agreement);
}

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

void ShowInstallerInfo(Execution::Context& context)
Expand Down