1
0
mirror of https://github.com/danog/Telegram.git synced 2024-12-12 09:29:55 +01:00
Telegram/Watch/Bridge/TGBridgeWebPageMediaAttachment.m

65 lines
3.1 KiB
Mathematica
Raw Normal View History

2015-10-01 18:19:52 +02:00
#import "TGBridgeWebPageMediaAttachment.h"
#import "TGBridgeImageMediaAttachment.h"
const NSInteger TGBridgeWebPageMediaAttachmentType = 0x584197af;
NSString *const TGBridgeWebPageMediaWebPageIdKey = @"webPageId";
NSString *const TGBridgeWebPageMediaUrlKey = @"url";
NSString *const TGBridgeWebPageMediaDisplayUrlKey = @"displayUrl";
NSString *const TGBridgeWebPageMediaPageTypeKey = @"pageType";
NSString *const TGBridgeWebPageMediaSiteNameKey = @"siteName";
NSString *const TGBridgeWebPageMediaTitleKey = @"title";
NSString *const TGBridgeWebPageMediaPageDescriptionKey = @"pageDescription";
NSString *const TGBridgeWebPageMediaPhotoKey = @"photo";
NSString *const TGBridgeWebPageMediaEmbedUrlKey = @"embedUrl";
NSString *const TGBridgeWebPageMediaEmbedTypeKey = @"embedType";
NSString *const TGBridgeWebPageMediaEmbedSizeKey = @"embedSize";
NSString *const TGBridgeWebPageMediaDurationKey = @"duration";
NSString *const TGBridgeWebPageMediaAuthorKey = @"author";
@implementation TGBridgeWebPageMediaAttachment
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
self = [super init];
if (self != nil)
{
_webPageId = [aDecoder decodeInt64ForKey:TGBridgeWebPageMediaWebPageIdKey];
_url = [aDecoder decodeObjectForKey:TGBridgeWebPageMediaUrlKey];
_displayUrl = [aDecoder decodeObjectForKey:TGBridgeWebPageMediaDisplayUrlKey];
_pageType = [aDecoder decodeObjectForKey:TGBridgeWebPageMediaPageTypeKey];
_siteName = [aDecoder decodeObjectForKey:TGBridgeWebPageMediaSiteNameKey];
_title = [aDecoder decodeObjectForKey:TGBridgeWebPageMediaTitleKey];
_pageDescription = [aDecoder decodeObjectForKey:TGBridgeWebPageMediaPageDescriptionKey];
_photo = [aDecoder decodeObjectForKey:TGBridgeWebPageMediaPhotoKey];
_embedUrl = [aDecoder decodeObjectForKey:TGBridgeWebPageMediaEmbedUrlKey];
_embedSize = [aDecoder decodeCGSizeForKey:TGBridgeWebPageMediaEmbedSizeKey];
_duration = [aDecoder decodeObjectForKey:TGBridgeWebPageMediaDurationKey];
_author = [aDecoder decodeObjectForKey:TGBridgeWebPageMediaAuthorKey];
}
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeInt64:self.webPageId forKey:TGBridgeWebPageMediaWebPageIdKey];
[aCoder encodeObject:self.url forKey:TGBridgeWebPageMediaUrlKey];
[aCoder encodeObject:self.displayUrl forKey:TGBridgeWebPageMediaDisplayUrlKey];
[aCoder encodeObject:self.pageType forKey:TGBridgeWebPageMediaPageTypeKey];
[aCoder encodeObject:self.siteName forKey:TGBridgeWebPageMediaSiteNameKey];
[aCoder encodeObject:self.title forKey:TGBridgeWebPageMediaTitleKey];
[aCoder encodeObject:self.pageDescription forKey:TGBridgeWebPageMediaPageDescriptionKey];
[aCoder encodeObject:self.photo forKey:TGBridgeWebPageMediaPhotoKey];
[aCoder encodeObject:self.embedUrl forKey:TGBridgeWebPageMediaEmbedUrlKey];
[aCoder encodeCGSize:self.embedSize forKey:TGBridgeWebPageMediaEmbedSizeKey];
[aCoder encodeObject:self.duration forKey:TGBridgeWebPageMediaDurationKey];
[aCoder encodeObject:self.author forKey:TGBridgeWebPageMediaAuthorKey];
}
+ (NSInteger)mediaType
{
return TGBridgeWebPageMediaAttachmentType;
}
@end