mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
[runner]Fix opening settings through the update notification (#35429)
This commit is contained in:
@@ -178,7 +178,8 @@ void notifications::show_toast_with_activations(std::wstring message,
|
||||
std::wstring title,
|
||||
std::wstring_view background_handler_id,
|
||||
std::vector<action_t> actions,
|
||||
toast_params params)
|
||||
toast_params params,
|
||||
std::wstring launch_uri)
|
||||
{
|
||||
// DO NOT LOCALIZE any string in this function, because they're XML tags and a subject to
|
||||
// https://learn.microsoft.com/windows/uwp/design/shell/tiles-and-notifications/toast-xml-schema
|
||||
@@ -189,7 +190,18 @@ void notifications::show_toast_with_activations(std::wstring message,
|
||||
// We must set toast's title and contents immediately, because some of the toasts we send could be snoozed.
|
||||
// Windows instantiates the snoozed toast from scratch before showing it again, so all bindings that were set
|
||||
// using NotificationData would be empty.
|
||||
toast_xml += LR"(<?xml version="1.0"?><toast><visual><binding template="ToastGeneric">)";
|
||||
// Add the launch attribute if launch_uri is provided, otherwise omit it
|
||||
toast_xml += LR"(<?xml version="1.0"?>)";
|
||||
if (!launch_uri.empty())
|
||||
{
|
||||
toast_xml += LR"(<toast launch=")" + launch_uri + LR"(" activationType="protocol">)"; // Use the launch URI if provided
|
||||
}
|
||||
else
|
||||
{
|
||||
toast_xml += LR"(<toast>)"; // No launch attribute if empty
|
||||
}
|
||||
|
||||
toast_xml += LR"(<visual><binding template="ToastGeneric">)";
|
||||
toast_xml += LR"(<text id="1">)";
|
||||
toast_xml += std::move(title);
|
||||
toast_xml += LR"(</text>)";
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace notifications
|
||||
using action_t = std::variant<link_button, background_activated_button, snooze_button>;
|
||||
|
||||
void show_toast(std::wstring plaintext_message, std::wstring title, toast_params params = {});
|
||||
void show_toast_with_activations(std::wstring plaintext_message, std::wstring title, std::wstring_view background_handler_id, std::vector<action_t> actions, toast_params params = {});
|
||||
void show_toast_with_activations(std::wstring plaintext_message, std::wstring title, std::wstring_view background_handler_id, std::vector<action_t> actions, toast_params params = {}, std::wstring launch_uri = L"");
|
||||
void update_toast_progress_bar(std::wstring_view tag, progress_bar_params params);
|
||||
void remove_toasts_by_tag(std::wstring_view tag);
|
||||
void remove_all_scheduled_toasts();
|
||||
|
||||
Reference in New Issue
Block a user