2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Update API scheme on layer 145.

This commit is contained in:
John Preston
2022-08-16 14:28:17 +03:00
parent ba8673af5e
commit 60cc232884
40 changed files with 646 additions and 427 deletions

View File

@@ -905,23 +905,23 @@ void SetupMessages(
state->icons.lifetimes = std::vector<rpl::lifetime>(2);
const auto &reactions = controller->session().data().reactions();
auto emojiValue = rpl::single(
auto idValue = rpl::single(
reactions.favorite()
) | rpl::then(
reactions.updates() | rpl::map([=] {
return controller->session().data().reactions().favorite();
})
) | rpl::filter([](const QString &emoji) {
return !emoji.isEmpty();
) | rpl::filter([](const Data::ReactionId &id) {
return !id.empty();
});
auto selectedEmoji = rpl::duplicate(emojiValue);
auto selected = rpl::duplicate(idValue);
std::move(
selectedEmoji
) | rpl::start_with_next([=, emojiValue = std::move(emojiValue)](
const QString &emoji) {
selected
) | rpl::start_with_next([=, idValue = std::move(idValue)](
const Data::ReactionId &id) {
const auto &reactions = controller->session().data().reactions();
for (const auto &r : reactions.list(Data::Reactions::Type::All)) {
if (emoji != r.emoji) {
if (id != r.id) {
continue;
}
const auto index = state->icons.flag ? 1 : 0;
@@ -941,7 +941,7 @@ void SetupMessages(
) | rpl::filter([=](not_null<QEvent*> event) {
return event->type() == QEvent::Enter;
}) | rpl::to_empty,
rpl::duplicate(emojiValue) | rpl::skip(1) | rpl::to_empty,
rpl::duplicate(idValue) | rpl::skip(1) | rpl::to_empty,
&state->icons.lifetimes[index]);
state->icons.flag = !state->icons.flag;
toggleButtonRight(true);