add remote page loading
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "settings.h"
|
||||
#include "serializer.h"
|
||||
#include "font.h"
|
||||
#include "node_remote_page.h"
|
||||
|
||||
void App::title_update()
|
||||
{
|
||||
@@ -1333,6 +1334,32 @@ void App::initLayout()
|
||||
}
|
||||
}
|
||||
|
||||
auto whatsnew = std::make_shared<NodeRemotePage>();
|
||||
whatsnew->m_manager = &layout;
|
||||
whatsnew->init();
|
||||
whatsnew->load_url("http://localhost:8080/app-content/whatsnew.xml", [this, whatsnew] (bool success) {
|
||||
if (success)
|
||||
{
|
||||
int last_id = Settings::value_or<Serializer::Integer>("whatsnew-id", 0);
|
||||
if (whatsnew->m_page_id <= g_version_build && whatsnew->m_page_id > last_id)
|
||||
{
|
||||
whatsnew->set_title(fmt::format("What's new in version {}", g_version_number));
|
||||
layout[main_id]->add_child(whatsnew);
|
||||
}
|
||||
whatsnew->add_button("Reload", 120, [this, whatsnew](Node*) {
|
||||
whatsnew->reload();
|
||||
});
|
||||
whatsnew->add_button("Read Later", 120, [this, whatsnew](Node*) {
|
||||
whatsnew->destroy();
|
||||
});
|
||||
whatsnew->add_button("Close", 100, [this, whatsnew](Node*) {
|
||||
Settings::set<Serializer::Integer>("whatsnew-id", whatsnew->m_page_id);
|
||||
Settings::save();
|
||||
whatsnew->destroy();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
brush_update(true, true);
|
||||
|
||||
// hacky thing to make the toolbar buttons not steal events when moving cursor fast
|
||||
|
||||
Reference in New Issue
Block a user