Call content::DesktopNotificationDelegate::NotificationError when toast notification fails on Windows
This commit is contained in:
parent
cdc27a85c0
commit
dedf3553e2
2 changed files with 24 additions and 3 deletions
|
@ -85,6 +85,11 @@ void WindowsToastNotification::NotificationDismissed() {
|
|||
delete this;
|
||||
}
|
||||
|
||||
void WindowsToastNotification::NotificationFailed() {
|
||||
delegate_->NotificationError();
|
||||
delete this;
|
||||
}
|
||||
|
||||
bool WindowsToastNotification::GetToastXml(
|
||||
ABI::Windows::UI::Notifications::IToastNotificationManagerStatics* toastManager,
|
||||
const std::wstring& title,
|
||||
|
@ -231,12 +236,15 @@ bool WindowsToastNotification::AppendTextToXml(
|
|||
}
|
||||
|
||||
bool WindowsToastNotification::SetupCallbacks(ABI::Windows::UI::Notifications::IToastNotification* toast) {
|
||||
EventRegistrationToken activatedToken, dismissedToken;
|
||||
EventRegistrationToken activatedToken, dismissedToken, failedToken;
|
||||
event_handler_ = Make<ToastEventHandler>(this);
|
||||
if (FAILED(toast->add_Activated(event_handler_.Get(), &activatedToken)))
|
||||
return false;
|
||||
|
||||
return SUCCEEDED(toast->add_Dismissed(event_handler_.Get(), &dismissedToken));
|
||||
if (FAILED(toast->add_Dismissed(event_handler_.Get(), &dismissedToken)))
|
||||
return false;
|
||||
|
||||
return SUCCEEDED(toast->add_Failed(event_handler_.Get(), &failedToken));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -262,4 +270,11 @@ IFACEMETHODIMP ToastEventHandler::Invoke(
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP ToastEventHandler::Invoke(
|
||||
ABI::Windows::UI::Notifications::IToastNotification* sender,
|
||||
ABI::Windows::UI::Notifications::IToastFailedEventArgs* e) {
|
||||
notification_->NotificationFailed();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
} // namespace brightray
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue