state is now saved on every last post change
This commit is contained in:
parent
c0d90d2341
commit
9b758c6fb8
@ -108,6 +108,7 @@ void NewPostFetcher::fetch() {
|
|||||||
if (posts.size() > 0) {
|
if (posts.size() > 0) {
|
||||||
spdlog::info("last vk post id is now {}", posts[0].id);
|
spdlog::info("last vk post id is now {}", posts[0].id);
|
||||||
mgr->m_appState->vkLastLoadedPostId = posts[0].id;
|
mgr->m_appState->vkLastLoadedPostId = posts[0].id;
|
||||||
|
mgr->m_appState->save();
|
||||||
}
|
}
|
||||||
vkState.ready = true;
|
vkState.ready = true;
|
||||||
std::vector<AbstractPost> aposts = mgr->to_abstract_posts(posts);
|
std::vector<AbstractPost> aposts = mgr->to_abstract_posts(posts);
|
||||||
@ -137,6 +138,7 @@ void NewPostFetcher::fetch() {
|
|||||||
if (posts.size() > 0) {
|
if (posts.size() > 0) {
|
||||||
spdlog::info("last telegram post id is now {}", posts[0]->id_);
|
spdlog::info("last telegram post id is now {}", posts[0]->id_);
|
||||||
mgr->m_appState->tgLastLoadedPostId = posts[0]->id_;
|
mgr->m_appState->tgLastLoadedPostId = posts[0]->id_;
|
||||||
|
mgr->m_appState->save();
|
||||||
}
|
}
|
||||||
tgState.ready = true;
|
tgState.ready = true;
|
||||||
std::vector<AbstractPost> aposts = mgr->to_abstract_posts(posts);
|
std::vector<AbstractPost> aposts = mgr->to_abstract_posts(posts);
|
||||||
@ -170,6 +172,7 @@ void NewPostFetcher::check_vk_posts(std::vector<vk::Post> posts) {
|
|||||||
if (vkState.ready && !vkState.posts.empty()) {
|
if (vkState.ready && !vkState.posts.empty()) {
|
||||||
spdlog::debug("last loaded vk post id is now {}", vkState.posts[0].id);
|
spdlog::debug("last loaded vk post id is now {}", vkState.posts[0].id);
|
||||||
mgr->m_appState->vkLastLoadedPostId = vkState.posts[0].id;
|
mgr->m_appState->vkLastLoadedPostId = vkState.posts[0].id;
|
||||||
|
mgr->m_appState->save();
|
||||||
}
|
}
|
||||||
fetch();
|
fetch();
|
||||||
}
|
}
|
||||||
@ -193,6 +196,7 @@ void NewPostFetcher::check_tg_posts(std::vector<td::tl::unique_ptr<td_api::messa
|
|||||||
if (tgState.ready && !tgState.posts.empty()) {
|
if (tgState.ready && !tgState.posts.empty()) {
|
||||||
spdlog::debug("last loaded tg post id is now {}", tgState.posts[0].id);
|
spdlog::debug("last loaded tg post id is now {}", tgState.posts[0].id);
|
||||||
mgr->m_appState->tgLastLoadedPostId = tgState.posts[0].id;
|
mgr->m_appState->tgLastLoadedPostId = tgState.posts[0].id;
|
||||||
|
mgr->m_appState->save();
|
||||||
}
|
}
|
||||||
fetch();
|
fetch();
|
||||||
}
|
}
|
||||||
@ -420,6 +424,7 @@ void RepostManager::repost(AbstractPost &post) {
|
|||||||
m_appState->vkLastPostId = postId;
|
m_appState->vkLastPostId = postId;
|
||||||
else
|
else
|
||||||
m_appState->tgLastPostId = postId;
|
m_appState->tgLastPostId = postId;
|
||||||
|
m_appState->save();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user