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