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

AppNotificationBuilder - Addressing last few feature nits #2813

Merged
merged 23 commits into from
Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
71a2da7
FI develop into WNP_ContentBuilder_Prev1 (#2656)
loneursid Jun 23, 2022
9be0803
User/erlangl/fi develop into feature (#2660)
loneursid Jun 24, 2022
4355c4e
Merge branch 'develop' of https://github.com/microsoft/WindowsAppSDK …
kythant Jun 28, 2022
6149efb
FI develop into Content Builder feature branch (#2717)
loneursid Jul 12, 2022
d394165
FI develop into notification feature branch (#2733)
loneursid Jul 25, 2022
eca07a6
Merge branch 'develop' of https://github.com/microsoft/WindowsAppSDK …
kythant Jul 26, 2022
ad6a94c
AppNotificationBuilder features (#2786)
pmpurifoy Jul 29, 2022
2fd4a1f
Merge branch 'develop' into feature/WNP_ContentBuilder_Prev1
kythant Jul 29, 2022
a103cab
AppNotificationContent Builder 1.2 spec (#2648)
pmpurifoy Jul 30, 2022
7348ed6
Merge branch 'develop' into feature/WNP_ContentBuilder_Prev1
kythant Aug 1, 2022
6cb166b
AppNotificationBuilder - Code Improvements (#2801)
loneursid Aug 2, 2022
5c91499
AppNotificationContent Builder Core Features - part II (#2760)
loneursid Aug 3, 2022
17688ec
nits
Aug 3, 2022
44d2fd9
new line to keep github happy
Aug 3, 2022
3d9830d
Merge branch 'develop' into feature/WNP_ContentBuilder_Prev1
kythant Aug 3, 2022
5e4961a
AppNotificationBuilder - ProgressBar (#2780)
loneursid Aug 4, 2022
28325b4
Merge branch 'feature/WNP_ContentBuilder_Prev1' into user/erlangl/esc…
Aug 4, 2022
8708879
Nits
Aug 4, 2022
b26d503
Wrong error type
Aug 4, 2022
ae8119a
Nits
Aug 4, 2022
90e4905
Merge branch 'develop' into user/erlangl/escapes
Aug 4, 2022
da98b9b
Spacing
Aug 5, 2022
db44473
Spacing
Aug 5, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ namespace winrt::Microsoft::Windows::AppNotifications::Builder::implementation
ThrowIfMaxInputItemsExceeded();
THROW_HR_IF_MSG(E_INVALIDARG, id.empty(), "You must provide an id for the TextBox");


m_textBoxList.push_back(wil::str_printf<std::wstring>(L"<input id='%ls' type='text'/>", EncodeXml(id).c_str()));
return *this;
}
Expand Down Expand Up @@ -370,27 +369,23 @@ namespace winrt::Microsoft::Windows::AppNotifications::Builder::implementation

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

auto xmlResult{ wil::str_printf<std::wstring>(L"%ls%ls%ls%ls%ls%ls%ls%ls%ls%ls%ls%ls%ls%ls%ls",
L"<toast",
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(),
L"><visual><binding template='ToastGeneric'>",
GetText().c_str(),
m_attributionText.c_str(),
GetImages().c_str(),
GetProgressBars().c_str(),
L"</binding></visual>",
m_audio.c_str(),
actions.c_str(),
L"</toast>") };
actions.c_str()) };

THROW_HR_IF_MSG(E_INVALIDARG, xmlResult.size() > c_maxAppNotificationPayload, "Maximum payload size exceeded");
THROW_HR_IF_MSG(E_FAIL, xmlResult.size() > c_maxAppNotificationPayload, "Maximum payload size exceeded");
loneursid marked this conversation as resolved.
Show resolved Hide resolved

winrt::Microsoft::Windows::AppNotifications::AppNotification appNotification{ xmlResult };
appNotification.Tag(m_tag);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ namespace winrt::Microsoft::Windows::AppNotifications::Builder::implementation
auto valueStringOverride{ wil::str_printf < std::wstring>(L" valueStringOverride='%ls'", m_valueStringOverrideBindMode == BindMode::Value ? m_valueStringOverride.c_str() : L"{progressValueString}") };

return wil::str_printf<std::wstring>(L"<progress%ls%ls%ls%ls/>",
m_titleBindMode == BindMode::NotSet ? L"" :title.c_str(),
m_titleBindMode == BindMode::NotSet ? L"" : title.c_str(),
status.c_str(),
value.c_str(),
m_valueStringOverrideBindMode == BindMode::NotSet ? L"" : valueStringOverride.c_str()).c_str();
Expand Down
2 changes: 1 addition & 1 deletion test/AppNotificationBuilderTests/APITests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ namespace Test::AppNotification::Builder
{
VERIFY_THROWS_HR(winrt::AppNotificationBuilder()
.AddText(std::wstring(5120, 'A').c_str())
.BuildNotification(), E_INVALIDARG);
.BuildNotification(), E_FAIL);
}

TEST_METHOD(AppNotificationAddProgressBar)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,4 @@
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.220531.1\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.220531.1\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.220531.1\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.220531.1\build\native\Microsoft.Windows.CppWinRT.targets'))" />
</Target>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
</Project>