2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +00:00

Move messages data to AuthSession.

This commit is contained in:
John Preston
2019-04-25 16:45:15 +04:00
parent cb3e649e61
commit 08bddc5579
49 changed files with 684 additions and 590 deletions

View File

@@ -206,8 +206,8 @@ void BoxController::Row::stopLastActionRipple() {
void BoxController::prepare() {
Auth().data().itemRemoved(
) | rpl::start_with_next([this](auto item) {
if (auto row = rowForItem(item)) {
) | rpl::start_with_next([=](not_null<const HistoryItem*> item) {
if (const auto row = rowForItem(item)) {
row->itemRemoved(item);
if (!row->hasItems()) {
delegate()->peerListRemoveRow(row);
@@ -218,8 +218,8 @@ void BoxController::prepare() {
delegate()->peerListRefreshRows();
}
}, lifetime());
subscribe(Current().newServiceMessage(), [this](const FullMsgId &msgId) {
if (auto item = App::histItemById(msgId)) {
subscribe(Current().newServiceMessage(), [=](FullMsgId msgId) {
if (const auto item = Auth().data().message(msgId)) {
insertRow(item, InsertWay::Prepend);
}
});
@@ -301,10 +301,12 @@ void BoxController::receivedCalls(const QVector<MTPMessage> &result) {
}
for (const auto &message : result) {
auto msgId = IdFromMessage(message);
auto peerId = PeerFromMessage(message);
if (auto peer = Auth().data().peerLoaded(peerId)) {
auto item = Auth().data().addNewMessage(message, NewMessageExisting);
const auto msgId = IdFromMessage(message);
const auto peerId = PeerFromMessage(message);
if (const auto peer = Auth().data().peerLoaded(peerId)) {
const auto item = Auth().data().addNewMessage(
message,
NewMessageType::Existing);
insertRow(item, InsertWay::Append);
} else {
LOG(("API Error: a search results with not loaded peer %1").arg(peerId));