2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Respect reactions_default from appconfig.

This commit is contained in:
John Preston
2022-01-13 19:39:44 +03:00
parent f3e84de5fb
commit 8a071fe1fe
7 changed files with 63 additions and 13 deletions

View File

@@ -10,6 +10,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/history.h"
#include "history/history_item.h"
#include "main/main_session.h"
#include "main/main_account.h"
#include "main/main_app_config.h"
#include "data/data_session.h"
#include "data/data_changes.h"
#include "data/data_document.h"
@@ -47,6 +49,18 @@ Reactions::Reactions(not_null<Session*> owner)
_pollItems.remove(item);
_repaintItems.remove(item);
}, _lifetime);
const auto appConfig = &_owner->session().account().appConfig();
appConfig->value(
) | rpl::start_with_next([=] {
const auto favorite = appConfig->get<QString>(
u"reactions_default"_q,
QString::fromUtf8("\xf0\x9f\x91\x8d"));
if (_favorite != favorite) {
_favorite = favorite;
_updated.fire({});
}
}, _lifetime);
}
Reactions::~Reactions() = default;
@@ -63,6 +77,10 @@ const std::vector<Reaction> &Reactions::list(Type type) const {
Unexpected("Type in Reactions::list.");
}
QString Reactions::favorite() const {
return _favorite;
}
rpl::producer<> Reactions::updates() const {
return _updated.events();
}