Not quite sure how this ever worked
This commit is contained in:
parent
e901b1c6ca
commit
157f3abe64
2 changed files with 15 additions and 15 deletions
|
@ -173,10 +173,10 @@ bool WindowsToastNotification::GetToastXml(
|
||||||
if (!SetXmlText(*toast_xml, title, msg))
|
if (!SetXmlText(*toast_xml, title, msg))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configure the toast's notification sound
|
// Configure the toast's notification sound
|
||||||
if (silent) {
|
if (silent) {
|
||||||
if (FAILED(SetXmlAudioSilent(*toast_xml)))
|
if (FAILED(SetXmlAudioSilent(*toast_xml)))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,40 +200,40 @@ bool WindowsToastNotification::SetXmlAudioSilent(
|
||||||
ComPtr<IXmlNode> root;
|
ComPtr<IXmlNode> root;
|
||||||
if (FAILED(node_list->Item(0, &root)))
|
if (FAILED(node_list->Item(0, &root)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ComPtr<IXmlElement> audio_element;
|
ComPtr<IXmlElement> audio_element;
|
||||||
ScopedHString audio_str(L"audio");
|
ScopedHString audio_str(L"audio");
|
||||||
if (FAILED(doc->CreateElement(audio_str, &audio_element)))
|
if (FAILED(doc->CreateElement(audio_str, &audio_element)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ComPtr<IXmlNode> audio_node_tmp;
|
ComPtr<IXmlNode> audio_node_tmp;
|
||||||
if (FAILED(audio_element.As(&audio_node_tmp)))
|
if (FAILED(audio_element.As(&audio_node_tmp)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Append audio node to toast xml
|
// Append audio node to toast xml
|
||||||
ComPtr<IXmlNode> audio_node;
|
ComPtr<IXmlNode> audio_node;
|
||||||
if (FAILED(root->AppendChild(audio_node_tmp.Get(), &audio_node)))
|
if (FAILED(root->AppendChild(audio_node_tmp.Get(), &audio_node)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Create silent attribute
|
// Create silent attribute
|
||||||
ComPtr<IXmlNamedNodeMap> attributes;
|
ComPtr<IXmlNamedNodeMap> attributes;
|
||||||
if (FAILED(audio_node->get_Attributes(&attributes)))
|
if (FAILED(audio_node->get_Attributes(&attributes)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ComPtr<IXmlAttribute> silent_attribute;
|
ComPtr<IXmlAttribute> silent_attribute;
|
||||||
ScopedHString silent_str(L"silent");
|
ScopedHString silent_str(L"silent");
|
||||||
if (FAILED(doc->CreateAttribute(silent_str, &silent_attribute)))
|
if (FAILED(doc->CreateAttribute(silent_str, &silent_attribute)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ComPtr<IXmlNode> silent_attribute_node;
|
ComPtr<IXmlNode> silent_attribute_node;
|
||||||
if (FAILED(silent_attribute.As(&silent_attribute_node)))
|
if (FAILED(silent_attribute.As(&silent_attribute_node)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Set silent attribute to true
|
// Set silent attribute to true
|
||||||
ScopedHString silent_value(L"true");
|
ScopedHString silent_value(L"true");
|
||||||
if (!silent_value.success())
|
if (!silent_value.success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ComPtr<IXmlText> silent_text;
|
ComPtr<IXmlText> silent_text;
|
||||||
if (FAILED(doc->CreateTextNode(silent_value, &silent_text)))
|
if (FAILED(doc->CreateTextNode(silent_value, &silent_text)))
|
||||||
return false;
|
return false;
|
||||||
|
@ -241,11 +241,11 @@ bool WindowsToastNotification::SetXmlAudioSilent(
|
||||||
ComPtr<IXmlNode> silent_node;
|
ComPtr<IXmlNode> silent_node;
|
||||||
if (FAILED(silent_text.As(&silent_node)))
|
if (FAILED(silent_text.As(&silent_node)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ComPtr<IXmlNode> child_node;
|
ComPtr<IXmlNode> child_node;
|
||||||
if (FAILED(silent_attribute_node->AppendChild(silent_node.Get(), &child_node)))
|
if (FAILED(silent_attribute_node->AppendChild(silent_node.Get(), &child_node)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ComPtr<IXmlNode> silent_attribute_pnode;
|
ComPtr<IXmlNode> silent_attribute_pnode;
|
||||||
return SUCCEEDED(attributes.Get()->SetNamedItem(silent_attribute_node.Get(), &silent_attribute_pnode));
|
return SUCCEEDED(attributes.Get()->SetNamedItem(silent_attribute_node.Get(), &silent_attribute_pnode));
|
||||||
}
|
}
|
||||||
|
@ -330,7 +330,7 @@ bool WindowsToastNotification::GetTextNodeList(
|
||||||
ScopedHString* tag,
|
ScopedHString* tag,
|
||||||
IXmlDocument* doc,
|
IXmlDocument* doc,
|
||||||
IXmlNodeList** node_list,
|
IXmlNodeList** node_list,
|
||||||
Uint32_t req_length) {
|
uint32_t req_length) {
|
||||||
tag->Reset(L"text");
|
tag->Reset(L"text");
|
||||||
if (!tag->success())
|
if (!tag->success())
|
||||||
return false;
|
return false;
|
||||||
|
@ -338,7 +338,7 @@ bool WindowsToastNotification::GetTextNodeList(
|
||||||
if (FAILED(doc->GetElementsByTagName(*tag, node_list)))
|
if (FAILED(doc->GetElementsByTagName(*tag, node_list)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Uint32_t node_length;
|
uint32_t node_length;
|
||||||
if (FAILED((*node_list)->get_Length(&node_length)))
|
if (FAILED((*node_list)->get_Length(&node_length)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ class WindowsToastNotification : public Notification {
|
||||||
bool GetTextNodeList(ScopedHString* tag,
|
bool GetTextNodeList(ScopedHString* tag,
|
||||||
ABI::Windows::Data::Xml::Dom::IXmlDocument* doc,
|
ABI::Windows::Data::Xml::Dom::IXmlDocument* doc,
|
||||||
ABI::Windows::Data::Xml::Dom::IXmlNodeList** nodeList,
|
ABI::Windows::Data::Xml::Dom::IXmlNodeList** nodeList,
|
||||||
Uint32_t reqLength);
|
uint32_t reqLength);
|
||||||
bool AppendTextToXml(ABI::Windows::Data::Xml::Dom::IXmlDocument* doc,
|
bool AppendTextToXml(ABI::Windows::Data::Xml::Dom::IXmlDocument* doc,
|
||||||
ABI::Windows::Data::Xml::Dom::IXmlNode* node,
|
ABI::Windows::Data::Xml::Dom::IXmlNode* node,
|
||||||
const std::wstring& text);
|
const std::wstring& text);
|
||||||
|
|
Loading…
Reference in a new issue