NEW:DailyTips

Change-Id: I510e96652c9a0c9fe422546b09b2d035d9e46a23
This commit is contained in:
liz.li 2022-09-15 14:51:29 +08:00 committed by Lane.Wei
parent c9499b7401
commit 81da77d1e0
9 changed files with 1366 additions and 5 deletions

View file

@ -1,5 +1,6 @@
#include "NotificationManager.hpp"
#include "HintNotification.hpp"
#include "GUI.hpp"
#include "ImGuiWrapper.hpp"
#include "wxExtensions.hpp"
@ -1787,7 +1788,27 @@ int NotificationManager::progress_indicator_get_range() const
void NotificationManager::push_hint_notification(bool open_next)
{
return;
for (std::unique_ptr<PopNotification>& notification : m_pop_notifications) {
if (notification->get_type() == NotificationType::DidYouKnowHint) {
(dynamic_cast<HintNotification*>(notification.get()))->open_next();
return;
}
}
NotificationData data{ NotificationType::DidYouKnowHint, NotificationLevel::HintNotificationLevel, 300, "" };
// from user - open now
if (!open_next) {
push_notification_data(std::make_unique<NotificationManager::HintNotification>(data, m_id_provider, m_evt_handler, open_next), 0);
stop_delayed_notifications_of_type(NotificationType::DidYouKnowHint);
// at startup - delay for half a second to let other notification pop up, than try every 30 seconds
// show only if no notifications are shown
}
else {
auto condition = [&self = std::as_const(*this)]() {
return self.get_notification_count() == 0;
};
push_delayed_notification_data(std::make_unique<NotificationManager::HintNotification>(data, m_id_provider, m_evt_handler, open_next), condition, 500, 30000);
}
}
bool NotificationManager::is_hint_notification_open()