2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Support new ('modern') API file locations.

This commit is contained in:
John Preston
2019-03-22 18:19:43 +04:00
parent eba2a98703
commit aa8f62da9d
41 changed files with 947 additions and 566 deletions

View File

@@ -135,11 +135,33 @@ Image *PhotoData::getReplyPreview(Data::FileOrigin origin) {
return _replyPreview.image();
}
void PhotoData::setRemoteLocation(
int32 dc,
uint64 access,
const QByteArray &fileReference) {
_fileReference = fileReference;
if (_dc != dc || _access != access) {
_dc = dc;
_access = access;
}
}
MTPInputPhoto PhotoData::mtpInput() const {
return MTP_inputPhoto(
MTP_long(id),
MTP_long(access),
MTP_bytes(fileReference));
MTP_long(_access),
MTP_bytes(_fileReference));
}
QByteArray PhotoData::fileReference() const {
return _fileReference;
}
void PhotoData::refreshFileReference(const QByteArray &value) {
_fileReference = value;
_thumbnailSmall->refreshFileReference(value);
_thumbnail->refreshFileReference(value);
_large->refreshFileReference(value);
}
void PhotoData::collectLocalData(not_null<PhotoData*> local) {
@@ -206,7 +228,7 @@ void PhotoData::updateImages(
if (!was) {
was = now;
} else if (was->isDelayedStorageImage()) {
if (const auto location = now->location(); !location.isNull()) {
if (const auto location = now->location(); location.valid()) {
was->setDelayedStorageLocation(
Data::FileOrigin(),
location);