From e358b967461f9ae20a3eef6e1487d91ed50f7205 Mon Sep 17 00:00:00 2001
From: Leon Liang <57155886+leonMSFT@users.noreply.github.com>
Date: Tue, 28 Apr 2020 13:22:44 -0700
Subject: [PATCH] Add a Third-Party notices link to the about dialog (#5508)
## Summary of the Pull Request
This PR will add a link to the version of `NOTICE.md` in GitHub at the commit that the build was on. It uses the same approach for generating our settings files, where we'll create a header file with the commit hash assigned to a `wstring_view` during build time.
## PR Checklist
* [x] Closes #5139
* [x] CLA signed.
* [x] Tests added/passed
## Validation Steps Performed
The link is there and goes to the expected `NOTICE.md`.
---
.../Resources/en-US/Resources.resw | 4 ++++
src/cascadia/TerminalApp/TerminalPage.cpp | 8 +++++++
src/cascadia/TerminalApp/TerminalPage.h | 2 ++
src/cascadia/TerminalApp/TerminalPage.idl | 2 ++
src/cascadia/TerminalApp/TerminalPage.xaml | 3 +++
.../TerminalApp/lib/TerminalAppLib.vcxproj | 4 ++++
tools/GenerateCommitHashHeader.ps1 | 21 +++++++++++++++++++
7 files changed, 44 insertions(+)
create mode 100644 tools/GenerateCommitHashHeader.ps1
diff --git a/src/cascadia/TerminalApp/Resources/en-US/Resources.resw b/src/cascadia/TerminalApp/Resources/en-US/Resources.resw
index c8fa25218..e9732e9ce 100644
--- a/src/cascadia/TerminalApp/Resources/en-US/Resources.resw
+++ b/src/cascadia/TerminalApp/Resources/en-US/Resources.resw
@@ -273,6 +273,10 @@
Privacy PolicyA hyperlink name for the Terminal's privacy policy
+
+ Third-Party Notices
+ A hyperlink name for the Terminal's third-party notices
+
Windows Terminal (Unpackaged)This display name is used when the application's name cannot be determined
diff --git a/src/cascadia/TerminalApp/TerminalPage.cpp b/src/cascadia/TerminalApp/TerminalPage.cpp
index 96a823e7d..d7a15836f 100644
--- a/src/cascadia/TerminalApp/TerminalPage.cpp
+++ b/src/cascadia/TerminalApp/TerminalPage.cpp
@@ -18,6 +18,8 @@
#include "TabRowControl.h"
#include "DebugTapConnection.h"
+#include "CurrentCommitHash.h" // For the about dialog's ThirdPartyNotices link
+
using namespace winrt;
using namespace winrt::Windows::Foundation::Collections;
using namespace winrt::Windows::UI::Xaml;
@@ -254,6 +256,12 @@ namespace winrt::TerminalApp::implementation
return RS_(L"ApplicationVersionUnknown");
}
+ winrt::hstring TerminalPage::ThirdPartyNoticesLink()
+ {
+ winrt::hstring link{ fmt::format(L"https://github.com/microsoft/terminal/blob/{}/NOTICE.md", CurrentCommitHash) };
+ return link;
+ }
+
// Method Description:
// - Displays a dialog for warnings found while closing the terminal app using
// key binding with multiple tabs opened. Display messages to warn user
diff --git a/src/cascadia/TerminalApp/TerminalPage.h b/src/cascadia/TerminalApp/TerminalPage.h
index a7d37c138..ff561f164 100644
--- a/src/cascadia/TerminalApp/TerminalPage.h
+++ b/src/cascadia/TerminalApp/TerminalPage.h
@@ -45,6 +45,8 @@ namespace winrt::TerminalApp::implementation
winrt::hstring ApplicationDisplayName();
winrt::hstring ApplicationVersion();
+ winrt::hstring ThirdPartyNoticesLink();
+
void CloseWindow();
int32_t SetStartupCommandline(winrt::array_view args);
diff --git a/src/cascadia/TerminalApp/TerminalPage.idl b/src/cascadia/TerminalApp/TerminalPage.idl
index dc4b7820d..ec7e261ba 100644
--- a/src/cascadia/TerminalApp/TerminalPage.idl
+++ b/src/cascadia/TerminalApp/TerminalPage.idl
@@ -17,6 +17,8 @@ namespace TerminalApp
String ApplicationDisplayName { get; };
String ApplicationVersion { get; };
+ String ThirdPartyNoticesLink { get; };
+
event Windows.Foundation.TypedEventHandler