Skip to content

Commit

Permalink
Merge Develop
Browse files Browse the repository at this point in the history
  • Loading branch information
kythant committed Sep 9, 2022
2 parents 4cb42ea + 3076f9c commit a3cea6a
Show file tree
Hide file tree
Showing 63 changed files with 2,592 additions and 324 deletions.
2 changes: 1 addition & 1 deletion NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<packageSources>
<clear />
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
<add key="WindowsAppSDK-Dependencies" value="https://pkgs.dev.azure.com/ms/ProjectReunion/_packaging/ProjectReunion-Dependencies/nuget/v3/index.json" />
<add key="ProjectReunion internal" value="https://microsoft.pkgs.visualstudio.com/ProjectReunion/_packaging/Project.Reunion.nuget.internal/nuget/v3/index.json" />
</packageSources>
<disabledPackageSources>
<clear />
Expand Down
17 changes: 16 additions & 1 deletion WindowsAppRuntime.sln
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Test_BootstrapAutoInitializ
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Test_BootstrapAutoInitialize_CS_Options_None", "test\DynamicDependency\Test_BootstrapAutoInitialize\CS\Test_BootstrapAutoInitialize_CS_Options_None\Test_BootstrapAutoInitialize_CS_Options_None.csproj", "{4A74BBED-3B20-44A7-B6FF-3373160DE741}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AppNotificationTests", "test\AppNotificationTests\AppNotificationTests.vcxproj", "{1C9477D2-7330-4992-B06C-F7E2193CF379}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DeploymentAgent", "dev\DeploymentAgent\DeploymentAgent.vcxproj", "{4410D374-A90C-4ADF-8B15-AA2AAE2636BF}"
ProjectSection(ProjectDependencies) = postProject
{B73AD907-6164-4294-88FB-F3C9C10DA1F1} = {B73AD907-6164-4294-88FB-F3C9C10DA1F1}
Expand Down Expand Up @@ -1411,6 +1413,18 @@ Global
{4A74BBED-3B20-44A7-B6FF-3373160DE741}.Release|x64.Build.0 = Release|x64
{4A74BBED-3B20-44A7-B6FF-3373160DE741}.Release|x86.ActiveCfg = Release|x86
{4A74BBED-3B20-44A7-B6FF-3373160DE741}.Release|x86.Build.0 = Release|x86
{1C9477D2-7330-4992-B06C-F7E2193CF379}.Debug|Any CPU.ActiveCfg = Debug|Win32
{1C9477D2-7330-4992-B06C-F7E2193CF379}.Debug|ARM64.ActiveCfg = Debug|Win32
{1C9477D2-7330-4992-B06C-F7E2193CF379}.Debug|x64.ActiveCfg = Debug|x64
{1C9477D2-7330-4992-B06C-F7E2193CF379}.Debug|x64.Build.0 = Debug|x64
{1C9477D2-7330-4992-B06C-F7E2193CF379}.Debug|x86.ActiveCfg = Debug|Win32
{1C9477D2-7330-4992-B06C-F7E2193CF379}.Debug|x86.Build.0 = Debug|Win32
{1C9477D2-7330-4992-B06C-F7E2193CF379}.Release|Any CPU.ActiveCfg = Release|Win32
{1C9477D2-7330-4992-B06C-F7E2193CF379}.Release|ARM64.ActiveCfg = Release|Win32
{1C9477D2-7330-4992-B06C-F7E2193CF379}.Release|x64.ActiveCfg = Release|x64
{1C9477D2-7330-4992-B06C-F7E2193CF379}.Release|x64.Build.0 = Release|x64
{1C9477D2-7330-4992-B06C-F7E2193CF379}.Release|x86.ActiveCfg = Release|Win32
{1C9477D2-7330-4992-B06C-F7E2193CF379}.Release|x86.Build.0 = Release|Win32
{4410D374-A90C-4ADF-8B15-AA2AAE2636BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4410D374-A90C-4ADF-8B15-AA2AAE2636BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4410D374-A90C-4ADF-8B15-AA2AAE2636BF}.Debug|ARM64.ActiveCfg = Debug|arm64
Expand Down Expand Up @@ -1705,7 +1719,7 @@ Global
{50451390-66E7-4465-8804-427560625794} = {82A73181-EA4A-431A-B82B-BE6734604CC9}
{0419CA2B-5ED1-49F0-B70B-5F470A15D3D0} = {448ED2E5-0B37-4D97-9E6B-8C10A507976A}
{8828053C-D6EC-4744-8624-F8C676C2D4DF} = {0419CA2B-5ED1-49F0-B70B-5F470A15D3D0}
{33609C47-60F4-48ED-AB2C-83A89C17255F} = {17B1F036-8FC3-49E6-9464-0C1F96CEAEB9}
{33609C47-60F4-48ED-AB2C-83A89C17255F} = {0C534F12-B076-47E5-A05B-2A711233AC6F}
{53E3E9A7-11BE-4BBC-981F-AF98A1B00617} = {A05C260F-877D-49C2-968A-164E5A904422}
{A05C260F-877D-49C2-968A-164E5A904422} = {33609C47-60F4-48ED-AB2C-83A89C17255F}
{F9BA7D03-5B5F-4FF1-A3A6-81B64FBDFE2A} = {A05C260F-877D-49C2-968A-164E5A904422}
Expand All @@ -1716,6 +1730,7 @@ Global
{0EF1080B-15C6-42E7-A0E2-D624D85C3EBF} = {99C514E4-A6B3-4B09-B870-5511EF9D93AC}
{D9139E3C-8D21-4BD9-84E3-30A03A54D610} = {99C514E4-A6B3-4B09-B870-5511EF9D93AC}
{4A74BBED-3B20-44A7-B6FF-3373160DE741} = {99C514E4-A6B3-4B09-B870-5511EF9D93AC}
{1C9477D2-7330-4992-B06C-F7E2193CF379} = {8630F7AA-2969-4DC9-8700-9B468C1DC21D}
{4410D374-A90C-4ADF-8B15-AA2AAE2636BF} = {E378857C-D22A-4E5E-A6DA-A59C445CF22E}
{E49329F3-5196-4BBA-B5C4-E11CE7EFB07A} = {1C9A0791-2BAA-420B-84B6-C0721F22A6E8}
{131DE0C4-AA1E-4649-B5BC-7B43508FA93A} = {8630F7AA-2969-4DC9-8700-9B468C1DC21D}
Expand Down
1 change: 1 addition & 0 deletions build/CopyFilesToStagingDir.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ PublishFile $FullBuildOutput\Microsoft.Windows.System.Power.Projection\Microsoft
PublishFile $FullBuildOutput\Microsoft.Windows.System.Power.Projection\Microsoft.Windows.System.Power.Projection.pdb $NugetDir\lib\net6.0-windows10.0.17763.0
PublishFile $FullBuildOutput\Microsoft.Windows.Security.AccessControl.Projection\Microsoft.Windows.Security.AccessControl.Projection.dll $NugetDir\lib\net6.0-windows10.0.17763.0
PublishFile $FullBuildOutput\Microsoft.Windows.Security.AccessControl.Projection\Microsoft.Windows.Security.AccessControl.Projection.pdb $NugetDir\lib\net6.0-windows10.0.17763.0

