mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-06 20:54:04 +00:00
no message
This commit is contained in:
parent
c013a50d31
commit
8028166b15
@ -101,7 +101,10 @@
|
||||
break;
|
||||
|
||||
case TGMediaOriginTypeWebpage:
|
||||
info->_webpageUrl = keyComponents[1];
|
||||
{
|
||||
NSString *url = (__bridge_transfer NSString *)CFURLCreateStringByReplacingPercentEscapesUsingEncoding(NULL, (CFStringRef)keyComponents[1], CFSTR(""), kCFStringEncodingUTF8);
|
||||
info->_webpageUrl = url;
|
||||
}
|
||||
break;
|
||||
|
||||
case TGMediaOriginTypeWallpaper:
|
||||
@ -111,11 +114,11 @@
|
||||
default:
|
||||
return nil;
|
||||
}
|
||||
if ([components[1] length] > 0)
|
||||
if (components.count > 1 && [components[1] length] > 0)
|
||||
info->_fileReference = [NSData dataWithHexString:components[1]];
|
||||
|
||||
NSMutableDictionary *fileReferences = [[NSMutableDictionary alloc] init];
|
||||
if ([components[2] length] > 0)
|
||||
if (components.count > 2 && [components[2] length] > 0)
|
||||
{
|
||||
NSArray *refComponents = [components[2] componentsSeparatedByString:@","];
|
||||
for (NSString *ref in refComponents)
|
||||
@ -174,7 +177,10 @@
|
||||
return [NSString stringWithFormat:@"%d|%@", _type, _chatPhotoPeerId];
|
||||
|
||||
case TGMediaOriginTypeWebpage:
|
||||
return [NSString stringWithFormat:@"%d|%@", _type, _webpageUrl];
|
||||
{
|
||||
NSString *url = [TGStringUtils stringByEscapingForURL:_webpageUrl];
|
||||
return [NSString stringWithFormat:@"%d|%@", _type, url];
|
||||
}
|
||||
|
||||
case TGMediaOriginTypeWallpaper:
|
||||
return [NSString stringWithFormat:@"%d|%@", _type, _wallpaperId];
|
||||
|
@ -13,6 +13,7 @@ static TGCache *sharedCache = nil;
|
||||
@interface TGRemoteImageView ()
|
||||
|
||||
@property (atomic, strong) NSString *path;
|
||||
@property (atomic, strong) NSString *currentCacheUrl;
|
||||
|
||||
@property (nonatomic, strong) UIImageView *placeholderView;
|
||||
|
||||
@ -231,8 +232,13 @@ static TGCache *sharedCache = nil;
|
||||
|
||||
TGCache *cache = _cache != nil ? _cache : [TGRemoteImageView sharedCache];
|
||||
|
||||
NSString *cacheUrl = filter == nil ? url : [[NSString alloc] initWithFormat:@"{filter:%@}%@", filter, url];
|
||||
NSString *trimmedUrl = url;
|
||||
NSArray *components = [trimmedUrl componentsSeparatedByString:@"_"];
|
||||
if (components.count >= 5)
|
||||
trimmedUrl = [NSString stringWithFormat:@"%@_%@_%@_%@", components[0], components[1], components[2], components[3]];
|
||||
|
||||
NSString *cacheUrl = filter == nil ? trimmedUrl : [[NSString alloc] initWithFormat:@"{filter:%@}%@", filter, trimmedUrl];
|
||||
self.currentCacheUrl = cacheUrl;
|
||||
UIImage *image = [cache cachedImage:cacheUrl availability:TGCacheMemory];
|
||||
|
||||
if (image == nil)
|
||||
@ -461,7 +467,7 @@ static TGCache *sharedCache = nil;
|
||||
if (_useCache)
|
||||
{
|
||||
TGCache *cache = _cache != nil ? _cache : [TGRemoteImageView sharedCache];
|
||||
[cache cacheImage:image withData:nil url:self.currentUrl availability:TGCacheMemory];
|
||||
[cache cacheImage:image withData:nil url:self.currentCacheUrl availability:TGCacheMemory];
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user