2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Update user status in Info::Profile cover.

This commit is contained in:
John Preston
2017-11-24 19:51:47 +04:00
parent 0ced28f991
commit da386f2c2e
2 changed files with 11 additions and 3 deletions

View File

@@ -243,7 +243,8 @@ Cover::Cover(
this,
_peer->isMegagroup()
? st::infoProfileMegagroupStatusLabel
: st::infoProfileStatusLabel) {
: st::infoProfileStatusLabel)
, _refreshStatusTimer([this] { refreshStatusText(); }) {
_peer->updateFull();
_name->setSelectable(true);
@@ -351,8 +352,13 @@ void Cover::refreshStatusText() {
auto statusText = [&] {
auto currentTime = unixtime();
if (auto user = _peer->asUser()) {
auto result = App::onlineText(user, currentTime, true);
return App::onlineColorUse(user, currentTime)
const auto result = App::onlineText(user, currentTime, true);
const auto showOnline = App::onlineColorUse(user, currentTime);
const auto updateIn = App::onlineWillChangeIn(user, currentTime);
if (showOnline) {
_refreshStatusTimer.callOnce(updateIn * 1000LL);
}
return showOnline
? textcmdLink(1, result)
: result;
} else if (auto chat = _peer->asChat()) {