2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-01 23:15:59 +00:00

Save themes, apply and close editor on save.

This commit is contained in:
John Preston
2019-09-06 14:33:51 +03:00
parent 910f16312c
commit 9c86f0e0a5
9 changed files with 122 additions and 53 deletions

View File

@@ -162,18 +162,10 @@ void Uploader::uploadMedia(
media.document,
base::duplicate(media.photoThumbs.front().second));
if (!media.data.isEmpty()) {
document->setData(media.data);
document->setDataAndCache(media.data);
if (media.type == SendMediaType::ThemeFile) {
document->checkWallPaperProperties();
}
if (document->saveToCache()
&& media.data.size() <= Storage::kMaxFileInMemory) {
Auth().data().cache().put(
document->cacheKey(),
Storage::Cache::Database::TaggedValue(
base::duplicate(media.data),
document->cacheTag()));
}
}
if (!media.file.isEmpty()) {
document->setLocation(FileLocation(media.file));
@@ -206,18 +198,10 @@ void Uploader::upload(
std::move(file->goodThumbnail),
std::move(file->goodThumbnailBytes));
if (!file->content.isEmpty()) {
document->setData(file->content);
document->setDataAndCache(file->content);
if (file->type == SendMediaType::ThemeFile) {
document->checkWallPaperProperties();
}
if (document->saveToCache()
&& file->content.size() <= Storage::kMaxFileInMemory) {
Auth().data().cache().put(
document->cacheKey(),
Storage::Cache::Database::TaggedValue(
base::duplicate(file->content),
document->cacheTag()));
}
}
if (!file->filepath.isEmpty()) {
document->setLocation(FileLocation(file->filepath));