mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Build ChatListUI
This commit is contained in:
71
submodules/LegacyComponents/Sources/TGDataResource.m
Normal file
71
submodules/LegacyComponents/Sources/TGDataResource.m
Normal file
@@ -0,0 +1,71 @@
|
||||
#import "TGDataResource.h"
|
||||
|
||||
@interface TGDataResource ()
|
||||
{
|
||||
NSData *_data;
|
||||
NSInputStream *_stream;
|
||||
UIImage *_image;
|
||||
bool _imageDecoded;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation TGDataResource
|
||||
|
||||
- (instancetype)initWithData:(NSData *)data
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_data = data;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithInputStream:(NSInputStream *)stream
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_stream = stream;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithImage:(UIImage *)image decoded:(bool)decoded
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_image = image;
|
||||
_imageDecoded = decoded;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[_stream close];
|
||||
}
|
||||
|
||||
- (NSData *)data
|
||||
{
|
||||
return _data;
|
||||
}
|
||||
|
||||
- (NSInputStream *)stream
|
||||
{
|
||||
return _stream;
|
||||
}
|
||||
|
||||
- (UIImage *)image
|
||||
{
|
||||
return _image;
|
||||
}
|
||||
|
||||
- (bool)isImageDecoded
|
||||
{
|
||||
return _imageDecoded;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user