#
# Dynamic Dependency build overrides
PublishFile $OverrideDir\DynamicDependency-Override.json $NugetDir\runtimes\win10-$Platform\native
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

#include "pch.h"
#include "AppNotificationBuilder.h"
#include "AppNotificationBuilderTelemetry.h"
#include <winrt/Windows.Globalization.h>
#include <winrt/Windows.Globalization.DateTimeFormatting.h>
#include "Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilder.g.cpp"
Expand Down Expand Up @@ -369,28 +370,42 @@ namespace winrt::Microsoft::Windows::AppNotifications::Builder::implementation

winrt::Microsoft::Windows::AppNotifications::AppNotification AppNotificationBuilder::BuildNotification()
{
// Build the actions string and fill m_useButtonStyle
std::wstring actions{ GetActions() };

auto xmlResult{ wil::str_printf<std::wstring>(L"<toast%ls%ls%ls%ls%ls><visual><binding template='ToastGeneric'>%ls%ls%ls%ls</binding></visual>%ls%ls</toast>",
m_timeStamp.c_str(),
GetDuration().c_str(),
GetScenario().c_str(),
GetArguments().c_str(),
GetButtonStyle().c_str(),
GetText().c_str(),
m_attributionText.c_str(),
GetImages().c_str(),
GetProgressBars().c_str(),
m_audio.c_str(),
actions.c_str()) };

THROW_HR_IF_MSG(E_FAIL, xmlResult.size() > c_maxAppNotificationPayload, "Maximum payload size exceeded");

winrt::Microsoft::Windows::AppNotifications::AppNotification appNotification{ xmlResult };
appNotification.Tag(m_tag);
appNotification.Group(m_group);

return appNotification;
HRESULT hr{ S_OK };

auto logTelemetry{ wil::scope_exit([&]() {
AppNotificationBuilderTelemetry::LogBuildNotification(hr);
}) };

try
{
// Build the actions string and fill m_useButtonStyle
std::wstring actions{ GetActions() };

auto xmlResult{ wil::str_printf<std::wstring>(L"<toast%ls%ls%ls%ls%ls><visual><binding template='ToastGeneric'>%ls%ls%ls%ls</binding></visual>%ls%ls</toast>",
m_timeStamp.c_str(),
GetDuration().c_str(),
GetScenario().c_str(),
GetArguments().c_str(),
GetButtonStyle().c_str(),
GetText().c_str(),
m_attributionText.c_str(),
GetImages().c_str(),
GetProgressBars().c_str(),
m_audio.c_str(),
actions.c_str()) };

THROW_HR_IF_MSG(E_FAIL, xmlResult.size() > c_maxAppNotificationPayload, "Maximum payload size exceeded");

winrt::Microsoft::Windows::AppNotifications::AppNotification appNotification{ xmlResult };
appNotification.Tag(m_tag);
appNotification.Group(m_group);

return appNotification;
}
catch (...)
{
hr = wil::ResultFromCaughtException();
throw;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="$(MSBuildThisFileDirectory)AppNotificationBuilder.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)AppNotificationBuilderTelemetry.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)AppNotificationBuilderUtility.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)AppNotificationButton.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)AppNotificationProgressBar.h" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

#pragma once

#include <WindowsAppRuntimeInsights.h>
#include <NotificationTelemetryHelper.h>

DECLARE_TRACELOGGING_CLASS(AppNotificationBuilderTelemetryProvider,
"Microsoft.WindowsAppSDK.Notifications.AppNotificationBuilderTelemetry",
// {6f23f3a8-1420-4814-83c7-c752565aad22}
(0x6f23f3a8, 0x1420, 0x4814, 0x83, 0xc7, 0xc7, 0x52, 0x56, 0x5a, 0xad, 0x22));

class AppNotificationBuilderTelemetry : public wil::TraceLoggingProvider
{
IMPLEMENT_TELEMETRY_CLASS(AppNotificationBuilderTelemetry, AppNotificationBuilderTelemetryProvider);

public:
DEFINE_EVENT_METHOD(LogBuildNotification)(
winrt::hresult hr) noexcept try
{
if (m_telemetryHelper.ShouldLogEvent())
{
TraceLoggingClassWriteMeasure(
"BuildNotification",
TelemetryPrivacyDataTag(PDT_ProductAndServicePerformance),
_GENERIC_PARTB_FIELDS_ENABLED,
TraceLoggingHexUInt32(hr, "OperationResult"),
TraceLoggingBool(m_telemetryHelper.IsPackagedApp(), "IsAppPackaged"),
TraceLoggingWideString(m_telemetryHelper.GetAppName().c_str(), "AppName"));
}
}
CATCH_LOG()

DEFINE_EVENT_METHOD(LogButtonToString)(
winrt::hresult hr) noexcept try
{
if (m_telemetryHelper.ShouldLogEvent())
{
TraceLoggingClassWriteMeasure(
"ButtonToString",
TelemetryPrivacyDataTag(PDT_ProductAndServicePerformance),
_GENERIC_PARTB_FIELDS_ENABLED,
TraceLoggingHexUInt32(hr, "OperationResult"),
TraceLoggingBool(m_telemetryHelper.IsPackagedApp(), "IsAppPackaged"),
TraceLoggingWideString(m_telemetryHelper.GetAppName().c_str(), "AppName"));
}
}
CATCH_LOG()

DEFINE_EVENT_METHOD(LogComboBoxToString)(
winrt::hresult hr) noexcept try
{
if (m_telemetryHelper.ShouldLogEvent())
{
TraceLoggingClassWriteMeasure(
"ComboBoxToString",
TelemetryPrivacyDataTag(PDT_ProductAndServicePerformance),
_GENERIC_PARTB_FIELDS_ENABLED,
TraceLoggingHexUInt32(hr, "OperationResult"),
TraceLoggingBool(m_telemetryHelper.IsPackagedApp(), "IsAppPackaged"),
TraceLoggingWideString(m_telemetryHelper.GetAppName().c_str(), "AppName"));
}
}
CATCH_LOG()

DEFINE_EVENT_METHOD(LogProgressBarToString)(
winrt::hresult hr) noexcept try
{
if (m_telemetryHelper.ShouldLogEvent())
{
TraceLoggingClassWriteMeasure(
"ProgressBarToString",
TelemetryPrivacyDataTag(PDT_ProductAndServicePerformance),
_GENERIC_PARTB_FIELDS_ENABLED,
TraceLoggingHexUInt32(hr, "OperationResult"),
TraceLoggingBool(m_telemetryHelper.IsPackagedApp(), "IsAppPackaged"),
TraceLoggingWideString(m_telemetryHelper.GetAppName().c_str(), "AppName"));
}
}
CATCH_LOG()

DEFINE_EVENT_METHOD(LogTextPropertiesToString)(
winrt::hresult hr) noexcept try
{
if (m_telemetryHelper.ShouldLogEvent())
{
TraceLoggingClassWriteMeasure(
"TextPropertiesToString",
TelemetryPrivacyDataTag(PDT_ProductAndServicePerformance),
_GENERIC_PARTB_FIELDS_ENABLED,
TraceLoggingHexUInt32(hr, "OperationResult"),
TraceLoggingBool(m_telemetryHelper.IsPackagedApp(), "IsAppPackaged"),
TraceLoggingWideString(m_telemetryHelper.GetAppName().c_str(), "AppName"));
}
}
CATCH_LOG()

private:
NotificationTelemetryHelper m_telemetryHelper;
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

#include "pch.h"
#include "winrt/Microsoft.Windows.AppNotifications.Builder.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

#include "pch.h"
#include "AppNotificationButton.h"
#include "Microsoft.Windows.AppNotifications.Builder.AppNotificationButton.g.cpp"
#include <IsWindowsVersion.h>
#include "AppNotificationBuilderUtility.h"
#include "AppNotificationBuilderTelemetry.h"

namespace winrt::Microsoft::Windows::AppNotifications::Builder::implementation
{
Expand Down Expand Up @@ -117,15 +118,29 @@ namespace winrt::Microsoft::Windows::AppNotifications::Builder::implementation

winrt::hstring AppNotificationButton::ToString()
{
std::wstring xmlResult{ wil::str_printf<std::wstring>(L"<action content='%ls'%ls%ls%ls%ls%ls%ls/>",
m_content.c_str(),
GetActivationArguments().c_str(),
m_useContextMenuPlacement ? L" placement='contextMenu'" : L"",
m_iconUri ? wil::str_printf<std::wstring>(L" imageUri='%ls'", m_iconUri.ToString().c_str()).c_str() : L"",
!m_inputId.empty() ? wil::str_printf<std::wstring>(L" hint-inputId='%ls'", m_inputId.c_str()).c_str() : L"",
GetButtonStyle().c_str(),
!m_toolTip.empty() ? wil::str_printf<std::wstring>(L" hint-toolTip='%ls'", m_toolTip.c_str()).c_str() : L"") };

return xmlResult.c_str();
HRESULT hr{ S_OK };

auto logTelemetry{ wil::scope_exit([&]() {
AppNotificationBuilderTelemetry::LogButtonToString(hr);
}) };

try
{
std::wstring xmlResult{ wil::str_printf<std::wstring>(L"<action content='%ls'%ls%ls%ls%ls%ls%ls/>",
m_content.c_str(),
GetActivationArguments().c_str(),
m_useContextMenuPlacement ? L" placement='contextMenu'" : L"",
m_iconUri ? wil::str_printf<std::wstring>(L" imageUri='%ls'", m_iconUri.ToString().c_str()).c_str() : L"",
!m_inputId.empty() ? wil::str_printf<std::wstring>(L" hint-inputId='%ls'", m_inputId.c_str()).c_str() : L"",
GetButtonStyle().c_str(),
!m_toolTip.empty() ? wil::str_printf<std::wstring>(L" hint-toolTip='%ls'", m_toolTip.c_str()).c_str() : L"") };

return xmlResult.c_str();
}
catch (...)
{
hr = wil::ResultFromCaughtException();
throw;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

#pragma once
#include "Microsoft.Windows.AppNotifications.Builder.AppNotificationButton.g.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

#include "pch.h"
#include "AppNotificationComboBox.h"
#include "Microsoft.Windows.AppNotifications.Builder.AppNotificationComboBox.g.cpp"
#include "AppNotificationBuilderUtility.h"
#include "AppNotificationBuilderTelemetry.h"

namespace winrt::Microsoft::Windows::AppNotifications::Builder::implementation
{
Expand Down Expand Up @@ -54,12 +55,26 @@ namespace winrt::Microsoft::Windows::AppNotifications::Builder::implementation

winrt::hstring AppNotificationComboBox::ToString()
{
std::wstring xmlResult{ wil::str_printf<std::wstring>(L"<input id='%ls' type='selection'%ls%ls>%ls</input>",
m_id.c_str(),
m_title.empty() ? L"" : wil::str_printf<std::wstring>(L" title='%ls'", m_title.c_str()).c_str(),
m_selectedItem.empty() ? L"" : wil::str_printf<std::wstring>(L" defaultInput='%ls'", m_selectedItem.c_str()).c_str(),
GetSelectionItems().c_str()) };
HRESULT hr{ S_OK };

return xmlResult.c_str();
auto logTelemetry{ wil::scope_exit([&]() {
AppNotificationBuilderTelemetry::LogComboBoxToString(hr);
}) };

try
{
std::wstring xmlResult{ wil::str_printf<std::wstring>(L"<input id='%ls' type='selection'%ls%ls>%ls</input>",
m_id.c_str(),
m_title.empty() ? L"" : wil::str_printf<std::wstring>(L" title='%ls'", m_title.c_str()).c_str(),
m_selectedItem.empty() ? L"" : wil::str_printf<std::wstring>(L" defaultInput='%ls'", m_selectedItem.c_str()).c_str(),
GetSelectionItems().c_str()) };

return xmlResult.c_str();
}
catch (...)
{
hr = wil::ResultFromCaughtException();
throw;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

#pragma once
#include "Microsoft.Windows.AppNotifications.Builder.AppNotificationComboBox.g.h"
Expand Down
Loading

0 comments on commit a3cea6a

Please sign in to comment.