2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-01 06:55:58 +00:00

Implement personal channel selector.

This commit is contained in:
John Preston
2024-03-29 11:21:57 +04:00
parent ab74ed0fa7
commit 280d69d346
8 changed files with 238 additions and 26 deletions

View File

@@ -195,6 +195,23 @@ void UserData::setBusinessDetails(Data::BusinessDetails details) {
session().changes().peerUpdated(this, UpdateFlag::BusinessDetails);
}
ChannelId UserData::personalChannelId() const {
return _personalChannelId;
}
MsgId UserData::personalChannelMessageId() const {
return _personalChannelMessageId;
}
void UserData::setPersonalChannel(ChannelId channelId, MsgId messageId) {
if (_personalChannelId != channelId
|| _personalChannelMessageId != messageId) {
_personalChannelId = channelId;
_personalChannelMessageId = messageId;
session().changes().peerUpdated(this, UpdateFlag::PersonalChannel);
}
}
void UserData::setName(const QString &newFirstName, const QString &newLastName, const QString &newPhoneName, const QString &newUsername) {
bool changeName = !newFirstName.isEmpty() || !newLastName.isEmpty();
@@ -623,6 +640,9 @@ void ApplyUserUpdate(not_null<UserData*> user, const MTPDuserFull &update) {
update.vbusiness_location(),
update.vbusiness_intro()));
user->setBirthday(update.vbirthday());
user->setPersonalChannel(
update.vpersonal_channel_id().value_or_empty(),
update.vpersonal_channel_message().value_or_empty());
if (user->isSelf()) {
user->owner().businessInfo().applyAwaySettings(
FromMTP(&user->owner(), update.vbusiness_away_message()));