Load only accent colors in ThemeManager constructor.
This commit is contained in:
parent
3870c29b15
commit
d305476cfe
@ -182,10 +182,14 @@ void ThemeManager::AccentColors::parse(ParserT &parser) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ThemeManager::ThemeManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) {
|
ThemeManager::ThemeManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) {
|
||||||
do_init();
|
load_accent_colors();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThemeManager::do_init() {
|
void ThemeManager::start_up() {
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ThemeManager::load_chat_themes() { // must not be called in constructor, because uses other managers
|
||||||
if (!td_->auth_manager_->is_authorized() || td_->auth_manager_->is_bot()) {
|
if (!td_->auth_manager_->is_authorized() || td_->auth_manager_->is_bot()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -201,8 +205,14 @@ void ThemeManager::do_init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
chat_themes_.next_reload_time = Time::now();
|
chat_themes_.next_reload_time = Time::now();
|
||||||
|
}
|
||||||
|
|
||||||
log_event_string = G()->td_db()->get_binlog_pmc()->get(get_accent_colors_database_key());
|
void ThemeManager::load_accent_colors() {
|
||||||
|
if (!td_->auth_manager_->is_authorized() || td_->auth_manager_->is_bot()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto log_event_string = G()->td_db()->get_binlog_pmc()->get(get_accent_colors_database_key());
|
||||||
if (!log_event_string.empty()) {
|
if (!log_event_string.empty()) {
|
||||||
auto status = log_event_parse(accent_colors_, log_event_string);
|
auto status = log_event_parse(accent_colors_, log_event_string);
|
||||||
if (status.is_ok()) {
|
if (status.is_ok()) {
|
||||||
@ -215,7 +225,7 @@ void ThemeManager::do_init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ThemeManager::init() {
|
void ThemeManager::init() {
|
||||||
do_init();
|
load_chat_themes();
|
||||||
loop();
|
loop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,11 +106,15 @@ class ThemeManager final : public Actor {
|
|||||||
void parse(ParserT &parser);
|
void parse(ParserT &parser);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void start_up() final;
|
||||||
|
|
||||||
void loop() final;
|
void loop() final;
|
||||||
|
|
||||||
void tear_down() final;
|
void tear_down() final;
|
||||||
|
|
||||||
void do_init();
|
void load_chat_themes();
|
||||||
|
|
||||||
|
void load_accent_colors();
|
||||||
|
|
||||||
static bool is_dark_base_theme(BaseTheme base_theme);
|
static bool is_dark_base_theme(BaseTheme base_theme);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user