chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// TLExpressionGroupModel.h
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 16/2/19.
|
||||
// Copyright © 2016年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "TLChatMacros.h"
|
||||
#import "TLExpressionModel.h"
|
||||
|
||||
typedef NS_ENUM(NSInteger, TLExpressionGroupStatus) {
|
||||
TLExpressionGroupStatusNet, // 未下载
|
||||
TLExpressionGroupStatusDownloading, // 正在下载
|
||||
TLExpressionGroupStatusLocal, // 已下载
|
||||
};
|
||||
|
||||
@interface TLExpressionGroupModel: NSObject
|
||||
|
||||
@property (nonatomic, assign) TLEmojiType type;
|
||||
|
||||
/// 表情包id
|
||||
@property (nonatomic, strong) NSString *gId;
|
||||
|
||||
/// 表情包名称
|
||||
@property (nonatomic, strong) NSString *name;
|
||||
/// 表情包描述
|
||||
@property (nonatomic, strong) NSString *detail;
|
||||
|
||||
/// 表情包icon路径
|
||||
@property (nonatomic, strong) NSString *iconPath;
|
||||
/// 表情包iconURL
|
||||
@property (nonatomic, strong) NSString *iconURL;
|
||||
|
||||
/// 表情包bannerId
|
||||
@property (nonatomic, strong) NSString *bannerId;
|
||||
/// 表情包bannerURL
|
||||
@property (nonatomic, strong) NSString *bannerURL;
|
||||
|
||||
/// 表情
|
||||
@property (nonatomic, strong) NSMutableArray *data;
|
||||
/// 表情总数
|
||||
@property (nonatomic, assign) NSUInteger count;
|
||||
|
||||
/// 详细信息
|
||||
@property (nonatomic, strong) NSString *groupInfo;
|
||||
/// 发布日期
|
||||
@property (nonatomic, strong) NSDate *date;
|
||||
|
||||
/// 作者姓名
|
||||
@property (nonatomic, strong) NSString *authName;
|
||||
/// 作者Id
|
||||
@property (nonatomic, strong) NSString *authID;
|
||||
|
||||
/// 表情包状态
|
||||
@property (nonatomic, assign) TLExpressionGroupStatus status;
|
||||
|
||||
/// 表情包路径
|
||||
@property (nonatomic, strong, readonly) NSString *path;
|
||||
|
||||
/// 下载进度
|
||||
@property (nonatomic, assign) CGFloat downloadProgress;
|
||||
/// 下载进度block
|
||||
@property (nonatomic, copy) void (^downloadProgressAction)(TLExpressionGroupModel *groupModel, CGFloat progress);
|
||||
/// 下载完成block
|
||||
@property (nonatomic, copy) void (^downloadCompleteAction)(TLExpressionGroupModel *groupModel, BOOL success, id data);
|
||||
|
||||
- (id)objectAtIndex:(NSUInteger)index;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
//
|
||||
// TLExpressionGroupModel.m
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 16/2/19.
|
||||
// Copyright © 2016年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TLExpressionGroupModel.h"
|
||||
#import "NSFileManager+TLChat.h"
|
||||
#import "TLExpressionHelper.h"
|
||||
|
||||
@implementation TLExpressionGroupModel
|
||||
@synthesize path = _path;
|
||||
|
||||
+ (NSDictionary *)replacedKeyFromPropertyName
|
||||
{
|
||||
return @{
|
||||
@"gId" : @"eId",
|
||||
@"iconURL" : @"coverUrl",
|
||||
@"name" : @"eName",
|
||||
@"detail" : @"memo1",
|
||||
@"count" : @"picCount",
|
||||
@"bannerId" : @"aId",
|
||||
@"bannerURL" : @"URL",
|
||||
@"groupInfo" : @"memo",
|
||||
};
|
||||
}
|
||||
|
||||
- (void)setData:(NSMutableArray *)data
|
||||
{
|
||||
_data = data;
|
||||
self.count = data.count;
|
||||
[self p_updateExpressionItemGid];
|
||||
}
|
||||
|
||||
- (void)setGId:(NSString *)gId
|
||||
{
|
||||
_gId = gId;
|
||||
|
||||
[self p_updateExpressionItemGid];
|
||||
}
|
||||
|
||||
- (id)objectAtIndex:(NSUInteger)index
|
||||
{
|
||||
return [self.data objectAtIndex:index];
|
||||
}
|
||||
|
||||
#pragma mark - # Private Methods
|
||||
- (void)p_updateExpressionItemGid
|
||||
{
|
||||
for (TLExpressionModel *model in self.data) {
|
||||
model.gid = self.gId;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - # Getters
|
||||
- (NSString *)path
|
||||
{
|
||||
if (_path == nil && self.gId != nil) {
|
||||
_path = [NSFileManager pathExpressionForGroupID:self.gId];
|
||||
}
|
||||
return _path;
|
||||
}
|
||||
|
||||
- (NSString *)iconPath
|
||||
{
|
||||
if (_iconPath == nil && self.path != nil) {
|
||||
_iconPath = [NSString stringWithFormat:@"%@icon_%@", self.path, self.gId];
|
||||
}
|
||||
return _iconPath;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// TLExpressionModel.h
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 16/2/20.
|
||||
// Copyright © 2016年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "TLChatMacros.h"
|
||||
|
||||
@interface TLExpressionModel : NSObject
|
||||
|
||||
/// 表情类型
|
||||
@property (nonatomic, assign) TLEmojiType type;
|
||||
|
||||
/// 表情包id
|
||||
@property (nonatomic, strong) NSString *gid;
|
||||
|
||||
/// 表情id
|
||||
@property (nonatomic, strong) NSString *eId;
|
||||
|
||||
/// 表情名
|
||||
@property (nonatomic, strong) NSString *name;
|
||||
|
||||
/// 远程url
|
||||
@property (nonatomic, strong) NSString *url;
|
||||
|
||||
/// 本地路径
|
||||
@property (nonatomic, strong, readonly) NSString *path;
|
||||
|
||||
/// 表情大小
|
||||
@property (nonatomic, assign) CGFloat size;
|
||||
|
||||
/**
|
||||
* 根据eid获取表情url
|
||||
*/
|
||||
+ (NSString *)expressionURLWithEid:(NSString *)eid;
|
||||
|
||||
/**
|
||||
* 根据eid获取表情下载url
|
||||
*/
|
||||
+ (NSString *)expressionDownloadURLWithEid:(NSString *)eid;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// TLExpressionModel.m
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 16/2/20.
|
||||
// Copyright © 2016年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TLExpressionModel.h"
|
||||
#import "NSFileManager+TLChat.h"
|
||||
#import "TLMacros.h"
|
||||
|
||||
@implementation TLExpressionModel
|
||||
@synthesize path = _path;
|
||||
|
||||
+ (NSString *)expressionURLWithEid:(NSString *)eid
|
||||
{
|
||||
return [NSString stringWithFormat:@"%@expre/downloadsuo.do?pId=%@", IEXPRESSION_HOST_URL, eid];
|
||||
}
|
||||
|
||||
+ (NSString *)expressionDownloadURLWithEid:(NSString *)eid
|
||||
{
|
||||
return [NSString stringWithFormat:@"%@expre/download.do?pId=%@", IEXPRESSION_HOST_URL, eid];
|
||||
}
|
||||
|
||||
+ (NSDictionary *)replacedKeyFromPropertyName
|
||||
{
|
||||
return @{
|
||||
@"eId" : @"pId",
|
||||
@"url" : @"Url",
|
||||
@"name" : @"credentialName",
|
||||
@"emojiPath" : @"imageFile",
|
||||
@"size" : @"size",
|
||||
};
|
||||
}
|
||||
|
||||
#pragma mark - # Getters
|
||||
- (NSString *)path
|
||||
{
|
||||
if (_path == nil) {
|
||||
NSString *groupPath = [NSFileManager pathExpressionForGroupID:self.gid];
|
||||
_path = [NSString stringWithFormat:@"%@%@", groupPath, self.eId];
|
||||
}
|
||||
return _path;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user