diff --git a/loader/include/Geode/ui/Notification.hpp b/loader/include/Geode/ui/Notification.hpp index 1e09d8ba..0efa65c8 100644 --- a/loader/include/Geode/ui/Notification.hpp +++ b/loader/include/Geode/ui/Notification.hpp @@ -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(); }; } diff --git a/loader/src/ui/nodes/Notification.cpp b/loader/src/ui/nodes/Notification.cpp index 3bd57bd0..0aa0579c 100644 --- a/loader/src/ui/nodes/Notification.cpp +++ b/loader/src/ui/nodes/Notification.cpp @@ -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); + } +} \ No newline at end of file