2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-10-05 13:36:18 +00:00

Use empty Storage::Cache::Key as nullopt.

This commit is contained in:
John Preston
2020-05-20 16:28:18 +04:00
parent 581a21dbd9
commit fb322b5fc5
20 changed files with 71 additions and 68 deletions

View File

@@ -776,6 +776,26 @@ DownloadLocation DownloadLocation::convertToModern(
return DownloadLocation{ file.convertToModern(type, id, accessHash) };
}
Storage::Cache::Key DownloadLocation::cacheKey() const {
return data.match([](const GeoPointLocation &data) {
return Data::GeoPointCacheKey(data);
}, [](const StorageFileLocation &data) {
return data.valid()
? data.cacheKey()
: Storage::Cache::Key();
}, [](const WebFileLocation &data) {
return data.isNull()
? Storage::Cache::Key()
: Data::WebDocumentCacheKey(data);
}, [](const PlainUrlLocation &data) {
return data.url.isEmpty()
? Storage::Cache::Key()
: Data::UrlCacheKey(data.url);
}, [](const InMemoryLocation &data) {
return Storage::Cache::Key();
});
}
bool DownloadLocation::valid() const {
return data.match([](const GeoPointLocation &data) {
return true;