From ae443e2b36fe3fad78a27453394630bf4aebb963 Mon Sep 17 00:00:00 2001 From: Eric Langlois Date: Fri, 29 Jul 2022 14:47:42 -0700 Subject: [PATCH 1/5] Addressing nits from a previous PR --- .../AppNotificationBuilder.cpp | 62 +++++++++---------- .../AppNotificationBuilderUtility.h | 6 +- .../AppNotificationButton.cpp | 30 ++++----- .../AppNotificationTextProperties.cpp | 4 +- 4 files changed, 51 insertions(+), 51 deletions(-) diff --git a/dev/AppNotifications/AppNotificationBuilder/AppNotificationBuilder.cpp b/dev/AppNotifications/AppNotificationBuilder/AppNotificationBuilder.cpp index a0d150629c..d6fec547fa 100644 --- a/dev/AppNotifications/AppNotificationBuilder/AppNotificationBuilder.cpp +++ b/dev/AppNotifications/AppNotificationBuilder/AppNotificationBuilder.cpp @@ -23,7 +23,7 @@ namespace winrt::Microsoft::Windows::AppNotifications::Builder::implementation winrt::Microsoft::Windows::AppNotifications::Builder::AppNotificationBuilder AppNotificationBuilder::AddArgument(hstring const& key, hstring const& value) { - THROW_HR_IF_MSG(E_INVALIDARG, key.empty(), "You must provide a key when adding an argument."); + THROW_HR_IF_MSG(E_INVALIDARG, key.empty(), "You must provide a key when adding an argument"); m_arguments.Insert(key, value); return *this; @@ -38,7 +38,7 @@ namespace winrt::Microsoft::Windows::AppNotifications::Builder::implementation std::wstringstream buffer; buffer << std::put_time(&buf, L"%FT%T"); - m_timeStamp = wil::str_printf(L" displayTimestamp='%wsZ'", buffer.str().c_str()); + m_timeStamp = wil::str_printf(L" displayTimestamp='%lsZ'", buffer.str().c_str()); return *this; } @@ -56,18 +56,18 @@ namespace winrt::Microsoft::Windows::AppNotifications::Builder::implementation winrt::Microsoft::Windows::AppNotifications::Builder::AppNotificationBuilder AppNotificationBuilder::AddText(hstring const& text) { - THROW_HR_IF_MSG(E_INVALIDARG, m_textLines.size() >= c_maxTextElements, "Maximum number of text elements added."); + THROW_HR_IF_MSG(E_INVALIDARG, m_textLines.size() >= c_maxTextElements, "Maximum number of text elements added"); - m_textLines.push_back(wil::str_printf(L"%ws", text.c_str()).c_str()); + m_textLines.push_back(wil::str_printf(L"%ls", text.c_str()).c_str()); return *this; } winrt::Microsoft::Windows::AppNotifications::Builder::AppNotificationBuilder AppNotificationBuilder::AddText(hstring const& text, AppNotificationTextProperties const& properties) { - THROW_HR_IF_MSG(E_INVALIDARG, m_textLines.size() >= c_maxTextElements, "Maximum number of text elements added."); + THROW_HR_IF_MSG(E_INVALIDARG, m_textLines.size() >= c_maxTextElements, "Maximum number of text elements added"); std::wstring props{ properties.as().ToString() }; - m_textLines.push_back(wil::str_printf(L"%ws%ws", props.c_str(), text.c_str()).c_str()); + m_textLines.push_back(wil::str_printf(L"%ls%ls", props.c_str(), text.c_str()).c_str()); if (properties.IncomingCallAlignment()) { @@ -78,21 +78,21 @@ namespace winrt::Microsoft::Windows::AppNotifications::Builder::implementation winrt::Microsoft::Windows::AppNotifications::Builder::AppNotificationBuilder AppNotificationBuilder::SetAttributionText(hstring const& text) { - m_attributionText = wil::str_printf(L"%ws", text.c_str()); + m_attributionText = wil::str_printf(L"%ls", text.c_str()); return *this; } winrt::Microsoft::Windows::AppNotifications::Builder::AppNotificationBuilder AppNotificationBuilder::SetAttributionText(hstring const& text, hstring const& language) { - THROW_HR_IF_MSG(E_INVALIDARG, language.empty(), "You must provide a language calling SetAttributionText."); + THROW_HR_IF_MSG(E_INVALIDARG, language.empty(), "You must provide a language calling SetAttributionText"); - m_attributionText = wil::str_printf(L"%ws", language.c_str(), text.c_str()); + m_attributionText = wil::str_printf(L"%ls", language.c_str(), text.c_str()); return *this; } winrt::Microsoft::Windows::AppNotifications::Builder::AppNotificationBuilder AppNotificationBuilder::SetInlineImage(winrt::Windows::Foundation::Uri const& imageUri) { - m_inlineImage = wil::str_printf(L"", imageUri.ToString().c_str()); + m_inlineImage = wil::str_printf(L"", imageUri.ToString().c_str()); return *this; } @@ -100,7 +100,7 @@ namespace winrt::Microsoft::Windows::AppNotifications::Builder::implementation { if (imageCrop == AppNotificationImageCrop::Circle) { - m_inlineImage = wil::str_printf(L"", imageUri.ToString().c_str()); + m_inlineImage = wil::str_printf(L"", imageUri.ToString().c_str()); } else { @@ -112,17 +112,17 @@ namespace winrt::Microsoft::Windows::AppNotifications::Builder::implementation winrt::Microsoft::Windows::AppNotifications::Builder::AppNotificationBuilder AppNotificationBuilder::SetInlineImage(winrt::Windows::Foundation::Uri const& imageUri, AppNotificationImageCrop const& imageCrop, hstring const& alternateText) { - THROW_HR_IF_MSG(E_INVALIDARG, alternateText.empty(), "You must provide an alternate text string calling SetInlineImage."); + THROW_HR_IF_MSG(E_INVALIDARG, alternateText.empty(), "You must provide an alternate text string calling SetInlineImage"); std::wstring hintCrop { imageCrop == AppNotificationImageCrop::Circle ? L" hint-crop='circle'" : L"" }; - m_inlineImage = wil::str_printf(L"%ws", imageUri.ToString().c_str(), alternateText.c_str(), hintCrop.c_str()); + m_inlineImage = wil::str_printf(L"%ls", imageUri.ToString().c_str(), alternateText.c_str(), hintCrop.c_str()); return *this; } winrt::Microsoft::Windows::AppNotifications::Builder::AppNotificationBuilder AppNotificationBuilder::SetAppLogoOverride(winrt::Windows::Foundation::Uri const& imageUri) { - m_appLogoOverride = wil::str_printf(L"", imageUri.ToString().c_str()); + m_appLogoOverride = wil::str_printf(L"", imageUri.ToString().c_str()); return *this; } @@ -130,7 +130,7 @@ namespace winrt::Microsoft::Windows::AppNotifications::Builder::implementation { if (imageCrop == AppNotificationImageCrop::Circle) { - m_appLogoOverride = wil::str_printf(L"", imageUri.ToString().c_str()); + m_appLogoOverride = wil::str_printf(L"", imageUri.ToString().c_str()); } else { @@ -142,49 +142,49 @@ namespace winrt::Microsoft::Windows::AppNotifications::Builder::implementation winrt::Microsoft::Windows::AppNotifications::Builder::AppNotificationBuilder AppNotificationBuilder::SetAppLogoOverride(winrt::Windows::Foundation::Uri const& imageUri, AppNotificationImageCrop const& imageCrop, hstring const& alternateText) { - THROW_HR_IF_MSG(E_INVALIDARG, alternateText.empty(), "You must provide an alternate text string calling SetAppLogoOverride."); + THROW_HR_IF_MSG(E_INVALIDARG, alternateText.empty(), "You must provide an alternate text string calling SetAppLogoOverride"); std::wstring hintCrop{ imageCrop == AppNotificationImageCrop::Circle ? L" hint-crop='circle'" : L"" }; - m_appLogoOverride = wil::str_printf(L"%ws", imageUri.ToString().c_str(), alternateText.c_str(), hintCrop.c_str()); + m_appLogoOverride = wil::str_printf(L"%ls", imageUri.ToString().c_str(), alternateText.c_str(), hintCrop.c_str()); return *this; } winrt::Microsoft::Windows::AppNotifications::Builder::AppNotificationBuilder AppNotificationBuilder::SetHeroImage(winrt::Windows::Foundation::Uri const& imageUri) { - m_heroImage = wil::str_printf(L"", imageUri.ToString().c_str()); + m_heroImage = wil::str_printf(L"", imageUri.ToString().c_str()); return *this; } winrt::Microsoft::Windows::AppNotifications::Builder::AppNotificationBuilder AppNotificationBuilder::SetHeroImage(winrt::Windows::Foundation::Uri const& imageUri, hstring const& alternateText) { - THROW_HR_IF_MSG(E_INVALIDARG, alternateText.empty(), "You must provide an alternate text string calling SetHeroImage."); + THROW_HR_IF_MSG(E_INVALIDARG, alternateText.empty(), "You must provide an alternate text string calling SetHeroImage"); - m_heroImage = wil::str_printf(L"%ws", imageUri.ToString().c_str(), alternateText.c_str()); + m_heroImage = wil::str_printf(L"%ls", imageUri.ToString().c_str(), alternateText.c_str()); return *this; } winrt::Microsoft::Windows::AppNotifications::Builder::AppNotificationBuilder AppNotificationBuilder::SetAudioUri(winrt::Windows::Foundation::Uri const& audioUri) { - m_audio = wil::str_printf(L"