Will need to support progressive sizes in the future

This commit is contained in:
Ali 2021-02-19 20:37:57 +04:00
parent 0d9c4aafe7
commit d2036b830e

View File

@ -248,6 +248,7 @@ static void reportMemory() {
int32_t fileDatacenterId = 0; int32_t fileDatacenterId = 0;
Api1_InputFileLocation *inputFileLocation = nil; Api1_InputFileLocation *inputFileLocation = nil;
int32_t progressiveFileLimit = -1;
NSString *fetchResourceId = nil; NSString *fetchResourceId = nil;
bool isPng = false; bool isPng = false;
@ -257,14 +258,27 @@ static void reportMemory() {
if ([parsedAttachment isKindOfClass:[Api1_Photo_photo class]]) { if ([parsedAttachment isKindOfClass:[Api1_Photo_photo class]]) {
Api1_Photo_photo *photo = parsedAttachment; Api1_Photo_photo *photo = parsedAttachment;
isExpandableMedia = true; isExpandableMedia = true;
for (id size in photo.sizes) {
if ([size isKindOfClass:[Api1_PhotoSize_photoSize class]]) { /*for (id size in photo.sizes) {
Api1_PhotoSize_photoSize *sizeValue = size; if ([size isKindOfClass:[Api1_PhotoSize_photoSizeProgressive class]]) {
if ([sizeValue.type isEqualToString:@"m"]) { Api1_PhotoSize_photoSizeProgressive *sizeValue = size;
inputFileLocation = [Api1_InputFileLocation inputPhotoFileLocationWithPid:photo.pid accessHash:photo.accessHash fileReference:photo.fileReference thumbSize:sizeValue.type]; inputFileLocation = [Api1_InputFileLocation inputPhotoFileLocationWithPid:photo.pid accessHash:photo.accessHash fileReference:photo.fileReference thumbSize:sizeValue.type];
fileDatacenterId = [photo.dcId intValue]; fileDatacenterId = [photo.dcId intValue];
fetchResourceId = [NSString stringWithFormat:@"telegram-cloud-photo-size-%@-%@-%@", photo.dcId, photo.pid, sizeValue.type]; fetchResourceId = [NSString stringWithFormat:@"telegram-cloud-photo-size-%@-%@-%@", photo.dcId, photo.pid, sizeValue.type];
break; break;
}
}*/
if (inputFileLocation == nil) {
for (id size in photo.sizes) {
if ([size isKindOfClass:[Api1_PhotoSize_photoSize class]]) {
Api1_PhotoSize_photoSize *sizeValue = size;
if ([sizeValue.type isEqualToString:@"m"]) {
inputFileLocation = [Api1_InputFileLocation inputPhotoFileLocationWithPid:photo.pid accessHash:photo.accessHash fileReference:photo.fileReference thumbSize:sizeValue.type];
fileDatacenterId = [photo.dcId intValue];
fetchResourceId = [NSString stringWithFormat:@"telegram-cloud-photo-size-%@-%@-%@", photo.dcId, photo.pid, sizeValue.type];
break;
}
} }
} }
} }