ZaStoGram_desktop/Telegram/SourceFiles/info/profile/info_profile_status_label.h
Mehran 4dea46c97f Fix online count lost in group profile status
TopBar::adjustColors recreates the status label when the top bar colors
change, for example after switching night mode, and the new label
started without the online count. The count is only sent again when it
changes, so the group status showed just the members count until then.

Carry the online count over to the new label, like its link callbacks.
2026-10-01 18:48:12 +04:00

45 lines
1.1 KiB
C++

/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "base/timer.h"
namespace Ui {
class FlatLabel;
} // namespace Ui
namespace Info::Profile {
class StatusLabel final {
public:
StatusLabel(
not_null<Ui::FlatLabel*> label,
not_null<PeerData*> peer);
void refresh();
void setMembersLinkCallback(Fn<void()> callback);
[[nodiscard]] Fn<void()> membersLinkCallback() const;
void setHiddenLinkCallback(Fn<void()> callback);
[[nodiscard]] Fn<void()> hiddenLinkCallback() const;
void setOnlineCount(int count);
[[nodiscard]] int onlineCount() const;
void setColorized(bool enabled);
private:
const not_null<Ui::FlatLabel*> _label;
const not_null<PeerData*> _peer;
int _onlineCount = 0;
bool _colorized = true;
Fn<void()> _membersLinkCallback;
Fn<void()> _hiddenLinkCallback;
base::Timer _refreshTimer;
rpl::lifetime _lifetime;
};
} // namespace Info::Profile