add Notification::Cancel

This commit is contained in:
Cvolton 2024-08-15 15:43:45 +02:00
parent ff8de4eec6
commit cd5a66c1d1
2 changed files with 14 additions and 0 deletions

View file

@ -93,5 +93,11 @@ namespace geode {
* to prematurily hide the notification
*/
void hide();
/**
* Cancels the showing of the notification if it's in the queue.
* Otherwise, it hides the notification if it's currently showing.
*/
void cancel();
};
}

View file

@ -211,3 +211,11 @@ void Notification::hide() {
nullptr
));
}
void Notification::cancel() {
if(m_pParent) return this->hide();
if (s_queue->containsObject(this)) {
s_queue->removeObject(this);
}
}