Don't show motd if not available
This commit is contained in:
parent
d0e148bd54
commit
6434b0ac87
@ -11,6 +11,10 @@ LUI.MenuBuilder.registerPopupType("motd", function()
|
||||
end)
|
||||
|
||||
LUI.onmenuopen("main_campaign", function(menu)
|
||||
if (not motd.hasmotd()) then
|
||||
return
|
||||
end
|
||||
|
||||
if (not motd.hasseentoday()) then
|
||||
motd.sethasseentoday()
|
||||
LUI.FlowManager.RequestPopupMenu(nil, "motd")
|
||||
|
@ -233,6 +233,15 @@ namespace motd
|
||||
});
|
||||
}
|
||||
|
||||
bool has_motd()
|
||||
{
|
||||
return marketing.access<bool>([](nlohmann::json& data)
|
||||
-> nlohmann::json
|
||||
{
|
||||
return data.is_object() && data["motd"].is_object();
|
||||
});
|
||||
}
|
||||
|
||||
class component final : public component_interface
|
||||
{
|
||||
public:
|
||||
|
@ -8,4 +8,5 @@ namespace motd
|
||||
int get_num_featured_tabs();
|
||||
nlohmann::json get_motd();
|
||||
nlohmann::json get_featured_tab(const int index);
|
||||
bool has_motd();
|
||||
}
|
||||
|
@ -654,6 +654,8 @@ namespace ui_scripting
|
||||
const auto now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
|
||||
config::set<uint64_t>("motd_last_seen", static_cast<uint64_t>(now));
|
||||
};
|
||||
|
||||
motd_table["hasmotd"] = motd::has_motd;
|
||||
}
|
||||
|
||||
void start()
|
||||
|
Loading…
Reference in New Issue
Block a user