refactor!: Rewrite of the old notification service (#2866)
The main goal was improving the readability of the original code however some ugliness remains. - Swapped from pointer singleton to instance singleton - Actually make use of the alpha logic that used to be present - Added a counter to notifications to indicate if something is being spammed - Notification timeouts reset if they're sent to the queue again
This commit is contained in:
@ -42,11 +42,11 @@ namespace big
|
||||
try
|
||||
{
|
||||
const auto j = nlohmann::json::parse(response.text);
|
||||
g_notification_service->push_success("PROXY_SETTINGS"_T.data(), "PROXY_SETTINGS_TEST_CURRENT_SUCCESS"_T.data());
|
||||
g_notification_service.push_success("PROXY_SETTINGS"_T.data(), "PROXY_SETTINGS_TEST_CURRENT_SUCCESS"_T.data());
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
g_notification_service->push_error("PROXY_SETTINGS"_T.data(), "PROXY_SETTINGS_TEST_CURRENT_FAIL"_T.data());
|
||||
g_notification_service.push_error("PROXY_SETTINGS"_T.data(), "PROXY_SETTINGS_TEST_CURRENT_FAIL"_T.data());
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -66,7 +66,7 @@ namespace big
|
||||
else
|
||||
g_http_client.proxy_mgr().update(settings.proxy_host, settings.proxy_port, settings.protocol);
|
||||
|
||||
g_notification_service->push("PROXY_SETTINGS"_T.data(), "PROXY_SETTINGS_UPDATE_SUCCESS"_T.data());
|
||||
g_notification_service.push("PROXY_SETTINGS"_T.data(), "PROXY_SETTINGS_UPDATE_SUCCESS"_T.data());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ namespace big
|
||||
g_thread_pool->push([] {
|
||||
g_translation_service.update_n_reload_language_packs();
|
||||
|
||||
g_notification_service->push_success("LANGUAGE"_T.data(), "VIEW_SETTINGS_FINISHED_UPDATING_TRANSLATIONS"_T.data());
|
||||
g_notification_service.push_success("LANGUAGE"_T.data(), "VIEW_SETTINGS_FINISHED_UPDATING_TRANSLATIONS"_T.data());
|
||||
});
|
||||
}
|
||||
|
||||
@ -67,4 +67,4 @@ namespace big
|
||||
g.load();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user