2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 22:55:11 +00:00

Set correct cache tags for different file types.

This commit is contained in:
John Preston
2018-08-29 00:09:55 +03:00
parent e2f08d4161
commit 55f60866cb
9 changed files with 119 additions and 31 deletions

View File

@@ -771,13 +771,15 @@ void DocumentData::save(
&_urlLocation,
size,
fromCloud,
autoLoading);
autoLoading,
cacheTag());
} else if (!_access && !_url.isEmpty()) {
_loader = new webFileLoader(
_url,
toFile,
fromCloud,
autoLoading);
autoLoading,
cacheTag());
} else {
_loader = new mtpFileLoader(
_dc,
@@ -790,7 +792,8 @@ void DocumentData::save(
size,
(saveToCache() ? LoadToCacheAsWell : LoadToFileOnly),
fromCloud,
autoLoading);
autoLoading,
cacheTag());
}
_loader->connect(_loader, SIGNAL(progress(FileLoader*)), App::main(), SLOT(documentLoadProgress(FileLoader*)));
@@ -1098,6 +1101,19 @@ Storage::Cache::Key DocumentData::cacheKey() const {
}
}
uint8 DocumentData::cacheTag() const {
if (type == StickerDocument) {
return Data::kStickerCacheTag;
} else if (isVoiceMessage()) {
return Data::kVoiceMessageCacheTag;
} else if (isVideoMessage()) {
return Data::kVideoMessageCacheTag;
} else if (isAnimation()) {
return Data::kAnimationCacheTag;
}
return 0;
}
QString DocumentData::composeNameString() const {
if (auto songData = song()) {
return ComposeNameString(