File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -182,10 +182,14 @@ void ThemeManager::AccentColors::parse(ParserT &parser) {
182
182
}
183
183
184
184
ThemeManager::ThemeManager (Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) {
185
- do_init ();
185
+ load_accent_colors ();
186
186
}
187
187
188
- void ThemeManager::do_init () {
188
+ void ThemeManager::start_up () {
189
+ init ();
190
+ }
191
+
192
+ void ThemeManager::load_chat_themes () { // must not be called in constructor, because uses other managers
189
193
if (!td_->auth_manager_ ->is_authorized () || td_->auth_manager_ ->is_bot ()) {
190
194
return ;
191
195
}
@@ -201,8 +205,14 @@ void ThemeManager::do_init() {
201
205
}
202
206
}
203
207
chat_themes_.next_reload_time = Time::now ();
208
+ }
209
+
210
+ void ThemeManager::load_accent_colors () {
211
+ if (!td_->auth_manager_ ->is_authorized () || td_->auth_manager_ ->is_bot ()) {
212
+ return ;
213
+ }
204
214
205
- log_event_string = G ()->td_db ()->get_binlog_pmc ()->get (get_accent_colors_database_key ());
215
+ auto log_event_string = G ()->td_db ()->get_binlog_pmc ()->get (get_accent_colors_database_key ());
206
216
if (!log_event_string.empty ()) {
207
217
auto status = log_event_parse (accent_colors_, log_event_string);
208
218
if (status.is_ok ()) {
@@ -215,7 +225,7 @@ void ThemeManager::do_init() {
215
225
}
216
226
217
227
void ThemeManager::init () {
218
- do_init ();
228
+ load_chat_themes ();
219
229
loop ();
220
230
}
221
231
Original file line number Diff line number Diff line change @@ -106,11 +106,15 @@ class ThemeManager final : public Actor {
106
106
void parse (ParserT &parser);
107
107
};
108
108
109
+ void start_up () final ;
110
+
109
111
void loop () final ;
110
112
111
113
void tear_down () final ;
112
114
113
- void do_init ();
115
+ void load_chat_themes ();
116
+
117
+ void load_accent_colors ();
114
118
115
119
static bool is_dark_base_theme (BaseTheme base_theme);
116
120
You can’t perform that action at this time.
0 commit comments