Fixed voice messages autodownload

This commit is contained in:
Ilya Laktyushin 2019-06-12 18:02:12 +02:00
parent 9e57955cfb
commit c67619116b

View File

@ -337,13 +337,12 @@ public func shouldDownloadMediaAutomatically(settings: MediaAutoDownloadSettings
} }
if let (category, size) = categoryAndSizeForMedia(media, categories: effectiveAutodownloadCategories(settings: settings, networkType: networkType)) { if let (category, size) = categoryAndSizeForMedia(media, categories: effectiveAutodownloadCategories(settings: settings, networkType: networkType)) {
guard isAutodownloadEnabledForPeerType(peerType, category: category) else {
return false
}
if let size = size { if let size = size {
var sizeLimit = category.sizeLimit var sizeLimit = category.sizeLimit
if let file = media as? TelegramMediaFile, file.isVoice { if let file = media as? TelegramMediaFile, file.isVoice {
sizeLimit = max(2 * 1024 * 1024, sizeLimit) sizeLimit = max(2 * 1024 * 1024, sizeLimit)
} else if !isAutodownloadEnabledForPeerType(peerType, category: category) {
return false
} }
return size <= sizeLimit return size <= sizeLimit
} else if category.sizeLimit == Int32.max { } else if category.sizeLimit == Int32.max {