mirror of https://github.com/procxx/kepka.git
Refresh wallpaper file references.
This commit is contained in:
parent
466c6da5e3
commit
e59a68cd68
|
@ -2829,6 +2829,8 @@ void ApiWrap::refreshFileReference(
|
||||||
request(
|
request(
|
||||||
MTPmessages_GetSavedGifs(MTP_int(0)),
|
MTPmessages_GetSavedGifs(MTP_int(0)),
|
||||||
[] { crl::on_main([] { Local::writeSavedGifs(); }); });
|
[] { crl::on_main([] { Local::writeSavedGifs(); }); });
|
||||||
|
}, [&](Data::FileOriginWallpapers data) {
|
||||||
|
request(MTPaccount_GetWallPapers(MTP_int(0)));
|
||||||
}, [&](std::nullopt_t) {
|
}, [&](std::nullopt_t) {
|
||||||
fail();
|
fail();
|
||||||
});
|
});
|
||||||
|
|
|
@ -52,6 +52,11 @@ struct FileReferenceAccumulator {
|
||||||
}, [](const MTPDdocumentEmpty &data) {
|
}, [](const MTPDdocumentEmpty &data) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
void push(const MTPWallPaper &data) {
|
||||||
|
data.match([&](const MTPDwallPaper &data) {
|
||||||
|
push(data.vdocument);
|
||||||
|
});
|
||||||
|
}
|
||||||
void push(const MTPUserProfilePhoto &data) {
|
void push(const MTPUserProfilePhoto &data) {
|
||||||
data.match([&](const MTPDuserProfilePhoto &data) {
|
data.match([&](const MTPDuserProfilePhoto &data) {
|
||||||
push(data.vphoto_small);
|
push(data.vphoto_small);
|
||||||
|
@ -173,6 +178,12 @@ struct FileReferenceAccumulator {
|
||||||
}, [](const MTPDmessages_savedGifsNotModified &data) {
|
}, [](const MTPDmessages_savedGifsNotModified &data) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
void push(const MTPaccount_WallPapers &data) {
|
||||||
|
data.match([&](const MTPDaccount_wallPapers &data) {
|
||||||
|
push(data.vwallpapers);
|
||||||
|
}, [](const MTPDaccount_wallPapersNotModified &) {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
UpdatedFileReferences result;
|
UpdatedFileReferences result;
|
||||||
};
|
};
|
||||||
|
@ -237,4 +248,8 @@ UpdatedFileReferences GetFileReferences(const MTPmessages_SavedGifs &data) {
|
||||||
return GetFileReferencesHelper(data);
|
return GetFileReferencesHelper(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UpdatedFileReferences GetFileReferences(const MTPaccount_WallPapers &data) {
|
||||||
|
return GetFileReferencesHelper(data);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Data
|
} // namespace Data
|
||||||
|
|
|
@ -60,13 +60,20 @@ struct FileOriginSavedGifs {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct FileOriginWallpapers {
|
||||||
|
inline bool operator<(const FileOriginWallpapers &) const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
struct FileOrigin {
|
struct FileOrigin {
|
||||||
using Variant = base::optional_variant<
|
using Variant = base::optional_variant<
|
||||||
FileOriginMessage,
|
FileOriginMessage,
|
||||||
FileOriginUserPhoto,
|
FileOriginUserPhoto,
|
||||||
FileOriginPeerPhoto,
|
FileOriginPeerPhoto,
|
||||||
FileOriginStickerSet,
|
FileOriginStickerSet,
|
||||||
FileOriginSavedGifs>;
|
FileOriginSavedGifs,
|
||||||
|
FileOriginWallpapers>;
|
||||||
|
|
||||||
FileOrigin() = default;
|
FileOrigin() = default;
|
||||||
FileOrigin(FileOriginMessage data) : data(data) {
|
FileOrigin(FileOriginMessage data) : data(data) {
|
||||||
|
@ -79,6 +86,8 @@ struct FileOrigin {
|
||||||
}
|
}
|
||||||
FileOrigin(FileOriginSavedGifs data) : data(data) {
|
FileOrigin(FileOriginSavedGifs data) : data(data) {
|
||||||
}
|
}
|
||||||
|
FileOrigin(FileOriginWallpapers data) : data(data) {
|
||||||
|
}
|
||||||
|
|
||||||
explicit operator bool() const {
|
explicit operator bool() const {
|
||||||
return data.has_value();
|
return data.has_value();
|
||||||
|
@ -121,5 +130,6 @@ UpdatedFileReferences GetFileReferences(
|
||||||
const MTPmessages_FavedStickers &data);
|
const MTPmessages_FavedStickers &data);
|
||||||
UpdatedFileReferences GetFileReferences(const MTPmessages_StickerSet &data);
|
UpdatedFileReferences GetFileReferences(const MTPmessages_StickerSet &data);
|
||||||
UpdatedFileReferences GetFileReferences(const MTPmessages_SavedGifs &data);
|
UpdatedFileReferences GetFileReferences(const MTPmessages_SavedGifs &data);
|
||||||
|
UpdatedFileReferences GetFileReferences(const MTPaccount_WallPapers &data);
|
||||||
|
|
||||||
} // namespace Data
|
} // namespace Data
|
||||||
|
|
|
@ -1422,9 +1422,12 @@ void MainWidget::setChatBackground(const Data::WallPaper &background) {
|
||||||
_background = std::make_unique<SettingBackground>();
|
_background = std::make_unique<SettingBackground>();
|
||||||
_background->data = background;
|
_background->data = background;
|
||||||
if (_background->data.document) {
|
if (_background->data.document) {
|
||||||
_background->data.document->save(Data::FileOrigin(), QString());
|
_background->data.document->save(
|
||||||
|
Data::FileOriginWallpapers(),
|
||||||
|
QString());
|
||||||
} else if (_background->data.thumb) {
|
} else if (_background->data.thumb) {
|
||||||
_background->data.thumb->loadEvenCancelled(Data::FileOrigin());
|
_background->data.thumb->loadEvenCancelled(
|
||||||
|
Data::FileOriginWallpapers());
|
||||||
}
|
}
|
||||||
checkChatBackground();
|
checkChatBackground();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue