2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-05 08:55:59 +00:00

Added online badges to chats list.

This commit is contained in:
23rd
2019-06-02 22:44:00 +03:00
committed by John Preston
parent 859cfe4cbb
commit d9426413dd
7 changed files with 94 additions and 6 deletions

View File

@@ -177,6 +177,34 @@ InnerWidget::InnerWidget(
UpdateRowSection::Default | UpdateRowSection::Filtered);
}, lifetime());
const auto handleUserOnline = [=](const Notify::PeerUpdate &peerUpdate) {
if (peerUpdate.peer->isSelf()) {
return;
}
const auto circleSize = st::dialogsOnlineBadgeSize
+ st::dialogsOnlineBadgeSizePadding;
const auto updateRect = QRect(
st::dialogsPadding.x()
+ st::dialogsPhotoSize
- st::dialogsOnlineBadgeRightSkip
- circleSize,
st::dialogsPadding.y()
+ st::dialogsPhotoSize
- circleSize,
circleSize,
circleSize);
updateDialogRow(
RowDescriptor(
session().data().history(peerUpdate.peer->id),
FullMsgId()),
updateRect,
UpdateRowSection::Default | UpdateRowSection::Filtered);
};
subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(
Notify::PeerUpdate::Flag::UserOnlineChanged,
handleUserOnline));
session().data().chatsListChanges(
) | rpl::filter([=](Data::Folder *folder) {
return (folder == _openedFolder);