mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Respect wallpaper_overriden flag.
This commit is contained in:
@@ -1227,16 +1227,30 @@ const QString &PeerData::themeEmoji() const {
|
||||
return _themeEmoticon;
|
||||
}
|
||||
|
||||
void PeerData::setWallPaper(std::optional<Data::WallPaper> paper) {
|
||||
if (!paper && !_wallPaper) {
|
||||
return;
|
||||
} else if (paper && _wallPaper && _wallPaper->equals(*paper)) {
|
||||
return;
|
||||
void PeerData::setWallPaper(
|
||||
std::optional<Data::WallPaper> paper,
|
||||
bool overriden) {
|
||||
const auto paperChanged = (paper || _wallPaper)
|
||||
&& (!paper || !_wallPaper || !_wallPaper->equals(*paper));
|
||||
if (paperChanged) {
|
||||
_wallPaper = paper
|
||||
? std::make_unique<Data::WallPaper>(std::move(*paper))
|
||||
: nullptr;
|
||||
}
|
||||
_wallPaper = paper
|
||||
? std::make_unique<Data::WallPaper>(std::move(*paper))
|
||||
: nullptr;
|
||||
session().changes().peerUpdated(this, UpdateFlag::ChatWallPaper);
|
||||
|
||||
const auto overridenValue = overriden ? 1 : 0;
|
||||
const auto overridenChanged = (_wallPaperOverriden != overridenValue);
|
||||
if (overridenChanged) {
|
||||
_wallPaperOverriden = overridenValue;
|
||||
}
|
||||
|
||||
if (paperChanged || overridenChanged) {
|
||||
session().changes().peerUpdated(this, UpdateFlag::ChatWallPaper);
|
||||
}
|
||||
}
|
||||
|
||||
bool PeerData::wallPaperOverriden() const {
|
||||
return _wallPaperOverriden != 0;
|
||||
}
|
||||
|
||||
const Data::WallPaper *PeerData::wallPaper() const {
|
||||
|
@@ -414,7 +414,10 @@ public:
|
||||
void setThemeEmoji(const QString &emoticon);
|
||||
[[nodiscard]] const QString &themeEmoji() const;
|
||||
|
||||
void setWallPaper(std::optional<Data::WallPaper> paper);
|
||||
void setWallPaper(
|
||||
std::optional<Data::WallPaper> paper,
|
||||
bool overriden = false);
|
||||
[[nodiscard]] bool wallPaperOverriden() const;
|
||||
[[nodiscard]] const Data::WallPaper *wallPaper() const;
|
||||
|
||||
enum class StoriesState {
|
||||
@@ -467,7 +470,8 @@ private:
|
||||
crl::time _lastFullUpdate = 0;
|
||||
|
||||
QString _name;
|
||||
int _nameVersion = 1;
|
||||
uint32 _nameVersion : 31 = 1;
|
||||
uint32 _wallPaperOverriden : 1 = 0;
|
||||
|
||||
TimeId _ttlPeriod = 0;
|
||||
|
||||
@@ -475,6 +479,7 @@ private:
|
||||
TimeId _requestChatDate = 0;
|
||||
|
||||
Settings _settings = PeerSettings(PeerSetting::Unknown);
|
||||
|
||||
BlockStatus _blockStatus = BlockStatus::Unknown;
|
||||
LoadedStatus _loadedStatus = LoadedStatus::Not;
|
||||
TranslationFlag _translationFlag = TranslationFlag::Unknown;
|
||||
|
@@ -515,7 +515,8 @@ void ApplyUserUpdate(not_null<UserData*> user, const MTPDuserFull &update) {
|
||||
|
||||
if (const auto paper = update.vwallpaper()) {
|
||||
user->setWallPaper(
|
||||
Data::WallPaper::Create(&user->session(), *paper));
|
||||
Data::WallPaper::Create(&user->session(), *paper),
|
||||
update.is_wallpaper_overridden());
|
||||
} else {
|
||||
user->setWallPaper({});
|
||||
}
|
||||
|
Reference in New Issue
Block a user